添加个人中心及按角色展示内容

This commit is contained in:
2026-03-11 16:12:00 +08:00
parent 4df88ea502
commit 2056f69c3e
45 changed files with 1108 additions and 23 deletions

View File

@@ -0,0 +1,195 @@
<template>
<view class="user-center-container">
<view class="page-header">
<text class="page-title">个人中心</text>
</view>
<view class="form-container">
<view class="form-item">
<text class="form-label">头像</text>
<view class="form-content avatar-uploader">
<!-- 默认使用一个占位头像或 Logo -->
<image class="avatar-img" src="/static/logo.png" mode="aspectFill"></image>
</view>
</view>
<view class="form-item">
<text class="form-label">账号</text>
<view class="form-content">
<input class="uni-input disabled" value="demo" disabled placeholder="请输入账号" />
</view>
</view>
<view class="form-item">
<text class="form-label"><text class="required">*</text>姓名</text>
<view class="form-content">
<input class="uni-input" v-model="formData.name" placeholder="请输入姓名" />
</view>
</view>
<view class="form-item">
<text class="form-label">原始密码</text>
<view class="form-content">
<input class="uni-input" type="password" v-model="formData.oldPassword" placeholder="请输入原始密码" />
</view>
</view>
<view class="form-item">
<text class="form-label">新密码</text>
<view class="form-content">
<input class="uni-input" type="password" v-model="formData.newPassword" placeholder="请输入新密码" />
</view>
</view>
<view class="form-item">
<text class="form-label">确认密码</text>
<view class="form-content">
<input class="uni-input" type="password" v-model="formData.confirmPassword" placeholder="请再次输入新密码" />
</view>
</view>
<view class="form-actions">
<button class="submit-btn" type="primary" @click="onSubmit">保存修改</button>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { reactive } from 'vue'
const formData = reactive({
name: 'demo',
oldPassword: '',
newPassword: '',
confirmPassword: ''
})
const onSubmit = () => {
if (formData.newPassword && formData.newPassword !== formData.confirmPassword) {
uni.showToast({ title: '两次输入的新密码不一致', icon: 'none' })
return
}
if (!formData.name) {
uni.showToast({ title: '姓名不能为空', icon: 'none' })
return
}
uni.showLoading({ title: '保存中...' })
setTimeout(() => {
uni.hideLoading()
uni.showToast({ title: '保存成功(演示)', icon: 'success' })
// 清空密码框
formData.oldPassword = ''
formData.newPassword = ''
formData.confirmPassword = ''
}, 500)
}
</script>
<style scoped>
.user-center-container {
padding: 20px;
background-color: #f5f7f9;
min-height: 100%;
}
.page-header {
margin-bottom: 20px;
}
.page-title {
font-size: 16px;
font-weight: bold;
color: #333;
}
.form-container {
background-color: #fff;
border-radius: 4px;
padding: 30px 20px;
max-width: 800px;
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.form-item {
display: flex;
flex-direction: row;
align-items: center;
margin-bottom: 24px;
}
.form-label {
width: 100px;
text-align: right;
margin-right: 16px;
font-size: 14px;
color: #606266;
flex-shrink: 0;
}
.required {
color: #f5222d;
margin-right: 4px;
}
.form-content {
flex: 1;
max-width: 400px;
}
.uni-input {
width: 100%;
height: 36px;
line-height: 36px;
padding: 0 12px;
border: 1px solid #dcdfe6;
border-radius: 4px;
font-size: 14px;
color: #333;
box-sizing: border-box;
}
.uni-input:focus {
border-color: #1890ff;
outline: none;
}
.disabled {
background-color: #f5f7fa;
color: #c0c4cc;
cursor: not-allowed;
}
.avatar-uploader {
display: flex;
justify-content: flex-start;
}
.avatar-img {
width: 80px;
height: 80px;
border-radius: 4px;
background-color: #f0f2f5;
border: 1px dashed #d9d9d9;
}
.form-actions {
margin-top: 40px;
padding-left: 116px;
}
.submit-btn {
background-color: #1890ff;
color: #fff;
font-size: 14px;
height: 36px;
line-height: 36px;
width: 120px;
border-radius: 4px;
border: none;
}
.submit-btn:active {
background-color: #096dd9;
}
</style>

View File

@@ -1,10 +1,100 @@
signIn result:
AkSupaSignInResult {access_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI4Y…HNlfQ.5BvQq26lJUF23AEglMvA7EzJZvYN_hrp1Q2JA6o0s-w', refresh_token: 'ehhxnwgvgeyk', expires_at: 1773136334, user: UTSJSONObject2, token_type: 'bearer', …}
login.uvue:175 🔍 开始校验商家端角色 -> UID: 8bdf11be-2838-4d96-8552-0949cde076d4, Email: test19@163.com
login.uvue:216 ❌ 查询角色过程异常: TypeError: res.getData is not a function
at login.uvue:180:23
at Generator.next (<anonymous>)
login.uvue:435 登录错误: Error: 商家身份校验失败,请联系管理员检查用户数据
at login.uvue:221:9
at Generator.next (<anonymous>)。
打印这些东西
GET http://localhost:5173/layouts/admin/AdminLayout.uvue?t=1773216297014&import net::ERR_ABORTED 500 (Internal Server Error)
main.uts:16 [Vue warn]: Unhandled error during execution of async component loader
at <AsyncComponentWrapper>
at <PageBody>
at <Page>
at <Anonymous>
at <KeepAlive>
at <RouterView>
at <Layout>
at <App>
warnHandler @ uni-h5.es.js:19975
callWithErrorHandling @ vue.runtime.esm.js:1381
warn$1 @ vue.runtime.esm.js:1207
logError @ vue.runtime.esm.js:1438
errorHandler @ uni-h5.es.js:19600
callWithErrorHandling @ vue.runtime.esm.js:1381
handleError @ vue.runtime.esm.js:1421
onError @ vue.runtime.esm.js:3724
(anonymous) @ vue.runtime.esm.js:3767
Promise.catch
setup @ vue.runtime.esm.js:3766
callWithErrorHandling @ vue.runtime.esm.js:1381
setupStatefulComponent @ vue.runtime.esm.js:8985
setupComponent @ vue.runtime.esm.js:8946
mountComponent @ vue.runtime.esm.js:7262
processComponent @ vue.runtime.esm.js:7228
patch @ vue.runtime.esm.js:6694
mountChildren @ vue.runtime.esm.js:6942
processFragment @ vue.runtime.esm.js:7158
patch @ vue.runtime.esm.js:6668
mountChildren @ vue.runtime.esm.js:6942
processFragment @ vue.runtime.esm.js:7158
patch @ vue.runtime.esm.js:6668
mountChildren @ vue.runtime.esm.js:6942
mountElement @ vue.runtime.esm.js:6849
processElement @ vue.runtime.esm.js:6814
patch @ vue.runtime.esm.js:6682
mountChildren @ vue.runtime.esm.js:6942
mountElement @ vue.runtime.esm.js:6849
processElement @ vue.runtime.esm.js:6814
patch @ vue.runtime.esm.js:6682
mountChildren @ vue.runtime.esm.js:6942
processFragment @ vue.runtime.esm.js:7158
patch @ vue.runtime.esm.js:6668
componentUpdateFn @ vue.runtime.esm.js:7372
run @ vue.runtime.esm.js:153
instance.update @ vue.runtime.esm.js:7497
setupRenderEffect @ vue.runtime.esm.js:7507
mountComponent @ vue.runtime.esm.js:7274
processComponent @ vue.runtime.esm.js:7228
patch @ vue.runtime.esm.js:6694
mountChildren @ vue.runtime.esm.js:6942
mountElement @ vue.runtime.esm.js:6849
processElement @ vue.runtime.esm.js:6814
patch @ vue.runtime.esm.js:6682
componentUpdateFn @ vue.runtime.esm.js:7372
run @ vue.runtime.esm.js:153
instance.update @ vue.runtime.esm.js:7497
setupRenderEffect @ vue.runtime.esm.js:7507
mountComponent @ vue.runtime.esm.js:7274
processComponent @ vue.runtime.esm.js:7228
patch @ vue.runtime.esm.js:6694
componentUpdateFn @ vue.runtime.esm.js:7372
run @ vue.runtime.esm.js:153
instance.update @ vue.runtime.esm.js:7497
setupRenderEffect @ vue.runtime.esm.js:7507
mountComponent @ vue.runtime.esm.js:7274
processComponent @ vue.runtime.esm.js:7228
patch @ vue.runtime.esm.js:6694
componentUpdateFn @ vue.runtime.esm.js:7453
run @ vue.runtime.esm.js:153
instance.update @ vue.runtime.esm.js:7497
updateComponent @ vue.runtime.esm.js:7305
processComponent @ vue.runtime.esm.js:7239
patch @ vue.runtime.esm.js:6694
componentUpdateFn @ vue.runtime.esm.js:7453
run @ vue.runtime.esm.js:153
instance.update @ vue.runtime.esm.js:7497
callWithErrorHandling @ vue.runtime.esm.js:1381
flushJobs @ vue.runtime.esm.js:1585
Promise.then
queueFlush @ vue.runtime.esm.js:1494
queueJob @ vue.runtime.esm.js:1488
scheduler @ vue.runtime.esm.js:3179
resetScheduling @ vue.runtime.esm.js:236
triggerEffects @ vue.runtime.esm.js:280
triggerRefValue @ vue.runtime.esm.js:1033
set value @ vue.runtime.esm.js:1078
finalizeNavigation @ vue-router.mjs?v=ed041164:2474
(anonymous) @ vue-router.mjs?v=ed041164:2384
Promise.then
pushWithRedirect @ vue-router.mjs?v=ed041164:2352
push @ vue-router.mjs?v=ed041164:2278
install @ vue-router.mjs?v=ed041164:2631
use @ vue.runtime.esm.js:5190
initRouter @ uni-h5.es.js:19886
install @ uni-h5.es.js:19955
use @ vue.runtime.esm.js:5190
(anonymous) @ main.uts:16
main.uts:16 TypeError: Failed to fetch dynamically imported module: http://localhost:5173/pages/mall/admin/homePage/index.uvue?t=1773216297014&import