wuhongyu 4 rokov pred
rodič
commit
6b67ae3a3c

+ 3 - 3
src/layout/user/workList.vue

@@ -7,7 +7,7 @@
             <el-col :span="18">科目:{{ item.subname }}</el-col>
             <el-col :span="6" class="anniu">
               <el-button v-if="item.display === 'second'" type="primary" size="small" @click="clickBtn(item.subname, item.subid, item._id)">在线作答</el-button>
-              <el-button v-else type="primary" size="small" @click="clickzy(item.subid)">上传作业</el-button>
+              <el-button v-else type="primary" size="small" @click="clickzy(item.subid, item.subname)">上传作业</el-button>
             </el-col>
           </el-col>
         </el-col>
@@ -32,8 +32,8 @@ export default {
     clickBtn(subname, subid, _id) {
       this.$router.push({ path: '/user/dati', query: { name: subname, id: subid, lessonid: _id } });
     },
-    clickzy(subid) {
-      this.$router.push({ path: '/user/chuanzuoye', query: { id: subid } });
+    clickzy(subid, subname) {
+      this.$router.push({ path: '/user/chuanzuoye', query: { id: subid, name: subname } });
     },
   },
 };

+ 5 - 0
src/views/user/chuanzuoye.vue

@@ -58,6 +58,10 @@ export default {
     id() {
       return this.$route.query.id;
     },
+
+    name() {
+      return this.$route.query.name;
+    },
   },
   methods: {
     ...mapUploadtask({ list: 'query', add: 'create', fet: 'fetch', updates: 'update' }),
@@ -69,6 +73,7 @@ export default {
       this.form.classid = this.user.classid;
       this.form.studentid = this.user.userid;
       this.form.lessonid = this.id;
+      this.form.lessonname = this.name;
       let data = this.form;
       console.log(data);
       let res = await this.add(data);