Browse Source

scg:login

honghaitzz11 6 years ago
parent
commit
5a187074da

File diff suppressed because it is too large
+ 0 - 0
www/webapp/scg/asset/css/app.css


File diff suppressed because it is too large
+ 0 - 0
www/webapp/scg/asset/css/app.css.map


File diff suppressed because it is too large
+ 0 - 0
www/webapp/scg/asset/js/app.js


File diff suppressed because it is too large
+ 0 - 0
www/webapp/scg/asset/js/app.js.map


File diff suppressed because it is too large
+ 0 - 0
www/webapp/scg/asset/js/manifest.js.map


+ 1 - 14
www/webapp/scg/src/App.vue

@@ -5,7 +5,7 @@
 </template>
 
 <script>
-  import { mapActions, mapGetters } from 'vuex';
+  import { mapActions } from 'vuex';
 
   export default {
     name: 'app',
@@ -15,19 +15,6 @@
     created() {
       this.getUserInfo();
     },
-    watch: {
-      // eslint-disable-next-line
-      ifLogin: function (val, oVal) {
-        if (val) {
-          this.$router.push({ name: 'login' });
-        }
-      }
-    },
-    computed: {
-      ...mapGetters({
-        ifLogin: 'getIfLogin'
-      })
-    },
     methods: {
       ...mapActions(['getUserInfo'])
     }

+ 13 - 13
www/webapp/scg/src/lib/userID.js

@@ -1,17 +1,17 @@
 export default function userId() {
-  // const id = [
-  //   //     '5acb042a9f5160bc048b6b1b', // 余零雨
-  //   //     '57e245989f5160ca048b456f', // 余零雨
-  //   //     '57eb6d449f5160a6048b46f9', // 焦孟骁
-  //   //     '5befffbf9f5160c03c8b547b', // Sherry
-  //   //     '5befd8d19f5160c03c8b5478', // Koala
-  //   //     '5bef8e3e9f5160123e8b5451', // jjhuman
-  //   //     '57e237ea9f5160b6048b4568', // 陌上歌
-  //   //     '57e238929f5160d6048b456d', // .
-  //   //     '57e38f1b9f5160ac048b457d', // 塘下七武海-涛
-  //   //     '59e41443fb48a7552f8b459e', // 笨笨_8119619
-  //   //   ];
-  return localStorage.getItem('wxUserID1') != null ? localStorage.getItem('wxUserID1') : '5acb042a9f5160bc048b6b1b';
+  const id = [
+    '5acb042a9f5160bc048b6b1b', // 假装在路上
+    '5acae4769f5160a6048b687e', // 洪海涛
+    //     '57eb6d449f5160a6048b46f9', // 焦孟骁
+    //     '5befffbf9f5160c03c8b547b', // Sherry
+    //     '5befd8d19f5160c03c8b5478', // Koala
+    //     '5bef8e3e9f5160123e8b5451', // jjhuman
+    //     '57e237ea9f5160b6048b4568', // 陌上歌
+    //     '57e238929f5160d6048b456d', // .
+    //     '57e38f1b9f5160ac048b457d', // 塘下七武海-涛
+    //     '59e41443fb48a7552f8b459e', // 笨笨_8119619
+  ];
+  return localStorage.getItem('wxUserID1') != null ? localStorage.getItem('wxUserID1') : id[1];
 }
 /*
 card: {

+ 9 - 12
www/webapp/scg/src/store.js

@@ -19,7 +19,6 @@ export default new Vuex.Store({
     user_id: userID(),
     isDev: util.isDev(),
     userInfo: {},
-    ifLogin: '',
     name: Name,
     addressRouter: {},
     addressInformation: {},
@@ -28,8 +27,7 @@ export default new Vuex.Store({
     productList: {}
   },
   getters: {
-    getUserInfo: state => state.userInfo,
-    getIfLogin: state => state.ifLogin
+    getUserInfo: state => state.userInfo
   },
   mutations: {
     getUserInfo(state) {
@@ -39,20 +37,19 @@ export default new Vuex.Store({
       })
       .then(res => {
         // eslint-disable-next-line
-        console.log(res);
         self.userInfo = res;
         if (self.userInfo.avatar.indexOf('odulcd8g1.bkt.clouddn.com') > -1) {
           self.userInfo.avatar = self.userInfo.avatar.replace(/odulcd8g1\.bkt\.clouddn\.com/, 'avatar.yiguanjia.me');
         }
       })
-      .then(() => {
-        self.ifLogin = self.userInfo.isReg;
-        // if (self.userInfo.isReg === '建工' && self.userInfo.user_info.phone !== undefined && self.userInfo.type === '微信') {
-        //   self.ifLogin = false;
-        // } else {
-        //   self.ifLogin = true;
-        // }
-      })
+      // .then(() => {
+      //   self.ifLogin = self.userInfo.isReg;
+      //   // if (self.userInfo.isReg === '建工' && self.userInfo.user_info.phone !== undefined && self.userInfo.type === '微信') {
+      //   //   self.ifLogin = false;
+      //   // } else {
+      //   //   self.ifLogin = true;
+      //   // }
+      // })
       .then(() => {
         // console.log('准备获取商品列表');
         // self.productList = product.data.products;

+ 22 - 1
www/webapp/scg/src/views/home/index.vue

@@ -8,6 +8,7 @@
 </template>
 
 <script>
+  import { mapGetters } from 'vuex';
   import HomeList from './list';
 
   export default {
@@ -25,10 +26,30 @@
     },
     created() {
       // 判断用户是否注册
-      if (this.$store.state.ifLogin) {
+      if (this.userInfo !== undefined && this.userInfo.isReg !== undefined && !this.userInfo.isReg) {
         this.$router.push({ name: 'login' });
       }
     },
+    mounted() {
+    },
+    watch: {
+      userInfo: {
+        // eslint-disable-next-line
+        handler: function (val, oldVal) {
+          if (val !== undefined) {
+            if (!val.isReg) {
+              this.$router.push({ name: 'login' });
+            }
+          }
+        },
+        deep: true
+      }
+    },
+    computed: {
+      ...mapGetters({
+        userInfo: 'getUserInfo'
+      })
+    },
     components: {
       HomeList
     },

+ 27 - 12
www/webapp/scg/src/views/login/index.vue

@@ -63,20 +63,27 @@
       // 初始化识别码
       this.getCreateCode();
     },
+    mounted() {
+      if (this.$store.state.userInfo.isReg !== undefined && this.$store.state.userInfo.isReg) {
+        this.$router.push({ name: 'home' });
+      }
+    },
     methods: {
       ...mapActions(['getUserInfo']),
       getSMS() {
         if (this.test('sms')) {
           http(ApiSetting.getSMSCode, {
-            user_id: this.userID,
+            user_id: this.$store.state.user_id,
             type: 3,
             mobile: this.user.phone,
-          }).then(res => {
+          })
+          .then(res => {
             this.code.dxm.scg = res.code;
             if (this.$store.state.ifDev) {
               this.code.dxm.user = `${res.code}`;
             }
-          }).catch(err => {
+          })
+          .catch(err => {
             console.log(err);
           });
         }
@@ -89,7 +96,8 @@
           phone: this.user.phone,
           card_number: this.user.card_number,
           password: this.user.password
-        }).then(res => {
+        })
+        .then(res => {
           this.$store.state.ifLogin = false;
           if (res.length === 0) {
             this.$createDialog({
@@ -99,9 +107,11 @@
                 this.getUserInfo();
                 this.$router.push({ name: 'home' });
               }
-            }).show();
+            })
+            .show();
           }
-        }).catch(err => {
+        })
+        .catch(err => {
           console.log(err);
         });
       },
@@ -122,7 +132,8 @@
           this.$createDialog({
             title: '错误',
             content: '您输入的手机号码有误,请重新输入!'
-          }).show();
+          })
+          .show();
           return false;
         }
         // 识别码检测
@@ -130,7 +141,8 @@
           this.$createDialog({
             title: '错误',
             content: '您输入的识别码有误,请重新输入!'
-          }).show();
+          })
+          .show();
           return false;
         }
         if (type === 'sms') return true;
@@ -139,7 +151,8 @@
           this.$createDialog({
             title: '错误',
             content: '您的手机号验证失败,请重新验证!'
-          }).show();
+          })
+          .show();
           return false;
         }
         // 验证卡号不为空
@@ -147,7 +160,8 @@
           this.$createDialog({
             title: '错误',
             content: '卡号不能为空,请您重新输入!'
-          }).show();
+          })
+          .show();
           return false;
         }
         // 验证卡密不为空
@@ -155,7 +169,8 @@
           this.$createDialog({
             title: '错误',
             content: '卡密不能为空,请您重新输入!'
-          }).show();
+          })
+          .show();
           return false;
         }
         return true;
@@ -197,4 +212,4 @@
         padding: 0 10px;
         /*margin-top: 5px;*/
         text-align: center;
-</style>
+</style>

+ 1 - 1
www/webapp/scg/src/views/mine/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="mine-wrapper">
-    <div class="avatar" v-if="userInfo.user_info &&  userInfo.user_info.name">
+    <div class="avatar" v-if="userInfo.user_info">
       <img :src="userInfo.avatar" alt="">
       <div>{{userInfo.user_info.name}}</div>
       <div class="balance">余额:{{userInfo.balance}}</div>

Some files were not shown because too many files changed in this diff