guhongwei 5 years ago
parent
commit
f0008bc611
3 changed files with 12 additions and 10 deletions
  1. 0 2
      src/layout/user/studentInfo.vue
  2. 9 7
      src/views/index.vue
  3. 3 1
      src/views/user/index.vue

+ 0 - 2
src/layout/user/studentInfo.vue

@@ -286,8 +286,6 @@
           </el-col>
         </span>
       </el-col>
-
-      
     </el-row>
   </div>
 </template>

+ 9 - 7
src/views/index.vue

@@ -55,13 +55,15 @@ export default {
     let todate = this.getDate();
     this.$set(this.today, `date`, todate);
     this.$set(this.today, `day`, today);
-    if (this.user.type === '1') {
-      this.view = 'class';
-      this.getClass();
-    } else {
-      this.$set(this, `classid`, this.user.classid);
-      this.searchInfo();
-      this.view = 'arrange';
+    if (this.user !== undefined) {
+      if (this.user.type === '1') {
+        this.view = 'class';
+        this.getClass();
+      } else {
+        this.$set(this, `classid`, this.user.classid);
+        this.searchInfo();
+        this.view = 'arrange';
+      }
     }
   },
   computed: {

+ 3 - 1
src/views/user/index.vue

@@ -50,6 +50,7 @@ export default {
     navShow: true,
   }),
   created() {
+    console.log(this.user);
     this.searchSite();
   },
   computed: {
@@ -73,6 +74,7 @@ export default {
     // 查询登录用户信息
     async searchSite() {
       // 1:班主任,4:学生
+      console.log(this.user);
       if (this.user.type === '1') {
         const res = await this.directorFetch(this.user.userid);
         const arr = await this.deptFetch(res.data.department);
@@ -83,7 +85,7 @@ export default {
         this.$set(this, `info`, res.data);
       } else if (this.user.type === '3') {
         const res = await this.teacherfetch(this.user.userid);
-        console.log(res.data); 
+        console.log(res.data);
         this.$set(this, `jiaoshiinfo`, res.data);
       }
     },