完成导航

This commit is contained in:
TOP糯米 2023-03-23 00:51:30 +08:00
parent d8ddbbdecd
commit 6b9d5c4153
5 changed files with 48 additions and 52 deletions

View File

@ -100,9 +100,6 @@ export default {
insurance: { insurance: {
url: "/wxapp/index/getyiwai", url: "/wxapp/index/getyiwai",
}, },
aftermarket: {
url: "/wxapp/index/category2",
},
hotCate: { hotCate: {
url: "/wxapp/index/hotcategory", url: "/wxapp/index/hotcategory",
}, },

View File

@ -36,30 +36,6 @@ export default {
}); });
}); });
}, },
/**
* 售后分类
*/
getAfterMarketCate() {
return new Promise((resolve, reject) => {
prototype.$request({
api: "service.aftermarket",
}).then((response) => {
if (response.code == 1) {
let list = [];
response.data.forEach((item) => {
list.push({
id: item.id,
name: item.name,
cover: item.more,
page: item.name == "货物配送" ? "/pages/service/other/distribution" : "/pages/demand/demand",
});
});
return resolve(list);
}
return reject(response.msg);
});
});
},
/** /**
* 保险价格 * 保险价格
*/ */

View File

@ -27,13 +27,33 @@ export default {
api: "index.nav", api: "index.nav",
}).then(response => { }).then(response => {
if (response.code == 1) { if (response.code == 1) {
let list = []; let list = {
response.data.forEach(item => { install: [],
list.push({ aftermarket: [],
other: [],
};
response.data.lists1.forEach(item => {
list.install.push({
id: item.id, id: item.id,
cover: item.logo, cover: item.logo,
name: item.title, name: item.title,
page: item.url, page: item.types,
})
});
response.data.lists2.forEach(item => {
list.aftermarket.push({
id: item.id,
cover: item.logo,
name: item.title,
page: item.types,
})
});
response.data.lists3.forEach(item => {
list.other.push({
id: item.id,
cover: item.logo,
name: item.title,
page: item.types,
}) })
}); });
return resolve(list); return resolve(list);

View File

@ -33,12 +33,7 @@
<view class="common-service-nav-group"> <view class="common-service-nav-group">
<text class="section-title">建材安装服务</text> <text class="section-title">建材安装服务</text>
<view class="group g1"> <view class="group g1">
<view <view class="service-item" v-for="(item, index) in installServiceList" :key="index" @click="toPage(item.page)">
class="service-item"
v-for="(item, index) in installServiceList"
:key="index"
@click="toService(item.page, item.id)"
>
<image class="service-icon" :src="item.cover" mode="scaleToFill" /> <image class="service-icon" :src="item.cover" mode="scaleToFill" />
<text class="service-name limit-line clamp-1"> <text class="service-name limit-line clamp-1">
{{ item.name }} {{ item.name }}
@ -53,7 +48,7 @@
class="service-item" class="service-item"
v-for="(item, index) in aftermarketServiceList" v-for="(item, index) in aftermarketServiceList"
:key="index" :key="index"
@click="utils.toPage(item.page)" @click="toPage(item.page)"
> >
<image class="service-icon" :src="item.cover" mode="scaleToFill" /> <image class="service-icon" :src="item.cover" mode="scaleToFill" />
<text class="service-name limit-line clamp-1"> <text class="service-name limit-line clamp-1">
@ -139,15 +134,10 @@ export default {
this.$models.system.notifyList().then((list) => { this.$models.system.notifyList().then((list) => {
this.notifyList = list; this.notifyList = list;
}); });
// //
this.$models.system.navList().then((list) => { this.$models.system.navList().then((list) => {
this.installServiceList = list; this.installServiceList = list.install;
}); this.aftermarketServiceList = list.aftermarket;
/**
* 维修售后
*/
this.$models.service.getAfterMarketCate().then((list) => {
this.aftermarketServiceList = list;
}); });
}, },
onShow() {}, onShow() {},
@ -156,9 +146,9 @@ export default {
onPullDownRefresh() {}, onPullDownRefresh() {},
methods: { methods: {
/** /**
* 点击导航 * 跳转
*/ */
toService(page) { toPage(page) {
const params = this.$utils.getUrlParams(page); const params = this.$utils.getUrlParams(page);
if (page.indexOf("service/cate") > 0) { if (page.indexOf("service/cate") > 0) {
this.$store.commit("system/currentCateId", params.id); this.$store.commit("system/currentCateId", params.id);

View File

@ -3,10 +3,10 @@
<view class="common-service-nav-group"> <view class="common-service-nav-group">
<text class="section-title">其他服务</text> <text class="section-title">其他服务</text>
<view class="group g1"> <view class="group g1">
<view class="service-item" v-for="(item, index) in list" :key="index" @click="utils.toPage(item.page)"> <view class="service-item" v-for="(item, index) in list" :key="index" @click="toPage(item.page)">
<image class="service-icon" :src="item.cover" mode="scaleToFill" /> <image class="service-icon" :src="item.cover" mode="scaleToFill" />
<text class="service-name limit-line clamp-1"> <text class="service-name limit-line clamp-1">
{{ item.title }} {{ item.name }}
</text> </text>
</view> </view>
</view> </view>
@ -29,14 +29,27 @@ export default {
}, },
onLoad() { onLoad() {
this.$models.system.navList().then((list) => { this.$models.system.navList().then((list) => {
this.list = list; this.list = list.other;
}); });
}, },
onShow() {}, onShow() {},
onReady() {}, onReady() {},
onReachBottom() {}, onReachBottom() {},
onPullDownRefresh() {}, onPullDownRefresh() {},
methods: {}, methods: {
/**
* 跳转
*/
toPage(page) {
const params = this.$utils.getUrlParams(page);
if (page.indexOf("service/cate") > 0) {
this.$store.commit("system/currentCateId", params.id);
this.$utils.toPage(page, {}, "switch");
} else {
this.$utils.toPage(page);
}
},
},
}; };
</script> </script>