Browse Source

feat(pptEasyClass): 添加教师用户名显示及异步获取用户数据

在教师类型为2时显示用户名,并异步获取用户信息
lsc 1 week ago
parent
commit
ba4e2bfd1b
1 changed files with 15 additions and 1 deletions
  1. 15 1
      src/components/pptEasyClass/index.vue

+ 15 - 1
src/components/pptEasyClass/index.vue

@@ -52,6 +52,9 @@
               <img src="../../assets/icon/newIcon/afterClass.svg" alt="" />
               <span>下课</span>
             </div>
+            <div class="name_box" v-if="tType == 2">
+              {{ userJson.username }}
+            </div>
           </div>
         </div>
       </div>
@@ -278,7 +281,7 @@ export default {
       console.log('同步数据')
     }
   },
-  mounted() {
+  async mounted() {
     this.setoTime("1");
     this.startTime = new Date().toLocaleString("zh-CN", {
       hour12: false,
@@ -291,6 +294,12 @@ export default {
       this.freeBrowse = value;
       console.log('自由浏览模式已切换为:', this.freeBrowse);
     }
+    if(!this.userJson || !this.userJson.accountNumber){
+      let res = await this.ajax.get(this.$store.state.api + "selectUser", {
+        userid: this.$route.query.userid
+        });
+        this.userJson = res.data[0][0]
+    }
   }
 };
 </script>
@@ -488,4 +497,9 @@ export default {
   width: 20px;
   height: 20px;
 }
+
+.name_box {
+  background: unset !important;
+  border: none !important;
+}
 </style>