Commit 2f22d8ed authored by 张九刚's avatar 张九刚

feat: 优化 Home.vue 中的弹窗逻辑,使用 qrObj 替代原有的 qrInfoList 访问方式,确保弹窗内容的安全渲染,并增加对 qrInfoList 的默认值处理。

parent ed5e4b08
......@@ -111,14 +111,14 @@
<!-- 普通弹窗 -->
<uni-popup :is-mask-click="false" :safe-area="false" ref="popup" background-color="#fff"
border-radius="48rpx">
<view v-if="this.popupIndex !== 3 && this.qrInfoList && this.qrInfoList[this.popupIndex]" class="popup-content">
<view v-if="qrObj !== null" class="popup-content">
<image class="btnclose" @tap="closePop" :src="$baseUrl + 'homepage/btnclose.png'"></image>
<view class="title">
{{ this.qrInfoList[this.popupIndex]?.title || '' }}
{{ qrObj.title || '' }}
</view>
<rich-text class="desc" :nodes="this.qrInfoList[this.popupIndex]?.desc || ''"></rich-text>
<image :show-menu-by-longpress="true" class="qrcode" :src="$baseUrl + (this.qrInfoList[this.popupIndex]?.qrUrl || '')"></image>
<image @tap="downloadHandler($baseUrl + (this.qrInfoList[this.popupIndex]?.qrUrl || ''))" class="btndownload"
<rich-text class="desc" :nodes="qrObj.desc || ''"></rich-text>
<image :show-menu-by-longpress="true" class="qrcode" :src="$baseUrl + (qrObj.qrUrl || '')"></image>
<image @tap="downloadHandler($baseUrl + (qrObj.qrUrl || ''))" class="btndownload"
:src="$baseUrl + 'homepage/btn_download.png'"></image>
</view>
<view v-else class="popup-content" style="height: 977rpx;">
......@@ -173,7 +173,8 @@ export default {
bottomLinkList: [],
qrInfoObj: undefined,
popupIndex: 0,
qrInfoList: [{ title: '', desc: '', qrUrl: '' }],
qrInfoList: [{ title: '', desc: '', qrUrl: '' },{ title: '', desc: '', qrUrl: '' },{ title: '', desc: '', qrUrl: '' },{ title: '', desc: '', qrUrl: '' }],
qrObj:{ title: '', desc: '', qrUrl: ''},
showVideo: false,
currentVideoUrl: '',
isClickPhoneAuth:false,
......@@ -215,7 +216,6 @@ export default {
const { data } = await fetchHomeJSON();
console.log('111111111111',data);
if (data) {
this.swiperList = data.swiperList;
this.vipConfigList = data.vipConfigList;
......@@ -225,7 +225,7 @@ export default {
this.changelInfoList = data.changelInfoList;
this.childrenInfoList = data.childrenInfoList[0] || [];
this.bottomLinkList = data.bottomLinkList;
this.qrInfoList = data.qrInfoList;
this.qrInfoList = data.qrInfoList||[];
this.vipCardList = data.vipCardList;
this.voiceStory = data.voiceStory;
this.suggest = data.suggest;
......@@ -311,7 +311,15 @@ export default {
this.channelTabIndex = _index;
},
showPopup(_index) {
this.popupIndex = _index;
// this.popupIndex = Math.max(0, Math.min(_index, this.qrInfoList.length - 1));
if(_index === 3){
this.qrObj = null;
}else{
_index= Math.max(0, Math.min(_index, this.qrInfoList.length - 1));
this.qrObj = this.qrInfoList[_index];
}
this.$refs.popup.open(this.popType);
},
closePop() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment