把 XH巡课 的当前可运行版本放进仓库,方便后续继续改并同步。
This commit is contained in:
commit
6e5107f1b6
134 files changed
+11284
No files matched your search
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<div class="page" style="max-width: 420px">
|
||||
<div class="card">
|
||||
<h1>{{ site.nameZh }}</h1>
|
||||
<p>{{ site.nameEn }}</p>
|
||||
<p v-if="site.announcement">{{ site.announcement }}</p>
|
||||
<el-form @submit.prevent="submit">
|
||||
<el-form-item label="账号">
|
||||
<el-input v-model="account" placeholder="用户名、邮箱或手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码">
|
||||
<el-input v-model="password" type="password" show-password />
|
||||
</el-form-item>
|
||||
<el-button class="touch" type="primary" native-type="submit" :loading="loading" style="width: 100%">登录</el-button>
|
||||
</el-form>
|
||||
<p v-if="error">{{ error }}</p>
|
||||
<p v-if="site.registrationEnabled"><router-link to="/register">注册家长账号</router-link></p>
|
||||
<p v-else>注册已关闭</p>
|
||||
<p class="muted">{{ site.footer }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useAuthStore } from "../stores/auth";
|
||||
import { useSiteStore } from "../stores/site";
|
||||
|
||||
const site = useSiteStore();
|
||||
const auth = useAuthStore();
|
||||
const router = useRouter();
|
||||
const account = ref("");
|
||||
const password = ref("");
|
||||
const loading = ref(false);
|
||||
const error = ref("");
|
||||
|
||||
async function submit() {
|
||||
loading.value = true;
|
||||
error.value = "";
|
||||
try {
|
||||
await auth.login(account.value, password.value);
|
||||
router.push("/");
|
||||
} catch (err: unknown) {
|
||||
error.value = (err as { response?: { data?: { message?: string } } }).response?.data?.message ?? "登录失败";
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user