guhongwei 4 년 전
부모
커밋
0bc30b5c5e
1개의 변경된 파일22개의 추가작업 그리고 1개의 파일을 삭제
  1. 22 1
      src/components/common/top.vue

+ 22 - 1
src/components/common/top.vue

@@ -10,7 +10,7 @@
             <el-col :span="12" class="right">
               <el-col :span="24" v-if="user ? user.id : ''">
                 <span>{{ user.name || user.adminuser || user.user || user.title || '游客' }}</span>
-                <el-button type="primary" size="mini" @click="$router.push({ path: '/userCenter' })">个人中心</el-button>
+                <el-button type="primary" size="mini" @click="centerLogin">个人中心</el-button>
                 <el-button type="danger" size="mini" @click="logout">退出登录</el-button>
               </el-col>
               <el-col :span="24" v-else>
@@ -77,6 +77,27 @@ export default {
     isTab(type) {
       return this.$route.path.includes(`/${type}`);
     },
+    // 个人中心
+    centerLogin() {
+      let data = this.user;
+      console.log(data);
+      if (data.code) {
+        console.log('1');
+        this.$router.push({ path: '/userCenter' });
+      } else if (data.room_id) {
+        let num = data.room_id.substr(0, 1);
+        if (num == 1) {
+          this.$router.push({ path: '/admin/live/achieve' });
+        } else if (num == 2) {
+          this.$router.push({ path: '/admin/live/science' });
+        } else if (num == 3) {
+          this.$router.push({ path: '/admin/live/train' });
+        }
+      } else {
+        console.log('3');
+        console.log(this.user);
+      }
+    },
     // 退出登录
     logout() {
       localStorage.removeItem('token');