Fix:3285 【商城小程序】用户昵称有两行时,部分机型的【设置中心】按钮超出了红色区域(机型:苹果12)

This commit is contained in:
linxi
2025-02-24 16:26:37 +08:00
parent 89dcf74f17
commit b0613f3760
+30 -13
View File
@@ -39,18 +39,20 @@
class="vip"
/>
</view>
<view class="qrcode" @click="getSpreadPoster">
<image :src="webUrl + '/icon/icon-qrcode.png'" class="code" />
<text class="code-txt">会员码</text>
</view>
<view class="v12-align-center v12-mt-2" @click="linkTo('/pkg_user/views/personalData')">
<image
:src="webUrl + '/icon/icon-setting.png'"
class="settings-img v12-mr-1"
/>
<text class="v12-font-30">
设置中心
</text>
<view :class="{'v12-align-center': !nowrap}">
<view class="qrcode" @click="getSpreadPoster">
<image :src="webUrl + '/icon/icon-qrcode.png'" class="code" />
<text class="code-txt">会员码</text>
</view>
<view class="v12-align-center" :class="{'v12-ml-2': !nowrap, 'v12-mt-2' : nowrap}" @click="linkTo('/pkg_user/views/personalData')">
<image
:src="webUrl + '/icon/icon-setting.png'"
class="settings-img v12-mr-1"
/>
<text class="v12-font-30">
设置中心
</text>
</view>
</view>
</view>
<view class="avatar-cont" @click="goPersonalData()">
@@ -356,7 +358,8 @@ export default {
],
bannerBgUrl: '',
userCenterBannerUrl: '',
pageKeyId: Object.freeze('userIndex')
pageKeyId: Object.freeze('userIndex'),
nowrap: true
}
},
computed: mapGetters(['userInfo']),
@@ -388,6 +391,19 @@ export default {
},
methods: {
...mapMutations(['updateAuthorizationPage']),
// 新增方法:计算文本像素长度
getTextWidth() {
this.$nextTick(() => {
const query = uni.createSelectorQuery().in(this);
query.select('.txt-cont').boundingClientRect(data => {
console.log(data, 'data');
if (data) {
this.nowrap = data.width < 200;
return data.width;
}
}).exec();
})
},
handleSwiper(e) {
const url = this.userCenterCarousel[e].url
this.linkTo(url)
@@ -463,6 +479,7 @@ export default {
const _this = this
getUserLevelInfo().then((res) => {
if (res.data) {
_this.getTextWidth()
_this.userLevelInfo = res.data
}
uni.hideLoading()