新增单独的标签,移除了以前一整个的标签。允许新增、删除标签。允许对本子进行标记(与标签关联)与取消标记。重写了标签查找。确保所有接口都带有授权码。优化了搜索任务的显示。修复刚提交下载时的任务有概率没有简单名称的bug。(同步更新)
This commit is contained in:
+64
-16
@@ -23,7 +23,7 @@
|
||||
</span>
|
||||
|
||||
<el-button @click="deleteGallery(props.row.gid)" :disabled="props.row.download === undefined">删除</el-button>
|
||||
<el-button @click="editGalleryTag(props.row.gid, props.row.tag)">编辑标签</el-button>
|
||||
<el-button @click="editGalleryTag(props.row)">编辑标签</el-button>
|
||||
<el-button @click="updateGallery(props.row.link)" :disabled="props.row.download === undefined">更新</el-button>
|
||||
<el-button @click="shareGallery({gid:props.row.gid, shortName:props.row.shortName + '.zip'})" v-show="isLion">分享</el-button>
|
||||
</template>
|
||||
@@ -95,20 +95,20 @@
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<el-dialog v-model="isEditingTag" title="编辑标签">
|
||||
<el-dialog v-model="isEditingTag" title="编辑本子标签">
|
||||
<el-form>
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
标签:
|
||||
</template>
|
||||
<template #default>
|
||||
<el-input v-model="tempTag"></el-input>
|
||||
<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-footer>
|
||||
<el-button @click="submitGalleryTag()">提交修改</el-button>
|
||||
</el-footer>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="isOnlineReading" title="在线预览" @close="closeOnlineReading" width="90%" style="margin-top: 0; margin-bottom: 0; padding: 0">
|
||||
@@ -136,8 +136,7 @@ let isEditingPage = ref(false)
|
||||
let isEditingTag = ref(false)
|
||||
|
||||
//临时变量
|
||||
let tempTag = ref("")
|
||||
let tempGid = ref("")
|
||||
let galleryForTag = ref({})
|
||||
|
||||
let category = ref("myDownload") //myDownload myCollect total
|
||||
let galleryNameType = ref("shortName") // shortName name
|
||||
@@ -192,6 +191,12 @@ let imagePadding = computed(() => {
|
||||
return store.state.imagePadding
|
||||
})
|
||||
|
||||
//标签
|
||||
let tags = computed(() => {
|
||||
return store.state.tags
|
||||
})
|
||||
let newTag = ref("")
|
||||
|
||||
//翻页
|
||||
function next() {
|
||||
if(targetPage.value < max.value) {
|
||||
@@ -243,16 +248,59 @@ function changeGalleryCollect(gid, isCollect){
|
||||
else
|
||||
store.dispatch("collectGallery", gid)
|
||||
}
|
||||
function editGalleryTag(gid, tag){
|
||||
tempTag.value = tag
|
||||
tempGid.value = gid
|
||||
function editGalleryTag(gallery){
|
||||
galleryForTag.value = gallery
|
||||
isEditingTag.value = true
|
||||
}
|
||||
function submitGalleryTag(){
|
||||
store.dispatch("updateGalleryTag", {gid:tempGid.value, tag:tempTag.value})
|
||||
tempTag.value = ''
|
||||
tempGid.value = ''
|
||||
isEditingTag.value = false
|
||||
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() !== '' && !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})
|
||||
}
|
||||
|
||||
//下载,删除,在线看
|
||||
|
||||
Reference in New Issue
Block a user