优化首页导航
This commit is contained in:
parent
928e3dec86
commit
7801227096
|
@ -19,6 +19,9 @@ export default {
|
||||||
banner: {
|
banner: {
|
||||||
url: "/wxapp/index/banner",
|
url: "/wxapp/index/banner",
|
||||||
},
|
},
|
||||||
|
nav: {
|
||||||
|
url: "/wxapp/index/getindexmenu"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
sendCode: {
|
sendCode: {
|
||||||
|
|
|
@ -283,6 +283,19 @@ function isType(param, type) {
|
||||||
return Object.prototype.toString.call(param) === t;
|
return Object.prototype.toString.call(param) === t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getUrlParams(url) {
|
||||||
|
const params = {}
|
||||||
|
if (url.indexOf('?') > 0) {//判断是否有qurey
|
||||||
|
let parmas = url.slice(url.indexOf('?') + 1)//截取出query
|
||||||
|
const paramlists = parmas.split('&')//分割键值对
|
||||||
|
for (const param of paramlists) {
|
||||||
|
let a = param.split('=')
|
||||||
|
Object.assign(params, { [a[0]]: a[1] })//将键值对封装成对象
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
time,
|
time,
|
||||||
datetime,
|
datetime,
|
||||||
|
@ -298,4 +311,5 @@ export default {
|
||||||
formatNumber,
|
formatNumber,
|
||||||
chooseImage,
|
chooseImage,
|
||||||
isType,
|
isType,
|
||||||
|
getUrlParams,
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,30 @@ export default {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 导航列表
|
||||||
|
*/
|
||||||
|
navList() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
prototype.$request({
|
||||||
|
api: "index.nav",
|
||||||
|
}).then(response => {
|
||||||
|
if (response.code == 1) {
|
||||||
|
let list = [];
|
||||||
|
response.data.forEach(item => {
|
||||||
|
list.push({
|
||||||
|
id: item.id,
|
||||||
|
cover: item.logo,
|
||||||
|
name: item.title,
|
||||||
|
page: item.url,
|
||||||
|
})
|
||||||
|
});
|
||||||
|
return resolve(list);
|
||||||
|
}
|
||||||
|
return reject(response.msg);
|
||||||
|
}).catch(e => { });
|
||||||
|
});
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 提交投诉
|
* 提交投诉
|
||||||
*/
|
*/
|
||||||
|
@ -47,7 +71,15 @@ export default {
|
||||||
}
|
}
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
if (response.code == 1) {
|
if (response.code == 1) {
|
||||||
return resolve(response.data);
|
let list = [];
|
||||||
|
response.data.forEach((item) => {
|
||||||
|
list.push({
|
||||||
|
id: item.id,
|
||||||
|
title: item.title,
|
||||||
|
content: item.message,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return resolve(list);
|
||||||
}
|
}
|
||||||
return reject(response.msg);
|
return reject(response.msg);
|
||||||
}).catch(e => { throw e; });
|
}).catch(e => { throw e; });
|
||||||
|
|
|
@ -231,7 +231,7 @@ export default {
|
||||||
insurancePrice: (state) => state.service.insurancePrice,
|
insurancePrice: (state) => state.service.insurancePrice,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad(e) {
|
||||||
this.pageConfig = getApp().globalData.pageConfig;
|
this.pageConfig = getApp().globalData.pageConfig;
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
uni.enableAlertBeforeUnload({
|
uni.enableAlertBeforeUnload({
|
||||||
|
@ -241,6 +241,14 @@ export default {
|
||||||
this.$store.dispatch("service/insurancePrice");
|
this.$store.dispatch("service/insurancePrice");
|
||||||
this.$models.service.getInstallCate().then((list) => {
|
this.$models.service.getInstallCate().then((list) => {
|
||||||
this.cateList = list;
|
this.cateList = list;
|
||||||
|
if (e.id && e.id > 0) {
|
||||||
|
list.forEach((item) => {
|
||||||
|
if (item.id == e.id) {
|
||||||
|
this.cateId = item.id;
|
||||||
|
this.cateText = item.name;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onShow() {},
|
onShow() {},
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
class="service-item"
|
class="service-item"
|
||||||
v-for="(item, index) in installServiceList"
|
v-for="(item, index) in installServiceList"
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="toInstallService(item.id)"
|
@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">
|
||||||
|
@ -125,7 +125,7 @@ export default {
|
||||||
WidgetModal,
|
WidgetModal,
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
// 轮播
|
// 首页轮播
|
||||||
this.$request({
|
this.$request({
|
||||||
api: "index.banner",
|
api: "index.banner",
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
|
@ -135,20 +135,17 @@ export default {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// 公告
|
// 系统公告
|
||||||
this.$models.system.notifyList().then((list) => {
|
this.$models.system.notifyList().then((list) => {
|
||||||
list.forEach((item) => {
|
this.notifyList = list;
|
||||||
this.notifyList.push({
|
|
||||||
id: item.id,
|
|
||||||
title: item.title,
|
|
||||||
content: item.message,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
// 服务
|
// 安装服务
|
||||||
this.$models.service.getInstallCate().then((list) => {
|
this.$models.system.navList().then((list) => {
|
||||||
this.installServiceList = list;
|
this.installServiceList = list;
|
||||||
});
|
});
|
||||||
|
/**
|
||||||
|
* 维修售后
|
||||||
|
*/
|
||||||
this.$models.service.getAfterMarketCate().then((list) => {
|
this.$models.service.getAfterMarketCate().then((list) => {
|
||||||
this.aftermarketServiceList = list;
|
this.aftermarketServiceList = list;
|
||||||
});
|
});
|
||||||
|
@ -161,9 +158,14 @@ export default {
|
||||||
/**
|
/**
|
||||||
* 服务分类
|
* 服务分类
|
||||||
*/
|
*/
|
||||||
toInstallService(id) {
|
toService(page) {
|
||||||
this.$store.commit("system/indexCateId", id);
|
const params = this.$utils.getUrlParams(page);
|
||||||
this.$utils.toPage("/pages/service/cate", {}, "switch");
|
if (page.indexOf("demand") > 0) {
|
||||||
|
this.$utils.toPage(page);
|
||||||
|
} else {
|
||||||
|
this.$store.commit("system/currentCateId", params.id);
|
||||||
|
this.$utils.toPage(page, {}, "switch");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 公告详情
|
* 公告详情
|
||||||
|
|
|
@ -57,7 +57,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
indexCateId: (state) => state.system.indexCateId,
|
currentCateId: (state) => state.system.currentCateId,
|
||||||
cartCount: (state) => state.cart.count,
|
cartCount: (state) => state.cart.count,
|
||||||
}),
|
}),
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
|
@ -90,12 +90,12 @@ export default {
|
||||||
this.loadCate();
|
this.loadCate();
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.newId = this.currentId = this.indexCateId;
|
this.newId = this.currentId = this.currentCateId;
|
||||||
},
|
},
|
||||||
onReady() {},
|
onReady() {},
|
||||||
onHide() {
|
onHide() {
|
||||||
this.currentId = 0;
|
this.currentId = 0;
|
||||||
this.$store.commit("system/indexCateId", this.newId);
|
this.$store.commit("system/currentCateId", this.newId);
|
||||||
},
|
},
|
||||||
onReachBottom() {},
|
onReachBottom() {},
|
||||||
onPullDownRefresh() {},
|
onPullDownRefresh() {},
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
indexCateId: 0,
|
currentCateId: 0,
|
||||||
},
|
},
|
||||||
getters: {},
|
getters: {},
|
||||||
mutations: {
|
mutations: {
|
||||||
indexCateId(state, data) {
|
currentCateId(state, data) {
|
||||||
state.indexCateId = data;
|
state.currentCateId = data;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {}
|
actions: {}
|
||||||
|
|
Loading…
Reference in New Issue