From 7626f944ad3c1af3ba4b689114749605cc137534 Mon Sep 17 00:00:00 2001 From: Yer11214 <17633066053@163.com> Date: Tue, 21 Jul 2026 14:39:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=92=8C=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91=E4=BB=A5=E6=8F=90?= =?UTF-8?q?=E5=8D=87=E7=A8=B3=E5=AE=9A=E6=80=A7=E5=92=8C=E5=8F=AF=E8=AF=BB?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 manifest.json 和 project.config.json 中启用 postcss 和 enhance 设置 - 在多个 Vue 组件中优化空值处理逻辑,确保更健壮的代码执行 - 调整样式和布局以提升用户体验 --- manifest.json | 5 +- pages/cart/payment/payOrder.vue | 2 +- pages/mine/distribution/history.vue | 2 +- pages/mine/distribution/withdrawal.vue | 7 ++- pages/mine/myTracks.vue | 2 +- .../-promotion-assemble-promotions.vue | 2 +- pages/product/shopPage.vue | 52 +++++++++---------- pages/promotion/live/room.vue | 4 +- pages/tabbar/home/index.vue | 2 +- project.config.json | 8 ++- 10 files changed, 48 insertions(+), 38 deletions(-) diff --git a/manifest.json b/manifest.json index 8691191..f87ecaf 100644 --- a/manifest.json +++ b/manifest.json @@ -199,8 +199,9 @@ "setting" : { "urlCheck" : false, "minified" : true, - "postcss" : false, - "es6" : true + "postcss" : true, + "es6" : true, + "enhance" : true }, "permission" : { "scope.userLocation" : { diff --git a/pages/cart/payment/payOrder.vue b/pages/cart/payment/payOrder.vue index 21af8f6..52f4efc 100644 --- a/pages/cart/payment/payOrder.vue +++ b/pages/cart/payment/payOrder.vue @@ -194,7 +194,7 @@ function awaitPay(payment: string) { } function padTime(val: number) { - return String(val ?? 0).padStart(2, '0') + return String(val != null ? val : 0).padStart(2, '0') } function onPayTimeout() { diff --git a/pages/mine/distribution/history.vue b/pages/mine/distribution/history.vue index 39d6825..65c5b42 100644 --- a/pages/mine/distribution/history.vue +++ b/pages/mine/distribution/history.vue @@ -74,7 +74,7 @@ const withdrawParams = ref({ pageNumber: 1, pageSize: 10 }) const achievementParams = ref({ pageNumber: 1, pageSize: 10 }) onLoad((option) => { - const type = Number(option.type ?? 0) + const type = Number(option.type != null ? option.type : 0) listType.value = type routeQuery.value = option || {} uni.setNavigationBarTitle({ diff --git a/pages/mine/distribution/withdrawal.vue b/pages/mine/distribution/withdrawal.vue index bcfabfb..f3fd6fe 100644 --- a/pages/mine/distribution/withdrawal.vue +++ b/pages/mine/distribution/withdrawal.vue @@ -59,7 +59,7 @@ function fetchDistributionInfo() { } function submitWithdraw() { - const amount = String(price.value ?? '') + const amount = String(price.value != null ? price.value : '') if (proxy.$u.test.amount(parseInt(amount))) { cash({ price: amount }).then((res) => { if (res.data.success) { @@ -75,7 +75,10 @@ function submitWithdraw() { } function fillAllAmount() { - price.value = distributionData.value.canRebate ?? '' + price.value = + distributionData.value.canRebate != null + ? distributionData.value.canRebate + : '' } diff --git a/pages/mine/myTracks.vue b/pages/mine/myTracks.vue index 8533378..119e2e4 100644 --- a/pages/mine/myTracks.vue +++ b/pages/mine/myTracks.vue @@ -188,7 +188,7 @@ function fetchTrackList() { } function deleteTracks(e: any, ids?: any) { - const index = typeof e === 'object' ? (e.name ?? e.index) : e + const index = typeof e === 'object' ? (e.name != null ? e.name : e.index) : e const goodsId = ids || trackList.value[index]?.goodsId if (!goodsId) return deleteHistoryListId(goodsId).then((res) => { diff --git a/pages/product/product/promotion/-promotion-assemble-promotions.vue b/pages/product/product/promotion/-promotion-assemble-promotions.vue index 0a361a3..6dc1bbc 100644 --- a/pages/product/product/promotion/-promotion-assemble-promotions.vue +++ b/pages/product/product/promotion/-promotion-assemble-promotions.vue @@ -162,7 +162,7 @@ function refreshCountdown(list = promotionList.value) { } function padTime(val: number | undefined) { - return String(val ?? 0).padStart(2, '0') + return String(val != null ? val : 0).padStart(2, '0') } function countdownDisplayHours(index: number) { diff --git a/pages/product/shopPage.vue b/pages/product/shopPage.vue index d59810e..e1d66dc 100644 --- a/pages/product/shopPage.vue +++ b/pages/product/shopPage.vue @@ -317,7 +317,7 @@ function initPageData() { num: storeId.value, }) .then((res) => { - const payload = res?.data ?? res + const payload = res?.data != null ? res.data : res const result = payload?.result const pageDataStr = result?.pageData if (!isPageDataSuccess(payload) || !pageDataStr) { @@ -571,31 +571,31 @@ onMounted(() => { min-height: 56rpx; } - .store-name { - width: 100%; - font-size: 34rpx; - color: #333; - letter-spacing: 1rpx; - font-weight: bold; - text-align: left; - } - - .store-name-text { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - display: block; - padding: 0 150rpx 0 0; - box-sizing: border-box; - } - - .store-message { - display: flex; - align-items: center; - justify-content: flex-start; - flex-wrap: nowrap; - margin-top: 12rpx; - font-size: 24rpx; + .store-name { + width: 100%; + font-size: 34rpx; + color: #333; + letter-spacing: 1rpx; + font-weight: bold; + text-align: left; + } + + .store-name-text { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + display: block; + padding: 0 150rpx 0 0; + box-sizing: border-box; + } + + .store-message { + display: flex; + align-items: center; + justify-content: flex-start; + flex-wrap: nowrap; + margin-top: 12rpx; + font-size: 24rpx; color: #999; } diff --git a/pages/promotion/live/room.vue b/pages/promotion/live/room.vue index 9d91fc7..008c18d 100644 --- a/pages/promotion/live/room.vue +++ b/pages/promotion/live/room.vue @@ -898,7 +898,9 @@ function normalizeMqttLiveStatus(status: string | number) { 2: LIVE_STATUS.ENDED, 3: LIVE_STATUS.PAUSED, } - return numMap[status as number] ?? roomInfo.value.liveStatus + return numMap[status as number] != null + ? numMap[status as number] + : roomInfo.value.liveStatus } function handleMqttLiveMessage(message: string) { diff --git a/pages/tabbar/home/index.vue b/pages/tabbar/home/index.vue index dac7ae3..f65cc75 100644 --- a/pages/tabbar/home/index.vue +++ b/pages/tabbar/home/index.vue @@ -124,7 +124,7 @@ function init() { loading.value = true getFloorData() .then((res) => { - const payload = res?.data ?? res + const payload = res?.data != null ? res.data : res const pageDataStr = payload?.result?.pageData const isSuccess = payload?.success === true || payload?.code === 200 if (!isSuccess || !pageDataStr) return diff --git a/project.config.json b/project.config.json index 53882bb..fbc57db 100644 --- a/project.config.json +++ b/project.config.json @@ -1,5 +1,9 @@ { "setting": { - "minifyWXML": true + "minifyWXML": true, + "es6": true, + "minified": true, + "postcss": true, + "enhance": true } -} \ No newline at end of file +}