增加品牌方案管理
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="course-list-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">←</text>
|
||||
<text class="nav-title">我的团课</text>
|
||||
@@ -12,6 +12,7 @@
|
||||
:key="idx"
|
||||
class="tab-item"
|
||||
:class="{ active: currentTab === tab.value }"
|
||||
:style="currentTab === tab.value ? tabActiveStyle : ''"
|
||||
@click="switchTab(tab.value)"
|
||||
>
|
||||
<text>{{ tab.label }}</text>
|
||||
@@ -33,7 +34,7 @@
|
||||
<view v-for="course in filteredCourses" :key="course.id" class="course-card" :class="{ grayed: !course._isToday }" @click="goToDetail(course.id)">
|
||||
<view class="card-header">
|
||||
<text class="course-name">{{ course.courseName }}</text>
|
||||
<view class="status-tag" :class="course._statusClass">
|
||||
<view class="status-tag" :class="course._statusClass" :style="course._statusClass === 'normal' ? statusNormalStyle : ''">
|
||||
<text>{{ course._statusLabel }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -62,6 +63,7 @@
|
||||
<script>
|
||||
const coachApi = require('../../api/coach')
|
||||
const store = require('../../store/index')
|
||||
const brandStore = require('../../store/brand')
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -78,10 +80,14 @@
|
||||
{ label: '待开课', value: 'pending' },
|
||||
{ label: '进行中', value: 'in_progress' },
|
||||
{ label: '已结束', value: 'ended' }
|
||||
]
|
||||
],
|
||||
brandConfig: brandStore.config
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
headerStyle() { return 'padding-top:' + this.statusBarHeight + 'px;background-color:' + this.brandConfig.secondaryColor },
|
||||
tabActiveStyle() { return 'background-color:' + this.brandConfig.primaryColor + ';color:' + this.brandConfig.secondaryColor },
|
||||
statusNormalStyle() { return 'background-color:rgba(' + this.brandConfig.primaryColorRgb + ',0.15);color:' + this.brandConfig.primaryColor },
|
||||
filteredCourses() {
|
||||
switch (this.currentTab) {
|
||||
case 'pending':
|
||||
@@ -109,14 +115,24 @@
|
||||
this.navBarHeight = navBarHeight
|
||||
// 状态栏 + 导航栏 + tab行高度
|
||||
this.totalHeaderHeight = statusBarHeight + navBarHeight + 44
|
||||
|
||||
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
|
||||
}
|
||||
this.loadCourses()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
brandStore.fetchConfig()
|
||||
this.loadCourses().finally(() => { uni.stopPullDownRefresh() })
|
||||
},
|
||||
methods: {
|
||||
goBack() { uni.navigateBack() },
|
||||
goToDetail(id) {
|
||||
|
||||
Reference in New Issue
Block a user