Files
XH-XunKe/frontend/src/views/Login.vue
T
xhgitandClaude Code ed55053b10 直播观看与录像链路真实验证通过,前端 UI 全面重做,分角色控制台
- 修复: LiveKit 回环候选生效(宿主机浏览器可直连推流)
- 修复: 回放预签名 URL 403(公开端点直接签名,SignedHeaders=host)
- 修复: 录像探针补 fileSize/durationSeconds
- 修复: 家长录像列表被权限过滤误伤为 0 条;教师/家长列表按角色精确隔离
- 修复: 巡课静音失效(LiveKit attach 强制 unmute,静音时不挂载音轨)
- 修复: 教室页自动请求摄像头/麦克风权限,分辨率失败自动降级
- 新增: 浏览器端到端验证脚本 scripts/e2e-browser.mjs(9 项断言全过:
  教师推流/家长观看含音频电平实测/巡课默认静音/Egress 录像双轨齐全/
  DPlayer 回放/录像权限隔离)
- 新增: /parent/today 家长今日课程表、网站 Logo 上传与公开读取
- UI 重做: 虎牙风直播播放器 + DPlayer 回放播放器(视觉统一)
- 分角色控制台: 管理端 /admin(16 模块)、教师端 /teacher、家长端 /parent
- 直播/录像列表返回班级、课程、教师名称与在线人数
- 18088 本地预览改为 Vite 热更新,README/实现状态文档同步更新

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-22 15:08:36 +08:00

84 lines
3.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<AuthLayout>
<h2 class="form-title">登录</h2>
<p class="form-sub">欢迎回到 {{ site.nameZh }}</p>
<el-form @submit.prevent="submit" size="large">
<el-form-item>
<el-input v-model="account" placeholder="用户名 / 邮箱 / 手机号" clearable autocomplete="username" />
</el-form-item>
<el-form-item>
<el-input v-model="password" type="password" placeholder="密码" show-password autocomplete="current-password" @keyup.enter="submit" />
</el-form-item>
<el-alert v-if="error" :title="error" type="error" :closable="false" class="form-alert" />
<el-button class="touch" type="primary" native-type="submit" :loading="loading" style="width: 100%">登录</el-button>
</el-form>
<div class="form-links">
<router-link to="/forgot">忘记密码?</router-link>
<router-link v-if="site.registrationEnabled" to="/register">注册家长账号</router-link>
<span v-else class="muted">注册已关闭</span>
</div>
<div v-if="site.terms || site.privacy" class="terms">
<el-link v-if="site.terms" type="primary" @click="showText('用户协议', site.terms)">用户协议</el-link>
<el-link v-if="site.privacy" type="primary" @click="showText('隐私政策', site.privacy)">隐私政策</el-link>
</div>
<el-dialog v-model="docVisible" :title="docTitle" width="560px">
<p class="doc-body">{{ docBody }}</p>
</el-dialog>
</AuthLayout>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import AuthLayout from "../components/AuthLayout.vue";
import { useAuthStore } from "../stores/auth";
import { useSiteStore } from "../stores/site";
import { homeFor } from "../utils/roles";
const site = useSiteStore();
const auth = useAuthStore();
const router = useRouter();
const route = useRoute();
const account = ref("");
const password = ref("");
const loading = ref(false);
const error = ref("");
const docVisible = ref(false);
const docTitle = ref("");
const docBody = ref("");
function showText(title: string, body: string) {
docTitle.value = title;
docBody.value = body;
docVisible.value = true;
}
async function submit() {
if (!account.value.trim() || !password.value) {
error.value = "请输入账号和密码";
return;
}
loading.value = true;
error.value = "";
try {
await auth.login(account.value.trim(), password.value);
const next = typeof route.query.next === "string" ? route.query.next : homeFor(auth.roles);
router.push(next);
} catch (err: unknown) {
error.value = (err as { response?: { data?: { message?: string } } }).response?.data?.message ?? "登录失败";
} finally {
loading.value = false;
}
}
</script>
<style scoped>
.form-title { margin: 0 0 4px; font-size: 24px; }
.form-sub { margin: 0 0 24px; color: var(--xh-text-2); font-size: 14px; }
.form-alert { margin-bottom: 14px; }
.form-links { display: flex; justify-content: space-between; margin-top: 16px; font-size: 14px; }
.terms { margin-top: 18px; display: flex; gap: 16px; font-size: 13px; }
.doc-body { white-space: pre-wrap; line-height: 1.8; color: var(--xh-text); }
</style>