完成首页分类跳转
This commit is contained in:
parent
d39cc6a2fb
commit
cf54b40b29
|
@ -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="utils.toPage(item.page)"
|
@click="toInstallService(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">
|
||||||
|
@ -163,7 +163,12 @@ export default {
|
||||||
onReady() {},
|
onReady() {},
|
||||||
onReachBottom() {},
|
onReachBottom() {},
|
||||||
onPullDownRefresh() {},
|
onPullDownRefresh() {},
|
||||||
methods: {},
|
methods: {
|
||||||
|
toInstallService(id) {
|
||||||
|
this.$store.commit("system/indexCateId", id);
|
||||||
|
this.$utils.toPage("/pages/service/cate", {}, "switch");
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<widget-search />
|
<widget-search />
|
||||||
</view>
|
</view>
|
||||||
<view class="cate">
|
<view class="cate">
|
||||||
<app-cate :offsetHeight="95" :data="data" cateType="cate" @clickItem="clickItem" />
|
<app-cate :offsetHeight="95" :data="data" cateType="cate" @clickItem="clickItem" :activeId="currentId" />
|
||||||
</view>
|
</view>
|
||||||
<movable-area class="cart-icon-box">
|
<movable-area class="cart-icon-box">
|
||||||
<movable-view
|
<movable-view
|
||||||
|
@ -36,6 +36,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
utils: this.$utils,
|
utils: this.$utils,
|
||||||
position: { x: 300, y: 1000 },
|
position: { x: 300, y: 1000 },
|
||||||
|
currentId: 0,
|
||||||
data: [],
|
data: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -44,6 +45,11 @@ export default {
|
||||||
AppCate,
|
AppCate,
|
||||||
WidgetSearch,
|
WidgetSearch,
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
indexCateId: (state) => state.system.indexCateId,
|
||||||
|
}),
|
||||||
|
},
|
||||||
async onLoad() {
|
async onLoad() {
|
||||||
let pageConfig = getApp().globalData.pageConfig;
|
let pageConfig = getApp().globalData.pageConfig;
|
||||||
|
|
||||||
|
@ -66,7 +72,9 @@ export default {
|
||||||
});
|
});
|
||||||
this.loadCate();
|
this.loadCate();
|
||||||
},
|
},
|
||||||
onShow() {},
|
onShow() {
|
||||||
|
this.currentId = this.indexCateId;
|
||||||
|
},
|
||||||
onReady() {},
|
onReady() {},
|
||||||
onReachBottom() {},
|
onReachBottom() {},
|
||||||
onPullDownRefresh() {},
|
onPullDownRefresh() {},
|
||||||
|
@ -93,8 +101,8 @@ export default {
|
||||||
/**
|
/**
|
||||||
* 分类
|
* 分类
|
||||||
*/
|
*/
|
||||||
async loadCate() {
|
loadCate() {
|
||||||
await this.$request({
|
this.$request({
|
||||||
api: "service.cate",
|
api: "service.cate",
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
|
|
||||||
|
import system from "@/store/modules/system"
|
||||||
import user from "@/store/modules/user"
|
import user from "@/store/modules/user"
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
modules: {
|
modules: {
|
||||||
|
system,
|
||||||
user,
|
user,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
export default {
|
||||||
|
namespaced: true,
|
||||||
|
state: {
|
||||||
|
indexCateId: 0,
|
||||||
|
},
|
||||||
|
getters: {},
|
||||||
|
mutations: {
|
||||||
|
indexCateId(state, data) {
|
||||||
|
state.indexCateId = data;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {}
|
||||||
|
}
|
Loading…
Reference in New Issue