feat: 黄豆登录后自动签到领积分

This commit is contained in:
Nixevol
2026-10-25 06:08:44 +08:00
parent 2286bc597d
commit fd9b155518
4 changed files with 84 additions and 2 deletions
+10
View File
@@ -140,6 +140,7 @@ const dramaboxLangs = ref<{ label: string; value: string }[]>([]);
const accountBusy = ref(false);
const activeProxyUrl = ref("");
const profileError = ref("");
const signNotice = ref("");
const method = ref<Method>("guest");
const email = ref("");
const password = ref("");
@@ -1035,6 +1036,7 @@ async function loginHuangdou(asGuest = false) {
}
token.value = payload.token;
profile.value = payload.profile;
takeSign(payload);
writeSavedToken(payload.token);
page.value = "download";
startLive();
@@ -1194,6 +1196,11 @@ function applyLive(payload: { downloads?: { active: LiveJob[]; done: LiveJob[];
if (payload.profile) profile.value = payload.profile;
}
function takeSign(payload: { sign?: { message?: string } | null }) {
const message = payload.sign?.message?.trim() || "";
if (message) signNotice.value = message;
}
function startLive() {
stopLive();
const protocol = location.protocol === "https:" ? "wss" : "ws";
@@ -1345,6 +1352,7 @@ onMounted(async () => {
const payload = await response.json();
token.value = payload.token;
profile.value = payload.profile;
takeSign(payload);
rememberSessionDevice(payload.device);
page.value = "download";
startLive();
@@ -1412,6 +1420,7 @@ onUnmounted(stopLive);
<div class="bar-title">
<n-button v-if="page === 'play'" quaternary size="small" @click="closePlay">返回</n-button>
<n-text strong class="bar-title-text">{{ pageTitle }}</n-text>
<n-text v-if="signNotice" class="sign-note">{{ signNotice }}</n-text>
</div>
<div v-if="page === 'download'" class="bar-search">
<n-input
@@ -1864,6 +1873,7 @@ html { color-scheme: dark; }
}
.bar-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sign-note { flex: none; color: #63e2b7; font-size: 13px; white-space: nowrap; }
.bar-search {
position: absolute;
left: 50%;