增加品牌方案管理

This commit is contained in:
2026-07-23 18:56:35 +08:00
parent 4c07ec5455
commit b689656faf
67 changed files with 5572 additions and 231 deletions
+57 -33
View File
@@ -1,7 +1,7 @@
<template>
<view class="profile-page">
<view class="header-wrap" :style="{ paddingTop: statusBarHeight + 'px' }">
<view class="nav-bar" :style="{ height: navBarHeight + 'px' }">
<view class="header-wrap" :style="headerStyle">
<view class="nav-bar" :style="navStyle">
<text class="nav-title">&#9679; 个人中心</text>
<text class="settings-symbol" @click="goToSettings">&#9881;</text>
</view>
@@ -14,7 +14,7 @@
<image class="big-avatar-img" :src="avatarSrc" mode="aspectFill" @error="onAvatarError" />
<view class="user-info">
<text class="user-name">{{ userInfo.nickname }}</text>
<view class="user-tag">
<view class="user-tag" :style="{ color: brandConfig.primaryColor }">
<text>会员号{{ userInfo.memberNo }}</text>
</view>
</view>
@@ -40,14 +40,14 @@
</view>
</view>
<view class="stats-card">
<view class="stats-card" :style="{ backgroundColor: brandConfig.secondaryColor }">
<view class="stat-item">
<text class="stat-number">{{ userInfo.totalSignInDays }}</text>
<text class="stat-number" :style="{ color: brandConfig.primaryColor }">{{ userInfo.totalSignInDays }}</text>
<text class="stat-label">累计签到()</text>
</view>
<view class="stat-divider"></view>
<view class="stat-item">
<text class="stat-number">{{ userInfo.monthSignInCount }}</text>
<text class="stat-number" :style="{ color: brandConfig.primaryColor }">{{ userInfo.monthSignInCount }}</text>
<text class="stat-label">本月签到</text>
</view>
</view>
@@ -55,10 +55,10 @@
<view class="sign-section">
<view class="sign-header">
<view class="section-title-row">
<text class="section-symbol">&#9776;</text>
<text class="section-symbol" :style="{ color: brandConfig.primaryColor }">&#9776;</text>
<text class="section-title">最近签到</text>
</view>
<text class="section-more" @click="viewAllSignIn">查看全部</text>
<text class="section-more" @click="viewAllSignIn" :style="{ color: brandConfig.primaryColor }">查看全部</text>
</view>
<view v-for="(record, idx) in signInRecords" :key="idx" class="sign-item">
<view class="sign-left">
@@ -79,10 +79,10 @@
<view class="sign-section">
<view class="sign-header">
<view class="section-title-row">
<text class="section-symbol">&#10003;</text>
<text class="section-symbol" :style="{ color: brandConfig.primaryColor }">&#10003;</text>
<text class="section-title">团课签到记录</text>
</view>
<text class="section-more">最近{{ courseCheckInRecords.length }}</text>
<text class="section-more" :style="{ color: brandConfig.primaryColor }">最近{{ courseCheckInRecords.length }}</text>
</view>
<view v-for="(record, idx) in courseCheckInRecords" :key="idx" class="sign-item">
<view class="sign-left">
@@ -92,7 +92,7 @@
<view class="sign-right">
<text class="sign-type">{{ record.courseName }}</text>
<text class="sign-source">{{ record.location }}</text>
<text class="sign-status success">已签到</text>
<text class="sign-status success" :style="signStatusSuccessStyle">已签到</text>
</view>
</view>
<view v-if="courseCheckInRecords.length === 0" class="empty-hint">
@@ -131,7 +131,8 @@
</scroll-view>
<view class="edit-modal-footer">
<button class="edit-btn cancel" @click="closeEdit">取消</button>
<button class="edit-btn confirm" :disabled="saving" @click="saveProfile">
<button class="edit-btn confirm" :disabled="saving" @click="saveProfile"
:style="confirmBtnStyle">
{{ saving ? '保存中...' : '保存' }}
</button>
</view>
@@ -144,6 +145,7 @@
const store = require('../../store/index')
const memberApi = require('../../api/member')
const bookingApi = require('../../api/booking')
const brandStore = require('../../store/brand')
const defaultAvatar = require('../../common/img/20200414210134_qbeyi.jpg')
export default {
@@ -169,7 +171,8 @@
{ label: '女', value: 'FEMALE' }
],
today: '',
showDefaultAvatar: false
showDefaultAvatar: false,
brandConfig: brandStore.config
}
},
onLoad() {
@@ -188,13 +191,53 @@
// 设置今天日期,限制生日选择不晚于今天
const d = new Date()
this.today = d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0')
uni.$on('brand:updated', (config) => { this.brandConfig = config })
},
onUnload() {
uni.$off('brand:updated')
},
computed: {
headerStyle() {
return 'padding-top:' + this.statusBarHeight + 'px;background-color:' + this.brandConfig.secondaryColor
},
navStyle() {
return 'height:' + this.navBarHeight + 'px;background-color:' + this.brandConfig.secondaryColor
},
confirmBtnStyle() {
return 'background:' + this.brandConfig.primaryColor + ';color:' + this.brandConfig.secondaryColor
},
avatarSrc() {
if (this.showDefaultAvatar) return defaultAvatar
return this.userInfo.avatar || defaultAvatar
},
genderLabel() {
const g = this.userInfo.gender
if (g === 1 || g === 'MALE' || g === '男') return '男'
if (g === 2 || g === 'FEMALE' || g === '女') return '女'
return '未设置'
},
genderIndex() {
const genderMap = { 0: 'UNKNOWN', 1: 'MALE', 2: 'FEMALE' }
const genderStr = typeof this.editForm.gender === 'string'
? this.editForm.gender
: genderMap[this.editForm.gender] || 'UNKNOWN'
return Math.max(0, this.genderOptions.findIndex(o => o.value === genderStr))
},
signStatusSuccessStyle() {
return {
background: 'rgba(' + this.brandConfig.primaryColorRgb + ',0.15)',
color: this.brandConfig.primaryColor
}
}
},
onShow() {
if (!store.isLoggedIn) return
this.loadData()
brandStore.fetchConfig()
},
onPullDownRefresh() {
this.loadData().finally(() => { uni.stopPullDownRefresh() })
Promise.all([this.loadData(), brandStore.fetchConfig()])
.finally(() => { uni.stopPullDownRefresh() })
},
methods: {
async loadData() {
@@ -331,25 +374,6 @@
onAvatarError() { this.showDefaultAvatar = true },
goToSettings() { uni.showToast({ title: '设置页面', icon: 'none' }) },
viewAllSignIn() { uni.showToast({ title: '全部签到记录', icon: 'none' }) }
},
computed: {
avatarSrc() {
if (this.showDefaultAvatar) return defaultAvatar
return this.userInfo.avatar || defaultAvatar
},
genderLabel() {
const g = this.userInfo.gender
if (g === 1 || g === 'MALE' || g === '男') return '男'
if (g === 2 || g === 'FEMALE' || g === '女') return '女'
return '未设置'
},
genderIndex() {
const genderMap = { 0: 'UNKNOWN', 1: 'MALE', 2: 'FEMALE' }
const genderStr = typeof this.editForm.gender === 'string'
? this.editForm.gender
: genderMap[this.editForm.gender] || 'UNKNOWN'
return Math.max(0, this.genderOptions.findIndex(o => o.value === genderStr))
}
}
}
</script>