guhongwei 4 年之前
父節點
當前提交
77c12fd296

+ 2 - 2
src/layout/teacherscore/mainData.vue

@@ -26,7 +26,7 @@
           </el-col>
           </el-col>
           <el-col :span="24" class="anniu">
           <el-col :span="24" class="anniu">
             <el-form-item>
             <el-form-item>
-              <el-button type="primary" @click="onSubmit">提交</el-button>
+              <el-button type="primary" @click="onSubmit" :disabled="disabled">提交</el-button>
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
         </el-form>
         </el-form>
@@ -37,7 +37,7 @@
 <script>
 <script>
 export default {
 export default {
   name: 'mainData',
   name: 'mainData',
-  props: { teacherinfo: null, xsscore: null, form: null },
+  props: { teacherinfo: null, xsscore: null, form: null, disabled: Boolean },
   components: {},
   components: {},
   data: () => ({
   data: () => ({
     srcurl: require('@/assets/circle.png'),
     srcurl: require('@/assets/circle.png'),

+ 4 - 132
src/layout/user/studentInfo.vue

@@ -7,137 +7,9 @@
             <div class="block"><el-avatar :size="163" :src="circleUrl"></el-avatar></div>
             <div class="block"><el-avatar :size="163" :src="circleUrl"></el-avatar></div>
           </div>
           </div>
         </el-col>
         </el-col>
-        <!-- <span>
-          <el-col :span="24" class="mess">
-            <el-col :span="22" class="info">
-              <p class="title">姓名</p>
-              <p class="name">{{ messInfo.name }}</p>
-            </el-col>
-            <el-col :span="2" class="icon">
-              <van-icon name="arrow" />
-            </el-col>
-          </el-col>
-          <el-col :span="24" class="mess">
-            <el-col :span="22" class="info">
-              <p class="title">身份证号</p>
-              <p class="name">{{ messInfo.id_number }}</p>
-            </el-col>
-            <el-col :span="2" class="icon">
-              <van-icon name="arrow" />
-            </el-col>
-          </el-col>
-          <el-col :span="24" class="mess">
-            <el-col :span="22" class="info">
-              <p class="title">性别</p>
-              <p class="name">{{ messInfo.gender }}</p>
-            </el-col>
-            <el-col :span="2" class="icon">
-              <van-icon name="arrow" />
-            </el-col>
-          </el-col>
-          <el-col :span="24" class="mess">
-            <el-col :span="22" class="info">
-              <p class="title">民族</p>
-              <p class="name">{{ messInfo.nation }}</p>
-            </el-col>
-            <el-col :span="2" class="icon">
-              <van-icon name="arrow" />
-            </el-col>
-          </el-col>
-          <el-col :span="24" class="mess">
-            <el-col :span="22" class="info">
-              <p class="title">手机号</p>
-              <p class="name">{{ messInfo.phone }}</p>
-            </el-col>
-            <el-col :span="2" class="icon">
-              <van-icon name="arrow" />
-            </el-col>
-          </el-col>
-          <el-col :span="24" class="mess">
-            <el-col :span="22" class="info">
-              <p class="title">QQ</p>
-              <p class="name">{{ messInfo.qq }}</p>
-            </el-col>
-            <el-col :span="2" class="icon">
-              <van-icon name="arrow" />
-            </el-col>
-          </el-col>
-          <el-col :span="24" class="mess">
-            <el-col :span="22" class="info">
-              <p class="title">学校</p>
-              <p class="name">{{ messInfo.school_name }}</p>
-            </el-col>
-            <el-col :span="2" class="icon">
-              <van-icon name="arrow" />
-            </el-col>
-          </el-col>
-          <el-col :span="24" class="mess">
-            <el-col :span="22" class="info">
-              <p class="title">所在院系</p>
-              <p class="name">{{ messInfo.faculty }}</p>
-            </el-col>
-            <el-col :span="2" class="icon">
-              <van-icon name="arrow" />
-            </el-col>
-          </el-col>
-          <el-col :span="24" class="mess">
-            <el-col :span="22" class="info">
-              <p class="title">所在专业</p>
-              <p class="name">{{ messInfo.major }}</p>
-            </el-col>
-            <el-col :span="2" class="icon">
-              <van-icon name="arrow" />
-            </el-col>
-          </el-col>
-          <el-col :span="24" class="mess">
-            <el-col :span="22" class="info">
-              <p class="title">入学年份</p>
-              <p class="name">{{ messInfo.entry_year }}</p>
-            </el-col>
-            <el-col :span="2" class="icon">
-              <van-icon name="arrow" />
-            </el-col>
-          </el-col>
-          <el-col :span="24" class="mess">
-            <el-col :span="22" class="info">
-              <p class="title">毕业年份</p>
-              <p class="name">{{ messInfo.finish_year }}</p>
-            </el-col>
-            <el-col :span="2" class="icon">
-              <van-icon name="arrow" />
-            </el-col>
-          </el-col>
-          <el-col :span="24" class="mess">
-            <el-col :span="22" class="info">
-              <p class="title">在校所担当职务</p>
-              <p class="name">{{ messInfo.school_job }}</p>
-            </el-col>
-            <el-col :span="2" class="icon">
-              <van-icon name="arrow" />
-            </el-col>
-          </el-col>
-          <el-col :span="24" class="mess">
-            <el-col :span="22" class="info">
-              <p class="title">e-mail</p>
-              <p class="name">{{ messInfo.email }}</p>
-            </el-col>
-            <el-col :span="2" class="icon">
-              <van-icon name="arrow" />
-            </el-col>
-          </el-col>
-          <el-col :span="24" class="mess">
-            <el-col :span="22" class="info">
-              <p class="title">户口所在地</p>
-              <p class="name">{{ messInfo.family_place }}</p>
-            </el-col>
-            <el-col :span="2" class="icon">
-              <van-icon name="arrow" />
-            </el-col>
-          </el-col>
-        </span> -->
         <!-- 学生修改 -->
         <!-- 学生修改 -->
         <van-col span="24">
         <van-col span="24">
-          <van-form @submit="onSubmit">
+          <van-form>
             <van-field v-model="messInfo.name" name="姓名" label="姓名" placeholder="姓名" :rules="[{ required: true, message: '请填写用户名' }]" />
             <van-field v-model="messInfo.name" name="姓名" label="姓名" placeholder="姓名" :rules="[{ required: true, message: '请填写用户名' }]" />
             <van-field v-model="messInfo.id_number" name="身份证号" label="身份证号" placeholder="身份证号" />
             <van-field v-model="messInfo.id_number" name="身份证号" label="身份证号" placeholder="身份证号" />
             <van-field name="radio" label="性别">
             <van-field name="radio" label="性别">
@@ -176,9 +48,7 @@
             <van-field v-model="messInfo.email" name="e-mail" label="e-mail" placeholder="e-mail" />
             <van-field v-model="messInfo.email" name="e-mail" label="e-mail" placeholder="e-mail" />
             <van-field v-model="messInfo.family_place" name="户口所在地" label="户口所在地" placeholder="户口所在地" />
             <van-field v-model="messInfo.family_place" name="户口所在地" label="户口所在地" placeholder="户口所在地" />
             <div style="margin: 16px;">
             <div style="margin: 16px;">
-              <van-button round block type="info" native-type="submit">
-                保存
-              </van-button>
+              <van-button :loading="loading" round type="info" size="large" @click="onSubmit" :loading-text="loadingText">提交</van-button>
             </div>
             </div>
           </van-form>
           </van-form>
         </van-col>
         </van-col>
@@ -197,6 +67,7 @@ export default {
     messInfo: null,
     messInfo: null,
     teainfo: null,
     teainfo: null,
     jianshiinfo: null,
     jianshiinfo: null,
+    loading: Boolean,
   },
   },
   components: {},
   components: {},
   data: () => ({
   data: () => ({
@@ -206,6 +77,7 @@ export default {
     school: [],
     school: [],
     schoolList: [],
     schoolList: [],
     showSchool: false,
     showSchool: false,
+    loadingText: '加载中...',
   }),
   }),
   created() {
   created() {
     this.otherList();
     this.otherList();

+ 22 - 16
src/views/question/question.vue

@@ -6,7 +6,7 @@
           <nav-bar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </nav-bar>
           <nav-bar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </nav-bar>
         </el-col>
         </el-col>
         <el-col :span="24" class="main" v-if="info">
         <el-col :span="24" class="main" v-if="info">
-          <question-info :info="info" :form="form" @submit="submit"></question-info>
+          <question-info :info="info" :form="form" @submit="submit" :loading="loading"></question-info>
         </el-col>
         </el-col>
         <el-col :span="24" class="foot">
         <el-col :span="24" class="foot">
           <foot-info></foot-info>
           <foot-info></foot-info>
@@ -40,6 +40,7 @@ export default {
     isleftarrow: '',
     isleftarrow: '',
     transitionName: 'fade',
     transitionName: 'fade',
     navShow: true,
     navShow: true,
+    loading: false,
   }),
   }),
   created() {
   created() {
     this.searchInfo();
     this.searchInfo();
@@ -89,22 +90,27 @@ export default {
     },
     },
     // 提交答案
     // 提交答案
     async submit(task) {
     async submit(task) {
-      let { answerid } = task;
-      let { termid, batchid, classid, userid: studentid, planid } = this.user;
-      let answers = task.question.map(i => {
-        let { answer, _id: questionid } = i;
-        answer ? (answer = JSON.stringify(answer)) : '';
-        return { answer, questionid };
-      });
-      let object = { termid, batchid, classid, studentid, planid: this.user.planid, questionnaireid: this.id, answers };
-      let res;
-      if (!answerid) {
-        res = await this.sendAnswer(object);
-      } else {
-        object.id = answerid;
-        res = await this.updateAnswer(object);
+      try {
+        this.loading = true;
+        let { answerid } = task;
+        let { termid, batchid, classid, userid: studentid, planid } = this.user;
+        let answers = task.question.map(i => {
+          let { answer, _id: questionid } = i;
+          answer ? (answer = JSON.stringify(answer)) : '';
+          return { answer, questionid };
+        });
+        let object = { termid, batchid, classid, studentid, planid: this.user.planid, questionnaireid: this.id, answers };
+        let res;
+        if (!answerid) {
+          res = await this.sendAnswer(object);
+        } else {
+          object.id = answerid;
+          res = await this.updateAnswer(object);
+        }
+        this.$checkRes(res, '提交成功', res.errmsg);
+      } finally {
+        this.loading = false;
       }
       }
-      this.$checkRes(res, '提交成功', res.errmsg);
     },
     },
   },
   },
 };
 };

+ 6 - 2
src/views/teacherscore/index.vue

@@ -6,7 +6,7 @@
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         </el-col>
         <el-col :span="24" class="main">
         <el-col :span="24" class="main">
-          <mainData :teacherinfo="teacherinfo" :xsscore="xsscore" :form="form" @onsave="onsave"></mainData>
+          <mainData :teacherinfo="teacherinfo" :xsscore="xsscore" :form="form" @onsave="onsave" :disabled="disabled"></mainData>
         </el-col>
         </el-col>
         <el-col :span="24" class="foot">
         <el-col :span="24" class="foot">
           <footInfo></footInfo>
           <footInfo></footInfo>
@@ -38,6 +38,7 @@ export default {
     title: '',
     title: '',
     isleftarrow: '',
     isleftarrow: '',
     navShow: true,
     navShow: true,
+    disabled: false,
   }),
   }),
   created() {
   created() {
     this.searchInfo();
     this.searchInfo();
@@ -73,15 +74,18 @@ export default {
     },
     },
     // 为教师打分
     // 为教师打分
     async onsave(form) {
     async onsave(form) {
+      this.disabled = true;
       this.form.stuid = this.user.id;
       this.form.stuid = this.user.id;
       this.form.lessonid = this.lessonid;
       this.form.lessonid = this.lessonid;
       this.form.teacherid = this.teaid;
       this.form.teacherid = this.teaid;
       let data = this.form;
       let data = this.form;
       const res = await this.create(data);
       const res = await this.create(data);
-      this.$message({
+      this.$notify({
         message: '评分成功',
         message: '评分成功',
         type: 'success',
         type: 'success',
       });
       });
+      this.form = {};
+      this.disabled = false;
       this.searchInfo();
       this.searchInfo();
     },
     },
   },
   },

+ 44 - 38
src/views/user/dati.vue

@@ -7,7 +7,7 @@
         </el-col>
         </el-col>
         <el-col :span="24" class="main">
         <el-col :span="24" class="main">
           <el-col :span="24" class="leaveList" v-if="task.id">
           <el-col :span="24" class="leaveList" v-if="task.id">
-            <task :task="task" :answer="answer" @submit="onsave"></task>
+            <task :task="task" :answer="answer" @submit="onsave" :loading="loadingsubmit"></task>
           </el-col>
           </el-col>
         </el-col>
         </el-col>
       </el-col>
       </el-col>
@@ -40,6 +40,7 @@ export default {
     answer: [],
     answer: [],
     taskid: '',
     taskid: '',
     taskAnswer: null,
     taskAnswer: null,
+    loadingsubmit: false,
   }),
   }),
   mounted() {
   mounted() {
     this.title = this.$route.meta.title;
     this.title = this.$route.meta.title;
@@ -101,45 +102,50 @@ export default {
     },
     },
 
 
     async onsave() {
     async onsave() {
-      let task = _.cloneDeep(this.task);
-      let obj = {};
-      console.log(this.task);
-      console.log(task);
-      if (!this.taskAnswer) {
-        console.log('as');
+      try {
+        this.loadingsubmit = true;
+        let task = _.cloneDeep(this.task);
+        let obj = {};
         console.log(this.task);
         console.log(this.task);
         console.log(task);
         console.log(task);
-        obj = {
-          termid: this.user.termid,
-          batchid: this.user.batchid,
-          classid: this.user.classid,
-          lessonid: this.lessonid,
-          lessonname: this.task.name,
-          studentid: this.user.userid,
-          taskid: this.taks ? this.task.id : task.id,
-        };
-        console.log('1');
-      } else {
-        obj = _.cloneDeep(this.taskAnswer);
-        console.log('2');
-      }
-      let studanswer = [];
-      let { question } = task;
-      for (const quest of question) {
-        const { topic, answers, _id: questionid } = quest;
-        let obj = { topic, questionid };
-        if (_.isString(answers)) obj.answer = answers;
-        else obj.answer = JSON.stringify(answers);
-        studanswer.push(obj);
-      }
-      obj.answers = studanswer;
-      console.log(obj);
-      if (!obj.id) {
-        let res = await this.Uploadtaskadd(obj);
-        if (this.$checkRes(res, '作业提交成功', res.errmsg || '作业提交失败')) window.history.go(-1);
-      } else {
-        let res = await this.Uploadtaskupdates(obj);
-        if (this.$checkRes(res, '作业修改成功', res.errmsg || '作业修改失败')) window.history.go(-1);
+        if (!this.taskAnswer) {
+          console.log('as');
+          console.log(this.task);
+          console.log(task);
+          obj = {
+            termid: this.user.termid,
+            batchid: this.user.batchid,
+            classid: this.user.classid,
+            lessonid: this.lessonid,
+            lessonname: this.task.name,
+            studentid: this.user.userid,
+            taskid: this.taks ? this.task.id : task.id,
+          };
+          console.log('1');
+        } else {
+          obj = _.cloneDeep(this.taskAnswer);
+          console.log('2');
+        }
+        let studanswer = [];
+        let { question } = task;
+        for (const quest of question) {
+          const { topic, answers, _id: questionid } = quest;
+          let obj = { topic, questionid };
+          if (_.isString(answers)) obj.answer = answers;
+          else obj.answer = JSON.stringify(answers);
+          studanswer.push(obj);
+        }
+        obj.answers = studanswer;
+        console.log(obj);
+        if (!obj.id) {
+          let res = await this.Uploadtaskadd(obj);
+          if (this.$checkRes(res, '作业提交成功', res.errmsg || '作业提交失败')) window.history.go(-1);
+        } else {
+          let res = await this.Uploadtaskupdates(obj);
+          if (this.$checkRes(res, '作业修改成功', res.errmsg || '作业修改失败')) window.history.go(-1);
+        }
+      } finally {
+        this.loadingsubmit = false;
       }
       }
     },
     },
   },
   },

+ 2 - 1
src/views/user/homework/task.vue

@@ -34,7 +34,7 @@
             </span>
             </span>
           </el-col>
           </el-col>
           <el-col :span="24" class="btn">
           <el-col :span="24" class="btn">
-            <el-button type="primary" @click="onSubmit">提交</el-button>
+            <van-button :loading="loading" round type="info" size="large" @click="onSubmit" :loading-text="loadingText">提交</van-button>
           </el-col>
           </el-col>
         </el-form>
         </el-form>
       </el-col>
       </el-col>
@@ -49,6 +49,7 @@ export default {
   props: {
   props: {
     task: null,
     task: null,
     answer: null,
     answer: null,
+    loading: Boolean,
   },
   },
   components: {},
   components: {},
   data: () => ({}),
   data: () => ({}),

+ 14 - 8
src/views/user/personalDetail.vue

@@ -6,7 +6,7 @@
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         </el-col>
         <el-col :span="24" class="main">
         <el-col :span="24" class="main">
-          <studentInfo :messInfo="messInfo" @onSubmit="onSubmit"></studentInfo>
+          <studentInfo :messInfo="messInfo" @onSubmit="onSubmit" :loading="loading"></studentInfo>
         </el-col>
         </el-col>
       </el-col>
       </el-col>
     </el-row>
     </el-row>
@@ -31,6 +31,7 @@ export default {
     isleftarrow: '',
     isleftarrow: '',
     navShow: true,
     navShow: true,
     messInfo: {},
     messInfo: {},
+    loading: false,
   }),
   }),
   created() {
   created() {
     this.searchInfo();
     this.searchInfo();
@@ -59,13 +60,18 @@ export default {
       this.$set(this, `messInfo`, res.data);
       this.$set(this, `messInfo`, res.data);
     },
     },
     async onSubmit({ data }) {
     async onSubmit({ data }) {
-      data.status = '0';
-      const res = await this.studentUpdate(data);
-      if (this.$checkRes(res)) {
-        this.$notify({
-          message: '修改信息成功,等待确认',
-          type: 'success',
-        });
+      try {
+        this.loading = true;
+        data.status = '0';
+        const res = await this.studentUpdate(data);
+        if (this.$checkRes(res)) {
+          this.$notify({
+            message: '修改信息成功,等待确认',
+            type: 'success',
+          });
+        }
+      } finally {
+        this.loading = false;
       }
       }
     },
     },
   },
   },