UI优化,红包领取后缺少头像,名称字段
This commit is contained in:
@@ -6,10 +6,11 @@
|
||||
import { useUI } from '@/utils/use-ui'
|
||||
import { useAuthUser } from '@/composables/useAuthUser'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { formatNumberWithWan } from '../../utils'
|
||||
|
||||
const { showToast } = useUI()
|
||||
const { userInfo } = useAuthUser()
|
||||
const { refreshUserInfo } = useUserStore()
|
||||
const { integralData } = useAuthUser()
|
||||
const { getIntegral } = useUserStore()
|
||||
|
||||
const weekList = [
|
||||
{ name: '一', value: 1 },
|
||||
@@ -45,7 +46,7 @@
|
||||
)
|
||||
|
||||
if (msg) {
|
||||
await refreshUserInfo()
|
||||
await getIntegral()
|
||||
showToast(msg)
|
||||
}
|
||||
|
||||
@@ -161,22 +162,6 @@
|
||||
getData()
|
||||
}
|
||||
|
||||
const formatNumberWithWan = num => {
|
||||
if (num < 10000) {
|
||||
return num.toString()
|
||||
}
|
||||
|
||||
// 保留小数:根据需求可调整 toFixed 的位数
|
||||
let wan = num / 10000
|
||||
|
||||
// 如果是整数万,不显示小数;否则保留两位小数(或你想要的位数)
|
||||
if (wan % 1 === 0) {
|
||||
return wan + '万'
|
||||
} else {
|
||||
return wan.toFixed(2).replace(/\.?0+$/, '') + '万' // 去掉不必要的尾随零
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
const now = new Date()
|
||||
currentYear.value = now.getFullYear()
|
||||
@@ -200,8 +185,8 @@
|
||||
<view class="public-header—box">
|
||||
<view class="integral-box">
|
||||
<text>我的积分</text>
|
||||
<text style="font-size: 80rpx; margin-top: 30rpx;">
|
||||
{{ formatNumberWithWan(userInfo.totalPoints) }}
|
||||
<text style="font-size: 80rpx; margin-top: 30rpx">
|
||||
{{ formatNumberWithWan(integralData) }}
|
||||
</text>
|
||||
</view>
|
||||
<image
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { ref } from 'vue'
|
||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app'
|
||||
import { getUserIntegralRank } from '@/api'
|
||||
import { formatNumberWithWan } from '../../utils'
|
||||
|
||||
const cbNavBar = ref({})
|
||||
const listData = ref([])
|
||||
@@ -104,7 +105,9 @@
|
||||
</uni-col>
|
||||
<uni-col :span="6">
|
||||
<view class="table-right">
|
||||
<text class="item-text">{{ item.totalPoints }}</text>
|
||||
<text class="item-text">
|
||||
{{ formatNumberWithWan(item.totalPoints) }}
|
||||
</text>
|
||||
</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
Reference in New Issue
Block a user