优化:我的页面展示账号头像昵称
This commit is contained in:
@@ -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)
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
<view class="page">
|
||||
<view class="card profile-card">
|
||||
<view class="profile-main">
|
||||
<view class="shop-logo">指</view>
|
||||
<view class="account-avatar">
|
||||
<image wx:if="{{profileCard.avatar}}" src="{{profileCard.avatar}}" mode="aspectFill"></image>
|
||||
<text wx:else>{{profileCard.avatarText}}</text>
|
||||
</view>
|
||||
<view class="profile-copy">
|
||||
<text class="shop-name">{{shopName}}</text>
|
||||
<text class="phone">{{phone}}</text>
|
||||
<text class="profile-name">{{profileCard.nickname}}</text>
|
||||
<text class="profile-shop">{{profileCard.shopName}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="role-badge">{{roleText}}</text>
|
||||
|
||||
@@ -17,13 +17,14 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.shop-logo {
|
||||
.account-avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
overflow: hidden;
|
||||
border-radius: 24rpx;
|
||||
background: #6f8f83;
|
||||
color: #fff;
|
||||
@@ -31,12 +32,17 @@
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.shop-name,
|
||||
.phone {
|
||||
.account-avatar image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.profile-name,
|
||||
.profile-shop {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.shop-name {
|
||||
.profile-name {
|
||||
font-size: 34rpx;
|
||||
font-weight: 800;
|
||||
overflow: hidden;
|
||||
@@ -44,7 +50,7 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.phone {
|
||||
.profile-shop {
|
||||
margin-top: 8rpx;
|
||||
color: #91897f;
|
||||
font-size: 24rpx;
|
||||
|
||||
Reference in New Issue
Block a user