11
11
<el-select placeholder =" 排序" @change =" handleSortChange" clearable v-model =" sortValue" >
12
12
<el-option label =" 仅收藏" value =" mark" ></el-option >
13
13
<el-option label =" 仅合集" value =" collection" ></el-option >
14
+ <el-option label =" 仅隐藏" value =" hidden" ></el-option >
14
15
<el-option label =" 添加时间正序" value =" addAscend" ></el-option >
15
16
<el-option label =" 添加时间倒序" value =" addDescend" ></el-option >
16
17
<el-option label =" 上传时间正序" value =" postAscend" ></el-option >
40
41
:key =" book.id"
41
42
class =" book-card-frame"
42
43
>
43
- <div class =" book-card" v-if =" !book.collection && !book.hidden" >
44
+ <!-- show book card when book isn't a collection, book isn't hidden because collected, and book isn't hidden by user except sorting by onlyHiddenBook -->
45
+ <div class =" book-card" v-if =" !book.collection && !book.hidden && (sortValue == 'hidden' || !book.hiddenBook)" >
44
46
<p class =" book-title" :title =" book.title_jpn ? book.title_jpn : book.title" >{{book.title_jpn ? book.title_jpn : book.title}}</p >
45
47
<img class =" book-cover" :src =" book.coverPath" @click =" openBookDetail(book)" />
46
48
<el-icon :size =" 30" :color =" book.mark ? '#E6A23C' : '#666666'" class =" book-card-star" @click =" switchMark(book)" ><StarFilled /></el-icon >
142
144
</el-row >
143
145
<el-row class =" book-detail-function" >
144
146
<el-button type =" primary" plain @click =" showFile(bookDetail.filepath)" >打开漫画文件所在目录</el-button >
147
+ <el-button type =" primary" plain @click =" triggerHiddenBook(bookDetail)" >{{bookDetail.hiddenBook?'显示':'隐藏'}}漫画</el-button >
148
+ </el-row >
149
+ <el-row class =" book-detail-function" >
145
150
<el-button type =" primary" plain @click =" triggerShowComment" >{{showComment?'隐藏':'显示'}}评论</el-button >
146
151
</el-row >
147
152
</el-col >
@@ -607,6 +612,12 @@ export default defineComponent({
607
612
.then (()=> {
608
613
_ .remove (this .bookList , {filepath: this .bookDetail .filepath })
609
614
_ .remove (this .displayBookList , {filepath: this .bookDetail .filepath })
615
+ _ .forIn (this .collectionList , collection => {
616
+ collection .list = _ .filter (collection .list , id => id != this .bookDetail .id )
617
+ })
618
+ this .openCollectionBookList = _ .filter (this .openCollectionBookList , book => book .id != this .bookDetail .id )
619
+ this .saveBookList ()
620
+ this .saveCollection ()
610
621
this .dialogVisibleBookDetail = false
611
622
this .chunkList ()
612
623
})
@@ -781,7 +792,7 @@ export default defineComponent({
781
792
searchBook () {
782
793
let searchStringArray = this .searchString ? this .searchString .split (/ (?=(?:[^ "'] * ["'][^ "'] * ["'] )* [^ "'] * $ )/ ) : []
783
794
this .displayBookList = _ .filter (this .bookList , (book )=> {
784
- let bookString = JSON .stringify (_ .pick (book, [' title' , ' title_jpn' , ' tags' , ' status' , ' category' ])).toLowerCase ()
795
+ let bookString = JSON .stringify (_ .pick (book, [' title' , ' title_jpn' , ' tags' , ' status' , ' category' , ' filepath ' ])).toLowerCase ()
785
796
return _ .every (searchStringArray, (str )=> {
786
797
if (_ .startsWith (str, ' -' )) {
787
798
return ! bookString .includes (str .slice (1 ).replace (/ ["'] / g , ' ' ).toLowerCase ())
@@ -794,6 +805,7 @@ export default defineComponent({
794
805
},
795
806
searchFromTag (tag ) {
796
807
this .dialogVisibleBookDetail = false
808
+ this .drawerVisibleCollection = false
797
809
this .searchString = ` "${ tag} "`
798
810
this .searchBook ()
799
811
},
@@ -886,6 +898,9 @@ export default defineComponent({
886
898
loading .close ()
887
899
this .drawerVisibleViewer = true
888
900
})
901
+ .finally (()=> {
902
+ loading .close ()
903
+ })
889
904
},
890
905
initResize (id ) {
891
906
if (this .imageStyleType == ' scroll' ) {
@@ -925,6 +940,10 @@ export default defineComponent({
925
940
this .displayBookList = _ .filter (this .bookList , ' collection' )
926
941
this .chunkList ()
927
942
break
943
+ case ' hidden' :
944
+ this .displayBookList = _ .filter (this .bookList , ' hiddenBook' )
945
+ this .chunkList ()
946
+ break
928
947
case ' addAscend' :
929
948
this .displayBookList = _ .reverse (this .bookList .sort (this .sortList (' date' )))
930
949
this .chunkList ()
@@ -1103,12 +1122,16 @@ export default defineComponent({
1103
1122
book .collected = true
1104
1123
}
1105
1124
},
1106
- openCollection (book ) {
1125
+ openCollection (book ) {
1107
1126
this .drawerVisibleCollection = true
1108
1127
this .openCollectionBookList = _ .compact (book .list .map (id => {
1109
1128
return _ .find (this .bookList , {id})
1110
1129
}))
1111
1130
this .openCollectionTitle = book .title
1131
+ },
1132
+ triggerHiddenBook (book ) {
1133
+ book .hiddenBook = ! book .hiddenBook
1134
+ this .saveBookList ()
1112
1135
}
1113
1136
}
1114
1137
})
0 commit comments