Browse Source

mallid 被清理了

John-Hong 2 năm trước cách đây
mục cha
commit
857a09af4c
3 tập tin đã thay đổi với 44 bổ sung4 xóa
  1. 24 2
      src/App.vue
  2. 2 2
      src/pages/parkingFee/vehicleAddOrEdit.vue
  3. 18 0
      src/store/index.js

+ 24 - 2
src/App.vue

@@ -60,8 +60,13 @@ export default {
       const kipAccessToken = uni.getStorageSync('kipAccessToken');
       const query = getUrlParams();
       const platform = getPlatform();
-      this.$store.commit('SET_GROUP_ID', query.groupId);
-      this.$store.commit('SET_MALL_ID', query.mallid);
+      if (query.groupId && query.groupId !== 'undefined') {
+        this.$store.commit('SET_GROUP_ID', query.groupId);
+      }
+      if (query.mallid && query.mallid !== 'undefined') {
+        this.$store.commit('SET_MALL_ID', query.mallid);
+      }
+      
       // console.log(65, kipAccessToken);
       // TODO true 需要取消
       if (platform === 'micromessenger' && !kipAccessToken) {
@@ -289,6 +294,23 @@ export default {
         },
       });
     },
+    h5init() {
+      if(uni.getStorageSync('groupId')) {
+        this.$store.commit('SET_GROUP_ID', uni.getStorageSync('groupId'));
+      }
+      if(uni.getStorageSync('kipUserId')) {
+        this.$store.commit('SET_KIP_USER_ID', uni.getStorageSync('kipUserId'));
+      }
+      if(uni.getStorageSync('mallId')) {
+        this.$store.commit('SET_MALL_ID', uni.getStorageSync('mallId'));
+      }
+      if(uni.getStorageSync('openid')) {
+        this.$store.commit('SET_OPENID', uni.getStorageSync('openid'));
+      }
+      if(uni.getStorageSync('mobile')) {
+        this.$store.commit('SET_OPENID', uni.getStorageSync('mobile'));
+      }
+    }
   },
 };
 </script>

+ 2 - 2
src/pages/parkingFee/vehicleAddOrEdit.vue

@@ -247,7 +247,8 @@ export default {
       preUrl: '',
     };
   },
-  onLoad(params) {
+  created() {
+    const params = this.$route.query;
     if (params.carType) {
       this.carInfo = {
         ...params,
@@ -260,7 +261,6 @@ export default {
     this.preUrl = uni.getStorageSync('previousUrl');
     uni.setStorageSync('previousUrl', '/pages/parkingFee/vehicleAddOrEdit.vue');
   },
-  onShow() {},
   computed: {
     disabledBtn() {
       console.log(

+ 18 - 0
src/store/index.js

@@ -145,6 +145,24 @@ const store = new Vuex.Store({
       const res = await kipGetUserDetail();
       console.log('user_info', res);
     },
+    async initH5({commit}) {
+      if(uni.getStorageSync('groupId')) {
+        this.$store.
+        this.$store.commit('SET_GROUP_ID', uni.getStorageSync('groupId'));
+      }
+      if(uni.getStorageSync('kipUserId')) {
+        this.$store.commit('SET_KIP_USER_ID', uni.getStorageSync('kipUserId'));
+      }
+      if(uni.getStorageSync('mallId')) {
+        this.$store.commit('SET_MALL_ID', uni.getStorageSync('mallId'));
+      }
+      if(uni.getStorageSync('openid')) {
+        this.$store.commit('SET_OPENID', uni.getStorageSync('openid'));
+      }
+      if(uni.getStorageSync('mobile')) {
+        this.$store.commit('SET_OPENID', uni.getStorageSync('mobile'));
+      }
+    }
   },
   getters: {
     groupId(state) {