重构项目文件夹目录
This commit is contained in:
@@ -0,0 +1,456 @@
|
||||
/**
|
||||
* Purpose: authApi supports index.js by holding or executing the auth api page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const authApi = require('../../api/auth')
|
||||
/**
|
||||
* Purpose: couponApi supports index.js by holding or executing the coupon api page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const couponApi = require('../../api/coupon')
|
||||
/**
|
||||
* Purpose: orderApi supports index.js by holding or executing the order api page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const orderApi = require('../../api/order')
|
||||
const growthApi = require('../../api/growth')
|
||||
/**
|
||||
* Purpose: userApi supports index.js by holding or executing the user api page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const userApi = require('../../api/user')
|
||||
/**
|
||||
* Purpose: wishlistApi supports index.js by holding or executing the wishlist api page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const wishlistApi = require('../../api/wishlist')
|
||||
/**
|
||||
* Purpose: actionGuard supports index.js by holding or executing the action guard page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const actionGuard = require('../../utils/action-guard')
|
||||
/**
|
||||
* Purpose: auth supports index.js by holding or executing the auth page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const auth = require('../../utils/auth')
|
||||
/**
|
||||
* Purpose: navigation supports index.js by holding or executing the navigation page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const navigation = require('../../utils/navigation')
|
||||
const sessionSwitch = require('../../utils/session-switch')
|
||||
/**
|
||||
* Purpose: theme supports index.js by holding or executing the theme page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const theme = require('../../utils/theme')
|
||||
const { DEFAULT_AVATAR } = require('../../utils/config')
|
||||
const { runWithLoading } = require('../../utils/loading')
|
||||
|
||||
function formatGrowthSummary(summary) {
|
||||
if (!summary) {
|
||||
return null
|
||||
}
|
||||
return {
|
||||
levelName: summary.levelName || '成长新客',
|
||||
growthValue: Number(summary.growthValue || 0),
|
||||
appointmentCount: Number(summary.appointmentCount || 0),
|
||||
reviewCount: Number(summary.reviewCount || 0)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* profile page logic.
|
||||
* Call guide: page data drives the WXML template, and each method is called by user events or lifecycle callbacks.
|
||||
*/
|
||||
Page({
|
||||
data: Object.assign(theme.pageThemeData(getApp().globalData.shopTheme), {
|
||||
isLoggedIn: false,
|
||||
loading: false,
|
||||
needSetPassword: false,
|
||||
userInfo: null,
|
||||
orderCount: 0,
|
||||
pendingReviewCount: 0,
|
||||
couponCount: 0,
|
||||
wishlistCount: 0,
|
||||
unreadMessageCount: 0,
|
||||
growthSummary: null,
|
||||
defaultAvatar: DEFAULT_AVATAR
|
||||
}),
|
||||
|
||||
/**
|
||||
* `onShow` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
onShow() {
|
||||
this.loadProfile()
|
||||
},
|
||||
|
||||
async loadProfile() {
|
||||
this._avatarReloadSource = ''
|
||||
const isLoggedIn = auth.isLoggedIn()
|
||||
this.setData({
|
||||
isLoggedIn,
|
||||
needSetPassword: auth.getNeedSetPassword(),
|
||||
loading: isLoggedIn
|
||||
})
|
||||
|
||||
/**
|
||||
* `if` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
if (!isLoggedIn) {
|
||||
this.setData({
|
||||
userInfo: null,
|
||||
orderCount: 0,
|
||||
couponCount: 0,
|
||||
wishlistCount: 0,
|
||||
growthSummary: null,
|
||||
loading: false
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const [userInfo, orders, coupons, wishlist, unreadMessages, pendingReviews, growthSummary] = await Promise.all([
|
||||
userApi.getUserInfo(),
|
||||
orderApi.getOrderList(),
|
||||
couponApi.listUserCoupons(),
|
||||
wishlistApi.getWishlist(),
|
||||
userApi.getMyUnreadMessageCount(),
|
||||
orderApi.listMyPendingReviews().catch(() => []),
|
||||
growthApi.getGrowthSummary().catch(() => null)
|
||||
])
|
||||
|
||||
getApp().refreshUserInfo(userInfo)
|
||||
this.setData({
|
||||
userInfo,
|
||||
orderCount: Array.isArray(orders) ? orders.length : 0,
|
||||
pendingReviewCount: Array.isArray(pendingReviews) ? pendingReviews.length : 0,
|
||||
couponCount: Array.isArray(coupons) ? coupons.length : 0,
|
||||
wishlistCount: Array.isArray(wishlist) ? wishlist.length : 0,
|
||||
unreadMessageCount: Number((unreadMessages && unreadMessages.unreadCount) || 0),
|
||||
growthSummary: formatGrowthSummary(growthSummary)
|
||||
})
|
||||
await this.checkPopupMessages()
|
||||
} catch (error) {
|
||||
wx.showToast({
|
||||
title: error.message || '\u4e2a\u4eba\u4e2d\u5fc3\u52a0\u8f7d\u5931\u8d25',
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
this.setData({
|
||||
loading: false
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* `handleOpenAuth` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
handleOpenAuth() {
|
||||
navigation.openAuth('/pages/profile/index')
|
||||
},
|
||||
|
||||
handleOpenAdminLogin() {
|
||||
sessionSwitch.openAdminLogin()
|
||||
},
|
||||
|
||||
/**
|
||||
* `handleOpenSettings` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
handleOpenSettings() {
|
||||
/**
|
||||
* `if` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
if (!this.data.isLoggedIn) {
|
||||
this.handleOpenAuth()
|
||||
return
|
||||
}
|
||||
navigation.navigate('/pages/settings/index')
|
||||
},
|
||||
|
||||
/**
|
||||
* `handleOpenOrders` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
handleOpenOrders() {
|
||||
if (!navigation.ensureLogin('\u67e5\u770b\u8ba2\u5355')) {
|
||||
return
|
||||
}
|
||||
navigation.navigate('/pages/orders/index')
|
||||
},
|
||||
|
||||
/**
|
||||
* Purpose: handleOpenPendingReviews jumps straight to the order-page pending review focus.
|
||||
* Usage: bind the pending-review card in profile WXML.
|
||||
*/
|
||||
handleOpenPendingReviews() {
|
||||
if (!navigation.ensureLogin('查看待评价')) {
|
||||
return
|
||||
}
|
||||
navigation.navigate('/pages/orders/index', {
|
||||
review: 'pending',
|
||||
source: 'profile'
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* `handleOpenWishlist` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
handleOpenWishlist() {
|
||||
if (!navigation.ensureLogin('\u67e5\u770b\u6536\u85cf')) {
|
||||
return
|
||||
}
|
||||
navigation.navigate('/pages/wishlist/index')
|
||||
},
|
||||
|
||||
/**
|
||||
* `handleOpenCoupons` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
handleOpenCoupons() {
|
||||
if (!navigation.ensureLogin('\u67e5\u770b\u4f18\u60e0\u5238')) {
|
||||
return
|
||||
}
|
||||
navigation.navigate('/pages/coupons/index')
|
||||
},
|
||||
|
||||
/**
|
||||
* `handleOpenVipCenter` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
handleOpenVipCenter() {
|
||||
if (!navigation.ensureLogin('查看 VIP 中心')) {
|
||||
return
|
||||
}
|
||||
navigation.navigate('/pages/vip-center/index')
|
||||
},
|
||||
|
||||
/**
|
||||
* `handleOpenNotifications` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
handleOpenNotifications() {
|
||||
if (!navigation.ensureLogin('查看消息通知')) {
|
||||
return
|
||||
}
|
||||
navigation.navigate('/pages/notifications/index')
|
||||
},
|
||||
|
||||
async checkPopupMessages() {
|
||||
/**
|
||||
* `if` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
if (this._checkingPopupMessages) {
|
||||
return
|
||||
}
|
||||
this._checkingPopupMessages = true
|
||||
try {
|
||||
const globalApp = getApp()
|
||||
if (globalApp && typeof globalApp.checkPopupMessages === 'function') {
|
||||
await globalApp.checkPopupMessages()
|
||||
return
|
||||
}
|
||||
const messages = await userApi.listMyPopupMessages()
|
||||
/**
|
||||
* `for` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
for (const item of messages || []) {
|
||||
await new Promise(resolve => {
|
||||
wx.showModal({
|
||||
title: item.title || '消息通知',
|
||||
content: item.content || '',
|
||||
showCancel: false,
|
||||
confirmText: '我知道了',
|
||||
complete: resolve
|
||||
})
|
||||
})
|
||||
await userApi.markMessagePopupShown(item.id)
|
||||
const opened = await navigation.openSystemMessage(item)
|
||||
if (opened) {
|
||||
break
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载待弹窗消息失败', error)
|
||||
} finally {
|
||||
this._checkingPopupMessages = false
|
||||
}
|
||||
},
|
||||
|
||||
async handleSwitchShop() {
|
||||
if (!navigation.ensureLogin('\u5207\u6362\u95e8\u5e97')) {
|
||||
return
|
||||
}
|
||||
|
||||
const userInfo = this.data.userInfo
|
||||
const shopIds = userInfo && Array.isArray(userInfo.shopIds) ? userInfo.shopIds : []
|
||||
const shopNames = userInfo && Array.isArray(userInfo.shopNames) ? userInfo.shopNames : []
|
||||
|
||||
/**
|
||||
* `if` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
if (!shopIds.length) {
|
||||
wx.showToast({
|
||||
title: '\u5f53\u524d\u8d26\u53f7\u8fd8\u6ca1\u6709\u53ef\u7528\u95e8\u5e97',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
/**
|
||||
* `if` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
if (shopIds.length === 1) {
|
||||
navigation.navigate('/pages/shop-detail/index', {
|
||||
id: shopIds[0],
|
||||
returnTo: navigation.getCurrentPageUrl()
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await actionGuard.run(this, 'user:switch-shop', async () => {
|
||||
const selection = await new Promise(resolve => {
|
||||
wx.showActionSheet({
|
||||
itemList: shopNames.map((name, index) => name || `\u95e8\u5e97 ${shopIds[index]}`),
|
||||
success: res => resolve(res.tapIndex),
|
||||
fail: () => resolve(-1)
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
* `if` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
if (selection < 0 || selection >= shopIds.length) {
|
||||
return
|
||||
}
|
||||
|
||||
const payload = await runWithLoading(() => authApi.switchShop({
|
||||
shopId: shopIds[selection]
|
||||
}))
|
||||
getApp().setUserSession(payload)
|
||||
wx.showToast({
|
||||
title: '\u95e8\u5e97\u5df2\u5207\u6362',
|
||||
icon: 'none'
|
||||
})
|
||||
await this.loadProfile()
|
||||
}, {
|
||||
message: '\u95e8\u5e97\u5207\u6362\u4e2d\uff0c\u8bf7\u52ff\u91cd\u590d\u64cd\u4f5c'
|
||||
})
|
||||
} catch (error) {
|
||||
if (actionGuard.isGuardError(error)) {
|
||||
return
|
||||
}
|
||||
wx.showToast({
|
||||
title: error.message || '\u95e8\u5e97\u5207\u6362\u5931\u8d25',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
async handleLogout() {
|
||||
/**
|
||||
* `if` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
if (!this.data.isLoggedIn) {
|
||||
this.handleOpenAuth()
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await actionGuard.run(this, 'auth:logout', async () => {
|
||||
const confirmed = await new Promise(resolve => {
|
||||
wx.showModal({
|
||||
title: '\u9000\u51fa\u767b\u5f55',
|
||||
content: '\u9000\u51fa\u540e\u9700\u8981\u91cd\u65b0\u767b\u5f55\u624d\u80fd\u67e5\u770b\u8ba2\u5355\u548c\u7ee7\u7eed\u4e0b\u5355\u3002',
|
||||
success: res => resolve(Boolean(res.confirm))
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
* `if` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
if (!confirmed) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await runWithLoading(() => authApi.logout())
|
||||
} catch (error) {}
|
||||
|
||||
getApp().clearUserSession()
|
||||
await this.loadProfile()
|
||||
wx.showToast({
|
||||
title: '\u5df2\u9000\u51fa\u767b\u5f55',
|
||||
icon: 'none'
|
||||
})
|
||||
}, {
|
||||
message: '\u9000\u51fa\u5904\u7406\u4e2d\uff0c\u8bf7\u52ff\u91cd\u590d\u64cd\u4f5c'
|
||||
})
|
||||
} catch (error) {
|
||||
if (!actionGuard.isGuardError(error)) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async handleAvatarError() {
|
||||
const currentAvatar = this.data.userInfo && this.data.userInfo.avatar
|
||||
/**
|
||||
* `if` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
if (!currentAvatar) {
|
||||
return
|
||||
}
|
||||
|
||||
/**
|
||||
* `if` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
if (this._avatarReloadSource === currentAvatar) {
|
||||
this.setData({
|
||||
'userInfo.avatar': ''
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
this._avatarReloadSource = currentAvatar
|
||||
|
||||
try {
|
||||
const userInfo = await userApi.getUserInfo()
|
||||
getApp().refreshUserInfo(userInfo)
|
||||
/**
|
||||
* `if` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
*/
|
||||
if (!userInfo || !userInfo.avatar || userInfo.avatar === currentAvatar) {
|
||||
this.setData({
|
||||
'userInfo.avatar': ''
|
||||
})
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
userInfo
|
||||
})
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
'userInfo.avatar': ''
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"navigation-bar": "/components/navigation-bar/navigation-bar"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<view class="profile-page-root" style="{{themeVars}}">
|
||||
<navigation-bar title="个人中心" showBack="{{false}}" isTabPage="{{true}}" color="#FDFBF9" background="transparent" safeAreaMode="overlay"></navigation-bar>
|
||||
<view class="profile-bg"></view>
|
||||
|
||||
<view class="profile-scroll">
|
||||
<view class="page-shell profile-page">
|
||||
<view class="page-content profile-content">
|
||||
<view wx:if="{{!isLoggedIn}}" class="page-card guest-card">
|
||||
<image class="guest-avatar" src="{{defaultAvatar}}" mode="aspectFill" lazy-load="{{true}}"></image>
|
||||
<view class="guest-title">还没有登录账号</view>
|
||||
<view class="guest-desc">登录后查看订单、收藏和优惠券。</view>
|
||||
<view class="primary-btn" bindtap="handleOpenAuth">去登录</view>
|
||||
</view>
|
||||
|
||||
<block wx:elif="{{userInfo}}">
|
||||
<view class="page-card profile-card">
|
||||
<view class="profile-top">
|
||||
<image class="avatar" src="{{userInfo.avatar || defaultAvatar}}" mode="aspectFill" lazy-load="{{true}}" binderror="handleAvatarError"></image>
|
||||
<view class="profile-copy">
|
||||
<view class="nickname">{{userInfo.nickname || 'Yumi 用户'}}</view>
|
||||
<view class="account">{{userInfo.account}}</view>
|
||||
<view wx:if="{{userInfo.signature}}" class="signature">{{userInfo.signature}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="summary-strip profile-stats">
|
||||
<view class="summary-metric" bindtap="handleOpenOrders">
|
||||
<text class="summary-label">订单</text>
|
||||
<text class="summary-value">{{orderCount}}</text>
|
||||
</view>
|
||||
<view class="summary-metric" bindtap="handleOpenWishlist">
|
||||
<text class="summary-label">收藏</text>
|
||||
<text class="summary-value">{{wishlistCount}}</text>
|
||||
</view>
|
||||
<view class="summary-metric" bindtap="handleOpenCoupons">
|
||||
<text class="summary-label">优惠券</text>
|
||||
<text class="summary-value">{{couponCount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{pendingReviewCount > 0}}" class="pending-review-card" bindtap="handleOpenPendingReviews">
|
||||
<text>待评价 {{pendingReviewCount}}</text>
|
||||
<text>给服务过你的美甲师一点反馈</text>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{growthSummary}}" class="growth-card">
|
||||
<view class="growth-head">
|
||||
<text class="growth-label">成长等级</text>
|
||||
<text class="growth-level">{{growthSummary.levelName}}</text>
|
||||
</view>
|
||||
<view class="growth-metrics">
|
||||
<view>
|
||||
<text>{{growthSummary.growthValue}}</text>
|
||||
<text>成长值</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>{{growthSummary.appointmentCount}}</text>
|
||||
<text>预约</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>{{growthSummary.reviewCount}}</text>
|
||||
<text>评价</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="shop-box" bindtap="handleSwitchShop">
|
||||
<view>
|
||||
<view class="shop-label">当前登录门店</view>
|
||||
<view class="shop-name">{{userInfo.shopName || '当前暂无可用门店'}}</view>
|
||||
</view>
|
||||
<view class="shop-link">{{(userInfo.shopIds && userInfo.shopIds.length > 1) ? '切换' : '查看'}}</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{needSetPassword}}" class="password-tip">
|
||||
建议尽快设置登录密码。
|
||||
</view>
|
||||
|
||||
<view class="secondary-btn edit-btn" bindtap="handleOpenSettings">资料与设置</view>
|
||||
</view>
|
||||
|
||||
<view class="page-card menu-card">
|
||||
<view class="section-title">常用入口</view>
|
||||
<view class="menu-item" bindtap="handleOpenOrders">
|
||||
<text>我的订单</text>
|
||||
<text wx:if="{{pendingReviewCount > 0}}" class="menu-badge">待评价 {{pendingReviewCount}}</text>
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
<view class="menu-item" bindtap="handleOpenWishlist">
|
||||
<text>我的收藏</text>
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
<view class="menu-item" bindtap="handleOpenCoupons">
|
||||
<text>我的优惠券</text>
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
<view class="menu-item" bindtap="handleOpenVipCenter">
|
||||
<text>VIP 中心</text>
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
<view class="menu-item" bindtap="handleOpenNotifications">
|
||||
<text>消息通知</text>
|
||||
<text wx:if="{{unreadMessageCount > 0}}" class="menu-badge">{{unreadMessageCount}}</text>
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
<view class="menu-item" bindtap="handleOpenSettings">
|
||||
<text>设置中心</text>
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
<view class="menu-item admin-entry-item" bindtap="handleOpenAdminLogin">
|
||||
<text>进入管理后台</text>
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
<view class="menu-item logout-item" bindtap="handleLogout">
|
||||
<text>退出登录</text>
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,267 @@
|
||||
.profile-page-root {
|
||||
min-height: 100vh;
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.profile-scroll {
|
||||
min-height: 100%;
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.profile-page {
|
||||
min-height: 100%;
|
||||
background: var(--theme-page-bg);
|
||||
}
|
||||
|
||||
.profile-bg {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 228rpx;
|
||||
background: var(--theme-gradient);
|
||||
}
|
||||
|
||||
.profile-content {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding-top: 80rpx;
|
||||
}
|
||||
|
||||
.guest-card,
|
||||
.profile-card,
|
||||
.menu-card {
|
||||
padding: 28rpx;
|
||||
}
|
||||
|
||||
.guest-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 18rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.guest-avatar {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.guest-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.guest-desc {
|
||||
font-size: 24rpx;
|
||||
line-height: 1.7;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.profile-top {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.profile-copy {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.nickname {
|
||||
font-size: 38rpx;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.account,
|
||||
.signature {
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.profile-stats {
|
||||
margin-top: 26rpx;
|
||||
}
|
||||
|
||||
.pending-review-card {
|
||||
display: grid;
|
||||
gap: 8rpx;
|
||||
margin-top: 22rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
border-radius: 20rpx;
|
||||
background: var(--theme-primary-soft);
|
||||
color: var(--text-secondary);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.pending-review-card text:first-child {
|
||||
color: var(--theme-primary);
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.growth-card {
|
||||
margin-top: 22rpx;
|
||||
padding: 22rpx 24rpx;
|
||||
border-radius: 20rpx;
|
||||
background: var(--theme-card-bg);
|
||||
border: 2rpx solid var(--theme-border);
|
||||
}
|
||||
|
||||
.growth-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.growth-label {
|
||||
color: var(--text-secondary);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.growth-level {
|
||||
color: var(--theme-primary);
|
||||
font-size: 28rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.growth-metrics {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 12rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.growth-metrics view {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.growth-metrics text:first-child {
|
||||
color: var(--text-primary);
|
||||
font-size: 30rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.growth-metrics text:last-child {
|
||||
color: var(--text-secondary);
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.shop-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 18rpx;
|
||||
margin-top: 26rpx;
|
||||
padding: 22rpx 24rpx;
|
||||
border-radius: 24rpx;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.shop-label {
|
||||
font-size: 22rpx;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.shop-name {
|
||||
margin-top: 10rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.shop-link {
|
||||
font-size: 24rpx;
|
||||
color: var(--theme-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.password-tip {
|
||||
margin-top: 22rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
border-radius: 20rpx;
|
||||
background: var(--theme-secondary-soft);
|
||||
color: var(--theme-neutral);
|
||||
font-size: 24rpx;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.menu-card {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 92rpx;
|
||||
border-bottom: 2rpx solid var(--theme-border);
|
||||
font-size: 28rpx;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.menu-item:first-of-type {
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.menu-item:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.menu-arrow {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.menu-badge {
|
||||
margin-left: auto;
|
||||
min-width: 36rpx;
|
||||
height: 36rpx;
|
||||
padding: 0 10rpx;
|
||||
border-radius: 18rpx;
|
||||
background: var(--theme-primary);
|
||||
color: var(--theme-tertiary);
|
||||
font-size: 22rpx;
|
||||
line-height: 36rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.menu-badge + .menu-arrow {
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.logout-item {
|
||||
color: var(--theme-neutral);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.admin-entry-item {
|
||||
color: var(--theme-primary-action);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.admin-entry-item .menu-arrow {
|
||||
color: var(--theme-primary-action);
|
||||
}
|
||||
|
||||
.logout-item .menu-arrow {
|
||||
color: var(--theme-primary);
|
||||
}
|
||||
Reference in New Issue
Block a user