去除标签;修改在线看,允许未下载的本子在线看(同步更新)

This commit is contained in:
chuzhongzai
2023-12-25 20:38:13 +08:00
parent 83c093c4ee
commit e50c6e6805
5 changed files with 79 additions and 546 deletions
+6 -123
View File
@@ -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)
}
//显示缩略图