链接全转https协议,去除获取在线预览链接,改为本地生成,修复部分bug,优化预览图(同步更新)
This commit is contained in:
parent
4c3d070f0b
commit
4f87b7178e
@ -45,7 +45,8 @@
|
||||
{{thumbnailGallery.shortName}}
|
||||
</span><br>
|
||||
<picture>
|
||||
<el-image :src="thumbnailGallery.url" :preview-src-list="[thumbnailGallery.url,]" :initial-index="0" class="preview" style="height: 30vh"/>
|
||||
<el-image :src="thumbnailGallery.url" :preview-src-list="[thumbnailGallery.url,]" :initial-index="0" class="preview"
|
||||
style="height: 30vh" fit="contain"/>
|
||||
</picture>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -83,8 +83,8 @@ function close(){
|
||||
</div>
|
||||
<el-scrollbar height="65vh" ref="scrollBar">
|
||||
<div style="height: 20vh; width: 100%; border-radius: 5px" v-for="gallery in galleries">
|
||||
<el-image alt="picture" :preview-src-list="['https://cdn.lionwebsite.xyz/thumbnail' + gallery.thumbnailUrl.replace('/t', ''),]"
|
||||
:src="'https://cdn.lionwebsite.xyz/thumbnail' + gallery.thumbnailUrl.replace('/t', '')"
|
||||
<el-image alt="picture" :preview-src-list="['https://downloader.lionwebsite.xyz/GalleryManage/ehThumbnail?path=' + gallery.thumbnailUrl.replace('/t', ''),]"
|
||||
:src="'https://downloader.lionwebsite.xyz/GalleryManage/ehThumbnail?path=' + gallery.thumbnailUrl.replace('/t', '') "
|
||||
style="height:20vh;width:35vw;float: left;"
|
||||
fit="contain"
|
||||
loading="lazy"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script setup>
|
||||
import {computed, ref, watch} from "vue";
|
||||
import store from "../store/index.js";
|
||||
let props = defineProps(['currentLinks', 'isOnlineReading'])
|
||||
let props = defineProps(['currentGallery', 'isOnlineReading'])
|
||||
let isShowUp = ref()
|
||||
let onlineReadingScrollbar = ref()
|
||||
let links = ref()
|
||||
@ -19,12 +19,12 @@ watch(props, (props)=>{
|
||||
|
||||
//切换本子
|
||||
function alterPage(){
|
||||
console.log(lengthPerPage.value)
|
||||
if(props.currentLinks.length > lengthPerPage.value){
|
||||
links.value = props.currentLinks.slice(0, lengthPerPage.value)
|
||||
max.value = Math.ceil(props.currentLinks.length / lengthPerPage.value)
|
||||
if(props.currentGallery.images.length > lengthPerPage.value){
|
||||
links.value = props.currentGallery.images.slice(0, lengthPerPage.value)
|
||||
max.value = Math.ceil(props.currentGallery.images.length / lengthPerPage.value)
|
||||
}else{
|
||||
links.value = props.currentLinks
|
||||
links.value = props.currentGallery.images
|
||||
max.value = 0
|
||||
}
|
||||
index.value = 0
|
||||
temp_index.value = 1
|
||||
@ -45,10 +45,14 @@ function closeDialog(){
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog v-model="isShowUp" title="在线预览" @close="closeDialog" width="100%" top="0">
|
||||
<div style="font-size: 20px; text-align: center;" v-if="max > 0">
|
||||
{{index + 1}} - {{(index) * lengthPerPage + 1}} ~ {{(index + 1) * lengthPerPage + 1 > currentLinks.length? currentLinks.length: (index + 1) * lengthPerPage + 1}}
|
||||
<el-dialog v-model="isShowUp" @close="closeDialog" width="100%" top="0">
|
||||
<template #header style="padding-bottom: 0">
|
||||
在线预览: {{currentGallery.name}} 页数:{{currentGallery.pages}}<br>
|
||||
<div style="font-size: 3vh; display: inline" v-if="max > 0">
|
||||
{{ index + 1 }} - {{ (index) * lengthPerPage + 1 }} ~
|
||||
{{ (index + 1) * lengthPerPage + 1 > currentGallery.images.length ? currentGallery.images.length : (index + 1) * lengthPerPage }}
|
||||
</div>
|
||||
</template>
|
||||
<el-scrollbar height="75vh" ref="onlineReadingScrollbar">
|
||||
<el-image v-for="(link, i) in links" :src="link" :style="{'width': 'auto', 'text-align': 'center', 'background-color': 'ghostwhite'}"
|
||||
:preview-src-list="currentLinks" :initial-index="index * lengthPerPage + i" loading="lazy"/>
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<el-button @click="deleteGallery(props.row.gid)" :disabled="props.row.download === undefined">删除</el-button>
|
||||
<el-button @click="shareGallery({gid:props.row.gid, shortName:props.row.shortName + '.zip'})" v-if="isLion">分享</el-button>
|
||||
<el-button @click="changeGalleryCollect(props.row.gid, props.row.isCollect)" :disabled="props.row.download === undefined">{{props.row.isCollect ? '取消收藏' : '收藏'}}</el-button>
|
||||
<el-button @click="onlineGalleryReader(props.row.gid)" :disabled="props.row.download === undefined">在线看</el-button>
|
||||
<el-button @click="onlineGalleryReader(props.row)" :disabled="props.row.download === undefined">在线看</el-button>
|
||||
<el-button @click="showThumbnail(props.row)" :disabled="props.row.download === undefined">预览封面</el-button><br>
|
||||
<el-button @click="editGalleryTag(props.row)" :disabled="props.row.download === undefined">编辑标签</el-button>
|
||||
<el-button @click="updateGallery(props.row.link)" :disabled="props.row.download === undefined">更新本子</el-button>
|
||||
@ -104,7 +104,7 @@
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
|
||||
<OnlineReader :currentLinks="currentLinks" :isOnlineReading="isOnlineReading"/>
|
||||
<OnlineReader :current-gallery="currentGallery" :isOnlineReading="isOnlineReading"/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@ -114,12 +114,16 @@ import axios from "axios";
|
||||
import {ElMessage} from "element-plus";
|
||||
import OnlineReader from "./OnlineReader.vue";
|
||||
|
||||
let link = "https://downloader.lionwebsite.xyz/GalleryManage/"
|
||||
|
||||
//输入
|
||||
let inputNode = ref(null)
|
||||
//是否正在编辑页数
|
||||
let isEditingPage = ref(false)
|
||||
//是否正在编辑标签
|
||||
let isEditingTag = ref(false)
|
||||
//是否预览本子
|
||||
let isOnlineReading = ref(false)
|
||||
|
||||
//临时变量
|
||||
let galleryForTag = ref({})
|
||||
@ -142,9 +146,6 @@ let currentTasks = computed(() => {
|
||||
let isOpenHistoryPanel = computed(() => {
|
||||
return store.state.isShowHistory
|
||||
})
|
||||
let isOnlineReading = computed(() => {
|
||||
return store.state.isOnlineReading
|
||||
})
|
||||
//标签
|
||||
let tags = computed(() => {
|
||||
return store.state.tags
|
||||
@ -174,9 +175,7 @@ let emptyText = computed(() => {
|
||||
})
|
||||
|
||||
//在线预览
|
||||
let currentLinks = computed(() => {
|
||||
return store.state.currentLinks
|
||||
})
|
||||
let currentGallery = ref({name:"name"})
|
||||
|
||||
//翻页
|
||||
function next() {
|
||||
@ -294,8 +293,9 @@ function updateGallery(link){
|
||||
function deleteGallery(gid){
|
||||
store.dispatch("deleteGallery", gid)
|
||||
}
|
||||
function onlineGalleryReader(gid){
|
||||
store.dispatch("queryOnlineLinks", gid)
|
||||
function onlineGalleryReader(gallery){
|
||||
currentGallery.value = gallery
|
||||
isOnlineReading.value = true;
|
||||
}
|
||||
function shareGallery(data){
|
||||
const {gid, shortName} = data
|
||||
@ -317,8 +317,10 @@ function shareGallery(data){
|
||||
}
|
||||
//显示缩略图
|
||||
function showThumbnail(gallery){
|
||||
if(gallery.status === "下载完成") {
|
||||
store.commit("_changeThumbnailGallery", gallery)
|
||||
setTimeout(() => {document.querySelector(".preview > img").click()}, 1)
|
||||
}
|
||||
}
|
||||
|
||||
//移动端
|
||||
|
||||
@ -74,26 +74,6 @@ const actions = {
|
||||
ElMessage("查询失败")
|
||||
})
|
||||
},
|
||||
queryOnlineLinks(context, gid){
|
||||
// 如果本地有缓存,则直接返回,没有再请求
|
||||
if(context.state.onlineLinks[gid] !== undefined){
|
||||
context.commit("_setOnlineLinks", gid)
|
||||
}
|
||||
else {
|
||||
axios.get(GalleryManageUrl + "/onlineLinks", {
|
||||
params: {
|
||||
AuthCode: state.AuthCode,
|
||||
gid,
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.data.result === "success")
|
||||
context.commit("_addAndSetOnlineLinks", {gid, links: res.data.data})
|
||||
|
||||
else
|
||||
ElMessage(res.data.data)
|
||||
})
|
||||
}
|
||||
},
|
||||
updateGallery(context, link){
|
||||
axios.post(GalleryManageUrl + "/update", qs.stringify({AuthCode: state.AuthCode, link}))
|
||||
.then((res) => {
|
||||
@ -310,9 +290,12 @@ const mutations = {
|
||||
break;
|
||||
case "下载完成":
|
||||
task.progress = "下载完成"
|
||||
let tempLink
|
||||
tempLink = task.link.replace("element-plus.org", "exhentai.org").replace("element.org", "e-hentai.org")
|
||||
task.download = GalleryManageUrl + "/file/" + encodeURI(task.name.replace("#", "")) + "?link=" + tempLink + "&AuthCode=" + state.AuthCode
|
||||
task.download = GalleryManageUrl + "/file/" + encodeURI(task.name) + ".zip?AuthCode=" + state.AuthCode
|
||||
let links = []
|
||||
for(let i=1; i<=task.pages; i++)
|
||||
links.push(GalleryManageUrl + "/onlineImage/" + i + "?gid=" + task.gid);
|
||||
|
||||
task.images = links
|
||||
break;
|
||||
}
|
||||
|
||||
@ -353,7 +336,7 @@ const mutations = {
|
||||
preDeleteIndex = -1
|
||||
if(task.status !== "下载完成")
|
||||
for(let i=0; i < tasks.length; i++)
|
||||
if(tasks[i].name === task.name) {
|
||||
if(tasks[i] !== undefined && tasks[i].name === task.name) {
|
||||
preDeleteIndex = i
|
||||
task.status = tasks[i].status
|
||||
task.proceeding = tasks[i].proceeding
|
||||
@ -571,27 +554,6 @@ const mutations = {
|
||||
else
|
||||
state.length = state.defaultLength
|
||||
},
|
||||
_addAndSetOnlineLinks(state, data){
|
||||
let links = JSON.parse(data.links)
|
||||
state.onlineLinks[data.gid] = []
|
||||
state.currentLinks.splice(0)
|
||||
state.currentGid = data.gid
|
||||
|
||||
links.forEach((link) => {
|
||||
state.onlineLinks[data.gid].push('https://downloader.lionwebsite.xyz/GalleryManage/onlineImage/' + link + '?gid=' + state.currentGid + '&AuthCode=' + state.AuthCode)
|
||||
state.currentLinks.push('https://downloader.lionwebsite.xyz/GalleryManage/onlineImage/' + link + '?gid=' + state.currentGid + '&AuthCode=' + state.AuthCode)
|
||||
})
|
||||
|
||||
state.isOnlineReading = true
|
||||
},
|
||||
_setOnlineLinks(state, gid){
|
||||
state.currentLinks.splice(0)
|
||||
state.onlineLinks[gid].forEach((link) => {
|
||||
state.currentLinks.push(link)
|
||||
})
|
||||
state.currentGid = gid
|
||||
state.isOnlineReading = true
|
||||
},
|
||||
_openHistoryPanel(state){
|
||||
state.isShowHistory = true
|
||||
},
|
||||
@ -600,7 +562,7 @@ const mutations = {
|
||||
},
|
||||
_changeThumbnailGallery(state, gallery){
|
||||
state.thumbnailGallery = gallery
|
||||
state.thumbnailGallery.url = GalleryManageUrl + "/thumbnail/" + encodeURIComponent(gallery.name) + ".webp?AuthCode="+state.AuthCode
|
||||
state.thumbnailGallery.url = GalleryManageUrl + "/onlineImage/1?gid="+gallery.gid
|
||||
}
|
||||
}
|
||||
|
||||
@ -613,10 +575,7 @@ const state = {
|
||||
tags: new Map(), //可用tag
|
||||
isSearch: false, //用于决定是否显示搜索结果
|
||||
|
||||
onlineLinks: {}, //在线本子链接
|
||||
isOnlineReading: false, //是否在线看
|
||||
currentGid: "", //当前GID
|
||||
currentLinks: [], //当前本子链接
|
||||
lengthPerPage: 0, //在线预览每页图片数量
|
||||
|
||||
page: 1, //当前页数
|
||||
|
||||
Loading…
Reference in New Issue
Block a user