Quellcode durchsuchen

学委为学生打平时分(学生表里个人分)更新

guhongwei vor 5 Jahren
Ursprung
Commit
259571265f
4 geänderte Dateien mit 336 neuen und 346 gelöschten Zeilen
  1. 305 305
      package-lock.json
  2. 3 3
      src/layout/class/achieve.vue
  3. 11 11
      src/layout/class/achieveList/peaceAchieve.vue
  4. 17 27
      src/views/class/achieve.vue

Datei-Diff unterdrückt, da er zu groß ist
+ 305 - 305
package-lock.json


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

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

+ 11 - 11
src/layout/class/achieveList/peaceAchieve.vue

@@ -7,13 +7,17 @@
             {{ item.name }}
           </el-col>
           <el-col :span="12" class="score">
-            <span>分数:{{ item.score }}分</span>
+            <span>分数:{{ item.selfscore }}分</span>
             <el-button type="primary" size="mini" @click="showBtn(item.id)" round>选择</el-button>
           </el-col>
         </el-col>
       </el-col>
     </el-row>
-    <van-form>
+    <!-- <van-field readonly clickable name="picker" :value="value" placeholder="点击选择分数" @click="showPicker = false" /> -->
+    <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">
@@ -21,7 +25,7 @@
           </van-popup>
         </template>
       </van-field>
-    </van-form>
+    </van-form> -->
   </div>
 </template>
 
@@ -30,25 +34,21 @@ export default {
   name: 'peaceAchieve',
   props: {
     peaceAchieveList: null,
-    score: null,
-    formscore: null,
     showPicker: null,
+    peaceScore: null,
   },
   components: {},
   data: () => ({
-    columns: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
+    columns: ['1', '2', '3', '4', '5', '7', '8', '9', '10'],
   }),
   created() {},
   computed: {},
   methods: {
-    onConfirm() {
-      this.$emit('access', { data: this.formscore });
-    },
     showBtn(id) {
       this.$emit('showBtn', id);
     },
-    showGuan() {
-      this.$emit('showGuan');
+    onConfirm(value) {
+      this.$emit('onConfirm', value);
     },
   },
 };

+ 17 - 27
src/views/class/achieve.vue

@@ -9,16 +9,13 @@
         <el-col :span="24" class="main">
           <achieves
             :peaceAchieveList="peaceAchieveList"
+            :showPicker="showPicker"
+            :peaceScore="peaceScore"
             @showBtn="showBtn"
-            @showGuan="showGuan"
-            @access="clickscore"
+            @onConfirm="onConfirm"
             :achieveList="achieveList"
             :show="show"
             :form="form"
-            :score="score"
-            :formscore="formscore"
-            @clickDialog="clickAchieve"
-            @submit="submitAchieve"
           ></achieves>
         </el-col>
       </el-col>
@@ -41,10 +38,8 @@ export default {
   },
   data: () => ({
     peaceAchieveList: [],
-    // showPicker: false,
-    // score: '',
-    score: false,
-    formscore: {},
+    showPicker: false,
+    peaceScore: '',
     studid: '',
     achieveList: [
       {
@@ -99,31 +94,26 @@ 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 });
+      console.log(res.data);
       this.$set(this, `peaceAchieveList`, res.data);
     },
+    // 平时成绩上分显示+学生id
     showBtn(id) {
       this.$set(this, `studid`, id);
-      this.score = true;
+      this.showPicker = 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;
+    // 给学生上分
+    async onConfirm(peaceScore) {
+      let data = {};
+      data.id = this.studid;
+      data.selfscore = peaceScore;
+      const res = await this.updates(data);
+      this.showPicker = false;
+      this.search();
     },
   },
 };