mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 04:52:50 +08:00
feat(web/login): add Continue as guest entry when guest mode is on
This commit is contained in:
1 parent
78cf516c4c
commit
a21a01f0dd
1 file changed
+31
@@ -13,6 +13,15 @@
|
|||||||
<p v-if="error" class="auth-error">{{ error }}</p>
|
<p v-if="error" class="auth-error">{{ error }}</p>
|
||||||
<button type="submit" :disabled="loading">{{ loading ? '登录中…' : '登录' }}</button>
|
<button type="submit" :disabled="loading">{{ loading ? '登录中…' : '登录' }}</button>
|
||||||
</form>
|
</form>
|
||||||
|
<button
|
||||||
|
v-if="session.guestAllowed.value"
|
||||||
|
type="button"
|
||||||
|
class="guest-btn"
|
||||||
|
:disabled="loading"
|
||||||
|
@click="enterAsGuest"
|
||||||
|
>
|
||||||
|
以游客身份进入
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -43,6 +52,21 @@ async function submit() {
|
|||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function enterAsGuest() {
|
||||||
|
error.value = '';
|
||||||
|
loading.value = true;
|
||||||
|
try {
|
||||||
|
await session.continueAsGuest();
|
||||||
|
const rawNext = typeof route.query.next === 'string' ? route.query.next : '/';
|
||||||
|
const next = rawNext.startsWith('/') && !rawNext.startsWith('//') ? rawNext : '/';
|
||||||
|
router.replace(next);
|
||||||
|
} catch (e) {
|
||||||
|
error.value = (e as Error).message;
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@@ -75,4 +99,11 @@ async function submit() {
|
|||||||
}
|
}
|
||||||
.auth-card button:disabled { opacity: 0.6; cursor: progress; }
|
.auth-card button:disabled { opacity: 0.6; cursor: progress; }
|
||||||
.auth-error { color: #e26a6a; font-size: 13px; margin: 0; }
|
.auth-error { color: #e26a6a; font-size: 13px; margin: 0; }
|
||||||
|
.guest-btn {
|
||||||
|
height: 38px; margin-top: 4px; border-radius: var(--radius-sm);
|
||||||
|
background: transparent; color: var(--text-secondary);
|
||||||
|
border: 1px solid var(--border-color); cursor: pointer;
|
||||||
|
}
|
||||||
|
.guest-btn:hover { color: var(--text-primary); }
|
||||||
|
.guest-btn:disabled { opacity: 0.6; cursor: progress; }
|
||||||
</style>
|
</style>
|
||||||
Reference in new issue
Block a user