增加品牌方案管理

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
@@ -1,6 +1,6 @@
<template>
<view class="profile-page">
<view class="header-wrap" :style="{ paddingTop: statusBarHeight + 'px' }">
<view class="header-wrap" :style="headerStyle">
<view class="nav-bar" :style="{ height: navBarHeight + 'px' }">
<text class="back-btn" @click="goBack">&#8592;</text>
<text class="nav-title">个人中心</text>
@@ -12,13 +12,13 @@
<!-- 教练信息卡片 -->
<view class="user-card">
<view class="user-header">
<view class="avatar">
<text class="avatar-text">CC</text>
<view class="avatar" :style="{ backgroundColor: 'rgba(' + brandConfig.primaryColorRgb + ',0.15)' }">
<text class="avatar-text" :style="{ color: brandConfig.primaryColor }">CC</text>
</view>
<view class="user-info">
<text class="user-name">{{ coachInfo.username }}</text>
<view class="user-tag">
<text>教练</text>
<text :style="{ color: brandConfig.primaryColor }">教练</text>
</view>
</view>
</view>
@@ -49,26 +49,26 @@
<text class="perf-number">{{ performance.attendanceRate != null ? performance.attendanceRate + '%' : 'N/A' }}</text>
<text class="perf-label">出勤率 </text>
<view v-if="performance.attendanceRate != null" class="perf-bar-wrap">
<view class="perf-bar" :style="{ width: performance.attendanceRate + '%', background: getRateColor(performance.attendanceRate) }"></view>
<view class="perf-bar" :style="attendanceBarStyle"></view>
</view>
</view>
<view class="perf-item" @click="showFormula('fullness')">
<text class="perf-number">{{ performance.fullnessRate != null ? performance.fullnessRate + '%' : 'N/A' }}</text>
<text class="perf-label">满员率 </text>
<view v-if="performance.fullnessRate != null" class="perf-bar-wrap">
<view class="perf-bar" :style="{ width: performance.fullnessRate + '%', background: getRateColor(performance.fullnessRate) }"></view>
<view class="perf-bar" :style="fullnessBarStyle"></view>
</view>
</view>
</view>
<view class="score-row" @click="showFormula('composite')">
<text class="score-label">综合评分 </text>
<text class="score-badge" :class="scoreClass">{{ scoreText }}</text>
<text class="score-badge" :class="scoreClass" :style="scoreClass === 'score-great' ? scoreGreatStyle : ''">{{ scoreText }}</text>
<text v-if="scoreText !== '--'" class="score-icon"></text>
</view>
</view>
<!-- 违规统计 -->
<view v-if="violations.length > 0" class="stats-card">
<view v-if="violations.length > 0" class="stats-card" :style="{ backgroundColor: brandConfig.secondaryColor }">
<view class="stat-item">
<text class="stat-number">{{ violations.length }}</text>
<text class="stat-label">违规次数</text>
@@ -105,7 +105,7 @@
<text class="formula-example">{{ formulaExample }}</text>
</view>
<view class="formula-footer">
<button class="formula-btn" @click="closeFormula">知道了</button>
<button class="formula-btn" :style="{ backgroundColor: brandConfig.primaryColor }" @click="closeFormula">知道了</button>
</view>
</view>
</view>
@@ -124,6 +124,7 @@
<script>
const store = require('../../store/index')
const coachApi = require('../../api/coach')
const brandStore = require('../../store/brand')
export default {
data() {
@@ -150,9 +151,16 @@
formulaVisible: false,
formulaTitle: '',
formulaContent: '',
formulaExample: ''
formulaExample: '',
brandConfig: brandStore.config
}
},
computed: {
headerStyle() { return 'padding-top:' + this.statusBarHeight + 'px;background-color:' + this.brandConfig.secondaryColor },
scoreGreatStyle() { return 'color:' + this.brandConfig.primaryColor + ';background-color:rgba(' + this.brandConfig.primaryColorRgb + ',0.15)' },
attendanceBarStyle() { return { width: this.performance.attendanceRate + '%', background: this.getRateColor(this.performance.attendanceRate) } },
fullnessBarStyle() { return { width: this.performance.fullnessRate + '%', background: this.getRateColor(this.performance.fullnessRate) } }
},
onLoad() {
const systemInfo = uni.getSystemInfoSync()
const statusBarHeight = systemInfo.statusBarHeight || 20
@@ -166,8 +174,14 @@
this.statusBarHeight = statusBarHeight
this.navBarHeight = navBarHeight
this.totalHeaderHeight = statusBarHeight + navBarHeight
uni.$on('brand:updated', (config) => { this.brandConfig = config })
},
onUnload() {
uni.$off('brand:updated')
},
onShow() {
brandStore.fetchConfig()
if (!store.isLoggedIn) {
uni.reLaunch({ url: '/pages/login/login' })
return
@@ -178,6 +192,12 @@
},
methods: {
goBack() { uni.navigateBack() },
getRateColor(rate) {
if (rate == null) return '#CCCCCC'
if (rate >= 80) return this.brandConfig.primaryColor
if (rate >= 60) return '#FF9800'
return '#F44336'
},
async loadPerformance() {
try {