diff --git a/src/components/userScripts/tus-mission.vue b/src/components/userScripts/tus-mission.vue index f68352fb..01476ead 100644 --- a/src/components/userScripts/tus-mission.vue +++ b/src/components/userScripts/tus-mission.vue @@ -3,8 +3,10 @@
米游币任务({{ todayPoints }}/{{ totalPoints }})
- 刷新 - 执行 + {{ cancelLike ? "点赞后取消" : "点赞后不取消" }} + + 刷新 + 执行
@@ -18,10 +20,10 @@
{{ mission.process }}/{{ mission.total }} @@ -36,6 +38,7 @@ import apiHubReq from "@req/apiHubReq.js"; import miscReq from "@req/miscReq.js"; import painterReq from "@req/painterReq.js"; import postReq from "@req/postReq.js"; +import useAppStore from "@store/app.js"; import useUserStore from "@store/user.js"; import TGLogger from "@utils/TGLogger.js"; import { storeToRefs } from "pinia"; @@ -53,7 +56,10 @@ type ParseMission = { }; const { cookie, uid } = storeToRefs(useUserStore()); +const { cancelLike } = storeToRefs(useAppStore()); + const loadScript = defineModel(); + const todayPoints = ref(0); const totalPoints = ref(0); const loadState = ref(false); @@ -209,15 +215,17 @@ async function tryAuto(): Promise { await TGLogger.Script(`[米游币任务]点赞失败:${likeResp.retcode} ${likeResp.message}`); continue; } - await TGLogger.Script(`[米游币任务]正在取消点赞帖子${post.post.post_id}`); - await new Promise((resolve) => setTimeout(resolve, 1000)); - const unlikeResp = await apiHubReq.post.like(post.post.post_id, ckPost, true); - if (unlikeResp.retcode === 0) { - await TGLogger.Script("[米游币任务]取消点赞成功"); - } else { - await TGLogger.Script( - `[米游币任务]取消点赞失败:${unlikeResp.retcode} ${unlikeResp.message}`, - ); + if (cancelLike.value) { + await TGLogger.Script(`[米游币任务]正在取消点赞帖子${post.post.post_id}`); + await new Promise((resolve) => setTimeout(resolve, 1000)); + const unlikeResp = await apiHubReq.post.like(post.post.post_id, ckPost, true); + if (unlikeResp.retcode === 0) { + await TGLogger.Script("[米游币任务]取消点赞成功"); + } else { + await TGLogger.Script( + `[米游币任务]取消点赞失败:${unlikeResp.retcode} ${unlikeResp.message}`, + ); + } } } } @@ -328,9 +336,18 @@ async function autoSign(ck: TGApp.App.Account.Cookie, ch?: string): Promise(true); /* 帖子宽窄视图 */ const postViewWide = ref(true); + /* 是否取消点赞 */ + const cancelLike = ref(true); /** * 初始化应用状态 - * @since Beta v0.8.7 + * @since Beta v0.8.9 * @remarks 用于首次运行或重置应用状态 * @returns void */ @@ -82,6 +84,7 @@ const useAppStore = defineStore( imageQualityPercent.value = 10; incognito.value = true; postViewWide.value = true; + cancelLike.value = true; initDevice(); } @@ -136,6 +139,7 @@ const useAppStore = defineStore( imageQualityPercent, incognito, postViewWide, + cancelLike, init, changeTheme, getImageUrl, @@ -162,6 +166,7 @@ const useAppStore = defineStore( "incognito", "sidebar", "postViewWide", + "cancelLike", ], }, {