Commit 1cecd117 by Lin

重构(HomeFrame):更新标签页逻辑并改进数据处理

-- 改变了首页内容标签的显示方式,使用键值而非索引,以提高清晰度和可维护性。
-- 引入了一种方法,可根据营销活动和客户列表数据动态生成首页内容标签。
- 更新了首页内容标签的初始索引,以确保默认显示正确。
-- 清理了不必要的代码,并优化整体结构,提升可读性。
1 parent bd06a53a
...@@ -708,7 +708,6 @@ module.exports = { ...@@ -708,7 +708,6 @@ module.exports = {
...data, ...data,
}) })
}, },
/** /**
* 查询门店分类 * 查询门店分类
* *
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
</template> </template>
</view> </view>
<view <view
v-show="homeContentTabIndex === 0" v-show="currentHomeContentTab && currentHomeContentTab.key === 'home'"
class="right-content-box flex right-content-box-scene1" class="right-content-box flex right-content-box-scene1"
> >
<view class="content-left" style="padding-bottom: 40px;"> <view class="content-left" style="padding-bottom: 40px;">
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
</view> </view>
</view> </view>
<!-- 限时产品活动 --> <!-- 限时产品活动 -->
<view v-show="homeContentTabIndex === 1" class="right-content-box flex right-content-box-scene1"> <view v-show="currentHomeContentTab && currentHomeContentTab.key === 'activity'" class="right-content-box flex right-content-box-scene1">
<view class="tab-container"> <view class="tab-container">
<ActivityTime @entranceClick="entranceClick" /> <ActivityTime @entranceClick="entranceClick" />
<view class="line"></view> <view class="line"></view>
...@@ -110,8 +110,8 @@ ...@@ -110,8 +110,8 @@
</view> </view>
</view> </view>
<!-- 挖掘潜客机会 --> <!-- 挖掘潜客机会 -->
<view v-show="homeContentTabIndex === 2" class="right-content-box flex right-content-box-scene1 customer-opportunities-box"> <view v-show="currentHomeContentTab && currentHomeContentTab.key === 'customer'" class="right-content-box flex right-content-box-scene1 customer-opportunities-box">
<customer-opportunities :show="homeContentTabIndex === 2" /> <customer-opportunities :show="currentHomeContentTab && currentHomeContentTab.key === 'customer'" />
</view> </view>
</view> </view>
...@@ -348,12 +348,9 @@ export default { ...@@ -348,12 +348,9 @@ export default {
pointComponentName: 'Point', pointComponentName: 'Point',
// userInfo: {}, // userInfo: {},
tabIndex: 0, tabIndex: 0,
homeContentTabs: [ marketingActivityHasData: false,
{ label: '首页', key: 'home' }, customerListHasData: false,
{ label: '限时产品活动', key: 'activity' }, homeContentTabIndex: 0,
{ label: '挖掘潜客机会', key: 'customer' }
],
homeContentTabIndex: 1,
showBeisen: false, showBeisen: false,
tipsObject: {}, tipsObject: {},
autoplay: true, autoplay: true,
...@@ -446,6 +443,19 @@ export default { ...@@ -446,6 +443,19 @@ export default {
const { sceneType } = uni.$storage.get('userInfo') || {} const { sceneType } = uni.$storage.get('userInfo') || {}
return sceneType return sceneType
}, },
homeContentTabs() {
const tabs = []
if (!this.marketingActivityHasData) {
tabs.push({ label: '首页', key: 'home' })
}
if (this.marketingActivityHasData) {
tabs.push({ label: '限时产品活动', key: 'activity' })
}
if (this.customerListHasData) {
tabs.push({ label: '挖掘潜客机会', key: 'customer' })
}
return tabs
},
currentHomeContentTab() { currentHomeContentTab() {
return this.homeContentTabs[this.homeContentTabIndex] || null return this.homeContentTabs[this.homeContentTabIndex] || null
}, },
...@@ -477,6 +487,8 @@ export default { ...@@ -477,6 +487,8 @@ export default {
* 获取门店场景小分类 * 获取门店场景小分类
*/ */
this.getStoreBaseSceneCodeList() this.getStoreBaseSceneCodeList()
this.getStrategyStatus()
}, },
methods: { methods: {
handleHomeContentTabClick(index) { handleHomeContentTabClick(index) {
...@@ -690,6 +702,20 @@ export default { ...@@ -690,6 +702,20 @@ export default {
this.courseInfo = res this.courseInfo = res
} }
}, },
/**
* 查询策略首页数据状态(营销活动和客户列表是否有数据)
*/
async getStrategyStatus() {
// const res = await uni.$api.activityApi.getActivityStatusAPI()
const res = {
"marketingActivityHasData": true,
"customerListHasData": true
}
console.log('查询策略首页数据状态(营销活动和客户列表是否有数据):', res)
this.marketingActivityHasData = !!res.marketingActivityHasData
this.customerListHasData = !!res.customerListHasData
this.homeContentTabIndex = 0
},
handleFooter(val) { handleFooter(val) {
this.footerBox = val this.footerBox = val
}, },
......
const target = ['ip', 'dev', 'uat', 'prod', 'beta'] const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 1 const index = 2
/** /**
* *
0本地 0本地
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!