|
@@ -17,7 +17,7 @@
|
|
|
<td>{{ course.startTime }} <br> ~ <br> {{ course.endTime }}</td>
|
|
|
<td>
|
|
|
<div v-if="course.fileUrl">
|
|
|
- <a :href="course.fileUrl">
|
|
|
+ <a :href="course.fileUrl" download>
|
|
|
<i-icon type="ios-cloud-download"></i-icon>下载作答</a>
|
|
|
</div>
|
|
|
<div v-else>
|
|
@@ -25,23 +25,37 @@
|
|
|
</div>
|
|
|
</td>
|
|
|
<td style="min-width: 180px">
|
|
|
- <div v-if="course.paperId" style="display: grid; grid-gap: 10px">
|
|
|
- <i-button class="qm-primary-button">查看试卷</i-button>
|
|
|
- <i-button class="qm-primary-button">下载试卷</i-button>
|
|
|
- <i-button class="qm-primary-button">下载答题卡</i-button>
|
|
|
- <div>
|
|
|
- <Upload :headers="headers" :data="{fileType: fileType}" :before-upload="handleBeforeUpload" :action="'/api/offline_exam/'+course.examRecordId+'/submit'" :max-size="1024*30" :format="['pdf','zip']" :on-format-error="handleFormatError" :on-exceeded-size="handleMaxSize" :on-success="handleSuccess" :on-error="handleError" :show-upload-list="false">
|
|
|
- <Button type="ghost" icon="ios-cloud-upload-outline" class="qm-primary-button" style="width: 100%;">上传作答</Button>
|
|
|
- </Upload>
|
|
|
- <div v-if="file !== null">待上传文件: {{ file.name }}
|
|
|
- <Button type="text" @click="upload" :loading="loadingStatus">{{ loadingStatus ? '上传中...' : '上传' }}</Button>
|
|
|
+ <template v-if="!course.isvalid">
|
|
|
+ <div v-if="course.paperId" style="display: grid; grid-gap: 10px">
|
|
|
+ <i-button class="qm-primary-button" @click="previewPaper(course)">查看试卷</i-button>
|
|
|
+ <i-button class="qm-primary-button">
|
|
|
+ <a class="qm-primary-button" :href="tk_server_url+'/api/ecs_ques/paper/export/'+course.paperId+'/PAPER/'+course.orgName+'/'+course.paperId + '/offLine'" download>下载试卷</a>
|
|
|
+ </i-button>
|
|
|
+ <i-button class="qm-primary-button">
|
|
|
+ <a class="qm-primary-button" href="https://ecs-static.qmth.com.cn/offline-exam/答题卡.zip" download>下载答题卡</a>
|
|
|
+ </i-button>
|
|
|
+ <div>
|
|
|
+ <Upload :headers="headers" :data="{fileType: fileType}" :before-upload="handleBeforeUpload" :action="'/api/offline_exam/'+course.examRecordId+'/submit'" :max-size="1024*30" :format="['pdf','zip']" :on-format-error="handleFormatError" :on-exceeded-size="handleMaxSize" :on-success="handleSuccess" :on-error="handleError" :show-upload-list="false">
|
|
|
+ <Button type="ghost" icon="ios-cloud-upload-outline" class="qm-primary-button" style="width: 100%;">上传作答</Button>
|
|
|
+ </Upload>
|
|
|
+ <div v-if="file !== null">待上传文件: {{ file.name }}
|
|
|
+ <Button type="text" @click="upload" :loading="loadingStatus">{{ loadingStatus ? '上传中...' : '上传' }}</Button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
|
- <div v-else style="display: grid; grid-gap: 10px">
|
|
|
- <i-button class="qm-primary-button">抽取试卷</i-button>
|
|
|
- </div>
|
|
|
+ <div v-else style="display: grid; grid-gap: 10px">
|
|
|
+ <div v-if="new Date(course.startTime) - Date.now() > 0">
|
|
|
+ 未开始
|
|
|
+ </div>
|
|
|
+ <div v-else-if="new Date(course.endTime) - Date.now() < 0">
|
|
|
+ 已结束
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <i-button class="qm-primary-button" @click="enterExam(course)">抽取试卷</i-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
|
|
|
</td>
|
|
|
</tr>
|
|
@@ -51,10 +65,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { TK_SERVER_URL } from "@/constants/constants.js";
|
|
|
+
|
|
|
export default {
|
|
|
name: "EcsOfflineList",
|
|
|
data() {
|
|
|
return {
|
|
|
+ tk_server_url: TK_SERVER_URL,
|
|
|
headers: {
|
|
|
token: window.localStorage.getItem("token"),
|
|
|
key: window.localStorage.getItem("key")
|
|
@@ -65,7 +82,8 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
props: {
|
|
|
- courses: Array
|
|
|
+ courses: Array,
|
|
|
+ reloadList: Function
|
|
|
},
|
|
|
methods: {
|
|
|
fileFormatCheck(file, resolve, reject) {
|
|
@@ -105,11 +123,10 @@ export default {
|
|
|
binaryFileType: getMimetype(hex),
|
|
|
hex: hex
|
|
|
});
|
|
|
- // console.log(uploads);
|
|
|
+
|
|
|
if (
|
|
|
["application/zip", "application/pdf"].includes(getMimetype(hex))
|
|
|
) {
|
|
|
- // console.log("true");
|
|
|
resolve();
|
|
|
} else {
|
|
|
console.log("binary file type check: not zip or pdf");
|
|
@@ -131,12 +148,12 @@ export default {
|
|
|
this.file = file;
|
|
|
return false;
|
|
|
},
|
|
|
- handleSuccess(res, file) {
|
|
|
+ handleSuccess() {
|
|
|
this.file = null;
|
|
|
this.loadingStatus = false;
|
|
|
this.$Message.success("上传成功");
|
|
|
},
|
|
|
- handleError(res, file) {
|
|
|
+ handleError() {
|
|
|
this.file = null;
|
|
|
this.loadingStatus = false;
|
|
|
this.$Message.error("上传失败");
|
|
@@ -161,16 +178,28 @@ export default {
|
|
|
}
|
|
|
this.file = file;
|
|
|
this.loadingStatus = true;
|
|
|
- // const check = this.uploadList.length < 5;
|
|
|
- // if (!check) {
|
|
|
- // this.$Notice.warning({
|
|
|
- // title: "Up to five pictures can be uploaded."
|
|
|
- // });
|
|
|
- // }
|
|
|
return new Promise((resolve, reject) =>
|
|
|
this.fileFormatCheck(file, resolve, reject)
|
|
|
);
|
|
|
- // return true;
|
|
|
+ },
|
|
|
+ async enterExam(course) {
|
|
|
+ await this.$http.get("/api/offline_exam/start", {
|
|
|
+ params: { examStudentId: course.examStudentId }
|
|
|
+ });
|
|
|
+ this.$emit("reloadList");
|
|
|
+ },
|
|
|
+ previewPaper(course) {
|
|
|
+ var user = {
|
|
|
+ loginName: course.examStudentId,
|
|
|
+ backUrl: window.document.location.href,
|
|
|
+ isOnlineExam: true
|
|
|
+ };
|
|
|
+ window.name = JSON.stringify(user);
|
|
|
+ window.location.href =
|
|
|
+ this.tk_server_url +
|
|
|
+ "/#/preview_paper/" +
|
|
|
+ course.paperId +
|
|
|
+ "?isback=true";
|
|
|
}
|
|
|
}
|
|
|
};
|