重构 store 并修复多个 bug
- state.collectGallery.slice(0) → splice(0),修复收藏列表数据残留 bug
- action 中 state 引用改为 context.state,遵循 Vuex 规范
- 修复 _searchLocalByLink 中 gid 判空条件(null → undefined)
- 修复 deleteTask splice 后索引跳过下一个元素
- 简化 getShortname 用正则替代繁琐的手动遍历
- 移除 loadWeekUsedAmount 冗余的成功提示弹窗
- 添加 Axios 全局错误拦截器,统一处理网络请求失败
- websocket 初始值 {} → null,修正类型
- resetUndone 硬编码授权码改为从 state 获取
- computed 移除副作用,改用 watch 实现
- HentaiSearch 加载指示器 DOM 操作改为响应式 v-show
- 提取重复的 validateLink 到共享工具函数
- OnlineReader 全量 watch(store.state) → 精准监听 isReading
This commit is contained in:
@@ -140,9 +140,10 @@
|
||||
|
||||
<script setup>
|
||||
import store from "../store";
|
||||
import {computed, ref, onMounted} from "vue";
|
||||
import {computed, ref, onMounted, watch} from "vue";
|
||||
import {ElMessage} from "element-plus"
|
||||
import HentaiSearch from "./HentaiSearch.vue";
|
||||
import {validateLink} from "../utils/validate.js";
|
||||
|
||||
//授权码相关
|
||||
let AuthCode = ref("")
|
||||
@@ -172,8 +173,6 @@ let realAuthCode = computed(() => {
|
||||
})
|
||||
|
||||
let chosenGallery = computed(() => {
|
||||
param.value = ''
|
||||
targetResolution.value = ''
|
||||
return store.state.chosenGallery
|
||||
})
|
||||
|
||||
@@ -192,6 +191,12 @@ let isLion = computed(() => {
|
||||
return store.state.userId === 3
|
||||
})
|
||||
|
||||
// 查询弹窗打开时重置表单
|
||||
watch(chosenGallery, () => {
|
||||
param.value = ''
|
||||
targetResolution.value = ''
|
||||
})
|
||||
|
||||
//重连节点
|
||||
function reconnect(){
|
||||
store.dispatch("reconnect")
|
||||
@@ -269,16 +274,6 @@ function validate(){
|
||||
}
|
||||
}
|
||||
|
||||
//验证链接
|
||||
function validateLink(rawLink){
|
||||
if(rawLink.trim() === "")
|
||||
return false
|
||||
if(rawLink.includes("hentai"))
|
||||
return rawLink.includes("/g/")
|
||||
else
|
||||
return false
|
||||
}
|
||||
|
||||
//在线阅读以及展示缩略图
|
||||
function readOnlineGallery(gallery){
|
||||
store.dispatch("readOnlineGallery", gallery)
|
||||
|
||||
Reference in New Issue
Block a user