浏览代码

Merge branch 'develop' of http://52.130.252.100:10000/TEAMMODEL/TEAMModelOS into develop

zhouj1203@hotmail.com 2 年之前
父节点
当前提交
5d7f5a658b

+ 18 - 9
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/PaperViewBox/ArtView.vue

@@ -41,12 +41,12 @@
             {{ $t("answerSheet.dp.tip1") }}:{{ $t('studentWeb.art.tip1') }}
             {{ $t("answerSheet.dp.tip1") }}:{{ $t('studentWeb.art.tip1') }}
           </p>
           </p>
         </div>
         </div>
-        <div style="margin-bottom: 20px" v-if="hwInfo.answer && hwInfo.answer.attachments.length">
+        <div style="margin-bottom: 20px" v-if="hwInfo.answer">
           <p>{{ $t('jyzx.offline.submitFile') }}:
           <p>{{ $t('jyzx.offline.submitFile') }}:
             <!-- <span style="float: right; margin-right: 10px; color: #4e77b1; cursor: pointer;" @click="deleteFile">{{ $t("cusMgt.delBatch") }}</span> -->
             <!-- <span style="float: right; margin-right: 10px; color: #4e77b1; cursor: pointer;" @click="deleteFile">{{ $t("cusMgt.delBatch") }}</span> -->
           </p>
           </p>
           <div class="file-show">
           <div class="file-show">
-            <div v-for="(item, index) in hwInfo.answer.attachments" :key="index" class="one-show">
+            <div v-for="(item, index) in hwInfo.answer" :key="index" class="one-show">
               <div class="repair-link-wrap-item-box">
               <div class="repair-link-wrap-item-box">
                 <div class="file-icon">
                 <div class="file-icon">
                   <img :src="$tools.getFileThum(item.type, item.name)" />
                   <img :src="$tools.getFileThum(item.type, item.name)" />
@@ -328,15 +328,19 @@ export default {
             attachments: content,
             attachments: content,
             classId: this.getItemTitle.classIds[0], //行政班一个学生只会存在一个班级
             classId: this.getItemTitle.classIds[0], //行政班一个学生只会存在一个班级
           }
           }
-          // 如果是重新上传,要再传一个works里面的id
-          if (this.hwInfo.answer) params.id = this.hwInfo.answer.id
+          // 如果是重新上传,要再传一个works里面的id   #2642 后端调整结构后,不需要这个id
+          // if (this.hwInfo.answer) params.id = this.hwInfo.answer.id
           this.$api.studentWeb.uploadArtFile(params).then(res => {
           this.$api.studentWeb.uploadArtFile(params).then(res => {
-            if (res.code === 200 && res.record) {
+            // 后端结构调整,res.record不再返回,从param里面取attachments
+            if (res.code === 200) {
               this.uploadList.length = 0
               this.uploadList.length = 0
-              this.isUpload = false
               this.$Message.success(this.$t("jyzx.offline.uploadSuccess"))
               this.$Message.success(this.$t("jyzx.offline.uploadSuccess"))
-              this.$emit('changeHwAnswer', res.record, this.hwIndex)
+              this.$emit('changeHwAnswer', params, this.hwIndex)
+            } else {
+              this.$Message.success(this.$t("jyzx.offline.uploadError"))
             }
             }
+          }).finally(() => {
+              this.isUpload = false
           })
           })
         } catch (e) {
         } catch (e) {
           this.isUpload = false
           this.isUpload = false
@@ -490,7 +494,7 @@ export default {
         this.openSong = false
         this.openSong = false
         return
         return
       } else if(message === 'singComplete') {
       } else if(message === 'singComplete') {
-        let params = {
+        /* let params = {
           acId: this.hwInfo.id,
           acId: this.hwInfo.id,
           subject: this.hwInfo.subject,
           subject: this.hwInfo.subject,
           artId: this.getItemTitle.id,
           artId: this.getItemTitle.id,
@@ -499,8 +503,13 @@ export default {
           isAnswer: 1,
           isAnswer: 1,
           url: '', //智音作答详情
           url: '', //智音作答详情
         }
         }
+        params.url = this.zyModule('aqd', true) */
+        let params = {
+          id: `${this.userInfo.azp}-${this.userInfo.sub}`, //work里的id
+          artId: this.getItemTitle.id,
+          isAnswer: 1,
+        }
         // 返回智音详情链接
         // 返回智音详情链接
-        params.url = this.zyModule('aqd', true)
         this.$api.studentWeb.setArtScore(params).then(res => {
         this.$api.studentWeb.setArtScore(params).then(res => {
           this.hwInfo.isAnswer = 1
           this.hwInfo.isAnswer = 1
           this.finishSong = true
           this.finishSong = true

+ 11 - 10
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/PaperViewBox/PaperView.vue

@@ -239,11 +239,11 @@
                                             examInfo.quotaId = item.id
                                             examInfo.quotaId = item.id
                                         }
                                         }
                                     } else if(task.type === 2) {
                                     } else if(task.type === 2) {
-                                        files = res.works.find(work => {
-                                            return work.acId === task.acId
+                                        files = res.works[0].results.find(work => {
+                                            return work.taskId === task.acId
                                         })
                                         })
-                                        if(files) {
-                                            files.attachments = files.attachments.map(item => {
+                                        if(files.files) {
+                                            files.files = files.files.map(item => {
                                                 item.url = item.url + '?' + this.sasInfo.sas
                                                 item.url = item.url + '?' + this.sasInfo.sas
                                                 return item
                                                 return item
                                             })
                                             })
@@ -279,11 +279,11 @@
                                                 subject: task.subject,
                                                 subject: task.subject,
                                                 workDesc: task.workDesc,
                                                 workDesc: task.workDesc,
                                                 workEnd: this.dateFormat(task.workEnd),
                                                 workEnd: this.dateFormat(task.workEnd),
-                                                answer: files ? files : undefined,
+                                                answer: files.files ? files.files : undefined,
                                                 overTime: nowTime > task.workEnd,
                                                 overTime: nowTime > task.workEnd,
                                                 musicId: this.musicInfo.questionId,
                                                 musicId: this.musicInfo.questionId,
                                                 musicNm: this.musicInfo.questionName,
                                                 musicNm: this.musicInfo.questionName,
-                                                isAnswer: files ? files.isAnswer : 0,
+                                                isAnswer: res.works[0].isAnswer,
                                             })
                                             })
                                         }
                                         }
                                         subList.push(examList)
                                         subList.push(examList)
@@ -298,11 +298,11 @@
                                                 subject: task.subject,
                                                 subject: task.subject,
                                                 workDesc: task.workDesc,
                                                 workDesc: task.workDesc,
                                                 workEnd: this.dateFormat(task.workEnd),
                                                 workEnd: this.dateFormat(task.workEnd),
-                                                answer: files ? files : undefined,
+                                                answer: files.files ? files.files : undefined,
                                                 overTime: nowTime > task.workEnd, //作业提交已经到期
                                                 overTime: nowTime > task.workEnd, //作业提交已经到期
                                                 musicId: this.musicInfo.questionId, //智音id
                                                 musicId: this.musicInfo.questionId, //智音id
                                                 musicNm: this.musicInfo.questionName,
                                                 musicNm: this.musicInfo.questionName,
-                                                isAnswer: files ? files.isAnswer : 0,
+                                                isAnswer: res.works[0].isAnswer,
                                             })
                                             })
                                         }
                                         }
                                     }
                                     }
@@ -658,11 +658,12 @@
                 return Y + M + D + H + Min;
                 return Y + M + D + H + Min;
             },
             },
             changeHwAnswer(answer, index) {
             changeHwAnswer(answer, index) {
-                answer.attachments = answer.attachments.map(item => {
+                let attach = [...answer.attachments]
+                attach = attach.map(item => {
                     item.url = item.url + '?' + this.sasInfo.sas
                     item.url = item.url + '?' + this.sasInfo.sas
                     return item
                     return item
                 })
                 })
-                this.hwLists[index].answer = answer
+                this.hwLists[index].answer = attach
                 this.$forceUpdate()
                 this.$forceUpdate()
             },
             },
             openMask(item) {
             openMask(item) {

+ 1 - 1
TEAMModelOS/Controllers/Common/ArtController.cs

@@ -1039,7 +1039,7 @@ namespace TEAMModelOS.Controllers.Common
                         var data = new { busType = "aqd", artResult.zyanswer.thirdAnswerId };
                         var data = new { busType = "aqd", artResult.zyanswer.thirdAnswerId };
                         //byte[] inputBytes = Encoding.UTF8.GetBytes(artResult.zyanswer.thirdAnswerId);
                         //byte[] inputBytes = Encoding.UTF8.GetBytes(artResult.zyanswer.thirdAnswerId);
                         //string base64Str = Convert.ToBase64String(inputBytes);
                         //string base64Str = Convert.ToBase64String(inputBytes);
-                        var base64Str = HttpUtility.UrlEncode(data.ToJsonString());
+                        var base64Str = HttpUtility.UrlEncode(Convert.ToBase64String(Encoding.UTF8.GetBytes(data.ToJsonString())));
                         //var date = Convert.FromBase64String(base64Str);
                         //var date = Convert.FromBase64String(base64Str);
                         StringBuilder url = new("https://amesopen.aimusic.art?appid=8a68f563f3384662acbc268336b98ae2");
                         StringBuilder url = new("https://amesopen.aimusic.art?appid=8a68f563f3384662acbc268336b98ae2");
                         url.Append($"&data={base64Str}");
                         url.Append($"&data={base64Str}");