Procházet zdrojové kódy

数据取得从deptId改为liffId

liu před 2 roky
rodič
revize
d98021c074

+ 7 - 6
src/App.vue

@@ -74,6 +74,13 @@ export default {
     parmLiffId:"",
   }),
   created: function() {
+     this.parmLiffId = this.getQueryString("liffId");
+     if (this.parmLiffId) {
+       Cookies.set('liffId', this.parmLiffId);
+     } else {
+       this.parmLiffId = Cookies.get('liffId');
+     }
+     this.$store.commit("user/SET_LIFF_ID", this.parmLiffId);
   },
   mounted: function() {
     setTimeout(() => {
@@ -86,12 +93,6 @@ export default {
   },
   methods: {
     initializeLiff: function () {
-      this.parmLiffId = this.getQueryString("liffId");
-      if (this.parmLiffId) {
-          Cookies.set('liffId', this.parmLiffId);
-      } else {
-         this.parmLiffId = Cookies.get('liffId');
-      }
       this.api_loading = true
       liff.init(
         {

+ 1 - 1
src/components/pages/nav.vue

@@ -106,7 +106,7 @@ export default {
                         if (res.code == 200) {
                             this.$store.commit("user/SET_NAME", null); //用户名
                             this.$store.commit("user/SET_USERID", null); //用户ID
-                            this.$store.commit("user/SET_DEP_ID", 101); //deptId
+                            this.$store.commit("user/SET_LIFF_ID", null); //liffId
                             this.$store.commit("user/SET_USERINFO", null); //用户基本信息
                             removeToken();
                             this.$router.push({ path: "/home" });

+ 4 - 6
src/store/modules/user.js

@@ -15,10 +15,10 @@ const state = {
   userId: null, //用户ID
   nickName:null,//用户昵称
   userInfo: null, //用户基本信息
-  deptId: 101, //全局deptId home页面未登录状态使用
   distributionId:null,//分销人ID
   language:'ja',//语言
   companyinfo:{},
+  liffId: null,
 }
 
 const mutations = {
@@ -37,10 +37,6 @@ const mutations = {
   SET_USERINFO: (state, data) => {
     state.userInfo = data
   },
-  //储存depId
-  SET_DEP_ID: (state, data) => {
-    state.deptId = data
-  }, 
   SET_DISTR_BUTION_ID: (state, data) => {
     state.distributionId = data
   },
@@ -53,6 +49,9 @@ const mutations = {
   SET_COMPANY_INFO_DATA: (state, data) => {
       state.companyinfo = data
   },
+  SET_LIFF_ID: (state, data) => {
+    state.liffId = data
+  },
 }
 
 const actions = {
@@ -100,7 +99,6 @@ const actions = {
         const user = res.data
         commit('SET_NAME', user.name);//用户名
         commit('SET_USERID', user.id);//用户ID
-        commit('SET_DEP_ID', user.deptId);//deptId
         commit('SET_USERINFO', user);//用户基本信息
         resolve(res)
       }).catch(error => {

+ 4 - 4
src/views/home/home.vue

@@ -256,12 +256,12 @@ export default {
         selectExcellentList() {
             this.loading = true;
             //获取全局
-            let deptId = this.$store.state.user.deptId;
+            let liffId = this.$store.state.user.liffId;
             //拿到数据前做清空
             this.excellentList = [];
             let request = {
                 isPreferred: 1,
-                deptId: deptId,
+                liffId: liffId,
             };
             selectPreferredList(request).then((res) => {
                 if (res.code == 200) {
@@ -279,11 +279,11 @@ export default {
         selectRecommendList() {
             this.loading = true;
             //获取全局
-            let deptId = this.$store.state.user.deptId;
+            let liffId = this.$store.state.user.liffId;
             //拿到数据前做清空
             this.excellentList = [];
             let request = {
-                deptId: deptId,
+                liffId: liffId,
             };
             selectSalesTop10(request).then((res) => {
                 if (res.code == 200) {

+ 3 - 3
src/views/home/pages/specialArea/specialArea.vue

@@ -117,7 +117,7 @@ export default {
         getSearchList() {
             this.loading = true;
             //获取全局deptId
-            let deptId = this.$store.state.user.deptId;
+            let deptId = this.$store.state.user.companyinfo.deptId;
             //拿到数据前做清空
             this.rankList = [];
             let request = {
@@ -196,7 +196,7 @@ export default {
         selectExcellentList() {
             this.loading = true;
             //获取全局
-            let deptId = this.$store.state.user.deptId;
+            let deptId = this.$store.state.user.companyinfo.deptId;
             //拿到数据前做清空
             this.rankList = [];
             let request = {
@@ -232,7 +232,7 @@ export default {
         selectClassificationList() {
             this.loading = true;
             //获取全局
-            let deptId = this.$store.state.user.deptId;
+            let deptId = this.$store.state.user.companyinfo.deptId;
             //拿到数据前做清空
             this.rankList = [];
             let request = {