lrf402788946 5 years ago
parent
commit
2dbe7a7714
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/views/login.vue

+ 6 - 4
src/views/login.vue

@@ -6,7 +6,7 @@
 
 <script>
 import loginDetail from '@/layout/login.vue';
-import { createNamespacedHelpers, mapGetters } from 'vuex';
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: mapSite } = createNamespacedHelpers('site');
 const { mapActions: mapMarket } = createNamespacedHelpers('market');
 const { mapActions: login } = createNamespacedHelpers('login');
@@ -25,7 +25,7 @@ export default {
     this.searchSite();
   },
   methods: {
-    ...mapSite(['showInfo']),
+    ...mapSite(['showInfo', 'toGetUser']),
     ...mapMarket({ userFetch: 'fetch', userCreate: 'create', userUpdate: 'update' }),
     ...login({ toLogin: 'login' }),
     // 查询站点信息
@@ -40,8 +40,9 @@ export default {
     },
     async submitLogin(form) {
       const res = await this.toLogin({ user: form });
-      if (res.errcode == '0') {
-        window.location.href = 'http://free.liaoningdoupo.com/static/home.html';
+      if (res.uid) {
+        if (res.role == 1 || res.role == 4) window.location.href = 'http://free.liaoningdoupo.com/platadmin';
+        else window.location.href = 'http://free.liaoningdoupo.com/platlive/home.html';
       }
     },
     async submitRegister(forms) {
@@ -52,6 +53,7 @@ export default {
     },
   },
   computed: {
+    ...mapState(['user']),
     pageTitle() {
       return `${this.$route.meta.title}`;
     },