Browse Source

社保五险功能完善

dujingxian 4 years ago
parent
commit
3ad5e129d4
2 changed files with 27 additions and 11 deletions
  1. 10 7
      src/views/index/index.ts
  2. 17 4
      src/views/user/info.vue

+ 10 - 7
src/views/index/index.ts

@@ -25,7 +25,8 @@ export default class Index extends Vue {
         appid:'wx98622dc60a8a6abb',
         show: 1,
         bannerlist:'',
-        id_card: null
+        id_card: null,
+        is_town: true
     };
     private citycode = localStorage.getItem("citycode");
     private cityname = localStorage.getItem("cityname");
@@ -38,11 +39,13 @@ export default class Index extends Vue {
             this.data.bannerlist = resbanner.data;
             this.citycode = res.data.social_city  as string;
             this.cityname = res.data.city_name as string;
+            this.data.is_town = res.data.is_town
             localStorage.setItem("citycode", this.citycode);
             localStorage.setItem("cityname", this.cityname);
             localStorage.setItem('mobile',res.data.mobile);
             localStorage.setItem("social_type", res.data.social_type);
             localStorage.setItem("social_name", res.data.social_name);
+            localStorage.setItem("is_town", res.data.is_town);
             if(res.data.is_first == 0){
                 this.data.markShow = true
                 let ress = await Http.getInstance().setFirstLogin();
@@ -139,10 +142,10 @@ export default class Index extends Vue {
         // 获取本地信息
         let name = localStorage.getItem('realname')
         let socialType = localStorage.getItem('token_type')
-        if (name === '' || socialType === '' || this.data.id_card === '') {
-            this.$router.push('/user/info')
-        } else {
+        if (name !== null && socialType !== null && this.data.id_card !== null) {
             this.$router.push('/social?is_fund=1')
+        } else {
+            this.$router.push('/user/info')
         }
     }
 
@@ -159,10 +162,10 @@ export default class Index extends Vue {
             });
             return
         }
-        if (name === '' || socialType === '' || this.data.id_card === '') {
-            this.$router.push('/user/info')
-        } else {
+        if (name !== null && socialType !== null && this.data.id_card !== null) {
             this.$router.push('/social?is_fund=0')
+        } else {
+            this.$router.push('/user/info')
         } 
     }
 

+ 17 - 4
src/views/user/info.vue

@@ -84,18 +84,31 @@ import login from "@/store/module/login";
             localStorage.setItem("is_town", res.data.is_town);
             this.ShowCity();
             this.showSocialType();
+            this.wShowUserInfo()
         }
 
         mounted() {
         }
         public showUserInfo () {
-            return this.data.realname.value === '' || this.data.social_type.value === '' || this.data.id_card.value === ''
+            return this.data.realname.value == null || this.data.social_type.value == null || this.data.id_card.value == null
         }
 
         // 监听器
-        @Watch('$route')
-        wShowUserInfo(newVal: any, oldVal: any) {
-            if (newVal.path === '/user/info' && this.showUserInfo()) {
+        // @Watch('$route')
+        // wShowUserInfo(newVal: any, oldVal: any) {
+        //     if (newVal.path === '/user/info' && this.showUserInfo()) {
+        //         Message({
+        //             message: '真实姓名/社保户别/身份证号不能为空',
+        //             type: 'warning'
+        //         });
+        //     }
+            
+        // }
+        wShowUserInfo() {
+            let path = window.location.href
+            console.log('this.showUserInfo()', this.showUserInfo());
+            
+            if (path.indexOf('/user/info') > -1  && this.showUserInfo()) {
                 Message({
                     message: '真实姓名/社保户别/身份证号不能为空',
                     type: 'warning'