guhongwei 4 years ago
parent
commit
fe0a600c3b
5 changed files with 172 additions and 3 deletions
  1. 3 0
      src/layout/user/clickBtn.vue
  2. 6 1
      src/router/index.js
  3. 6 1
      src/store/index.js
  4. 156 0
      src/views/user/afterClass.vue
  5. 1 1
      src/views/user/leave.vue

+ 3 - 0
src/layout/user/clickBtn.vue

@@ -14,6 +14,9 @@
         <el-col :span="24" class="native">
           <van-cell is-link @click="$router.push({ path: '/user/leave' })">请假&退出</van-cell>
         </el-col>
+        <el-col :span="24" class="native">
+          <van-cell is-link @click="$router.push({ path: '/user/afterClass' })">课后答疑</van-cell>
+        </el-col>
       </el-col>
     </el-row>
   </div>

+ 6 - 1
src/router/index.js

@@ -160,7 +160,12 @@ const routes = [
     meta: { title: '班级列表', isleftarrow: true },
     component: () => import('../views/user/pingfenclass.vue'),
   },
-
+  // 课后答疑
+  {
+    path: '/user/afterClass',
+    meta: { title: '课后答疑', isleftarrow: true },
+    component: () => import('../views/user/afterClass.vue'),
+  },
   //正在登陆
   {
     path: '/login',

+ 6 - 1
src/store/index.js

@@ -24,7 +24,9 @@ import sethead from '@frame/store/sethead';
 import bedroom from '@frame/store/bedroom';
 import nation from '@frame/store/nation';
 import school from '@frame/store/school';
-
+import answerapply from '@frame/store/answerapply';
+import chatroom from '@frame/store/chatroom';
+import answerchat from '@frame/store/answerchat';
 import * as ustate from '@frame/store/user/state';
 import * as umutations from '@frame/store/user/mutations';
 Vue.use(Vuex);
@@ -59,5 +61,8 @@ export default new Vuex.Store({
     bedroom,
     nation,
     school,
+    answerapply,
+    chatroom,
+    answerchat,
   },
 });

+ 156 - 0
src/views/user/afterClass.vue

@@ -0,0 +1,156 @@
+<template>
+  <div id="afterClass">
+    <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 :span="24" class="search">
+            <el-col :span="20">
+              <el-select v-model="subid" clearable placeholder="请选择" style="width: 100%;">
+                <el-option v-for="(i, index) in subjectList" :key="index" :label="i.name" :value="i.id"></el-option>
+              </el-select>
+            </el-col>
+            <el-col :span="4"><el-button type="primary" size="mini" @click="search()">搜索</el-button></el-col>
+          </el-col>
+          <el-col :span="24" class="info">
+            <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
+              <el-col :span="24" class="sub"> 答疑科目:{{ item.subid }} </el-col>
+              <el-col :span="24" class="teacher"> 答疑教师:{{ item.teacher }} </el-col>
+              <el-col :span="24" class="btn">
+                <el-button type="primary" size="mini">申请答疑</el-button>
+              </el-col>
+            </el-col>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import NavBar from '@/layout/common/topTitle.vue';
+import leaveList from '@/layout/user/leaveList.vue';
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: subject } = createNamespacedHelpers('subject');
+const { mapActions: answerapply } = createNamespacedHelpers('answerapply');
+export default {
+  metaInfo: { title: '请假管理' },
+  name: 'afterClass',
+  props: {},
+  components: {
+    NavBar, //头部导航
+  },
+  data: function() {
+    return {
+      title: '',
+      isleftarrow: '',
+      transitionName: 'fade',
+      navShow: true,
+      // 答疑列表
+      list: [],
+      // 科目列表
+      subjectList: [],
+      // 查询
+      subid: '',
+    };
+  },
+  created() {
+    this.getOtherList();
+    this.search();
+  },
+  methods: {
+    ...subject({ getSubjectList: 'query' }),
+    ...answerapply(['query', 'delete']),
+    // 查询科目
+    async getOtherList() {
+      let res = await this.getSubjectList();
+      if (this.$checkRes(res)) {
+        this.$set(this, `subjectList`, res.data);
+      }
+    },
+    async search({ skip, limit, ...info } = {}) {
+      if (this.subid) {
+        const res = await this.query({ skip, limit, status: '1', subid: this.subid, ...info });
+        if (this.$checkRes(res)) {
+          for (const val of res.data) {
+            const subject = this.subjectList.find(f => f.id == val.subid);
+            if (subject) val.subid = subject.name;
+          }
+          this.$set(this, `list`, res.data);
+        }
+      } else {
+        const res = await this.query({ skip, limit, status: '1', ...info });
+        if (this.$checkRes(res)) {
+          for (const val of res.data) {
+            const subject = this.subjectList.find(f => f.id == val.subid);
+            if (subject) val.subid = subject.name;
+          }
+          this.$set(this, `list`, res.data);
+        }
+      }
+    },
+  },
+  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;
+    },
+  },
+};
+</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;
+  .search {
+    height: 50px;
+    border-bottom: 1px solid red;
+    padding: 10px;
+  }
+  .info {
+    margin: 10px 0 0 0;
+    .list {
+      background-color: #ffffff;
+      margin: 0 10px 10px 10px;
+      width: 95%;
+      border-radius: 5px;
+      padding: 10px;
+    }
+    .sub {
+      font-size: 18px;
+      padding: 0 0 5px 0;
+    }
+    .teacher {
+      font-size: 16px;
+      padding: 0 0 5px 0;
+    }
+    .btn {
+      text-align: center;
+    }
+  }
+}
+/deep/.el-input__inner {
+  height: 28px;
+  line-height: 28px;
+}
+/deep/.el-input__icon {
+  line-height: 28px;
+}
+</style>

+ 1 - 1
src/views/user/leave.vue

@@ -55,7 +55,7 @@ export default {
   methods: {
     ...mapLeave(['query']),
     async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
-      const res = await this.query({ skip, limit, ...info });
+      const res = await this.query({ skip, limit, studentid: this.user.userid, ...info });
       if (this.$checkRes(res)) {
         this.$set(this, `leaveList`, res.data);
       }