diff --git a/JC-Salon-WeChat/app.json b/JC-Salon-WeChat/app.json
index 9b532a96..20f2b2a6 100644
--- a/JC-Salon-WeChat/app.json
+++ b/JC-Salon-WeChat/app.json
@@ -15,6 +15,7 @@
"pages/leave-management/index",
"pages/color-setting/index",
"pages/profile/index",
+ "pages/profile-edit/index",
"pages/account-settings/index",
"pages/shop-settings/index",
"pages/export/index",
diff --git a/JC-Salon-WeChat/pages/planning/index.js b/JC-Salon-WeChat/pages/planning/index.js
index 2bb2e458..91e54162 100644
--- a/JC-Salon-WeChat/pages/planning/index.js
+++ b/JC-Salon-WeChat/pages/planning/index.js
@@ -3,6 +3,7 @@ const dateUtil = require('../../utils/date')
const userApi = require('../../api/user')
const auth = require('../../utils/auth')
const { uploadProfileImage } = require('../../utils/upload')
+const { normalizeAvatar } = require('../../utils/profile-card')
function canCreateAppointment() {
const app = getApp()
@@ -117,11 +118,12 @@ Page({
const today = dateUtil.formatDate(new Date())
const dismissed = wx.getStorageSync(auth.PHONE_BANNER_DISMISSED_KEY)
const missingNickname = !String(profile.nickname || '').trim() || String(profile.nickname).startsWith('微信用户')
+ const avatar = normalizeAvatar(profile.avatar)
const skipped = wx.getStorageSync(auth.PROFILE_PROMPT_SKIPPED_KEY) === '1'
this.setData({
phoneBannerVisible: Number(profile.phoneVerified) !== 1 && dismissed !== today,
- profilePromptVisible: !skipped && (missingNickname || !profile.avatar),
- profileForm: { nickname: missingNickname ? '' : profile.nickname, avatar: profile.avatar || '' }
+ profilePromptVisible: !skipped && (missingNickname || !avatar),
+ profileForm: { nickname: missingNickname ? '' : profile.nickname, avatar }
})
} catch (error) {
// 资料提醒失败不影响规划数据。
diff --git a/JC-Salon-WeChat/pages/profile-edit/index.js b/JC-Salon-WeChat/pages/profile-edit/index.js
new file mode 100644
index 00000000..48873846
--- /dev/null
+++ b/JC-Salon-WeChat/pages/profile-edit/index.js
@@ -0,0 +1,140 @@
+const userApi = require('../../api/user')
+const auth = require('../../utils/auth')
+const { chooseImageFilePath, uploadProfileImage } = require('../../utils/upload')
+const { buildProfileCard, normalizeAvatar } = require('../../utils/profile-card')
+const { BRAND_CONFIG } = require('../../utils/config')
+
+function resolveRoleText(type) {
+ const role = Number(type)
+ if (role === 2) return '店长'
+ if (role === 3) return '美甲师'
+ if (role === 4) return '管理员'
+ return '管理端'
+}
+
+function buildPageState(profile, fallbackShopName) {
+ const source = profile || {}
+ const card = buildProfileCard(source, fallbackShopName)
+ return {
+ profile: source,
+ avatarText: card.avatarText,
+ roleText: resolveRoleText(source.type),
+ shopName: card.shopName,
+ form: {
+ nickname: source.nickname || '',
+ avatar: normalizeAvatar(source.avatar),
+ contactPhone: source.contactPhone || '',
+ wechatId: source.wechatId || '',
+ signature: source.signature || ''
+ }
+ }
+}
+
+Page({
+ data: {
+ loading: true,
+ saving: false,
+ avatarUploading: false,
+ profile: {},
+ avatarText: '用',
+ roleText: '管理端',
+ shopName: BRAND_CONFIG.defaultShopName,
+ form: { nickname: '', avatar: '', contactPhone: '', wechatId: '', signature: '' }
+ },
+
+ onLoad() {
+ const app = getApp()
+ const state = buildPageState(app.globalData.userInfo || {}, app.globalData.shopName || BRAND_CONFIG.defaultShopName)
+ this.setData(state)
+ },
+
+ onShow() {
+ this.loadProfile()
+ },
+
+ async loadProfile() {
+ this.setData({ loading: true })
+ try {
+ const profile = await userApi.info()
+ this.syncProfileToSession(profile)
+ } catch (error) {
+ wx.showToast({ title: error.message || '个人信息加载失败', icon: 'none' })
+ } finally {
+ this.setData({ loading: false })
+ }
+ },
+
+ syncProfileToSession(profile) {
+ const app = getApp()
+ const session = auth.getSession()
+ const current = session.userInfo || app.globalData.userInfo || {}
+ const next = {
+ ...current,
+ ...profile,
+ nickname: profile.nickname || '',
+ avatar: profile.avatar || '',
+ contactPhone: profile.contactPhone || '',
+ wechatId: profile.wechatId || '',
+ signature: profile.signature || '',
+ shopName: profile.shopName || current.shopName || session.shopName || app.globalData.shopName || ''
+ }
+ app.setSession({ ...session, shopName: next.shopName || session.shopName, userInfo: next })
+ this.setData(buildPageState(next, app.globalData.shopName || BRAND_CONFIG.defaultShopName))
+ },
+
+ onInput(event) {
+ this.setData({ [`form.${event.currentTarget.dataset.field}`]: event.detail.value })
+ },
+
+ async chooseAvatar() {
+ if (this.data.avatarUploading || this.data.saving) return
+ try {
+ const filePath = await chooseImageFilePath()
+ if (!filePath) return
+ this.setData({ avatarUploading: true })
+ const avatar = await uploadProfileImage(filePath)
+ this.setData({ 'form.avatar': avatar })
+ } catch (error) {
+ wx.showToast({ title: error.message || '头像上传失败', icon: 'none' })
+ } finally {
+ this.setData({ avatarUploading: false })
+ }
+ },
+
+ removeAvatar() {
+ if (!this.data.avatarUploading && !this.data.saving) this.setData({ 'form.avatar': '' })
+ },
+
+ async save() {
+ if (this.data.saving || this.data.avatarUploading) return
+ const form = this.data.form
+ const nickname = String(form.nickname || '').trim()
+ const contactPhone = String(form.contactPhone || '').trim()
+ if (!nickname) {
+ wx.showToast({ title: '请填写昵称', icon: 'none' })
+ return
+ }
+ if (contactPhone && !/^1[3-9]\d{9}$/.test(contactPhone)) {
+ wx.showToast({ title: '请输入正确联系电话', icon: 'none' })
+ return
+ }
+ this.setData({ saving: true })
+ try {
+ await userApi.updateInfo({
+ nickname,
+ avatar: form.avatar || '',
+ contactPhone,
+ wechatId: String(form.wechatId || '').trim(),
+ signature: String(form.signature || '').trim()
+ })
+ const profile = await userApi.info()
+ this.syncProfileToSession(profile)
+ wx.showToast({ title: '已保存', icon: 'success' })
+ setTimeout(() => wx.navigateBack(), 350)
+ } catch (error) {
+ wx.showToast({ title: error.message || '保存失败', icon: 'none' })
+ } finally {
+ this.setData({ saving: false })
+ }
+ }
+})
diff --git a/JC-Salon-WeChat/pages/profile-edit/index.json b/JC-Salon-WeChat/pages/profile-edit/index.json
new file mode 100644
index 00000000..d39c5f00
--- /dev/null
+++ b/JC-Salon-WeChat/pages/profile-edit/index.json
@@ -0,0 +1,3 @@
+{
+ "navigationBarTitleText": "个人信息"
+}
diff --git a/JC-Salon-WeChat/pages/profile-edit/index.wxml b/JC-Salon-WeChat/pages/profile-edit/index.wxml
new file mode 100644
index 00000000..d1a1706f
--- /dev/null
+++ b/JC-Salon-WeChat/pages/profile-edit/index.wxml
@@ -0,0 +1,33 @@
+
+ 正在加载个人信息...
+
+
+
+
+ {{avatarText}}
+
+
+ 个人头像
+ 上传清晰头像,方便门店成员识别
+
+
+
+
+
+ 基本资料
+
+ 昵称
+ 联系电话
+ 微信号
+ 个性签名
+
+
+ 账号信息
+
+ 登录账号{{profile.account || '未设置'}}
+ 所属门店{{shopName}}
+ 身份{{roleText}}
+
+
+
+
diff --git a/JC-Salon-WeChat/pages/profile-edit/index.wxss b/JC-Salon-WeChat/pages/profile-edit/index.wxss
new file mode 100644
index 00000000..dcc948d9
--- /dev/null
+++ b/JC-Salon-WeChat/pages/profile-edit/index.wxss
@@ -0,0 +1,23 @@
+.profile-edit-page { padding-top:24rpx; }
+.loading-line { margin-bottom:16rpx; color:#8e9c94; font-size:22rpx; text-align:center; }
+.avatar-card { display:flex; align-items:center; padding:26rpx; }
+.avatar-preview { display:flex; width:104rpx; height:104rpx; flex:none; align-items:center; justify-content:center; overflow:hidden; border-radius:26rpx; background:#6f8f83; color:#fff; font-size:40rpx; font-weight:900; }
+.avatar-preview image { width:100%; height:100%; }
+.avatar-copy { display:flex; min-width:0; flex:1; flex-direction:column; margin-left:20rpx; }
+.avatar-title { color:#30483c; font-size:28rpx; font-weight:800; }
+.avatar-desc { margin-top:8rpx; color:#8a9a91; font-size:21rpx; line-height:1.5; }
+.avatar-action { min-width:112rpx; height:60rpx; margin-left:16rpx; padding:0 20rpx; border-radius:999rpx; background:#e5eee9; color:#4e7165; font-size:23rpx; font-weight:800; line-height:60rpx; }
+.remove-avatar { width:auto; margin:14rpx 6rpx 0 auto; color:#a36b5d; font-size:22rpx; }
+.section-title { margin:30rpx 4rpx 14rpx; }
+.form-card { padding:0 24rpx; }
+.field-label { width:170rpx; }
+.field input,.field textarea { text-align:right; }
+.signature-field { align-items:flex-start; }
+.signature-field .field-label { padding-top:34rpx; }
+.signature-field textarea { text-align:left; }
+.account-title { margin-top:26rpx; }
+.readonly-card { padding:0 24rpx; }
+.readonly-row { display:flex; min-height:92rpx; align-items:center; justify-content:space-between; gap:30rpx; border-bottom:1rpx solid #eee8df; font-size:25rpx; }
+.readonly-row:last-child { border-bottom:0; }
+.readonly-row text:first-child { color:#625c55; font-weight:700; }
+.readonly-row text:last-child { min-width:0; color:#8a837b; text-align:right; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
diff --git a/JC-Salon-WeChat/pages/profile/index.js b/JC-Salon-WeChat/pages/profile/index.js
index 74341b1f..bfb1828f 100644
--- a/JC-Salon-WeChat/pages/profile/index.js
+++ b/JC-Salon-WeChat/pages/profile/index.js
@@ -1,7 +1,6 @@
const { BRAND_CONFIG } = require('../../utils/config')
const userApi = require('../../api/user')
const auth = require('../../utils/auth')
-const { chooseImageFilePath, uploadProfileImage } = require('../../utils/upload')
const planningApi = require('../../api/planning')
const employeesApi = require('../../api/employees')
const shopApi = require('../../api/shop')
@@ -19,18 +18,7 @@ function resolveRoleText(type) {
Page({
data: {
roleText: '管理端',
- userInfo: {},
profileCard: buildProfileCard({}, BRAND_CONFIG.defaultShopName),
- editModalVisible: false,
- profileSaving: false,
- avatarUploading: false,
- profileForm: {
- nickname: '',
- avatar: '',
- contactPhone: '',
- wechatId: '',
- signature: ''
- },
overviewLoading: false,
overview: {
date: '',
@@ -43,7 +31,7 @@ Page({
shopStatus: '营业中'
},
menus: [
- { title: '个人信息', action: 'editProfile' },
+ { title: '个人信息', url: '/pages/profile-edit/index' },
{ title: '账号设置', url: '/pages/account-settings/index' },
{ title: '店铺设置', url: '/pages/shop-settings/index' },
{ title: '数据导出', url: '/pages/export/index' },
@@ -112,17 +100,11 @@ Page({
const fallbackShopName = app.globalData.shopName || BRAND_CONFIG.defaultShopName
this.setData({
roleText: resolveRoleText(userInfo.type),
- userInfo,
profileCard: buildProfileCard(userInfo, fallbackShopName)
})
},
go(event) {
- const action = event.currentTarget.dataset.action
- if (action === 'editProfile') {
- this.openEditProfile()
- return
- }
wx.navigateTo({ url: event.currentTarget.dataset.url })
},
@@ -161,95 +143,8 @@ Page({
userInfo: nextUserInfo
})
this.setData({
- userInfo: nextUserInfo,
roleText: resolveRoleText(nextUserInfo.type),
profileCard: buildProfileCard(nextUserInfo, BRAND_CONFIG.defaultShopName)
})
- },
-
- openEditProfile() {
- const userInfo = this.data.userInfo || {}
- this.setData({
- editModalVisible: true,
- profileForm: {
- nickname: userInfo.nickname || '',
- avatar: userInfo.avatar || '',
- contactPhone: userInfo.contactPhone || '',
- wechatId: userInfo.wechatId || '',
- signature: userInfo.signature || ''
- }
- })
- },
-
- closeEditProfile() {
- if (this.data.profileSaving || this.data.avatarUploading) {
- return
- }
- this.setData({ editModalVisible: false })
- },
-
- stopTap() {
- },
-
- onProfileInput(event) {
- const field = event.currentTarget.dataset.field
- this.setData({
- [`profileForm.${field}`]: event.detail.value
- })
- },
-
- async chooseProfileAvatar() {
- if (this.data.avatarUploading || this.data.profileSaving) {
- return
- }
- try {
- const filePath = await chooseImageFilePath()
- if (!filePath) {
- return
- }
- this.setData({ avatarUploading: true })
- const avatar = await uploadProfileImage(filePath)
- this.setData({ 'profileForm.avatar': avatar })
- } catch (error) {
- wx.showToast({ title: error.message || '头像上传失败', icon: 'none' })
- } finally {
- this.setData({ avatarUploading: false })
- }
- },
-
- removeProfileAvatar() {
- this.setData({ 'profileForm.avatar': '' })
- },
-
- async saveProfile() {
- const form = this.data.profileForm
- const nickname = String(form.nickname || '').trim()
- const contactPhone = String(form.contactPhone || '').trim()
- if (contactPhone && !/^1[3-9]\d{9}$/.test(contactPhone)) {
- wx.showToast({ title: '请输入正确联系电话', icon: 'none' })
- return
- }
- if (!nickname) {
- wx.showToast({ title: '请填写昵称', icon: 'none' })
- return
- }
- this.setData({ profileSaving: true })
- try {
- await userApi.updateInfo({
- nickname,
- avatar: form.avatar || '',
- contactPhone,
- wechatId: String(form.wechatId || '').trim(),
- signature: String(form.signature || '').trim()
- })
- const profile = await userApi.info()
- this.syncProfileToSession(profile)
- this.setData({ editModalVisible: false })
- wx.showToast({ title: '已保存', icon: 'success' })
- } catch (error) {
- wx.showToast({ title: error.message || '保存失败', icon: 'none' })
- } finally {
- this.setData({ profileSaving: false })
- }
}
})
diff --git a/JC-Salon-WeChat/pages/profile/index.wxml b/JC-Salon-WeChat/pages/profile/index.wxml
index a6f9f363..518dfc01 100644
--- a/JC-Salon-WeChat/pages/profile/index.wxml
+++ b/JC-Salon-WeChat/pages/profile/index.wxml
@@ -49,55 +49,10 @@
diff --git a/JC-Salon-WeChat/pages/profile/index.wxss b/JC-Salon-WeChat/pages/profile/index.wxss
index 448fddd6..24182a61 100644
--- a/JC-Salon-WeChat/pages/profile/index.wxss
+++ b/JC-Salon-WeChat/pages/profile/index.wxss
@@ -177,172 +177,3 @@
color: #b0a79e;
font-size: 44rpx;
}
-
-.modal-mask {
- position: fixed;
- inset: 0;
- z-index: 80;
- display: flex;
- align-items: flex-end;
- justify-content: center;
- background: rgba(18, 15, 12, 0.48);
- animation: maskIn 180ms ease both;
-}
-
-.profile-modal {
- width: 100%;
- max-height: 88vh;
- overflow-y: auto;
- padding: 28rpx 28rpx calc(28rpx + env(safe-area-inset-bottom));
- border-radius: 28rpx 28rpx 0 0;
- background: #fffaf4;
- box-shadow: 0 -18rpx 40rpx rgba(41, 31, 23, 0.16);
- animation: modalUp 220ms ease both;
-}
-
-.modal-head {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 20rpx;
- margin-bottom: 20rpx;
-}
-
-.modal-title {
- color: #27211d;
- font-size: 34rpx;
- font-weight: 900;
-}
-
-.modal-close {
- position: relative;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 48rpx;
- min-width: 48rpx;
- height: 48rpx;
- border-radius: 50%;
- border: 1rpx solid #e4d8ca;
- background: #fffaf4;
- color: transparent;
- font-size: 0;
- line-height: 0;
-}
-
-.modal-close::before,
-.modal-close::after {
- content: "";
- position: absolute;
- width: 22rpx;
- height: 3rpx;
- border-radius: 999rpx;
- background: #61554c;
-}
-
-.modal-close::before {
- transform: rotate(45deg);
-}
-
-.modal-close::after {
- transform: rotate(-45deg);
-}
-
-.profile-avatar-row {
- display: flex;
- align-items: center;
- gap: 16rpx;
- margin-bottom: 18rpx;
- padding: 18rpx;
- border-radius: 18rpx;
- background: #f7efe7;
-}
-
-.profile-avatar {
- display: flex;
- align-items: center;
- justify-content: center;
- flex: 0 0 auto;
- width: 92rpx;
- height: 92rpx;
- overflow: hidden;
- border-radius: 50%;
- background: #6f8f83;
- color: #fff;
- font-size: 24rpx;
- font-weight: 900;
-}
-
-.profile-avatar image {
- width: 100%;
- height: 100%;
-}
-
-.avatar-btn {
- flex: 1;
- min-width: 0;
- max-width: none;
-}
-
-.avatar-remove {
- flex: 0 0 auto;
-}
-
-.modal-field {
- margin-bottom: 16rpx;
- padding: 16rpx 18rpx;
- border-radius: 18rpx;
- background: #f7efe7;
-}
-
-.modal-field text {
- display: block;
- margin-bottom: 8rpx;
- color: #6c5f54;
- font-size: 24rpx;
- font-weight: 800;
-}
-
-.modal-field input,
-.modal-field textarea,
-.readonly-field view {
- width: 100%;
- color: #2c2722;
- font-size: 28rpx;
-}
-
-.modal-field input,
-.readonly-field view {
- min-height: 58rpx;
- line-height: 58rpx;
-}
-
-.modal-field textarea {
- min-height: 120rpx;
-}
-
-.readonly-field view {
- color: #7f756b;
-}
-
-.modal-submit {
- margin-top: 22rpx;
-}
-
-@keyframes maskIn {
- from {
- opacity: 0;
- }
- to {
- opacity: 1;
- }
-}
-
-@keyframes modalUp {
- from {
- transform: translateY(40rpx);
- }
- to {
- transform: translateY(0);
- }
-}
diff --git a/JC-Salon-WeChat/utils/profile-card.js b/JC-Salon-WeChat/utils/profile-card.js
index fb9b2ebc..db682350 100644
--- a/JC-Salon-WeChat/utils/profile-card.js
+++ b/JC-Salon-WeChat/utils/profile-card.js
@@ -1,18 +1,25 @@
+const DEFAULT_AVATAR_URL = 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'
+
function cleanText(value) {
return String(value || '').trim()
}
+function normalizeAvatar(value) {
+ const avatar = cleanText(value)
+ return avatar === DEFAULT_AVATAR_URL ? '' : avatar
+}
+
function buildProfileCard(userInfo, fallbackShopName) {
const user = userInfo || {}
const nickname = cleanText(user.nickname) || cleanText(user.account) || '未设置昵称'
const shopName = cleanText(user.shopName) || cleanText(fallbackShopName) || '未设置门店'
return {
- avatar: cleanText(user.avatar),
+ avatar: normalizeAvatar(user.avatar),
avatarText: Array.from(nickname)[0] || '用',
nickname,
shopName
}
}
-module.exports = { buildProfileCard }
+module.exports = { DEFAULT_AVATAR_URL, buildProfileCard, normalizeAvatar }
diff --git a/JC-Salon-WeChat/utils/profile-card.test.js b/JC-Salon-WeChat/utils/profile-card.test.js
index 278453ff..73747091 100644
--- a/JC-Salon-WeChat/utils/profile-card.test.js
+++ b/JC-Salon-WeChat/utils/profile-card.test.js
@@ -1,6 +1,6 @@
const assert = require('assert')
-const { buildProfileCard } = require('./profile-card')
+const { DEFAULT_AVATAR_URL, buildProfileCard, normalizeAvatar } = require('./profile-card')
assert.deepStrictEqual(buildProfileCard({
nickname: '小屿',
@@ -26,3 +26,6 @@ assert.deepStrictEqual(buildProfileCard({}, ''), {
nickname: '未设置昵称',
shopName: '未设置门店'
})
+
+assert.strictEqual(normalizeAvatar(DEFAULT_AVATAR_URL), '')
+assert.strictEqual(buildProfileCard({ nickname: '小屿', avatar: DEFAULT_AVATAR_URL }, '中心店').avatar, '')
diff --git a/docs/项目变更记录.md b/docs/项目变更记录.md
index c85288e2..73ff5de1 100644
--- a/docs/项目变更记录.md
+++ b/docs/项目变更记录.md
@@ -1,5 +1,12 @@
# 项目变更记录
+## 2026-10-10 Salon 小程序个人信息独立页面
+
+- 新增独立“个人信息”页面,页面结构与账号设置统一,承载头像、昵称、联系电话、微信号和个性签名编辑,以及账号、门店和身份只读信息。
+- “我的”页面个人信息入口改为页面导航,删除原有底部弹窗、表单状态、上传保存方法和冗余样式。
+- 保存后同步本机会话并返回“我的”页面,顶部账号卡可立即刷新。
+- 将后端通用外链默认头像识别为未设置头像,“我的”和“个人信息”页面统一使用昵称首字兜底,首页资料完善提示仍会正确引导上传真实头像。
+
## 2026-10-10 Salon 小程序“我的”页面账号卡优化
- “我的”页面顶部卡片改为展示当前账号头像、昵称、所属门店和角色,不再展示固定品牌图标与“店长端”占位信息。