优化:我的页面展示账号头像昵称

This commit is contained in:
2026-10-10 17:04:03 +08:00
parent d511070fc7
commit 9148bdb027
6 changed files with 79 additions and 16 deletions
+10 -8
View File
@@ -6,6 +6,7 @@ const planningApi = require('../../api/planning')
const employeesApi = require('../../api/employees')
const shopApi = require('../../api/shop')
const dateUtil = require('../../utils/date')
const { buildProfileCard } = require('../../utils/profile-card')
function resolveRoleText(type) {
const role = Number(type)
@@ -17,10 +18,9 @@ function resolveRoleText(type) {
Page({
data: {
shopName: BRAND_CONFIG.defaultShopName,
phone: '店长端',
roleText: '管理端',
userInfo: {},
profileCard: buildProfileCard({}, BRAND_CONFIG.defaultShopName),
editModalVisible: false,
profileSaving: false,
avatarUploading: false,
@@ -109,11 +109,11 @@ Page({
refreshFromSession() {
const app = getApp()
const userInfo = app.globalData.userInfo || {}
const fallbackShopName = app.globalData.shopName || BRAND_CONFIG.defaultShopName
this.setData({
shopName: app.globalData.shopName || BRAND_CONFIG.appName,
phone: userInfo.contactPhone || userInfo.phone || userInfo.account || '店长端',
roleText: resolveRoleText(userInfo.type),
userInfo
userInfo,
profileCard: buildProfileCard(userInfo, fallbackShopName)
})
},
@@ -152,16 +152,18 @@ Page({
wechatId: profile.wechatId || '',
signature: profile.signature || '',
type: profile.type || currentUserInfo.type,
shopId: profile.shopId || currentUserInfo.shopId
shopId: profile.shopId || currentUserInfo.shopId,
shopName: profile.shopName || currentUserInfo.shopName || session.shopName || app.globalData.shopName || ''
}
app.setSession({
...session,
shopName: nextUserInfo.shopName || session.shopName,
userInfo: nextUserInfo
})
this.setData({
userInfo: nextUserInfo,
phone: nextUserInfo.contactPhone || nextUserInfo.phone || nextUserInfo.account || '店长端',
roleText: resolveRoleText(nextUserInfo.type)
roleText: resolveRoleText(nextUserInfo.type),
profileCard: buildProfileCard(nextUserInfo, BRAND_CONFIG.defaultShopName)
})
},