修复bug
This commit is contained in:
@@ -4,6 +4,9 @@ import test from 'node:test'
|
||||
|
||||
const loginSource = readFileSync(new URL('./LoginView.vue', import.meta.url), 'utf8')
|
||||
const registerSource = readFileSync(new URL('./RegisterView.vue', import.meta.url), 'utf8')
|
||||
const legalSource = readFileSync(new URL('./LegalDocumentView.vue', import.meta.url), 'utf8')
|
||||
const legalDocumentsSource = readFileSync(new URL('../legalDocuments.ts', import.meta.url), 'utf8')
|
||||
const authRoutesSource = readFileSync(new URL('../routes.ts', import.meta.url), 'utf8')
|
||||
const authStoreSource = readFileSync(new URL('../store/auth.ts', import.meta.url), 'utf8')
|
||||
const httpSource = readFileSync(new URL('../../../api/http.ts', import.meta.url), 'utf8')
|
||||
const sessionSource = readFileSync(new URL('../../../api/session.ts', import.meta.url), 'utf8')
|
||||
@@ -42,6 +45,17 @@ test('shows immediate login after registration and separates company review from
|
||||
assert.match(registerSource, /立即登录/)
|
||||
})
|
||||
|
||||
test('opens complete service and privacy documents from registration', () => {
|
||||
assert.match(registerSource, /to="\/legal\/terms" target="_blank"/)
|
||||
assert.match(registerSource, /to="\/legal\/privacy" target="_blank"/)
|
||||
assert.doesNotMatch(registerSource, /showDocument/)
|
||||
assert.match(authRoutesSource, /path: '\/legal\/terms'/)
|
||||
assert.match(authRoutesSource, /path: '\/legal\/privacy'/)
|
||||
assert.match(legalSource, /document\.sections/)
|
||||
assert.match(legalDocumentsSource, /跨境物流中的信息出境/)
|
||||
assert.match(legalDocumentsSource, /违禁品/)
|
||||
})
|
||||
|
||||
test('uses real auth endpoints and single-flight refresh handling', () => {
|
||||
assert.match(authApiSource, /\/auth\/login/)
|
||||
assert.match(authApiSource, /\/auth\/register/)
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { ArrowLeft } from '@lucide/vue'
|
||||
import baiyueLogoDark from '@/assets/brand/baiyue-logo-dark.png'
|
||||
import { legalDocuments, type LegalDocumentKey } from '@/modules/auth/legalDocuments'
|
||||
|
||||
const props = defineProps<{ documentKey: LegalDocumentKey }>()
|
||||
const document = computed(() => legalDocuments[props.documentKey])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="legal-page">
|
||||
<header class="legal-header">
|
||||
<RouterLink to="/register"><ArrowLeft :size="18" /> 返回企业注册</RouterLink>
|
||||
<RouterLink to="/login" class="auth-brand" aria-label="返回柏悦物流登录页">
|
||||
<img class="auth-brand-logo" :src="baiyueLogoDark" alt="柏悦物流" />
|
||||
</RouterLink>
|
||||
</header>
|
||||
|
||||
<main class="legal-main">
|
||||
<article class="legal-document">
|
||||
<header class="legal-title">
|
||||
<h1>{{ document.title }}</h1>
|
||||
<dl>
|
||||
<div><dt>版本</dt><dd>{{ document.version }}</dd></div>
|
||||
<div><dt>更新日期</dt><dd>{{ document.updatedAt }}</dd></div>
|
||||
<div><dt>生效日期</dt><dd>{{ document.effectiveAt }}</dd></div>
|
||||
</dl>
|
||||
</header>
|
||||
|
||||
<section class="legal-introduction" aria-label="重要提示">
|
||||
<p v-for="paragraph in document.introduction" :key="paragraph">{{ paragraph }}</p>
|
||||
</section>
|
||||
|
||||
<section v-for="section in document.sections" :key="section.title" class="legal-section">
|
||||
<h2>{{ section.title }}</h2>
|
||||
<p v-for="paragraph in section.paragraphs" :key="paragraph">{{ paragraph }}</p>
|
||||
<ul v-if="section.items">
|
||||
<li v-for="item in section.items" :key="item">{{ item }}</li>
|
||||
</ul>
|
||||
</section>
|
||||
</article>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
@@ -87,9 +87,6 @@ async function submit() {
|
||||
}
|
||||
}
|
||||
|
||||
function showDocument(name: string) {
|
||||
ElMessage.info(`${name}将在正式接入前由业务方确认内容`)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -116,7 +113,7 @@ function showDocument(name: string) {
|
||||
<el-form-item prop="agreement" class="agreement-item">
|
||||
<div class="agreement-control">
|
||||
<el-checkbox v-model="form.agreement"><span class="agreement-required" aria-hidden="true">*</span>我已阅读并同意</el-checkbox>
|
||||
<span><button type="button" @click="showDocument('《用户服务协议》')">《用户服务协议》</button> 和 <button type="button" @click="showDocument('《隐私政策》')">《隐私政策》</button></span>
|
||||
<span><RouterLink to="/legal/terms" target="_blank" rel="noopener">《用户服务协议》</RouterLink> 和 <RouterLink to="/legal/privacy" target="_blank" rel="noopener">《隐私政策》</RouterLink></span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<p class="register-security-note">注册成功后账号可立即登录;首次登录需上传营业执照并等待平台审核,审核通过后才能提交订单。</p>
|
||||
|
||||
Reference in New Issue
Block a user