瀏覽代碼

Merge branch 'dev' of licailing/zhirongip into master

xuqiang 4 年之前
父節點
當前提交
edfae9dfe9

+ 29 - 5
src/main/zhi-rong-web/src/components/popup/Message.vue

@@ -15,7 +15,7 @@
 
             <div class="btns">
                 <el-button type="info" size="small" @click="show = false">返回</el-button>
-                <el-button type="primary" size="small" @click="(show = false), (showForm = true)">确定</el-button>
+                <el-button type="primary" size="small" @click="add">确定</el-button>
             </div>
         </el-dialog>
 
@@ -89,6 +89,7 @@ export default {
             show: false,
             showForm: false,
             formData: {},
+            list: [],
             rules: {
                 documentNumber: [
                     {
@@ -126,7 +127,12 @@ export default {
         };
     },
     computed: {
-        ...mapState(['userInfo'])
+        ...mapState(['userInfo']),
+        Type() {
+            return this.userInfo.authorities.filter(item => {
+                return item.name === 'ROLE_PERSONAL';
+            });
+        }
     },
     mounted() {
         this.$EventBus.$on('postMessage', res => {
@@ -135,14 +141,32 @@ export default {
             if (this.$refs.form) {
                 this.$refs.form.resetFields();
             }
+        });
+    },
+    methods: {
+        add() {
+            (this.show = false), (this.showForm = true);
             this.formData = {
                 name: this.userInfo.nickname,
                 phone: this.userInfo.phone,
                 email: this.userInfo.email
             };
-        });
-    },
-    methods: {
+            if (this.isLogin && this.Type[0].name === 'ROLE_PERSONAL') {
+                this.$http
+                    .get('/personal/my')
+                    .then(res => {
+                        this.formData = {
+                            ...res,
+                            name: this.userInfo.nickname,
+                            phone: this.userInfo.phone,
+                            email: this.userInfo.email
+                        };
+                    })
+                    .catch(e => {
+                        console.log(e);
+                    });
+            }
+        },
         onSave() {
             this.$refs.form.validate(valid => {
                 console.log(valid);

+ 33 - 2
src/main/zhi-rong-web/src/router/index.js

@@ -995,8 +995,12 @@ router.beforeEach((to, from, next) => {
                             cancelButtonText: '取消'
                         })
                             .then(() => {
-                                if (info && info.status === 'DENY') {
+                                if (store.state.personalInfo && info.status === 'PENDING') {
                                     router.push('/authentication');
+                                } else if (store.state.personalInfo && info.status === 'DENY') {
+                                    router.push('/Authenticationfail');
+                                } else if (store.state.institutionInfo && info.status === 'DENY') {
+                                    router.push('/Authenticationsfail');
                                 } else if (!info) {
                                     router.push('/registration');
                                 } else if (store.state.personalInfo) {
@@ -1005,6 +1009,17 @@ router.beforeEach((to, from, next) => {
                                     router.push('/authentications');
                                 }
                             })
+                            // .then(() => {
+                            //     if (info && info.status === 'DENY') {
+                            //         router.push('/authentication');
+                            //     } else if (!info) {
+                            //         router.push('/registration');
+                            //     } else if (store.state.personalInfo) {
+                            //         router.push('/personal');
+                            //     } else {
+                            //         router.push('/authentications');
+                            //     }
+                            // })
                             .catch(() => {});
                     } else {
                         next();
@@ -1021,8 +1036,13 @@ router.beforeEach((to, from, next) => {
                 cancelButtonText: '取消'
             })
                 .then(() => {
-                    if (info && info.status === 'DENY') {
+                    console.log(store.state.personalInfo);
+                    if (store.state.personalInfo && info.status === 'PENDING') {
                         router.push('/authentication');
+                    } else if (store.state.personalInfo && info.status === 'DENY') {
+                        router.push('/Authenticationfail');
+                    } else if (store.state.institutionInfo && info.status === 'DENY') {
+                        router.push('/Authenticationsfail');
                     } else if (!info) {
                         router.push('/registration');
                     } else if (store.state.personalInfo) {
@@ -1031,6 +1051,17 @@ router.beforeEach((to, from, next) => {
                         router.push('/authentications');
                     }
                 })
+                // .then(() => {
+                //     if (info && info.status === 'DENY') {
+                //         router.push('/authentication');
+                //     } else if (!info) {
+                //         router.push('/registration');
+                //     } else if (store.state.personalInfo) {
+                //         router.push('/personal');
+                //     } else {
+                //         router.push('/authentications');
+                //     }
+                // })
                 .catch(() => {});
         } else {
             next();

+ 1 - 1
src/main/zhi-rong-web/src/store/index.js

@@ -41,7 +41,7 @@ export default new Vuex.Store({
         getUserInfo(context) {
             return http.http.get('/user/my').then(res => {
                 context.commit('updateUserInfo', res);
-                // console.log(res);
+                console.log(res);
                 let info = res.authorities.find(item => {
                     return item.name == 'ROLE_INSTITUTION' || item.name == 'ROLE_PERSONAL';
                 });