fix: 更新配置和代码逻辑以提升稳定性和可读性

- 在 manifest.json 和 project.config.json 中启用 postcss 和 enhance 设置
- 在多个 Vue 组件中优化空值处理逻辑,确保更健壮的代码执行
- 调整样式和布局以提升用户体验
This commit is contained in:
Yer11214
2026-07-21 14:39:16 +08:00
parent 4bb4bbdc6b
commit 7626f944ad
10 changed files with 48 additions and 38 deletions

View File

@@ -199,8 +199,9 @@
"setting" : { "setting" : {
"urlCheck" : false, "urlCheck" : false,
"minified" : true, "minified" : true,
"postcss" : false, "postcss" : true,
"es6" : true "es6" : true,
"enhance" : true
}, },
"permission" : { "permission" : {
"scope.userLocation" : { "scope.userLocation" : {

View File

@@ -194,7 +194,7 @@ function awaitPay(payment: string) {
} }
function padTime(val: number) { function padTime(val: number) {
return String(val ?? 0).padStart(2, '0') return String(val != null ? val : 0).padStart(2, '0')
} }
function onPayTimeout() { function onPayTimeout() {

View File

@@ -74,7 +74,7 @@ const withdrawParams = ref({ pageNumber: 1, pageSize: 10 })
const achievementParams = ref({ pageNumber: 1, pageSize: 10 }) const achievementParams = ref({ pageNumber: 1, pageSize: 10 })
onLoad((option) => { onLoad((option) => {
const type = Number(option.type ?? 0) const type = Number(option.type != null ? option.type : 0)
listType.value = type listType.value = type
routeQuery.value = option || {} routeQuery.value = option || {}
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({

View File

@@ -59,7 +59,7 @@ function fetchDistributionInfo() {
} }
function submitWithdraw() { function submitWithdraw() {
const amount = String(price.value ?? '') const amount = String(price.value != null ? price.value : '')
if (proxy.$u.test.amount(parseInt(amount))) { if (proxy.$u.test.amount(parseInt(amount))) {
cash({ price: amount }).then((res) => { cash({ price: amount }).then((res) => {
if (res.data.success) { if (res.data.success) {
@@ -75,7 +75,10 @@ function submitWithdraw() {
} }
function fillAllAmount() { function fillAllAmount() {
price.value = distributionData.value.canRebate ?? '' price.value =
distributionData.value.canRebate != null
? distributionData.value.canRebate
: ''
} }
</script> </script>

View File

@@ -188,7 +188,7 @@ function fetchTrackList() {
} }
function deleteTracks(e: any, ids?: any) { 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 const goodsId = ids || trackList.value[index]?.goodsId
if (!goodsId) return if (!goodsId) return
deleteHistoryListId(goodsId).then((res) => { deleteHistoryListId(goodsId).then((res) => {

View File

@@ -162,7 +162,7 @@ function refreshCountdown(list = promotionList.value) {
} }
function padTime(val: number | undefined) { 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) { function countdownDisplayHours(index: number) {

View File

@@ -317,7 +317,7 @@ function initPageData() {
num: storeId.value, num: storeId.value,
}) })
.then((res) => { .then((res) => {
const payload = res?.data ?? res const payload = res?.data != null ? res.data : res
const result = payload?.result const result = payload?.result
const pageDataStr = result?.pageData const pageDataStr = result?.pageData
if (!isPageDataSuccess(payload) || !pageDataStr) { if (!isPageDataSuccess(payload) || !pageDataStr) {
@@ -571,31 +571,31 @@ onMounted(() => {
min-height: 56rpx; min-height: 56rpx;
} }
.store-name { .store-name {
width: 100%; width: 100%;
font-size: 34rpx; font-size: 34rpx;
color: #333; color: #333;
letter-spacing: 1rpx; letter-spacing: 1rpx;
font-weight: bold; font-weight: bold;
text-align: left; text-align: left;
} }
.store-name-text { .store-name-text {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
display: block; display: block;
padding: 0 150rpx 0 0; padding: 0 150rpx 0 0;
box-sizing: border-box; box-sizing: border-box;
} }
.store-message { .store-message {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
flex-wrap: nowrap; flex-wrap: nowrap;
margin-top: 12rpx; margin-top: 12rpx;
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
} }

View File

@@ -898,7 +898,9 @@ function normalizeMqttLiveStatus(status: string | number) {
2: LIVE_STATUS.ENDED, 2: LIVE_STATUS.ENDED,
3: LIVE_STATUS.PAUSED, 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) { function handleMqttLiveMessage(message: string) {

View File

@@ -124,7 +124,7 @@ function init() {
loading.value = true loading.value = true
getFloorData() getFloorData()
.then((res) => { .then((res) => {
const payload = res?.data ?? res const payload = res?.data != null ? res.data : res
const pageDataStr = payload?.result?.pageData const pageDataStr = payload?.result?.pageData
const isSuccess = payload?.success === true || payload?.code === 200 const isSuccess = payload?.success === true || payload?.code === 200
if (!isSuccess || !pageDataStr) return if (!isSuccess || !pageDataStr) return

View File

@@ -1,5 +1,9 @@
{ {
"setting": { "setting": {
"minifyWXML": true "minifyWXML": true,
"es6": true,
"minified": true,
"postcss": true,
"enhance": true
} }
} }