Ver Fonte

更新分组成绩

wuhongyuq há 5 anos atrás
pai
commit
7e7d71c968

+ 3 - 1
src/layout/class/achieve.vue

@@ -4,7 +4,7 @@
       <el-col :span="24">
         <van-tabs v-model="active">
           <van-tab title="平时成绩">
-            <peaceAchieve :peaceAchieveList="peaceAchieveList"></peaceAchieve>
+            <peaceAchieve v-on="$listeners" :formscore="formscore" :peaceAchieveList="peaceAchieveList" :score="score"></peaceAchieve>
           </van-tab>
           <van-tab title="作业成绩">
             <homeworkAchiece v-on="$listeners" :achieveList="achieveList" :show="show" :form="form"></homeworkAchiece>
@@ -22,6 +22,8 @@ export default {
   name: 'achieve',
   props: {
     peaceAchieveList: null, //平时成绩
+    score: null, //
+    formscore: null,
     achieveList: null, //作业成绩
     show: null, //显示弹框
     form: null, //修改form

+ 21 - 10
src/layout/class/achieveList/peaceAchieve.vue

@@ -8,14 +8,20 @@
           </el-col>
           <el-col :span="12" class="score">
             <span>分数:{{ item.score }}分</span>
-            <el-button type="primary" size="mini" @click="showPicker = true" round>选择</el-button>
+            <el-button type="primary" size="mini" @click="showBtn(item.id)" round>选择</el-button>
           </el-col>
         </el-col>
       </el-col>
     </el-row>
-    <van-popup v-model="showPicker" position="bottom">
-      <van-picker show-toolbar :columns="columns" @confirm="onConfirm" @cancel="showPicker = false" />
-    </van-popup>
+    <van-form>
+      <van-field v-model="formscore.score">
+        <template #input>
+          <van-popup v-model="score" position="bottom">
+            <van-picker show-toolbar :columns="columns" @confirm="onConfirm" @cancel="showGuan()" />
+          </van-popup>
+        </template>
+      </van-field>
+    </van-form>
   </div>
 </template>
 
@@ -24,20 +30,25 @@ export default {
   name: 'peaceAchieve',
   props: {
     peaceAchieveList: null,
+    score: null,
+    formscore: null,
+    showPicker: null,
   },
   components: {},
   data: () => ({
-    value: '',
     columns: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
-    showPicker: false,
   }),
   created() {},
   computed: {},
   methods: {
-    onConfirm(value) {
-      this.value = value;
-      console.log(value);
-      this.showPicker = false;
+    onConfirm() {
+      this.$emit('access', { data: this.formscore });
+    },
+    showBtn(id) {
+      this.$emit('showBtn', id);
+    },
+    showGuan() {
+      this.$emit('showGuan');
     },
   },
 };

+ 1 - 1
src/layout/class/classList.vue

@@ -4,7 +4,7 @@
       <el-col :span="24">
         <van-tabs v-model="active">
           <van-tab title="班级名单">
-            <span v-if="role === '4'">
+            <span v-if="role === '1'">
               <headNameList v-on="$listeners" :headNameList="headNameList" :assignShow="assignShow" :assignForm="assignForm" :name="name"></headNameList>
             </span>
             <span v-else>

+ 39 - 24
src/views/class/achieve.vue

@@ -9,9 +9,14 @@
         <el-col :span="24" class="main">
           <achieves
             :peaceAchieveList="peaceAchieveList"
+            @showBtn="showBtn"
+            @showGuan="showGuan"
+            @access="clickscore"
             :achieveList="achieveList"
             :show="show"
             :form="form"
+            :score="score"
+            :formscore="formscore"
             @clickDialog="clickAchieve"
             @submit="submitAchieve"
           ></achieves>
@@ -24,6 +29,8 @@
 <script>
 import NavBar from '@/layout/common/topInfo.vue';
 import achieves from '@/layout/class/achieve.vue';
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapStudent } = createNamespacedHelpers('student');
 
 export default {
   name: 'achieve',
@@ -33,28 +40,12 @@ export default {
     achieves, //班级学生成绩列表
   },
   data: () => ({
-    peaceAchieveList: [
-      {
-        name: '流域你好',
-        score: '10',
-      },
-      {
-        name: '流域',
-        score: '2',
-      },
-      {
-        name: '流域好',
-        score: '3',
-      },
-      {
-        name: '流域',
-        score: '4',
-      },
-      {
-        name: '流域',
-        score: '5',
-      },
-    ],
+    peaceAchieveList: [],
+    // showPicker: false,
+    // score: '',
+    score: false,
+    formscore: {},
+    studid: '',
     achieveList: [
       {
         studentid: '刘裕',
@@ -90,8 +81,12 @@ export default {
     transitionName: 'fade',
     navShow: true,
   }),
-  created() {},
-  computed: {},
+  created() {
+    this.search();
+  },
+  computed: {
+    ...mapState(['user']),
+  },
   mounted() {
     this.title = this.$route.meta.title;
     this.isleftarrow = this.$route.meta.isleftarrow;
@@ -103,9 +98,29 @@ export default {
     },
   },
   methods: {
+    ...mapStudent({ list: 'query', add: 'create', fet: 'fetch', updates: 'update' }),
+    async search() {
+      let classid = this.user.classid;
+      const res = await this.list({ classid });
+      this.$set(this, `peaceAchieveList`, res.data);
+    },
+    showBtn(id) {
+      this.$set(this, `studid`, id);
+      this.score = true;
+    },
+    showGuan() {
+      this.score = false;
+    },
+    async clickscore(formscore) {
+      this.formscore.id = this.$route.query.id;
+      let data = this.formscore;
+      const ress = await this.updates(data);
+      this.score = false;
+    },
     clickAchieve() {
       this.show = true;
     },
+
     submitAchieve(form) {
       console.log(form);
       this.show = false;

+ 40 - 40
src/views/class/index.vue

@@ -42,11 +42,6 @@ import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: mapGroup } = createNamespacedHelpers('group');
 const { mapActions: mapStudent } = createNamespacedHelpers('student');
 const { mapActions: mapclasses } = createNamespacedHelpers('classes');
-let site = JSON.parse(sessionStorage.getItem('site'));
-const termid = site.termid;
-const batchid = site.batchid;
-const classid = site.classid;
-const stuid = site.id;
 const type = '班长';
 export default {
   name: 'index',
@@ -81,27 +76,11 @@ export default {
     assignShow: false,
     assignForm: {},
     // 学生看学生名单
-    stuNameList: [
-      {
-        name: '测试人员',
-        job: '班长',
-      },
-      {
-        name: '测试人',
-        job: '',
-      },
-      {
-        name: '测试人员',
-        job: '班长',
-      },
-      {
-        name: '测试人',
-        job: '班长',
-      },
-    ],
+    stuNameList: [],
     groupList: [],
     stuIdAndGroupId: '',
-    noGroupStudentNames: '',
+    // noGroupStudentNames: '',
+    noGroupStudentNames: [],
     title: '',
     isleftarrow: '',
     transitionName: 'fade',
@@ -110,6 +89,7 @@ export default {
   created() {
     this.findList();
     this.search();
+    this.searchstu();
   },
   computed: {
     ...mapState(['user']),
@@ -126,32 +106,41 @@ export default {
   },
   methods: {
     ...mapStudent({ list: 'query', add: 'create', fet: 'fetch', updates: 'update' }),
+    //班主任
     async search() {
+      let termid = this.user.termid;
+      let batchid = this.user.batchid;
+      let stuid = this.user.userid;
       let classid = this.user.classid;
       const res = await this.list({ classid });
       console.log(res);
-
       this.$set(this, `headNameList`, res.data);
     },
-    async clickAssign({ id, name }) {
-      console.log(name);
+    //学生
+    async searchstu() {
+      let termid = this.user.termid;
+      let batchid = this.user.batchid;
+      let stuid = this.user.userid;
+      let classid = this.user.classid;
+      const res = await this.list({ classid });
+      console.log(res);
+
+      this.$set(this, `stuNameList`, res.data);
+    },
 
+    async clickAssign({ id, name }) {
       this.assignShow = true;
       this.$set(this, `xsid`, id);
       this.$set(this, `name`, name);
     },
     async onAssignShow(assignForm) {
-      console.log(this.xsid);
-
       this.assignShow = false;
       this.assignForm.id = this.xsid;
       let data = this.assignForm;
       let res = await this.updates(data);
       let classid = this.user.classid;
       const ress = await this.list({ classid });
-      console.log(res);
       this.$set(this, `headNameList`, ress.data);
-      console.log(res);
       this.$message({
         message: '评分成功',
         type: 'success',
@@ -165,17 +154,23 @@ export default {
     // 查询小组列表
     async findList() {
       let data = {};
-      data.termid = termid;
-      data.batchid = batchid;
-      data.classid = classid;
+      data.termid = this.user.termid;
+      data.batchid = this.user.batchid;
+      data.classid = this.user.classid;
+      let stuid = this.user.userid;
+      // data.termid = termid;
+      // data.batchid = batchid;
+      // data.classid = classid;
       const result = await this.query(data);
       const groupList = result.data;
+      console.log(noGroupStudentNames);
       this.$set(this, 'groupList', groupList);
       // 找出登陆者在哪个组
       // 找出组id
       let groupId = '';
       // 所有有组学生id
       let studentIds = [];
+
       var i = groupList.findIndex(value => {
         var v = value.students.findIndex(value => {
           studentIds.push(value.stuid);
@@ -192,7 +187,11 @@ export default {
       // 登陆者属于哪个组id
       stuIdAndGroupId.groupId = groupId;
       // 登陆者身份是否为班长
+      // let job = this.user.job;
+      // console.log(stuIdAndGroupId.job);
+      //   stuIdAndGroupId.job = job;
       stuIdAndGroupId.type = type;
+
       this.$set(this, 'stuIdAndGroupId', stuIdAndGroupId);
       // 所有学生
       let studentList = await this.stuQery(data);
@@ -213,9 +212,10 @@ export default {
     },
     // 创建小组
     async saveGroup({ data }) {
-      data.termid = termid;
-      data.batchid = batchid;
-      data.classid = classid;
+      data.termid = this.user.termid;
+      data.batchid = this.user.batchid;
+      data.classid = this.user.classid;
+
       const result = await this.create(data);
       if (result.errcode == 0) {
         this.findList();
@@ -225,8 +225,8 @@ export default {
     async joinGroup({ groupId }) {
       let data = {};
       data.groupid = groupId;
-      data.stuid = stuid;
-      data.stuname = site.name;
+      data.stuid = this.user.userid;
+      data.stuname = this.user.name;
       const result = await this.insert(data);
       if (result.errcode == 0) {
         this.findList();
@@ -236,7 +236,7 @@ export default {
     async exitGroup({ groupId }) {
       let data = {};
       data.groupid = groupId;
-      data.stuid = stuid;
+      data.stuid = this.user.userid;
       const result = await this.exit(data);
       if (result.errcode == 0) {
         this.findList();