guhongwei 4 years ago
parent
commit
9e63117869
2 changed files with 61 additions and 0 deletions
  1. 6 0
      src/router/index.js
  2. 55 0
      src/views/teacher/index.vue

+ 6 - 0
src/router/index.js

@@ -219,6 +219,12 @@ const routes = [
         meta: { title: '课程教师评分' },
         component: () => import('@/views/stuscore/scoreList.vue'),
       },
+      {
+        path: '/teacher/index',
+        name: 'teacher_index',
+        meta: { title: '教师管理' },
+        component: () => import('@/views/teacher/index.vue'),
+      },
     ],
   },
   {

+ 55 - 0
src/views/teacher/index.vue

@@ -0,0 +1,55 @@
+<template>
+  <div id="index">
+    <list-frame :title="pageTitle" :needFilter="false" :needPag="false" :needAdd="false">
+      <data-table :fields="fields" :data="list" :opera="opera" @query="search" :total="total"></data-table>
+    </list-frame>
+  </div>
+</template>
+
+<script>
+import _ from 'lodash';
+import listFrame from '@frame/layout/admin/list-frame';
+import dataTable from '@frame/components/filter-page-table';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: teacher } = createNamespacedHelpers('teacher');
+export default {
+  name: 'index',
+  props: {},
+  components: { listFrame, dataTable },
+  data: () => {
+    return {
+      opera: [],
+      fields: [
+        { label: '姓名', prop: 'name', filter: true },
+        { label: '手机号', prop: 'phone', filter: true },
+      ],
+      list: [],
+      total: 0,
+    };
+  },
+  async created() {
+    this.search();
+  },
+  methods: {
+    ...teacher(['query']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped></style>