wuhongyuq преди 5 години
родител
ревизия
afbcd120b3
променени са 6 файла, в които са добавени 195 реда и са изтрити 14 реда
  1. 84 7
      src/layout/teacherscore/mainData.vue
  2. 1 0
      src/router/index.js
  3. 4 0
      src/store/index.js
  4. 38 0
      src/store/score.js
  5. 38 0
      src/store/teacher.js
  6. 30 7
      src/views/teacherscore/index.vue

+ 84 - 7
src/layout/teacherscore/mainData.vue

@@ -1,19 +1,96 @@
-6<template>
+<template>
   <div id="mainData">
-    <el-row> </el-row>
+    <el-row>
+      <el-col :span="24" class="info">
+        <el-form ref="form" :model="form">
+          <el-col :span="24" class="top">
+            <van-image round width="10rem" height="10rem" :src="srcurl" />
+            <el-col :span="24">{{ teacherinfo.name }}</el-col>
+          </el-col>
+
+          <el-col :span="24"></el-col>
+          <el-col :span="24" class="pingfen">
+            <el-form-item>
+              <el-rate v-model="form.score"></el-rate>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="24">
+            <el-col :span="16" class="title">工作量</el-col>
+            <el-col :span="8" class="fenshu">评分:10分</el-col>
+            <el-col :span="24" class="work">本周工作饱满</el-col>
+          </el-col>
+          <el-col :span="24" class="beizhu">
+            <span>备注</span>
+            <el-input type="textarea" v-model="form.remark"></el-input>
+          </el-col>
+          <el-col :span="24" class="anniu">
+            <el-form-item>
+              <el-button type="primary" @click="onSubmit">提交</el-button>
+            </el-form-item>
+          </el-col>
+        </el-form>
+      </el-col>
+    </el-row>
   </div>
 </template>
-
 <script>
 export default {
   name: 'mainData',
-  props: {},
+  props: { teacherinfo: null, form: null },
   components: {},
-  data: () => ({}),
+  data: () => ({
+    srcurl: require('@/assets/circle.png'),
+  }),
   created() {},
   computed: {},
-  methods: {},
+  methods: {
+    onSubmit() {
+      this.$emit('onsave', { data: this.form });
+    },
+  },
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.info {
+  background-color: #ffffff;
+}
+.top {
+  text-align: center;
+  padding: 30px 0 0 0;
+}
+.pingfen {
+  text-align: center;
+  padding: 10px 0 0 0;
+  border-bottom: 1px dashed #bbbbbb;
+}
+.context {
+  padding: 30px 0 0 0;
+  height: 120px;
+}
+.title {
+  padding: 10px 0 0 20px;
+}
+.fenshu {
+  padding: 10px 0 0 0;
+}
+.work {
+  color: #319ff7;
+  padding: 10px 0 0 20px;
+}
+.beizhu {
+  margin: 20px;
+}
+/deep/.beizhu .el-textarea__inner {
+  background-color: #f5f5f5;
+  width: 90%;
+  margin: 20px 0 0 0;
+  height: 100px;
+}
+
+.anniu {
+  padding: 20px 0 0 0;
+  text-align: center;
+}
+</style>

+ 1 - 0
src/router/index.js

@@ -27,6 +27,7 @@ const routes = [
   // 教师评分
   {
     path: '/teacherscore/index',
+    meta: { title: '教师评分', isleftarrow: true },
     component: () => import('../views/teacherscore/index.vue'),
   },
   // 班级名单-上成绩

+ 4 - 0
src/store/index.js

@@ -7,6 +7,8 @@ import question from './question';
 import questionnaire from './questionnaire';
 import student from './student';
 import lesson from './lesson';
+import teacher from './teacher';
+import score from './score';
 
 Vue.use(Vuex);
 
@@ -19,6 +21,8 @@ export default new Vuex.Store({
     questionnaire,
     student,
     lesson,
+    teacher,
+    score,
   },
   state: {}, //变量
   mutations: {}, //同步方法

+ 38 - 0
src/store/score.js

@@ -0,0 +1,38 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  scoreInfo: `/api/train/score`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.scoreInfo}`, { skip, limit, ...info });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.scoreInfo}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.scoreInfo}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.scoreInfo}/update/${id}`, data);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.scoreInfo}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 38 - 0
src/store/teacher.js

@@ -0,0 +1,38 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  studentInfo: `/api/train/teacher`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.studentInfo}`, { skip, limit, ...info });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.studentInfo}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.studentInfo}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.studentInfo}/update/${id}`, data);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.studentInfo}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 30 - 7
src/views/teacherscore/index.vue

@@ -6,7 +6,7 @@
           <topInfo></topInfo>
         </el-col>
         <el-col :span="24" class="main">
-          <mainData></mainData>
+          <mainData :teacherinfo="teacherinfo" :form="form" @onsave="onsave"></mainData>
         </el-col>
         <el-col :span="24" class="foot">
           <footInfo></footInfo>
@@ -20,9 +20,10 @@
 import topInfo from '@/layout/teacherscore/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
 import mainData from '@/layout/teacherscore/mainData.vue';
-const { mapActions: lesson } = createNamespacedHelpers('lesson');
+const { mapActions: teacher } = createNamespacedHelpers('teacher');
 import { createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: mapStudent } = createNamespacedHelpers('student');
+const { mapActions: mapScore } = createNamespacedHelpers('score');
 export default {
   name: 'index',
   props: {},
@@ -32,13 +33,35 @@ export default {
     mainData, //课程安排主体
   },
   data: () => ({
-    dates: '',
-    week: '',
+    teacherinfo: {},
+    form: {},
   }),
-  created() {},
-  computed: {},
+  created() {
+    this.searchInfo();
+  },
+  computed: {
+    id() {
+      return this.$route.query.id;
+    },
+  },
   mounted() {},
-  methods: {},
+  watch: {},
+  methods: {
+    ...teacher({ columnList: 'query', teacherInfo: 'fetch' }),
+    ...mapScore(['fetch', 'create', 'update']),
+
+    async searchInfo() {
+      const res = await this.teacherInfo(this.id);
+      console.log(res);
+      this.$set(this, `teacherinfo`, res.data);
+    },
+    async onsave(form) {
+      let data = this.form;
+      let res = await this.create(data);
+      console.log('成功');
+      // res = await this.create(form);
+    },
+  },
 };
 </script>