去除标签;修改在线看,允许未下载的本子在线看(同步更新)
This commit is contained in:
+16
-189
@@ -8,24 +8,16 @@
|
||||
查询参数类型: <el-select style="width: 125px" v-model="type" @change="resetLocalQuery()">
|
||||
<el-option value="link" label="链接"/>
|
||||
<el-option value="keyword" label="关键字"/>
|
||||
<el-option value="tag" label="标签"/>
|
||||
</el-select>
|
||||
<el-input style="width: 200px;" v-model="param" v-if="type !== 'tag'">
|
||||
<el-input style="width: 200px;" v-model="param">
|
||||
<template #prepend>
|
||||
参数:
|
||||
</template>
|
||||
</el-input>
|
||||
<div v-if="type === 'tag'">
|
||||
<el-tag v-for="tid in paramForTags" closable @close="removeQueryTag(tid)">
|
||||
{{store.state.tags.get(tid).tag}}
|
||||
</el-tag>
|
||||
<el-autocomplete v-model="param" :fetch-suggestions="completeQueryTag" @select="handleTagSelect" ref="tagInput" placeholder="检索标签"/>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<el-button @click="queryRemoteTask" v-show="type === 'link'">远程查询</el-button>
|
||||
<el-button @click="queryLocalTask">当前页查询</el-button>
|
||||
<el-button @click="removeAllQueryTag" v-show="type === 'tag'">清空查询标签</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<br>
|
||||
@@ -37,24 +29,22 @@
|
||||
<el-switch @click="toggleStyle" v-model="isDark">夜间模式</el-switch>
|
||||
<hr>
|
||||
<el-button @click="isQuerying = true">里站搜索</el-button>
|
||||
<el-button @click="isViewingTag = true">查看标签</el-button>
|
||||
<hr>
|
||||
<el-button v-if="isLion" @click="resetUndone">重置任务</el-button>
|
||||
<div v-show="thumbnailGallery.url !== undefined">
|
||||
<div v-show="thumbnailGallery.thumb_link !== undefined">
|
||||
<span>
|
||||
{{thumbnailGallery.shortName}}<br>
|
||||
<el-space v-show="thumbnailGallery.tag !== ''">标签:{{thumbnailGallery.tag}}</el-space>
|
||||
</span><br>
|
||||
<picture>
|
||||
<el-image :src="thumbnailGallery.url" :preview-src-list="[thumbnailGallery.images[0], ]" :initial-index="0" class="preview"
|
||||
<el-image :src="thumbnailGallery.thumb_link" :preview-src-list="[thumbnailGallery.thumb_link, ]" class="preview"
|
||||
style="width: 300px; height: 250px" fit="contain"/>
|
||||
</picture>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog title="查询本子" v-model="chosenGallery">
|
||||
<el-dialog title="查询本子" v-model="chosenGallery" style="height: 350px">
|
||||
<el-image v-show='chosenGallery.thumb_link !== undefined'
|
||||
style="float: right; width: 250px; height: 250px" fit="contain"
|
||||
style="float: right; width: 250px; height: 250px;" fit="contain"
|
||||
:src="'https://downloader.lionwebsite.xyz/GalleryManage/ehThumbnail?path=' + chosenGallery.thumb_link"/>
|
||||
<table>
|
||||
<tr>本子名字:{{chosenGallery.name}}</tr>
|
||||
@@ -69,27 +59,14 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</tr>
|
||||
<tr v-if="chosenGallery.availableResolution">
|
||||
下载模式:<el-select v-model="targetDownloadMode" style="width: 200px" default-first-option>
|
||||
<el-option :value="1" label="仅下载"/>
|
||||
<el-option :value="2" label="仅在线看"/>
|
||||
<el-option :value="3" label="在线看并下载"/>
|
||||
</el-select>
|
||||
</tr>
|
||||
<tr>
|
||||
标签:<el-tag v-for="tid in paramForTags" closable @close="removeQueryTag(tid)">
|
||||
{{store.state.tags.get(tid).tag}}
|
||||
</el-tag>
|
||||
<el-autocomplete v-model="param" :fetch-suggestions="completeQueryTag" @select="handleTagSelect" ref="tagInputForSubmit"/>
|
||||
</tr>
|
||||
</table>
|
||||
<el-button @click="postTask" v-if="chosenGallery.availableResolution">下载</el-button>
|
||||
<el-button @click="removeAllQueryTag" v-if="chosenGallery.availableResolution">清空标签</el-button>
|
||||
<tr v-if="chosenGallery.status === '下载完成'">
|
||||
<el-button @click="onlineGalleryReader(chosenGallery.gid)">在线预览</el-button>
|
||||
<el-button @click="showThumbnailGallery(chosenGallery)">查看封面图</el-button>
|
||||
<el-button @click="deleteGallery">删除</el-button>
|
||||
</tr>
|
||||
<template #footer>
|
||||
<el-button @click="postTask" v-if="chosenGallery.availableResolution">下载</el-button>
|
||||
<el-button @click="readOnlineGallery(chosenGallery)">在线预览</el-button>
|
||||
<tr v-if="chosenGallery.status === '下载完成'">
|
||||
<el-button @click="deleteGallery">删除</el-button>
|
||||
</tr>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="修改授权码" v-model="isAlterAuthCode">
|
||||
@@ -141,33 +118,6 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="查看标签" v-model="isViewingTag" style="margin-top: 0; width: 550px">
|
||||
<div style="text-align: center">
|
||||
输入关键字:<el-input style="width: 150px" v-model="tagKeyWord"></el-input>
|
||||
<el-button @click="tagKeyWord = ''">清空</el-button>
|
||||
<el-button @click="pullNewTag">刷新</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :data="tags" height="450px" stripe>
|
||||
<el-table-column prop="id" label="id" width="50px" sortable/>
|
||||
<el-table-column prop="tag" label="标签" width="300px" sortable/>
|
||||
<el-table-column prop="usage" label="用量" width="75px" sortable/>
|
||||
|
||||
<el-table-column width="75px">
|
||||
<template #default="scoped">
|
||||
<el-button v-if="scoped.row.usage === 0" @click="deleteTag(scoped.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<span style="color: red; font: bold 15px sans-serif">
|
||||
创建标签前先看看有没有符合的,尽量用统一一点的标签,比如已经有个图包就不要创建图集之类的了。毕竟标签多起来数据挺多的。
|
||||
</span>
|
||||
<template #footer>
|
||||
输入新标签:<el-input v-model="tag"></el-input>
|
||||
<el-button @click="postTag">创建标签</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<div class="DashBoard" v-show="!loadComplete">
|
||||
<el-input v-model="AuthCode" placeholder="请输入授权码" style="padding-top: 200px"/> <br>
|
||||
<el-checkbox v-model="isRemember">是否记住授权码</el-checkbox>
|
||||
@@ -191,7 +141,6 @@ let newAuthCode = ref("")
|
||||
let tempAuthCode = ref("")
|
||||
|
||||
let isQuerying = ref(false)
|
||||
let isViewingTag = ref(false)
|
||||
let isConfig = ref(false)
|
||||
let isDark = ref(false)
|
||||
let keyword = ref("")
|
||||
@@ -201,19 +150,15 @@ let lengthPerPage = ref(0)
|
||||
//查询相关
|
||||
let type = ref("link")
|
||||
let param = ref("")
|
||||
let paramForTags = ref([]) //tidS
|
||||
|
||||
let targetResolution = ref("")
|
||||
let targetDownloadMode = ref("")
|
||||
let tag = ref("")
|
||||
let tagKeyWord = ref("") //查询tag的关键字
|
||||
|
||||
let realAuthCode = computed(() => {
|
||||
return store.state.AuthCode
|
||||
})
|
||||
|
||||
let chosenGallery = computed(() => {
|
||||
paramForTags.value.splice(0)
|
||||
param.value = ''
|
||||
return store.state.chosenGallery
|
||||
})
|
||||
@@ -224,27 +169,8 @@ let loadComplete = computed(() => {
|
||||
let weekUsed = computed(() => {
|
||||
return store.state.weekUsed
|
||||
})
|
||||
let tags = computed(() => {
|
||||
let tags = store.state.tags
|
||||
let result = []
|
||||
tags.forEach((tag) => {
|
||||
result.push(tag)
|
||||
})
|
||||
|
||||
if(isViewingTag.value) { //正在查看标签
|
||||
if (tagKeyWord.value.trim() === '')
|
||||
return result
|
||||
else
|
||||
return result.filter((tag) => {
|
||||
return tag.tag.includes(tagKeyWord.value)
|
||||
})
|
||||
}
|
||||
return result
|
||||
})
|
||||
|
||||
let thumbnailGallery = computed(() => {
|
||||
if(store.state.thumbnailGallery.images === undefined)
|
||||
store.state.thumbnailGallery.images = []
|
||||
return store.state.thumbnailGallery
|
||||
})
|
||||
|
||||
@@ -252,18 +178,6 @@ let isLion = computed(() => {
|
||||
return store.state.userId === 3
|
||||
})
|
||||
|
||||
function pullNewTag(){
|
||||
store.dispatch("loadTags")
|
||||
}
|
||||
|
||||
function postTag(){
|
||||
store.dispatch("postTag", tag.value)
|
||||
}
|
||||
|
||||
function deleteTag(tid){
|
||||
store.dispatch("deleteTag", tid)
|
||||
}
|
||||
|
||||
//修改授权码
|
||||
function alterAuthCode(){
|
||||
if(newAuthCode.value.trim() === "" || tempAuthCode.value.trim() === "" || newAuthCode.value !== tempAuthCode.value)
|
||||
@@ -295,9 +209,7 @@ function postTask(){
|
||||
}
|
||||
store.dispatch("postGalleryTask",
|
||||
{link: chosenGallery.value.link,
|
||||
targetResolution: targetResolution.value,
|
||||
mode: targetDownloadMode.value,
|
||||
tags:paramForTags.value})
|
||||
targetResolution: targetResolution.value})
|
||||
targetResolution.value = ""
|
||||
}
|
||||
|
||||
@@ -319,89 +231,8 @@ function queryLocalTask(){
|
||||
case "keyword":
|
||||
store.commit("_searchLocalByKeyword", param.value)
|
||||
break
|
||||
case "tag":
|
||||
store.commit("_searchLocalByTag", paramForTags.value)
|
||||
break
|
||||
}
|
||||
}
|
||||
let tagInput = ref({}) //用于查询
|
||||
let tagInputForSubmit = ref({}) //用于提交
|
||||
function completeQueryTag(keyWord, cb) {
|
||||
if(keyWord.includes(' ')) { //查询多个标签的时候
|
||||
let temp = keyWord.split(' ')
|
||||
keyWord = temp[temp.length - 1]
|
||||
}else{ //只有一个标签的时候
|
||||
keyWord = param.value
|
||||
}
|
||||
let result = []
|
||||
let skip
|
||||
let hit = false //用于检测是否有重复标签
|
||||
tags.value.forEach((tag) => {
|
||||
if(tag.tag.includes(keyWord)) {
|
||||
skip = false
|
||||
for (let id of paramForTags.value) { //跳过已选中的标签
|
||||
if(tag.id === id){
|
||||
if(!hit && tag.tag === keyWord){ //是否命中标签
|
||||
hit = true
|
||||
}
|
||||
skip = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if(!skip)
|
||||
result.push({value: tag.tag, tid: tag.id})
|
||||
}
|
||||
})
|
||||
if(result.length === 0 && !keyWord.includes("#") && chosenGallery.value.gid !== undefined && !hit){ //未命中结果并且准备与下载任务一并提交
|
||||
result.push({value: '新建 #' + keyWord + ' 标签?', tag:keyWord})
|
||||
}
|
||||
cb(result)
|
||||
}
|
||||
|
||||
function removeQueryTag(tid){
|
||||
for (let i=0; i<paramForTags.value.length; i++){
|
||||
if(paramForTags.value[i] === tid){
|
||||
paramForTags.value.splice(i, 1)
|
||||
break
|
||||
}
|
||||
}
|
||||
if(chosenGallery.value.gid === undefined) //查询本地标签
|
||||
queryLocalTask()
|
||||
}
|
||||
|
||||
function removeAllQueryTag(){
|
||||
paramForTags.value.splice(0)
|
||||
if(chosenGallery.value.gid === undefined) //查询本地标签
|
||||
queryLocalTask()
|
||||
}
|
||||
|
||||
function handleTagSelect(data){
|
||||
if('tag' in data){ //需要新建,不知道怎么处理回调,直接把axios搬到vue里面
|
||||
axios.post("https://downloader.lionwebsite.xyz/GalleryManage/tag?" + qs.stringify({
|
||||
tag:data.tag,
|
||||
AuthCode: store.state.AuthCode
|
||||
})
|
||||
).then((res) => {
|
||||
if (res.data.result === 'success') {
|
||||
ElMessage('创建标签成功')
|
||||
paramForTags.value.push(parseInt(res.data.tid))
|
||||
tagInputForSubmit.value.blur()
|
||||
store.dispatch("loadTags", false).then()
|
||||
}
|
||||
else
|
||||
ElMessage(res.data.data)
|
||||
})}else{
|
||||
paramForTags.value.push(data.tid)
|
||||
console.log(chosenGallery)
|
||||
if(chosenGallery.value.gid === undefined){
|
||||
queryLocalTask()
|
||||
tagInput.value.blur()
|
||||
}else{
|
||||
tagInputForSubmit.value.blur()
|
||||
}
|
||||
}
|
||||
param.value = ''
|
||||
}
|
||||
|
||||
function resetLocalQuery(){
|
||||
store.commit("_searchLocalByKeyword", "")
|
||||
@@ -424,7 +255,7 @@ function validate(){
|
||||
}
|
||||
}
|
||||
|
||||
//验证链接以及伪装链接
|
||||
//验证链接
|
||||
function validateLink(rawLink){
|
||||
if(rawLink.trim() === "")
|
||||
return false
|
||||
@@ -435,12 +266,8 @@ function validateLink(rawLink){
|
||||
}
|
||||
|
||||
//在线阅读以及展示缩略图
|
||||
function onlineGalleryReader(gid){
|
||||
store.dispatch("queryOnlineLinks", gid)
|
||||
}
|
||||
function showThumbnailGallery(gallery){
|
||||
store.commit("_changeThumbnailGallery", gallery)
|
||||
document.querySelector(".preview > img").click()
|
||||
function readOnlineGallery(gallery){
|
||||
store.dispatch("readOnlineGallery", gallery)
|
||||
}
|
||||
|
||||
//重新给节点发送未完成任务
|
||||
|
||||
@@ -92,7 +92,10 @@ function close(){
|
||||
<span>页数:{{gallery.page}}</span><br>
|
||||
<span class="ct6">类型:{{gallery.type}}</span><br>
|
||||
<a :href="gallery.link">链接</a><br>
|
||||
<el-button style=" margin-left: 80%; margin-top: -5vh" @click="param=gallery.link; queryRemoteTask()">查看</el-button>
|
||||
<el-button-group style=" margin-left: 50%; margin-top: -5vh">
|
||||
<el-button @click="store.dispatch('readOnlineGallery', gallery)">在线看</el-button>
|
||||
<el-button @click="param=gallery.link; queryRemoteTask()">查看详情</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
<script setup>
|
||||
import {computed, ref, watch} from "vue";
|
||||
import {computed, ref} from "vue";
|
||||
import store from "../store/index.js";
|
||||
let props = defineProps(['currentGallery', 'isOnlineReading'])
|
||||
let emit = defineEmits(['close'])
|
||||
let isShowUp = ref()
|
||||
let onlineReadingScrollbar = ref()
|
||||
let links = ref()
|
||||
let index = ref(0)
|
||||
@@ -13,19 +10,21 @@ let current_page = 0
|
||||
let lengthPerPage = computed(() => {
|
||||
return store.state.lengthPerPage
|
||||
})
|
||||
|
||||
watch(props, (props)=>{
|
||||
isShowUp.value = props.isOnlineReading
|
||||
let readingGallery = computed(() => {
|
||||
return store.state.readingGallery
|
||||
})
|
||||
let isShowUp = computed(() => {
|
||||
alterPage()
|
||||
return store.state.isReading
|
||||
})
|
||||
|
||||
//切换本子
|
||||
function alterPage(){
|
||||
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)
|
||||
if(readingGallery.value.images.length > lengthPerPage.value){
|
||||
links.value = readingGallery.value.images.slice(0, lengthPerPage.value)
|
||||
max.value = Math.ceil(readingGallery.value.images.length / lengthPerPage.value)
|
||||
}else{
|
||||
links.value = props.currentGallery.images
|
||||
links.value = readingGallery.value.images
|
||||
max.value = 0
|
||||
}
|
||||
index.value = 0
|
||||
@@ -34,7 +33,7 @@ function alterPage(){
|
||||
|
||||
//跳转到对应页数
|
||||
function jump(targetIndex){
|
||||
links.value = props.currentGallery.images.slice(targetIndex * lengthPerPage.value, (targetIndex + 1) * lengthPerPage.value)
|
||||
links.value = readingGallery.value.images.slice(targetIndex * lengthPerPage.value, (targetIndex + 1) * lengthPerPage.value)
|
||||
index.value = targetIndex
|
||||
temp_index.value = targetIndex + 1
|
||||
onlineReadingScrollbar.value.setScrollTop(0)
|
||||
@@ -42,14 +41,12 @@ function jump(targetIndex){
|
||||
|
||||
function closeDialog(){
|
||||
onlineReadingScrollbar.value.setScrollTop(0)
|
||||
emit("close")
|
||||
store.commit("_closeReader")
|
||||
}
|
||||
|
||||
function switch_page(target_page){
|
||||
console.log(current_page, target_page)
|
||||
//上一页
|
||||
if(target_page > (current_page + 1) && current_page === 0 && index.value > 0) {
|
||||
console.log("上一页")
|
||||
document.querySelector("span.el-image-viewer__btn.el-image-viewer__close").click()
|
||||
jump(index.value - 1)
|
||||
onlineReadingScrollbar.value.setScrollTop(onlineReadingScrollbar.value.wrapRef.scrollHeight)
|
||||
@@ -64,7 +61,6 @@ function switch_page(target_page){
|
||||
}, 100)
|
||||
//下一页
|
||||
}else if(target_page === 0 && current_page === lengthPerPage.value - 1 && index.value < max.value){
|
||||
console.log("下一页")
|
||||
jump(index.value + 1)
|
||||
current_page = 0
|
||||
document.querySelector("div.el-scrollbar__wrap.el-scrollbar__wrap--hidden-default > div > div:nth-child(1) > img").click()
|
||||
@@ -82,15 +78,15 @@ function set_current_page(page){
|
||||
<template>
|
||||
<el-dialog v-model="isShowUp" width="90%" style="margin-top: 0; margin-bottom: 0; padding: 0" @close="closeDialog">
|
||||
<template #header style="padding-bottom: 0">
|
||||
在线预览: {{currentGallery.name}} 页数:{{currentGallery.pages}}<br>
|
||||
在线预览: {{readingGallery.name}} 页数:{{readingGallery.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 }}
|
||||
{{ (index + 1) * lengthPerPage + 1 > readingGallery.images.length ? readingGallery.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': store.state.imageWidth, 'padding-right': store.state.imagePadding, 'background-color': 'gary'}"
|
||||
:preview-src-list="links" :initial-index="i" @switch="switch_page" @show="set_current_page(i)">
|
||||
:preview-src-list="links" :initial-index="i" @switch="switch_page" @show="set_current_page(i)" loading="lazy">
|
||||
</el-image>
|
||||
</el-scrollbar>
|
||||
|
||||
|
||||
+6
-123
@@ -18,14 +18,11 @@
|
||||
文件大小:{{props.row.fileSize}}<br>
|
||||
分辨率:{{props.row.resolution}}<br>
|
||||
任务创建时间:{{props.row.createTimeDisplay}}<br>
|
||||
标签:{{props.row.tag === '' ? '无': props.row.tag}} <br>
|
||||
<span v-show="isLion">
|
||||
downloader:{{props.row.downloader}}
|
||||
</span>
|
||||
|
||||
<el-button @click="deleteGallery(props.row.gid)" :disabled="props.row.status !== '下载完成'">删除</el-button>
|
||||
<el-button @click="editGalleryTag(props.row)">编辑标签</el-button>
|
||||
<el-button @click="shareGallery({gid:props.row.gid, shortName:props.row.shortName + '.zip'})" v-show="isLion" :disabled="props.row.status !== '下载完成'">分享</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -40,7 +37,7 @@
|
||||
<span>
|
||||
<el-button @click="downloadTask(scoped.row.download)" :disabled="scoped.row.status !== '下载完成' || scoped.row.mode === 2">下载</el-button>
|
||||
<el-button @click="changeGalleryCollect(scoped.row.gid, scoped.row.isCollect)">{{scoped.row.isCollect ? '取消收藏' : '收藏'}}</el-button>
|
||||
<el-button @click="onlineGalleryReader(scoped.row)" :disabled="scoped.row.status !== '下载完成' || scoped.row.mode === 1">在线看</el-button>
|
||||
<el-button @click="readOnlineGallery(scoped.row)" :disabled="scoped.row.status !== '下载完成' || scoped.row.mode === 1">在线看</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -92,24 +89,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<el-dialog v-model="isEditingTag" title="编辑本子标签">
|
||||
<el-form>
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
标签:
|
||||
</template>
|
||||
<template #default>
|
||||
<el-tag v-for="tid in galleryForTag.tags" closable @close="disMark(galleryForTag.gid, tid)">
|
||||
{{tags.get(tid).tag}}
|
||||
</el-tag>
|
||||
<el-autocomplete v-model="newTag" :fetch-suggestions="querySimilarTag" @select="handleTagSelect" ref="tagInput"/>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
|
||||
<OnlineReader :current-gallery="currentGallery" :isOnlineReading="isOnlineReading" @close="isOnlineReading = false"/>
|
||||
<OnlineReader/>
|
||||
|
||||
<span v-show="!loadComplete" class="side">请输入授权码后再查看</span>
|
||||
</div>
|
||||
@@ -122,27 +102,18 @@ import axios from "axios";
|
||||
import {ElMessage} from "element-plus";
|
||||
import OnlineReader from "./OnlineReader.vue";
|
||||
|
||||
let link = "https://downloader.lionwebsite.xyz/GalleryManage/"
|
||||
let GalleryManagePrefix = "https://downloader.lionwebsite.xyz/GalleryManage/"
|
||||
|
||||
//输入
|
||||
let inputNode = ref(null)
|
||||
//是否正在编辑页数
|
||||
let isEditingPage = ref(false)
|
||||
//是否正在编辑标签
|
||||
let isEditingTag = ref(false)
|
||||
//是否预览本子
|
||||
let isOnlineReading = ref(false)
|
||||
|
||||
//临时变量
|
||||
let galleryForTag = ref({})
|
||||
|
||||
let category = ref("myDownload") //myDownload myCollect total
|
||||
let galleryNameType = ref("shortName") // shortName name
|
||||
let sortType = ref("shortName") // shortName name createTime
|
||||
let targetPage = ref(1) // 当前页数
|
||||
|
||||
let onlineReadingScrollbar = ref(null)
|
||||
|
||||
//防抖计时器
|
||||
let debounceTimer = 0
|
||||
//是否加载完成
|
||||
@@ -175,21 +146,6 @@ let emptyText = computed(() => {
|
||||
return '您未' + action + "本子"
|
||||
})
|
||||
|
||||
//在线预览相关
|
||||
let currentGallery = ref({name:"name"})
|
||||
let imageWidth = computed(() => {
|
||||
return store.state.imageWidth
|
||||
})
|
||||
let imagePadding = computed(() => {
|
||||
return store.state.imagePadding
|
||||
})
|
||||
|
||||
//标签
|
||||
let tags = computed(() => {
|
||||
return store.state.tags
|
||||
})
|
||||
let newTag = ref("")
|
||||
|
||||
//翻页
|
||||
function next() {
|
||||
if(targetPage.value < max.value) {
|
||||
@@ -234,67 +190,13 @@ function changeSortType(){
|
||||
store.commit("_setSortType", sortType.value)
|
||||
}
|
||||
|
||||
//收藏,编辑标签,提交编辑
|
||||
//收藏
|
||||
function changeGalleryCollect(gid, isCollect){
|
||||
if(isCollect)
|
||||
store.dispatch("disCollectGallery", gid)
|
||||
else
|
||||
store.dispatch("collectGallery", gid)
|
||||
}
|
||||
function editGalleryTag(gallery){
|
||||
galleryForTag.value = gallery
|
||||
isEditingTag.value = true
|
||||
}
|
||||
let tagInput = ref()
|
||||
|
||||
function querySimilarTag(keyWord, cb){
|
||||
let result = []
|
||||
let hit = false //用于检测是否有重复标签
|
||||
let skip //用于过滤已经有了的标签
|
||||
for(const [key, tag] of store.state.tags){
|
||||
skip = false
|
||||
for(let id of galleryForTag.value.tags)
|
||||
if(id === key) {
|
||||
if(!hit && tag.tag === keyWord) //是否命中标签
|
||||
hit = true
|
||||
skip = true
|
||||
break
|
||||
}else{
|
||||
console.log("id:", id, key)
|
||||
}
|
||||
if(skip)
|
||||
continue
|
||||
if(tag.tag.includes(keyWord))
|
||||
result.push({value: tag.tag, tag:tag})
|
||||
}
|
||||
|
||||
if(keyWord.trim() !== '' && !keyWord.includes("#") && !hit && !keyWord.includes("?") && result.length === 0)
|
||||
result.push({value: '新建 #' + keyWord + ' 标签?', tag:{tag:keyWord}})
|
||||
cb(result)
|
||||
}
|
||||
|
||||
function handleTagSelect(data){
|
||||
if(data.value.includes('#')) {
|
||||
if(data.tag.tag.includes("?")) {
|
||||
ElMessage("非法字符?")
|
||||
return
|
||||
}
|
||||
else
|
||||
store.dispatch("createTagAndMark", {tag: data.tag.tag.replace('#', ''), gid: galleryForTag.value.gid})
|
||||
}
|
||||
else
|
||||
store.dispatch("mark", {gid:galleryForTag.value.gid, tid:data.tag.id})
|
||||
newTag.value = ""
|
||||
tagInput.value.blur()
|
||||
}
|
||||
|
||||
function mark(gid, tid){
|
||||
store.dispatch("mark", {gid, tid})
|
||||
}
|
||||
|
||||
function disMark(gid, tid){
|
||||
store.dispatch("disMark", {gid, tid})
|
||||
}
|
||||
|
||||
//下载,删除,在线看
|
||||
function downloadTask(link){
|
||||
@@ -303,27 +205,8 @@ function downloadTask(link){
|
||||
function deleteGallery(gid){
|
||||
store.dispatch("deleteGallery", gid)
|
||||
}
|
||||
function onlineGalleryReader(gallery){
|
||||
currentGallery.value = gallery
|
||||
isOnlineReading.value = true;
|
||||
}
|
||||
function shareGallery(data){
|
||||
const {gid, shortName} = data
|
||||
let link
|
||||
axios.post("https://downloader.lionwebsite.xyz/GalleryManage/share?userId=3&expireHour=3&gid=" + gid).then((res) => {
|
||||
if(res.data.result === "success"){
|
||||
let data = JSON.parse(res.data.data)
|
||||
link = 'https://lionwebsite.xyz/GetFile/{0}?ShareCode={1}'.replace('{0}', encodeURIComponent(shortName)).replace('{1}', data.shareCode)
|
||||
ElMessage({dangerouslyUseHTMLString: true,
|
||||
message: "<span>分享成功, 过期时间:" + data.expireTime + "</span><br><a href=" + link + ">链接</a>",
|
||||
duration: 0,
|
||||
'show-close': true
|
||||
})
|
||||
navigator.clipboard.writeText(link)
|
||||
}
|
||||
else
|
||||
ElMessage(res.data.data)
|
||||
})
|
||||
function readOnlineGallery(gallery){
|
||||
store.dispatch("readOnlineGallery", gallery)
|
||||
}
|
||||
|
||||
//显示缩略图
|
||||
|
||||
Reference in New Issue
Block a user