Fix:4735 【商城小程序】管理后台未配置养生榜单数据的情况下点击【确认】后,前端无需显示养生榜单模块
This commit is contained in:
@@ -57,14 +57,14 @@
|
|||||||
</view>
|
</view>
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
<view class="v12-justify-center v12-mt-3" v-if="rank.length > 0">
|
<view class="v12-justify-center v12-mt-3" v-if="hasRankData">
|
||||||
<image
|
<image
|
||||||
class="title-img"
|
class="title-img"
|
||||||
:src="webUrl + '/orderIcon/rankTitle.png'"
|
:src="webUrl + '/orderIcon/rankTitle.png'"
|
||||||
mode="widthFix"
|
mode="widthFix"
|
||||||
></image>
|
></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="rank-wrap v12-mt-3" v-if="rank.length > 0">
|
<view class="rank-wrap v12-mt-3" v-if="hasRankData">
|
||||||
<view class="rank-items-wrap">
|
<view class="rank-items-wrap">
|
||||||
<view class="bee-rank" v-for="(k, i) in rank" :key="i">
|
<view class="bee-rank" v-for="(k, i) in rank" :key="i">
|
||||||
<image :src="k.backgroundImage" class="bg-img" style="width:inherit" mode="scaleToFill"></image>
|
<image :src="k.backgroundImage" class="bg-img" style="width:inherit" mode="scaleToFill"></image>
|
||||||
@@ -196,6 +196,31 @@ export default {
|
|||||||
ProductWindow
|
ProductWindow
|
||||||
},
|
},
|
||||||
mixins: [goCartMixin],
|
mixins: [goCartMixin],
|
||||||
|
computed: {
|
||||||
|
hasRankData() {
|
||||||
|
if (!Array.isArray(this.rank)) return false;
|
||||||
|
const hasText = (v) => typeof v === "string" && v.trim() !== "";
|
||||||
|
const hasValue = (v) => v !== null && v !== undefined && v !== "";
|
||||||
|
return this.rank.some((item) => {
|
||||||
|
if (!item) return false;
|
||||||
|
if (hasText(item.title) || hasText(item.backgroundImage)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (Array.isArray(item.products)) {
|
||||||
|
return item.products.some((p) => {
|
||||||
|
if (!p) return false;
|
||||||
|
return (
|
||||||
|
hasText(p.productTitle) ||
|
||||||
|
hasText(p.productDesc) ||
|
||||||
|
hasValue(p.productImage) ||
|
||||||
|
hasValue(p.productId)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||||
|
|||||||
Reference in New Issue
Block a user