feat: overnight-runner 入 SDD、dev-build 全栈编排,并落地 ACC-account
将 overnight-runner skill 无前缀并入套件;dev-build 编排自测/UI/代码评审;指南左侧导航;example 实现账号能力与 progress。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* 当前生效的协议版本。
|
||||
* 协议中心(PLT)上线后改为后端下发。
|
||||
*/
|
||||
export const AGREEMENT_VERSIONS: Record<string, string> = {
|
||||
service: 'v1',
|
||||
privacy: 'v1',
|
||||
}
|
||||
|
||||
export const AGREEMENT_LABELS: Record<string, string> = {
|
||||
service: '服务协议',
|
||||
privacy: '隐私政策',
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
|
||||
const auth = useAuthStore()
|
||||
const router = useRouter()
|
||||
|
||||
const displayName = computed(() => auth.profile?.nickname || auth.user?.phone || '未登录')
|
||||
|
||||
function handleLogout() {
|
||||
auth.logout()
|
||||
router.push('/user/login')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="layout">
|
||||
<header class="layout__header">
|
||||
<div class="layout__brand">咨询预约平台</div>
|
||||
<nav class="layout__nav">
|
||||
<router-link to="/">首页</router-link>
|
||||
<router-link to="/user/profile">个人中心</router-link>
|
||||
</nav>
|
||||
<div class="layout__user">
|
||||
<template v-if="auth.isLoggedIn">
|
||||
<span class="layout__name">{{ displayName }}</span>
|
||||
<el-button link type="primary" @click="handleLogout">退出</el-button>
|
||||
</template>
|
||||
<router-link v-else to="/user/login">登录 / 注册</router-link>
|
||||
</div>
|
||||
</header>
|
||||
<main class="layout__main">
|
||||
<slot />
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.layout {
|
||||
min-height: 100vh;
|
||||
background: #f5f7fa;
|
||||
}
|
||||
.layout__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 24px;
|
||||
padding: 0 24px;
|
||||
height: 56px;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
}
|
||||
.layout__brand {
|
||||
font-weight: 600;
|
||||
font-size: 18px;
|
||||
}
|
||||
.layout__nav {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
flex: 1;
|
||||
}
|
||||
.layout__nav a {
|
||||
color: #606266;
|
||||
text-decoration: none;
|
||||
}
|
||||
.layout__nav a.router-link-active {
|
||||
color: #409eff;
|
||||
}
|
||||
.layout__user {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.layout__name {
|
||||
color: #606266;
|
||||
}
|
||||
.layout__main {
|
||||
max-width: 1080px;
|
||||
margin: 0 auto;
|
||||
padding: 24px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,7 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import ElementPlus from 'element-plus'
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
import 'element-plus/dist/index.css'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
@@ -9,5 +10,6 @@ import './assets/main.css'
|
||||
const app = createApp(App)
|
||||
app.use(createPinia())
|
||||
app.use(router)
|
||||
app.use(ElementPlus)
|
||||
// 统一中文语言包(弹窗按钮等文案随 locale 走 zh-cn)
|
||||
app.use(ElementPlus, { locale: zhCn })
|
||||
app.mount('#app')
|
||||
|
||||
@@ -4,7 +4,25 @@ const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{ path: '/', name: 'home', component: () => import('@/views/home/HomePage.vue') },
|
||||
{
|
||||
path: '/user/login',
|
||||
name: 'user-login',
|
||||
component: () => import('@/views/auth/Login.vue'),
|
||||
},
|
||||
{
|
||||
path: '/user/profile',
|
||||
name: 'user-profile',
|
||||
component: () => import('@/views/user/Profile.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
router.beforeEach(to => {
|
||||
const token = localStorage.getItem('token')
|
||||
if (to.meta.requiresAuth && !token) {
|
||||
return { path: '/user/login' }
|
||||
}
|
||||
})
|
||||
|
||||
export default router
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import http, { unwrap } from '@/utils/request'
|
||||
import type { AgreementConsent } from '@/types'
|
||||
|
||||
/** 协议同意相关接口(ACC)。 */
|
||||
export const agreementService = {
|
||||
list: () => unwrap(http.get<AgreementConsent[]>('/me/agreements')),
|
||||
|
||||
/** 记录协议同意(按类型 + 版本幂等) */
|
||||
consent: (agreementType: string, agreementVersion: string) =>
|
||||
unwrap(http.post<AgreementConsent>('/me/agreements', { agreementType, agreementVersion })),
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import http, { unwrap } from '@/utils/request'
|
||||
import type { LoginResponse } from '@/types'
|
||||
|
||||
/** 鉴权相关接口(ACC)。 */
|
||||
export const authService = {
|
||||
/** 发送登录 / 注册验证码 */
|
||||
sendSmsCode: (phone: string) => unwrap(http.post<void>('/auth/sms/send', { phone })),
|
||||
|
||||
/** 验证码登录或注册 */
|
||||
smsLogin: (payload: { phone: string; code: string; nickname?: string }) =>
|
||||
unwrap(http.post<LoginResponse>('/auth/sms/login', payload)),
|
||||
|
||||
/** 管理员密码登录 */
|
||||
adminLogin: (payload: { phone: string; password: string }) =>
|
||||
unwrap(http.post<LoginResponse>('/auth/admin/login', payload)),
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import http, { unwrap } from '@/utils/request'
|
||||
import type { FavoriteItem } from '@/types'
|
||||
|
||||
/** 收藏相关接口(ACC)。 */
|
||||
export const favoriteService = {
|
||||
list: () => unwrap(http.get<FavoriteItem[]>('/me/favorites')),
|
||||
|
||||
/** 收藏咨询师(幂等) */
|
||||
add: (consultantId: string) => unwrap(http.post<FavoriteItem>('/me/favorites', { consultantId })),
|
||||
|
||||
/** 取消收藏(幂等) */
|
||||
remove: (consultantId: string) => unwrap(http.delete<void>(`/me/favorites/${consultantId}`)),
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import http, { unwrap } from '@/utils/request'
|
||||
import type { MeResponse, UserProfile } from '@/types'
|
||||
|
||||
/** 个人资料相关接口(ACC)。 */
|
||||
export const profileService = {
|
||||
/** 当前账号与资料 */
|
||||
me: () => unwrap(http.get<MeResponse>('/me')),
|
||||
|
||||
/** 更新本人资料 */
|
||||
updateProfile: (payload: {
|
||||
nickname?: string
|
||||
avatarUrl?: string
|
||||
email?: string
|
||||
cityCode?: string
|
||||
locale?: string
|
||||
}) => unwrap(http.put<UserProfile>('/me/profile', payload)),
|
||||
}
|
||||
@@ -1,16 +1,53 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref, computed } from 'vue'
|
||||
import type { AccountInfo, UserProfile } from '@/types'
|
||||
|
||||
/** Auth store shell — wire login/register when ACC is implemented. */
|
||||
/** 登录态:token + 当前账号 + 资料。 */
|
||||
export const useAuthStore = defineStore('auth', () => {
|
||||
const token = ref(localStorage.getItem('token') || '')
|
||||
const user = ref<AccountInfo | null>(readJson<AccountInfo>('user'))
|
||||
const profile = ref<UserProfile | null>(readJson<UserProfile>('profile'))
|
||||
const isLoggedIn = computed(() => !!token.value)
|
||||
const roles = computed(() => user.value?.roles ?? [])
|
||||
|
||||
function setLogin(payload: { token: string; account: AccountInfo; profile: UserProfile | null }) {
|
||||
token.value = payload.token
|
||||
user.value = payload.account
|
||||
profile.value = payload.profile
|
||||
localStorage.setItem('token', payload.token)
|
||||
localStorage.setItem('user', JSON.stringify(payload.account))
|
||||
if (payload.profile) localStorage.setItem('profile', JSON.stringify(payload.profile))
|
||||
else localStorage.removeItem('profile')
|
||||
}
|
||||
|
||||
function setProfile(value: UserProfile | null) {
|
||||
profile.value = value
|
||||
if (value) localStorage.setItem('profile', JSON.stringify(value))
|
||||
else localStorage.removeItem('profile')
|
||||
}
|
||||
|
||||
function logout() {
|
||||
token.value = ''
|
||||
user.value = null
|
||||
profile.value = null
|
||||
localStorage.removeItem('token')
|
||||
localStorage.removeItem('user')
|
||||
localStorage.removeItem('profile')
|
||||
}
|
||||
|
||||
return { token, isLoggedIn, logout }
|
||||
function hasRole(role: string) {
|
||||
return roles.value.includes(role)
|
||||
}
|
||||
|
||||
return { token, user, profile, isLoggedIn, roles, setLogin, setProfile, logout, hasRole }
|
||||
})
|
||||
|
||||
function readJson<T>(key: string): T | null {
|
||||
const raw = localStorage.getItem(key)
|
||||
if (!raw) return null
|
||||
try {
|
||||
return JSON.parse(raw) as T
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,58 @@
|
||||
/** Shared frontend types — extend when implementing iteration1 features. */
|
||||
/** 共享前端类型 —— 对齐 docs/facts/api.yaml(ACC 账号与个人中心)。 */
|
||||
|
||||
export interface HealthResponse {
|
||||
status: string
|
||||
}
|
||||
|
||||
export interface AccountInfo {
|
||||
id: string
|
||||
roles: string[]
|
||||
status: string
|
||||
phone: string | null
|
||||
phoneVerifiedAt: string | null
|
||||
lastLoginAt: string | null
|
||||
disabledReason: string | null
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export interface UserProfile {
|
||||
accountId: string
|
||||
nickname: string
|
||||
avatarUrl: string | null
|
||||
email: string | null
|
||||
cityCode: string | null
|
||||
locale: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export interface MeResponse {
|
||||
account: AccountInfo
|
||||
profile: UserProfile | null
|
||||
}
|
||||
|
||||
export interface LoginResponse {
|
||||
token: string
|
||||
account: AccountInfo
|
||||
profile: UserProfile | null
|
||||
}
|
||||
|
||||
export interface FavoriteItem {
|
||||
id: string
|
||||
consultantId: string
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export interface AgreementConsent {
|
||||
id: string
|
||||
agreementType: string
|
||||
agreementVersion: string
|
||||
consentedAt: string
|
||||
sourceIp: string
|
||||
}
|
||||
|
||||
export interface ApiError {
|
||||
errorCode: string
|
||||
errorMessage: string
|
||||
data: unknown
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import axios from 'axios'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { ApiError } from '@/types'
|
||||
|
||||
const http = axios.create({
|
||||
baseURL: '/api/v1',
|
||||
@@ -14,7 +17,43 @@ http.interceptors.request.use(cfg => {
|
||||
|
||||
http.interceptors.response.use(
|
||||
r => r,
|
||||
e => Promise.reject(e)
|
||||
e => {
|
||||
const status = e.response?.status
|
||||
const data = e.response?.data as ApiError | undefined
|
||||
if (status === 401) {
|
||||
// Token 过期 / 无效 / 账号被禁用 → 清除登录态并回到登录页
|
||||
localStorage.removeItem('token')
|
||||
localStorage.removeItem('user')
|
||||
localStorage.removeItem('profile')
|
||||
if (!location.pathname.startsWith('/user/login')) {
|
||||
location.href = '/user/login'
|
||||
}
|
||||
return Promise.reject(e)
|
||||
}
|
||||
if (status === 403) {
|
||||
ElMessage.error(data?.errorMessage || '无权访问该资源')
|
||||
return Promise.reject(e)
|
||||
}
|
||||
if (status === 409) {
|
||||
ElMessage.warning(data?.errorMessage || '操作冲突')
|
||||
return Promise.reject(e)
|
||||
}
|
||||
if (status === 400) {
|
||||
// 具体提示交由调用方展示
|
||||
return Promise.reject(e)
|
||||
}
|
||||
if (status && status >= 500) {
|
||||
ElMessage.error('系统繁忙,请稍后重试')
|
||||
return Promise.reject(e)
|
||||
}
|
||||
return Promise.reject(e)
|
||||
}
|
||||
)
|
||||
|
||||
export default http
|
||||
|
||||
/** 取出响应体(约定:成功响应直接返回 data)。 */
|
||||
export async function unwrap<T>(promise: Promise<AxiosResponse<T>>): Promise<T> {
|
||||
const response = await promise
|
||||
return response.data
|
||||
}
|
||||
|
||||
126
example-project/containers/frontend/src/views/auth/Login.vue
Normal file
126
example-project/containers/frontend/src/views/auth/Login.vue
Normal file
@@ -0,0 +1,126 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { authService } from '@/services/authService'
|
||||
import { agreementService } from '@/services/agreementService'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { AGREEMENT_VERSIONS } from '@/constants/agreements'
|
||||
import UserLayout from '@/layouts/UserLayout.vue'
|
||||
|
||||
const router = useRouter()
|
||||
const auth = useAuthStore()
|
||||
|
||||
const form = reactive({ phone: '', code: '', nickname: '', agree: false })
|
||||
const sending = ref(false)
|
||||
const loading = ref(false)
|
||||
const sent = ref(false)
|
||||
|
||||
async function handleSendCode() {
|
||||
if (!form.phone) {
|
||||
ElMessage.warning('请输入手机号')
|
||||
return
|
||||
}
|
||||
sending.value = true
|
||||
try {
|
||||
await authService.sendSmsCode(form.phone)
|
||||
sent.value = true
|
||||
ElMessage.success('验证码已发送')
|
||||
} catch (e: any) {
|
||||
ElMessage.warning(e.response?.data?.errorMessage || '验证码发送失败')
|
||||
} finally {
|
||||
sending.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleLogin() {
|
||||
if (!form.phone || !form.code) {
|
||||
ElMessage.warning('请输入手机号与验证码')
|
||||
return
|
||||
}
|
||||
if (!form.agree) {
|
||||
ElMessage.warning('请先阅读并同意《服务协议》与《隐私政策》')
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await authService.smsLogin({
|
||||
phone: form.phone,
|
||||
code: form.code,
|
||||
nickname: form.nickname || undefined,
|
||||
})
|
||||
auth.setLogin(res)
|
||||
await recordAgreements()
|
||||
ElMessage.success('登录成功')
|
||||
router.push('/user/profile')
|
||||
} catch (e: any) {
|
||||
ElMessage.warning(e.response?.data?.errorMessage || '登录失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 记录协议同意(按类型 + 版本幂等),失败不阻断登录。 */
|
||||
async function recordAgreements() {
|
||||
try {
|
||||
await agreementService.consent('service', AGREEMENT_VERSIONS.service)
|
||||
await agreementService.consent('privacy', AGREEMENT_VERSIONS.privacy)
|
||||
} catch {
|
||||
// 协议中心(PLT)上线后由后端校验,此处仅尽力记录
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UserLayout>
|
||||
<div class="login">
|
||||
<el-card class="login__card">
|
||||
<template #header><strong>手机号登录 / 注册</strong></template>
|
||||
<el-form label-position="top" @submit.prevent>
|
||||
<el-form-item label="手机号">
|
||||
<el-input id="login-phone" v-model="form.phone" placeholder="11 位手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="验证码">
|
||||
<div class="login__code">
|
||||
<el-input id="login-code" v-model="form.code" placeholder="6 位验证码" />
|
||||
<el-button :loading="sending" id="login-send-code" @click="handleSendCode">
|
||||
{{ sent ? '重新发送' : '获取验证码' }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="昵称(新用户可选)">
|
||||
<el-input id="login-nickname" v-model="form.nickname" placeholder="缺省由系统生成" />
|
||||
</el-form-item>
|
||||
<el-checkbox v-model="form.agree" class="login__agree">
|
||||
已阅读并同意《服务协议》与《隐私政策》
|
||||
</el-checkbox>
|
||||
<el-button
|
||||
type="primary"
|
||||
class="login__submit"
|
||||
:loading="loading"
|
||||
id="login-submit"
|
||||
@click="handleLogin"
|
||||
>
|
||||
登录 / 注册
|
||||
</el-button>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</UserLayout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.login {
|
||||
max-width: 420px;
|
||||
margin: 40px auto;
|
||||
}
|
||||
.login__code {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
.login__submit {
|
||||
width: 100%;
|
||||
margin-top: 12px;
|
||||
}
|
||||
</style>
|
||||
190
example-project/containers/frontend/src/views/user/Profile.vue
Normal file
190
example-project/containers/frontend/src/views/user/Profile.vue
Normal file
@@ -0,0 +1,190 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { profileService } from '@/services/profileService'
|
||||
import { favoriteService } from '@/services/favoriteService'
|
||||
import { agreementService } from '@/services/agreementService'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { AGREEMENT_LABELS } from '@/constants/agreements'
|
||||
import type { AgreementConsent, FavoriteItem } from '@/types'
|
||||
import UserLayout from '@/layouts/UserLayout.vue'
|
||||
|
||||
const auth = useAuthStore()
|
||||
|
||||
const form = reactive({ nickname: '', avatarUrl: '', email: '', cityCode: '', locale: 'zh-CN' })
|
||||
const saving = ref(false)
|
||||
const favorites = ref<FavoriteItem[]>([])
|
||||
const agreements = ref<AgreementConsent[]>([])
|
||||
const consultantId = ref('stub-consultant-001')
|
||||
const loading = ref(false)
|
||||
|
||||
async function loadAll() {
|
||||
loading.value = true
|
||||
try {
|
||||
const [me, favs, agrees] = await Promise.all([
|
||||
profileService.me(),
|
||||
favoriteService.list(),
|
||||
agreementService.list(),
|
||||
])
|
||||
form.nickname = me.profile?.nickname || ''
|
||||
form.avatarUrl = me.profile?.avatarUrl || ''
|
||||
form.email = me.profile?.email || ''
|
||||
form.cityCode = me.profile?.cityCode || ''
|
||||
form.locale = me.profile?.locale || 'zh-CN'
|
||||
auth.setProfile(me.profile)
|
||||
favorites.value = favs
|
||||
agreements.value = agrees
|
||||
} catch (e: any) {
|
||||
ElMessage.warning(e.response?.data?.errorMessage || '加载个人中心失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSave() {
|
||||
saving.value = true
|
||||
try {
|
||||
const updated = await profileService.updateProfile({
|
||||
nickname: form.nickname,
|
||||
avatarUrl: form.avatarUrl,
|
||||
email: form.email,
|
||||
cityCode: form.cityCode,
|
||||
locale: form.locale,
|
||||
})
|
||||
auth.setProfile(updated)
|
||||
ElMessage.success('资料已保存')
|
||||
} catch (e: any) {
|
||||
ElMessage.warning(e.response?.data?.errorMessage || '保存失败')
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleAddFavorite() {
|
||||
if (!consultantId.value) {
|
||||
ElMessage.warning('请输入咨询师 ID')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await favoriteService.add(consultantId.value)
|
||||
favorites.value = await favoriteService.list()
|
||||
ElMessage.success('收藏成功')
|
||||
} catch (e: any) {
|
||||
ElMessage.warning(e.response?.data?.errorMessage || '收藏失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function handleRemoveFavorite(id: string) {
|
||||
try {
|
||||
await ElMessageBox.confirm('确认取消该收藏?', '提示', { type: 'warning' })
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await favoriteService.remove(id)
|
||||
favorites.value = await favoriteService.list()
|
||||
ElMessage.success('已取消收藏')
|
||||
} catch (e: any) {
|
||||
ElMessage.warning(e.response?.data?.errorMessage || '取消收藏失败')
|
||||
}
|
||||
}
|
||||
|
||||
function formatTime(value: string) {
|
||||
return new Date(value).toLocaleString()
|
||||
}
|
||||
|
||||
onMounted(loadAll)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UserLayout>
|
||||
<div v-loading="loading">
|
||||
<h1 class="page-title">个人中心</h1>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-card class="card-gap">
|
||||
<template #header>个人资料</template>
|
||||
<el-form label-width="80px" @submit.prevent>
|
||||
<el-form-item label="手机号">
|
||||
<el-input :model-value="auth.user?.phone || ''" disabled id="profile-phone" />
|
||||
</el-form-item>
|
||||
<el-form-item label="昵称">
|
||||
<el-input v-model="form.nickname" id="profile-nickname" :disabled="loading" />
|
||||
</el-form-item>
|
||||
<el-form-item label="头像">
|
||||
<el-input v-model="form.avatarUrl" placeholder="头像地址" id="profile-avatar" :disabled="loading" />
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱">
|
||||
<el-input v-model="form.email" id="profile-email" :disabled="loading" />
|
||||
</el-form-item>
|
||||
<el-form-item label="城市">
|
||||
<el-input v-model="form.cityCode" placeholder="城市编码,如 310000" id="profile-city" :disabled="loading" />
|
||||
</el-form-item>
|
||||
<el-form-item label="语言">
|
||||
<el-input v-model="form.locale" id="profile-locale" :disabled="loading" />
|
||||
</el-form-item>
|
||||
<el-button type="primary" :loading="saving" :disabled="loading" id="profile-save" @click="handleSave">
|
||||
保存
|
||||
</el-button>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<template #header>协议同意记录</template>
|
||||
<div id="agreement-list">
|
||||
<el-table :data="agreements" size="small" empty-text="暂无协议同意记录">
|
||||
<el-table-column label="协议" width="120">
|
||||
<template #default="{ row }">{{ AGREEMENT_LABELS[row.agreementType] || row.agreementType }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="agreementVersion" label="版本" width="90" />
|
||||
<el-table-column label="同意时间">
|
||||
<template #default="{ row }">{{ formatTime(row.consentedAt) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sourceIp" label="来源 IP" />
|
||||
</el-table>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-card class="card-gap">
|
||||
<template #header>我的咨询师</template>
|
||||
<div class="favorites__add">
|
||||
<el-input v-model="consultantId" placeholder="咨询师 ID" id="favorite-consultant-id" :disabled="loading" />
|
||||
<el-button id="favorite-add" :disabled="loading" @click="handleAddFavorite">收藏</el-button>
|
||||
</div>
|
||||
<div id="favorite-list">
|
||||
<el-table :data="favorites" size="small" empty-text="暂无收藏">
|
||||
<el-table-column prop="consultantId" label="咨询师" />
|
||||
<el-table-column label="收藏时间" width="180">
|
||||
<template #default="{ row }">{{ formatTime(row.createdAt) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="danger" class="favorite-remove" @click="handleRemoveFavorite(row.consultantId)">
|
||||
取消收藏
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</UserLayout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.page-title {
|
||||
margin: 0 0 16px;
|
||||
}
|
||||
.card-gap {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.favorites__add {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user