|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div v-loading="loading" class="task-detail">
|
|
|
- <task-top :item-info="itemInfo" />
|
|
|
+ <task-top :item-info="itemInfo" @viewFile="viewFile" />
|
|
|
|
|
|
<div class="task-detail-main">
|
|
|
<div class="time-type">{{ timeType }}任务 {{ name }}</div>
|
|
@@ -34,7 +34,7 @@
|
|
|
color="#fff"
|
|
|
:title="item.file_name"
|
|
|
>
|
|
|
- <a :href="item.file_url" target="_blank">{{ item.file_name }}</a>
|
|
|
+ <span @click="viewFile(item.file_name, item.file_url)">{{ item.file_name }}</span>
|
|
|
</el-tag>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -50,7 +50,7 @@
|
|
|
color="#fff"
|
|
|
:title="item.file_name"
|
|
|
>
|
|
|
- <a :href="item.file_url" target="_blank">{{ item.file_name }}</a>
|
|
|
+ <span @click="viewFile(item.file_name, item.file_url)">{{ item.file_name }}</span>
|
|
|
</el-tag>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -109,7 +109,7 @@
|
|
|
<template v-else>
|
|
|
<div class="submit-homework">
|
|
|
<span class="label">提交作业</span>
|
|
|
- <el-upload action="no" :http-request="upload" multiple :show-file-list="false" accept="*">
|
|
|
+ <el-upload action="no" :http-request="upload" multiple :show-file-list="false">
|
|
|
<el-button><svg-icon icon-class="upload" /> 上传文件</el-button>
|
|
|
</el-upload>
|
|
|
</div>
|
|
@@ -149,6 +149,8 @@
|
|
|
:dialog-visible="dialogVisible"
|
|
|
@dialogClose="dialogClose"
|
|
|
/>
|
|
|
+
|
|
|
+ <show-file ref="file" :file-name="showCurFileName" :file-url="showCurFileUrl" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -156,15 +158,18 @@
|
|
|
import TaskTop from '../TaskTop.vue';
|
|
|
import FinishCourseware from '@/components/course/FinishCourseware.vue';
|
|
|
import CompletionView from '@/components/course/CompletionView.vue';
|
|
|
+import ShowFile from '@/common/show_file';
|
|
|
import { fileUpload, FileDownload } from '@/api/app';
|
|
|
import { CreateEnterLiveRoomSession } from '@/api/live';
|
|
|
import { GetTaskInfo, FillMyTaskExecuteInfo_Student } from '@/api/course';
|
|
|
+import { isAllowFileType } from '@/utils/validate';
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
FinishCourseware,
|
|
|
TaskTop,
|
|
|
- CompletionView
|
|
|
+ CompletionView,
|
|
|
+ ShowFile
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -193,7 +198,9 @@ export default {
|
|
|
my_execute_info: {},
|
|
|
student_remark: '',
|
|
|
student_score: 0,
|
|
|
- loading: false
|
|
|
+ loading: false,
|
|
|
+ showCurFileName: '',
|
|
|
+ showCurFileUrl: ''
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -256,6 +263,12 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
upload(file) {
|
|
|
+ let fileName = file.file.name;
|
|
|
+ if (!isAllowFileType(fileName)) {
|
|
|
+ this.$message.warning(`文件:【${fileName}】文件类型,不允许上传`);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
fileUpload('Open', file).then(({ file_info_list }) => {
|
|
|
if (file_info_list.length > 0) {
|
|
|
let { file_id, file_name, file_url } = file_info_list[0];
|
|
@@ -274,6 +287,12 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ viewFile(fileName, fileUrl) {
|
|
|
+ this.showCurFileName = fileName;
|
|
|
+ this.showCurFileUrl = fileUrl;
|
|
|
+ this.$refs.file.showDialog();
|
|
|
+ },
|
|
|
+
|
|
|
fillTaskExecuteInfo_Student() {
|
|
|
let homework_file_id_list = [];
|
|
|
this.file_list.forEach(item => {
|
|
@@ -356,6 +375,10 @@ $bor-color: #d9d9d9;
|
|
|
border-radius: 4px;
|
|
|
margin: 0 8px 6px 0;
|
|
|
border-color: $bor-color;
|
|
|
+
|
|
|
+ > span {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
&-main {
|