浏览代码

班级信息

reloaded 5 年之前
父节点
当前提交
5801974edd
共有 2 个文件被更改,包括 46 次插入2 次删除
  1. 27 1
      src/layout/class/classInfo.vue
  2. 19 1
      src/views/user/classInfos.vue

+ 27 - 1
src/layout/class/classInfo.vue

@@ -99,6 +99,9 @@
 <script>
 import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: classes } = createNamespacedHelpers('classes');
+const { mapActions: location } = createNamespacedHelpers('location');
+const { mapActions: teacher } = createNamespacedHelpers('teacher');
+const { mapActions: director } = createNamespacedHelpers('director');
 export default {
   name: 'classInfo',
   props: {},
@@ -114,8 +117,31 @@ export default {
   },
   methods: {
     ...classes(['fetch']),
+    ...location({ locationFetch: 'fetch' }),
+    ...teacher({ teaFetch: 'fetch' }),
+    ...director({ dirFetch: 'fetch' }),
     async search() {
-      const classinfo = await this.fetch(this.classid);
+      const classinfo = (await this.fetch(this.classid)).data;
+      if (classinfo.yclocationid) {
+        classinfo.yclocation = (await this.locationFetch(classinfo.yclocationid)).data.name;
+      }
+      if (classinfo.kzjhlocationid) {
+        classinfo.kzjhlocation = (await this.locationFetch(classinfo.kzjhlocationid)).data.name;
+      }
+      if (classinfo.kbyslocationid) {
+        classinfo.kbyslocation = (await this.locationFetch(classinfo.kbyslocationid)).data.name;
+      }
+      if (classinfo.jslocationid) {
+        classinfo.jslocation = (await this.locationFetch(classinfo.jslocationid)).data.name;
+      }
+      if (classinfo.lyteacherid) {
+        let res = await this.teaFetch(classinfo.lyteacherid);
+        if (res.length < 1) {
+          res = await this.dirFetch(classinfo.lyteacherid);
+        }
+        classinfo.lyteacher = res.data.name;
+      }
+      this.$set(this, `classinfo`, classinfo);
       console.log(classinfo);
     },
   },

+ 19 - 1
src/views/user/classInfos.vue

@@ -39,4 +39,22 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.style {
+  width: 100%;
+  min-height: 667px;
+  position: relative;
+  background-color: #f9fafc;
+}
+.top {
+  height: 46px;
+  overflow: hidden;
+}
+.main {
+  min-height: 570px;
+}
+.foot {
+  height: 90px;
+  overflow: hidden;
+}
+</style>