guhongwei há 4 anos atrás
pai
commit
263b77f97d

+ 1 - 1
src/views/class/newClass/nameList.vue

@@ -39,7 +39,7 @@ export default {
     return {
       show: false,
       form: {},
-      selectList: [{ name: '文艺委员' }, { name: '安全委员' }, { name: '宣传委员,' }, { name: '普通学员' }],
+      selectList: [{ name: '文艺委员' }, { name: '安全委员' }, { name: '宣传委员' }, { name: '普通学员' }],
       columns: ['男', '女', '全部'],
       showPicker: false,
     };

+ 111 - 0
src/views/user/pingfenGroup/index.vue

@@ -0,0 +1,111 @@
+<template>
+  <div id="index">
+    <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="list" v-for="(item, index) in list" :key="index">
+            <el-col :span="18" class="txt">
+              <p>{{ item.name }}</p>
+              <p>
+                <span>小组人数:{{ item.students.length }}人</span>
+                <span>小组状态:{{ item.status == '0' ? '未锁定' : '已锁定' }}</span>
+              </p>
+            </el-col>
+            <el-col :span="6" class="btn">
+              <el-button type="primary" size="mini" @click="$router.push({ path: '/user/pingfenGroup/lesson', query: { id: item.id } })">小组打分</el-button>
+            </el-col>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import NavBar from '@/layout/common/topInfo.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: group } = createNamespacedHelpers('group');
+export default {
+  name: 'index',
+  props: {},
+  components: {
+    NavBar,
+  },
+  data: function() {
+    return {
+      title: '',
+      isleftarrow: '',
+      navShow: true,
+      list: [],
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...group({ groupQuery: 'query' }),
+    async search() {
+      let res = await this.groupQuery({ classid: this.user.classid });
+      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>
+p {
+  padding: 0;
+  margin: 0;
+}
+.style {
+  width: 100%;
+  min-height: 667px;
+  position: relative;
+  background-color: #f9fafc;
+}
+.top {
+  height: 46px;
+  overflow: hidden;
+}
+.main {
+  min-height: 570px;
+  .list {
+    border-bottom: 1px dashed #ccc;
+    padding: 10px 0;
+    margin: 0 10px;
+    background: #fff;
+    width: 95%;
+    .txt {
+      padding: 0 0 0 10px;
+      p {
+        padding: 5px 0;
+      }
+      p:nth-child(2) {
+        span {
+          display: inline-block;
+          width: 50%;
+        }
+      }
+    }
+    .btn {
+      text-align: center;
+    }
+  }
+}
+</style>

+ 191 - 0
src/views/user/pingfenGroup/lesson.vue

@@ -0,0 +1,191 @@
+<template>
+  <div id="index">
+    <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="lessonList" v-for="(item, index) in lessonList" :key="index">
+            <el-col :span="16" class="name">
+              {{ item.subname }}
+            </el-col>
+            <el-col :span="8" class="btn">
+              <el-button type="primary" size="mini" @click="scoreBtn(item)">小组科目打分</el-button>
+            </el-col>
+            <el-col :span="24" class="other">
+              <span>科目教师:{{ item.teaname }}</span>
+              <span>科目时间:{{ item.date }}</span>
+            </el-col>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+    <van-dialog v-model="show" title="小组分" :showConfirmButton="false" :showCancelButton="true">
+      <van-form>
+        <van-field v-model="form.score" name="小组分" label="小组分" placeholder="请输入小组分" />
+        <div style="margin: 16px;">
+          <van-button round block type="info" @click="onSubmit">
+            提交
+          </van-button>
+        </div>
+      </van-form>
+    </van-dialog>
+  </div>
+</template>
+
+<script>
+import NavBar from '@/layout/common/topInfo.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: lesson } = createNamespacedHelpers('lesson');
+const { mapActions: util } = createNamespacedHelpers('util');
+const { mapActions: groupscore } = createNamespacedHelpers('groupscore');
+export default {
+  name: 'index',
+  props: {},
+  components: {
+    NavBar,
+  },
+  data: function() {
+    return {
+      title: '',
+      isleftarrow: '',
+      navShow: true,
+      lessonList: [],
+      show: false,
+      form: {},
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...lesson({ lessionInfo: 'fetch', lessionList: 'query' }),
+    ...util({ modelFetch: 'fetch' }),
+    ...groupscore({ groupscoreQuery: 'query', groupscoreUpdate: 'update', groupscoreCreate: 'create' }),
+    async search() {
+      let classid = this.user.classid;
+      const lesson = await this.modelFetch({ model: 'lesson', classid });
+      let lessons = _.get(lesson.data, 'lessons', []);
+      // lesson排序,只去时间最早的作为作业的上传lessonid,需要和学生作业列表处相同处理
+      let r = lessons.filter(f => f.subid);
+      r = r.map(r => {
+        let time = r.time.split('-');
+        r.start = `${r.date} ${time[0]}`;
+        return r;
+      });
+      r = Object.values(_.groupBy(r, 'subid'));
+      r = r.map(a => {
+        let na = _.orderBy(a, ['start'], ['asc']);
+        return _.head(na);
+      });
+      console.log(r);
+      this.$set(this, `lessonList`, r);
+    },
+    // 打开小组分
+    async scoreBtn(item) {
+      let res = await this.groupscoreQuery({ classid: this.user.classid, subid: item.subid, groupid: this.$route.query.id });
+      if (res.total > 0) {
+        this.$set(this, `form`, res.data[0]);
+      } else {
+        let data = {
+          classid: this.user.classid,
+          subid: item.subid,
+          date: item.date,
+          groupid: this.$route.query.id,
+          score: 0,
+        };
+        this.$set(this, `form`, data);
+      }
+      this.show = true;
+    },
+    // 保存小组分
+    async onSubmit() {
+      let data = this.form;
+      if (data.id) {
+        const res = await this.groupscoreUpdate(data);
+        if (res.errcode === 0) {
+          this.$notify({
+            message: '修改小组打分成功',
+            type: 'success',
+          });
+          this.show = false;
+        } else {
+          this.$notify({
+            message: res.errmsg,
+            type: 'danger',
+          });
+        }
+      } else {
+        const res = await this.groupscoreCreate(data);
+        if (res.errcode === 0) {
+          this.$notify({
+            message: '小组打分成功',
+            type: 'success',
+          });
+          this.show = false;
+        } else {
+          this.$notify({
+            message: res.errmsg,
+            type: 'danger',
+          });
+        }
+      }
+    },
+  },
+  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;
+  .lessonList {
+    border-bottom: 1px dashed #ccc;
+    padding: 10px 5px;
+    margin: 0 10px;
+    background: #fff;
+    width: 95%;
+    .name {
+      padding: 5px 0;
+    }
+    .btn {
+      padding: 5px 0;
+      text-align: center;
+    }
+    .other {
+      padding: 5px 0 0 0;
+      span {
+        display: inline-block;
+        width: 50%;
+      }
+    }
+  }
+}
+p {
+  padding: 0;
+  margin: 0;
+}
+</style>