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" : {
"urlCheck" : false,
"minified" : true,
"postcss" : false,
"es6" : true
"postcss" : true,
"es6" : true,
"enhance" : true
},
"permission" : {
"scope.userLocation" : {

View File

@@ -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() {

View File

@@ -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({

View File

@@ -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
: ''
}
</script>

View File

@@ -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) => {

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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) {

View File

@@ -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

View File

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