guhongwei 5 年 前
コミット
0292adb5bc

+ 52 - 0
src/layout/question/teaClass.vue

@@ -0,0 +1,52 @@
+<template>
+  <div id="teaClass">
+    <el-row>
+      <el-col :span="24">
+        <el-col :span="24" class="list" v-for="(item, index) in classList" :key="index">
+          <el-col :span="17" class="mess">
+            <p>班级:{{ item.name }}</p>
+            <p>班级人数:{{ item.number }}</p>
+          </el-col>
+          <el-col :span="7" class="btn">
+            <el-link :underline="false" @click="$router.push({ path: '/question/progress', query: { classid: item.id } })">班级问卷进度</el-link>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'teaClass',
+  props: {
+    classList: null,
+  },
+  components: {},
+  data: () => ({}),
+  created() {},
+  computed: {},
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+p {
+  padding: 0;
+  margin: 0;
+}
+.list {
+  background: #fff;
+  margin: 10px;
+  width: 94%;
+  padding: 10px;
+  border-radius: 20px;
+}
+.list .mess p {
+  padding: 5px 0;
+}
+.list .btn {
+  padding: 20px 0;
+  text-align: center;
+}
+</style>

+ 6 - 0
src/router/index.js

@@ -70,6 +70,12 @@ const routes = [
     meta: { title: '填写答案', isleftarrow: true },
     component: () => import('../views/question/question.vue'),
   },
+  // 班主任查看班级问卷调查答题进度
+  {
+    path: '/question/progress',
+    meta: { title: '问卷调查-问卷进度', isleftarrow: true },
+    component: () => import('../views/question/progress.vue'),
+  },
   // 个人信息
   {
     path: '/user/index',

+ 20 - 2
src/views/question/index.vue

@@ -6,7 +6,12 @@
           <nav-bar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </nav-bar>
         </el-col>
         <el-col :span="24" class="main">
-          <questionnaire-info :questionnaireList="questionnaireList"></questionnaire-info>
+          <span v-if="this.user.type === '1'">
+            <teaClass :classList="classList"></teaClass>
+          </span>
+          <span v-else>
+            <questionnaire-info :questionnaireList="questionnaireList"></questionnaire-info>
+          </span>
         </el-col>
         <el-col :span="24" class="foot">
           <footInfo></footInfo>
@@ -19,10 +24,13 @@
 <script>
 import NavBar from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
+import teaClass from '@/layout/question/teaClass.vue';
 import questionnaireInfo from '@question/src/views/index.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: termquest } = createNamespacedHelpers('termquest');
 const { mapActions: questionnaire } = createNamespacedHelpers('questionnaire');
+const { mapActions: mapClass } = createNamespacedHelpers('classes');
+const { mapActions: mapStudent } = createNamespacedHelpers('student');
 export default {
   name: 'index',
   props: {},
@@ -30,16 +38,18 @@ export default {
     NavBar, //头部导航
     footInfo, //底部导航
     questionnaireInfo, //问卷调查
+    teaClass, //班主任班级名单
   },
   data: () => ({
     questionnaireList: [],
+    classList: [],
     title: '',
     isleftarrow: '',
-    transitionName: 'fade',
     navShow: true,
   }),
   created() {
     this.search();
+    this.searchInfo();
   },
   computed: {
     ...mapState(['user']),
@@ -57,6 +67,8 @@ export default {
   methods: {
     ...termquest(['query']),
     ...questionnaire({ getQuestList: 'query', getQuestMerge: 'mergeRequest' }),
+    ...mapClass({ classinfo: 'query' }),
+    ...mapStudent({ stuQuery: 'query', stuFetch: 'fetch' }),
     // 查询问卷调查列表
     async search() {
       let res = await this.query({ termid: this.user.termid });
@@ -66,6 +78,12 @@ export default {
         this.$set(this, `questionnaireList`, quest);
       }
     },
+    // 班主任查询管理班级列表
+    async searchInfo({ ...info } = {}) {
+      const res = await this.classinfo({ ...info });
+      var result = res.data.filter(item => item.headteacherid === this.user.userid);
+      this.$set(this, `classList`, result);
+    },
   },
 };
 </script>

+ 65 - 0
src/views/question/progress.vue

@@ -0,0 +1,65 @@
+<template>
+  <div id="progress">
+    <el-row>
+      <el-col :span="24" class="style">
+        <el-col :span="24" class="top">
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
+        </el-col>
+        <el-col :span="24" class="main">
+          问卷调查
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import NavBar from '@/layout/common/topInfo.vue';
+import teaLeaveList from '@/layout/user/teaLeaveList.vue';
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+export default {
+  name: 'progress',
+  props: {},
+  components: {
+    NavBar, //头部导航
+  },
+  data: () => ({
+    title: '',
+    isleftarrow: '',
+    navShow: true,
+  }),
+  created() {
+    this.searchInfo();
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+.style {
+  width: 100%;
+  min-height: 667px;
+  position: relative;
+  background-color: #f9fafc;
+}
+.top {
+  height: 46px;
+  overflow: hidden;
+}
+.main {
+  min-height: 570px;
+}
+</style>