Quellcode durchsuchen

修复订单角标更新问题

npzzwq99 vor 2 Wochen
Ursprung
Commit
e174f0c945
2 geänderte Dateien mit 28 neuen und 19 gelöschten Zeilen
  1. 9 9
      components/live-room/control.vue
  2. 19 10
      pages/mine/index.vue

+ 9 - 9
components/live-room/control.vue

@@ -530,7 +530,7 @@
 		methods: {
 			buildStartCopy() {
 				const lang = uni.getLocale();
-				if (lang === 'zh-CN') {
+				if (lang === 'zh-cn') {
 					return {
 						badge: 'LIVE',
 						title: '准备开播',
@@ -687,12 +687,12 @@
 			async goLive() {
 				const lang = uni.getLocale();
 				if (!this.start.image) {
-					const t = lang === 'zh-CN' ? '请上传直播封面' : (lang === 'zh-Hant' ? '請上傳直播封面' : 'cover cannot be empty');
+					const t = lang === 'zh-cn' ? '请上传直播封面' : (lang === 'zh-Hant' ? '請上傳直播封面' : 'cover cannot be empty');
 					uni.showToast({ title: t, icon: 'none' });
 					return;
 				}
 				if (!this.start.content || !String(this.start.content).trim()) {
-					const t = lang === 'zh-CN' ? '请填写直播标题' : (lang === 'zh-Hant' ? '請填寫直播標題' : 'Title cannot be empty');
+					const t = lang === 'zh-cn' ? '请填写直播标题' : (lang === 'zh-Hant' ? '請填寫直播標題' : 'Title cannot be empty');
 					uni.showToast({ title: t, icon: 'none' });
 					return;
 				}
@@ -702,12 +702,12 @@
 					this.start.free_look_time = 0;
 				} else if (this.start.is_paid == 1) {
 					if (!this.start.paid_money || this.start.paid_money <= 0) {
-						const t = lang === 'zh-CN' ? '付费金额须大于 0' : (lang === 'zh-Hant' ? '付費金額須大於 0' : 'Paid amount must be greater than 0');
+						const t = lang === 'zh-cn' ? '付费金额须大于 0' : (lang === 'zh-Hant' ? '付費金額須大於 0' : 'Paid amount must be greater than 0');
 						uni.showToast({ title: t, icon: 'none' });
 						return;
 					}
 					if (this.start.free_look_time == null || this.start.free_look_time < 0) {
-						const t = lang === 'zh-CN' ? '试看时长不能为负' : (lang === 'zh-Hant' ? '試看時長不能為負' : 'Free watch time cannot be negative');
+						const t = lang === 'zh-cn' ? '试看时长不能为负' : (lang === 'zh-Hant' ? '試看時長不能為負' : 'Free watch time cannot be negative');
 						uni.showToast({ title: t, icon: 'none' });
 						return;
 					}
@@ -726,7 +726,7 @@
 					if (lang === 'zh-Hant') {
 						content = '請先完成實名認證後再開播';
 						confirmText = '去認證';
-					} else if (lang !== 'zh-CN') {
+					} else if (lang !== 'zh-cn') {
 						content = 'Please complete real-name verification before going live';
 						confirmText = 'Verify';
 						cancelText = 'Cancel';
@@ -893,7 +893,7 @@
 				if (!filePath) return
 				const lang = uni.getLocale()
 				let loadingTitle = 'Uploading'
-				if (lang === 'zh-CN') loadingTitle = '上传中'
+				if (lang === 'zh-cn') loadingTitle = '上传中'
 				else if (lang === 'zh-Hant') loadingTitle = '上傳中'
 				uni.showLoading({ title: loadingTitle, mask: true })
 				try {
@@ -901,13 +901,13 @@
 					const url = await uploadImageFile(filePath, config)
 					this.start.image = url
 					let okTitle = 'Uploaded'
-					if (lang === 'zh-CN') okTitle = '封面上传成功'
+					if (lang === 'zh-cn') okTitle = '封面上传成功'
 					else if (lang === 'zh-Hant') okTitle = '封面上傳成功'
 					uni.showToast({ title: okTitle, icon: 'success' })
 				} catch (err) {
 					console.error('live cover upload failed', err)
 					let errTitle = 'Upload failed'
-					if (lang === 'zh-CN') errTitle = '封面上传失败'
+					if (lang === 'zh-cn') errTitle = '封面上传失败'
 					else if (lang === 'zh-Hant') errTitle = '封面上傳失敗'
 					uni.showToast({
 						title: (err && err.message) ? err.message : errTitle,

+ 19 - 10
pages/mine/index.vue

@@ -93,7 +93,8 @@
 								<view class="mine-assets-card" @tap="goCoupon">
 									<view class="mine-assets-info">
 										<text class="mine-assets-title">{{ $t('mine.couponCenter') }}</text>
-										<text class="mine-assets-desc">{{ $t('mine.receiveCoupon') }} <text class="wlIcon-fanhui2 mine-assets-arrow"></text></text>
+										<text class="mine-assets-desc">{{ $t('mine.receiveCoupon') }} <text
+												class="wlIcon-fanhui2 mine-assets-arrow"></text></text>
 									</view>
 									<text class="wlIcon-31hongbao mine-assets-icon"></text>
 								</view>
@@ -101,7 +102,8 @@
 								<view class="mine-assets-card" @tap="goMyCouponList">
 									<view class="mine-assets-info">
 										<text class="mine-assets-title">{{ $t('mall.coupon') }}</text>
-										<text class="mine-assets-desc">{{ $t('mine.myCoupon') }}<text class="wlIcon-fanhui2 mine-assets-arrow"></text> </text>
+										<text class="mine-assets-desc">{{ $t('mine.myCoupon') }}<text
+												class="wlIcon-fanhui2 mine-assets-arrow"></text> </text>
 									</view>
 									<text class="wlIcon-qianbao mine-assets-icon"></text>
 								</view>
@@ -576,14 +578,6 @@ export default {
 	onHide() {
 		this.panelOpen = false
 	},
-	async loadOrderStats() {
-		try {
-			const stats = await fetchOrderStats()
-			this.$store.commit('statistics/order', stats)
-		} catch (e) {
-			console.error('[mine] 加载订单统计失败:', e)
-		}
-	},
 	onBackPress() {
 		if (this.panelOpen) {
 			this.closeSettingsPanel()
@@ -592,6 +586,14 @@ export default {
 		return false
 	},
 	methods: {
+		async loadOrderStats() {
+			try {
+				const stats = await fetchOrderStats()
+				this.$store.commit('statistics/order', stats)
+			} catch (e) {
+				console.error('[mine] 加载订单统计失败:', e)
+			}
+		},
 		openSettingsPanel() {
 			this.panelOpen = true
 		},
@@ -672,6 +674,7 @@ export default {
 				await this.loadProfile()
 				if (this.signedIn && this.isSelf) {
 					await this.loadDiamondBalance()
+					await this.loadOrderStats()
 				} else {
 					this.diamondBalance = null
 				}
@@ -1557,33 +1560,39 @@ export default {
 	border-radius: 20rpx;
 	border: 2rpx solid #e8edf5;
 }
+
 .mine-diamond-left {
 	display: flex;
 	flex-direction: row;
 	align-items: center;
 }
+
 .mine-diamond-icon {
 	width: 44rpx;
 	height: 44rpx;
 	margin-right: 16rpx;
 }
+
 .mine-diamond-label {
 	font-size: 28rpx;
 	color: #121836;
 	font-weight: 600;
 	line-height: 40rpx;
 }
+
 .mine-diamond-right {
 	display: flex;
 	flex-direction: row;
 	align-items: center;
 }
+
 .mine-diamond-value {
 	font-size: 34rpx;
 	font-weight: 700;
 	color: #ff6b35;
 	line-height: 44rpx;
 }
+
 .mine-diamond-arrow {
 	font-size: 22rpx;
 	color: #b0b5c3;