diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index ddab719..fc11c2a 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -37,7 +37,7 @@ class="service-item" v-for="(item, index) in installServiceList" :key="index" - @click="utils.toPage(item.page)" + @click="toInstallService(item.id)" > @@ -163,7 +163,12 @@ export default { onReady() {}, onReachBottom() {}, onPullDownRefresh() {}, - methods: {}, + methods: { + toInstallService(id) { + this.$store.commit("system/indexCateId", id); + this.$utils.toPage("/pages/service/cate", {}, "switch"); + }, + }, }; diff --git a/src/pages/service/cate.vue b/src/pages/service/cate.vue index 049544a..49314f4 100644 --- a/src/pages/service/cate.vue +++ b/src/pages/service/cate.vue @@ -4,7 +4,7 @@ - + state.system.indexCateId, + }), + }, async onLoad() { let pageConfig = getApp().globalData.pageConfig; @@ -66,7 +72,9 @@ export default { }); this.loadCate(); }, - onShow() {}, + onShow() { + this.currentId = this.indexCateId; + }, onReady() {}, onReachBottom() {}, onPullDownRefresh() {}, @@ -93,8 +101,8 @@ export default { /** * 分类 */ - async loadCate() { - await this.$request({ + loadCate() { + this.$request({ api: "service.cate", }) .then((response) => { diff --git a/src/store/index.js b/src/store/index.js index d0c7a81..c8d6757 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,11 +1,13 @@ import Vue from 'vue' import Vuex from 'vuex' +import system from "@/store/modules/system" import user from "@/store/modules/user" Vue.use(Vuex) export default new Vuex.Store({ modules: { + system, user, } }) diff --git a/src/store/modules/system.js b/src/store/modules/system.js new file mode 100644 index 0000000..4f9657d --- /dev/null +++ b/src/store/modules/system.js @@ -0,0 +1,13 @@ +export default { + namespaced: true, + state: { + indexCateId: 0, + }, + getters: {}, + mutations: { + indexCateId(state, data) { + state.indexCateId = data; + } + }, + actions: {} +}