| | |
| | | </view> |
| | | |
| | | <view class="list-section card-box"> |
| | | <view class="list-item" v-for="(item, index) in bottomMenuList" :key="`${item.title}-${index}`" @tap="goPage(item)"> |
| | | <view class="list-item" v-for="(item, index) in bottomMenuList" :key="`${item.title}-${index}`" @tap="handleBottomMenuClick(item)"> |
| | | <view class="list-left"> |
| | | <image class="list-icon" :class="item.iconClass" :src="item.icon" mode="aspectFit"></image> |
| | | <text class="list-title">{{ item.title }}</text> |
| | | <view v-if="item.action === 'app-update' && hasAppUpdate" class="update-dot"></view> |
| | | </view> |
| | | <u-icon name="arrow-right" color="#999" size="16"></u-icon> |
| | | </view> |
| | |
| | | import { onLoad, onShow } from '@dcloudio/uni-app' |
| | | import { getNoticeList } from '../notice/service' |
| | | import { getUserCenter } from './service' |
| | | import { getRuntimeVersionName } from '@/utils/app-version.js' |
| | | import { getRuntimeVersionName, promptAppVersionUpdate, queryAppVersionUpdate } from '@/utils/app-version.js' |
| | | import { hasStoredSession } from '@/utils/auth-session.js' |
| | | import manifestConfig from '../../manifest.json' |
| | | |
| | |
| | | url: string |
| | | iconClass?: string |
| | | requiresLogin?: boolean |
| | | action?: 'app-update' |
| | | } |
| | | |
| | | interface NoticeSummaryItem { |
| | |
| | | const unreadNoticeTotal = ref(0) |
| | | const manifestVersionName = String(manifestConfig.versionName || '') |
| | | const appVersionText = ref(manifestVersionName) |
| | | const hasAppUpdate = ref(false) |
| | | const appUpdateInfo = ref<any>(null) |
| | | const userCenter = ref<UserCenterData>(createDefaultUserCenter()) |
| | | const userRole = computed<UserRole>(() => { |
| | | return isDoctorLikeUser(userCenter.value) ? 'doctor' : 'personal' |
| | |
| | | { title: '我的课程', icon: '/static/image/mine/myClass.png', url: '/pages/myCourses/myCourses', iconClass: 'icon-myclass', requiresLogin: true }, |
| | | { title: '帮助中心', icon: '/static/image/mine/help.png', url: '/pages/helpCenter/helpCenter', iconClass: 'icon-help' }, |
| | | { title: '意见反馈', icon: '/static/image/mine/message.png', url: '/pages/feedback/feedback', iconClass: 'icon-feedback' }, |
| | | { title: '更新版本', icon: '/static/image/mine/refish.png', url: '', iconClass: 'icon-update', action: 'app-update' as const }, |
| | | ] |
| | | const liveOrderItem = { title: '直播订单', icon: '/static/image/mine/dingdan.png', url: buildWebviewUrl(WEIZAN_LIVE_ORDER_URL, '直播订单'), iconClass: 'icon-live-order', requiresLogin: true } |
| | | const liveStatsList = Number(userCenter.value.type) === 1 |
| | |
| | | syncCachedUserInfo() |
| | | loadUserCenter() |
| | | loadUnreadNoticeTotal() |
| | | loadAppUpdateStatus() |
| | | }) |
| | | |
| | | /** |
| | | * 静默检查版本更新,仅用于控制更新入口红点。 |
| | | */ |
| | | async function loadAppUpdateStatus() { |
| | | try { |
| | | appUpdateInfo.value = await queryAppVersionUpdate() |
| | | hasAppUpdate.value = !!appUpdateInfo.value |
| | | } catch { |
| | | appUpdateInfo.value = null |
| | | hasAppUpdate.value = false |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 拉取当前登录用户的通知未读总数。 |
| | |
| | | return |
| | | } |
| | | goPage(item) |
| | | } |
| | | |
| | | /** |
| | | * 更新版本使用统一弹窗,其余菜单保持原跳转行为。 |
| | | */ |
| | | async function handleBottomMenuClick(item: MenuItem) { |
| | | if (item.action !== 'app-update') { |
| | | goPage(item) |
| | | return |
| | | } |
| | | if (!appUpdateInfo.value) { |
| | | await loadAppUpdateStatus() |
| | | } |
| | | if (!appUpdateInfo.value) { |
| | | uni.showToast({ title: '当前已是最新版本', icon: 'none' }) |
| | | return |
| | | } |
| | | promptAppVersionUpdate(appUpdateInfo.value) |
| | | } |
| | | |
| | | /** |
| | |
| | | color: #1A1A1A; |
| | | margin-left: 22rpx; |
| | | } |
| | | |
| | | .update-dot { |
| | | width: 16rpx; |
| | | height: 16rpx; |
| | | margin-left: 12rpx; |
| | | border-radius: 50%; |
| | | background: #E64340; |
| | | } |
| | | } |
| | | } |
| | | } |