|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div v-loading="loading" class="task-detail">
|
|
|
- <task-top :item-info="itemInfo" type="student" @viewFile="viewFile" />
|
|
|
+ <TaskTop :item-info="itemInfo" type="student" @viewFile="viewFile" />
|
|
|
|
|
|
<div class="task-detail-main">
|
|
|
<div class="time-type">{{ $t(timeType) }} {{ name }}</div>
|
|
@@ -141,7 +141,7 @@
|
|
|
</template>
|
|
|
</div>
|
|
|
|
|
|
- <completion-view
|
|
|
+ <CompletionView
|
|
|
:task-id="id"
|
|
|
:cur-student-id="$store.state.user.user_code"
|
|
|
:cur-courseware-id="curCoursewareId"
|
|
@@ -150,7 +150,7 @@
|
|
|
@dialogClose="dialogClose_completion"
|
|
|
/>
|
|
|
|
|
|
- <finish-courseware
|
|
|
+ <FinishCourseware
|
|
|
:id="id"
|
|
|
:courseware-id="coursewareId"
|
|
|
:preview-group-id="previewGroupId"
|
|
@@ -163,250 +163,249 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-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/index.vue';
|
|
|
+export default {
|
|
|
+ name: 'TaskDetailsStudent'
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { ref, computed, inject } from 'vue';
|
|
|
import { fileUpload, FileDownload } from '@/api/app';
|
|
|
import { CreateEnterLiveRoomSession } from '@/api/live';
|
|
|
import { GetTaskInfo, FillMyTaskExecuteInfo_Student } from '@/api/course';
|
|
|
import { isAllowFileType, fileTypeSizeLimit } from '@/utils/validate';
|
|
|
+import { useRoute, useRouter } from 'vue-router/composables';
|
|
|
+import { Message } from 'element-ui';
|
|
|
|
|
|
-export default {
|
|
|
- name: 'TaskDetailsStudent',
|
|
|
- components: {
|
|
|
- FinishCourseware,
|
|
|
- TaskTop,
|
|
|
- CompletionView,
|
|
|
- ShowFile
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- // 任务 ID
|
|
|
- id: this.$route.params.id,
|
|
|
- itemInfo: {
|
|
|
- course_name: '',
|
|
|
- cs_item_name: '',
|
|
|
- cs_item_learning_material_list: [],
|
|
|
- time_space_view_txt: ''
|
|
|
- },
|
|
|
- student_message: '',
|
|
|
- name: '',
|
|
|
- teaching_type: '',
|
|
|
- time_type: '',
|
|
|
- content: '',
|
|
|
- task_mode: '',
|
|
|
- time_space_view_txt: '',
|
|
|
- courseware_list: [],
|
|
|
- accessory_list: [],
|
|
|
- file_list: [],
|
|
|
- dialogVisible: false,
|
|
|
- previewGroupId: '[]',
|
|
|
- coursewareId: '',
|
|
|
- curCoursewareId: '',
|
|
|
- dialogVisible_completion: false,
|
|
|
- my_execute_info: {},
|
|
|
- student_remark: '',
|
|
|
- student_score: 0,
|
|
|
- loading: false,
|
|
|
- visible: false,
|
|
|
- showCurFileName: '',
|
|
|
- showCurFileId: '',
|
|
|
- // 开启课后评价
|
|
|
- is_enable_KHPJ: false,
|
|
|
- is_enable_homework: false,
|
|
|
- is_enable_message: false
|
|
|
- };
|
|
|
- },
|
|
|
- computed: {
|
|
|
- timeType() {
|
|
|
- switch (this.time_type) {
|
|
|
- case 0:
|
|
|
- return 'Key353';
|
|
|
- case 1:
|
|
|
- return 'Key354';
|
|
|
- case 2:
|
|
|
- return 'Key355';
|
|
|
- default:
|
|
|
- return '';
|
|
|
- }
|
|
|
- },
|
|
|
- contentUrl() {
|
|
|
- const content = this.content;
|
|
|
- if (!content) return '';
|
|
|
- return content.replace(
|
|
|
- new RegExp(/((https?:\/\/)?[\w-]+\.[\w-]+\.[\w-,@?^=%&:/~\\+#]+)/, 'g'),
|
|
|
- '<a href="$1" target="_blank">$1</a>'
|
|
|
- );
|
|
|
+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/index.vue';
|
|
|
+
|
|
|
+const $t = inject('$t');
|
|
|
+const route = useRoute();
|
|
|
+const router = useRouter();
|
|
|
+// 任务 ID
|
|
|
+const id = route.params.id;
|
|
|
+let itemInfo = ref({
|
|
|
+ course_name: '',
|
|
|
+ cs_item_name: '',
|
|
|
+ cs_item_learning_material_list: [],
|
|
|
+ time_space_view_txt: ''
|
|
|
+});
|
|
|
+let student_message = ref('');
|
|
|
+let name = ref('');
|
|
|
+let teaching_type = ref('');
|
|
|
+let time_type = ref('');
|
|
|
+let content = ref('');
|
|
|
+let time_space_view_txt = ref('');
|
|
|
+let courseware_list = ref([]);
|
|
|
+let accessory_list = ref([]);
|
|
|
+let file_list = ref([]);
|
|
|
+let dialogVisible = ref(false);
|
|
|
+let previewGroupId = ref('[]');
|
|
|
+let coursewareId = ref('');
|
|
|
+let curCoursewareId = ref('');
|
|
|
+let dialogVisible_completion = ref(false);
|
|
|
+let my_execute_info = ref({});
|
|
|
+let student_remark = ref('');
|
|
|
+let student_score = ref(0);
|
|
|
+let loading = ref(true);
|
|
|
+let visible = ref(false);
|
|
|
+let showCurFileName = ref('');
|
|
|
+let showCurFileId = ref('');
|
|
|
+// 开启课后评价
|
|
|
+let is_enable_KHPJ = ref(false);
|
|
|
+let is_enable_homework = ref(false);
|
|
|
+let is_enable_message = ref(false);
|
|
|
+
|
|
|
+let timeType = computed(() => {
|
|
|
+ let val = '';
|
|
|
+ switch (time_type.value) {
|
|
|
+ case 0:
|
|
|
+ val = 'Key353';
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ val = 'Key354';
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ val = 'Key355';
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return val;
|
|
|
+});
|
|
|
+
|
|
|
+let contentUrl = computed(() => {
|
|
|
+ const con = content.value;
|
|
|
+ if (!con) return '';
|
|
|
+ return con.replace(
|
|
|
+ new RegExp(/((https?:\/\/)?[\w-]+\.[\w-]+\.[\w-,@?^=%&:/~\\+#]+)/, 'g'),
|
|
|
+ '<a href="$1" target="_blank">$1</a>'
|
|
|
+ );
|
|
|
+});
|
|
|
+
|
|
|
+GetTaskInfo({
|
|
|
+ id,
|
|
|
+ is_contain_cs_item_learning_material: true,
|
|
|
+ is_contain_my_execute_info: true
|
|
|
+})
|
|
|
+ .then(
|
|
|
+ ({
|
|
|
+ name: na,
|
|
|
+ teaching_type: teachingType,
|
|
|
+ time_type: timeType,
|
|
|
+ course_name,
|
|
|
+ cs_item_name,
|
|
|
+ courseware_list: courseList,
|
|
|
+ accessory_list: accList,
|
|
|
+ cs_item_learning_material_list,
|
|
|
+ content: con,
|
|
|
+ time_space_view_txt: view_txt,
|
|
|
+ my_execute_info: executeInfo,
|
|
|
+ is_enable_KHPJ: isKHPJ,
|
|
|
+ is_enable_homework: isHomework,
|
|
|
+ is_enable_message: isMessage,
|
|
|
+ cs_item_begin_time,
|
|
|
+ cs_item_end_time
|
|
|
+ }) => {
|
|
|
+ itemInfo.value = {
|
|
|
+ name,
|
|
|
+ time_space_view_txt: view_txt,
|
|
|
+ course_name,
|
|
|
+ cs_item_name,
|
|
|
+ cs_item_learning_material_list,
|
|
|
+ content,
|
|
|
+ cs_item_time: `${cs_item_begin_time} ~ ${cs_item_end_time}`
|
|
|
+ };
|
|
|
+
|
|
|
+ name.value = na;
|
|
|
+ content.value = con;
|
|
|
+ teaching_type.value = teachingType;
|
|
|
+ time_type.value = timeType;
|
|
|
+ courseware_list.value = courseList;
|
|
|
+ accessory_list.value = accList;
|
|
|
+ time_space_view_txt.value = view_txt;
|
|
|
+ my_execute_info.value = executeInfo;
|
|
|
+ is_enable_KHPJ.value = isKHPJ === 'true';
|
|
|
+ is_enable_homework.value = isHomework === 'true';
|
|
|
+ is_enable_message.value = isMessage === 'true';
|
|
|
}
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.loading = true;
|
|
|
- GetTaskInfo({
|
|
|
- id: this.id,
|
|
|
- is_contain_cs_item_learning_material: true,
|
|
|
- is_contain_my_execute_info: true
|
|
|
- })
|
|
|
- .then(
|
|
|
- ({
|
|
|
- name,
|
|
|
- teaching_type,
|
|
|
- time_type,
|
|
|
- course_name,
|
|
|
- cs_item_name,
|
|
|
- courseware_list,
|
|
|
- accessory_list,
|
|
|
- cs_item_learning_material_list,
|
|
|
- task_mode,
|
|
|
- content,
|
|
|
- time_space_view_txt,
|
|
|
- my_execute_info,
|
|
|
- is_enable_KHPJ,
|
|
|
- is_enable_homework,
|
|
|
- is_enable_message,
|
|
|
- cs_item_begin_time,
|
|
|
- cs_item_end_time
|
|
|
- }) => {
|
|
|
- this.itemInfo = {
|
|
|
- name,
|
|
|
- time_space_view_txt,
|
|
|
- course_name,
|
|
|
- cs_item_name,
|
|
|
- cs_item_learning_material_list,
|
|
|
- content,
|
|
|
- cs_item_time: `${cs_item_begin_time} ~ ${cs_item_end_time}`
|
|
|
- };
|
|
|
-
|
|
|
- this.name = name;
|
|
|
- this.content = content;
|
|
|
- this.teaching_type = teaching_type;
|
|
|
- this.time_type = time_type;
|
|
|
- this.courseware_list = courseware_list;
|
|
|
- this.accessory_list = accessory_list;
|
|
|
- this.task_mode = task_mode;
|
|
|
- this.time_space_view_txt = time_space_view_txt;
|
|
|
- this.my_execute_info = my_execute_info;
|
|
|
- this.is_enable_KHPJ = is_enable_KHPJ === 'true';
|
|
|
- this.is_enable_homework = is_enable_homework === 'true';
|
|
|
- this.is_enable_message = is_enable_message === 'true';
|
|
|
- }
|
|
|
- )
|
|
|
- .finally(() => {
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- },
|
|
|
- methods: {
|
|
|
- upload(file) {
|
|
|
- const fileName = file.file.name;
|
|
|
- if (!isAllowFileType(fileName)) {
|
|
|
- this.$message.warning(`【${fileName}】${this.$i18n.t('Key335')}`);
|
|
|
- return;
|
|
|
- }
|
|
|
+ )
|
|
|
+ .finally(() => {
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
+
|
|
|
+function upload(file) {
|
|
|
+ const fileName = file.file.name;
|
|
|
+ if (!isAllowFileType(fileName)) {
|
|
|
+ Message.error(`【${fileName}】${$t('Key335')}`);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- if (fileTypeSizeLimit(file.file.name, file.file.size)) {
|
|
|
- return this.$message.warning(`${fileName}文件大小超出限制`);
|
|
|
- }
|
|
|
+ if (fileTypeSizeLimit(file.file.name, file.file.size)) {
|
|
|
+ return Message.error(`${fileName}文件大小超出限制`);
|
|
|
+ }
|
|
|
|
|
|
- fileUpload('Open', file).then(({ file_info_list }) => {
|
|
|
- if (file_info_list.length > 0) {
|
|
|
- const { file_id, file_name, file_url } = file_info_list[0];
|
|
|
- this.file_list.push({ file_id, file_name, file_url });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- deleteFile(i) {
|
|
|
- this.file_list.splice(i, 1);
|
|
|
- },
|
|
|
-
|
|
|
- download(FileID) {
|
|
|
- FileDownload(FileID).then((data) => {
|
|
|
- console.log(data);
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- viewFile(fileName, fileId) {
|
|
|
- this.showCurFileName = fileName;
|
|
|
- this.showCurFileId = fileId;
|
|
|
- this.visible = true;
|
|
|
- },
|
|
|
-
|
|
|
- dialogShowFileClose() {
|
|
|
- this.visible = false;
|
|
|
- this.showCurFileName = '';
|
|
|
- this.showCurFileId = '';
|
|
|
- },
|
|
|
-
|
|
|
- fillTaskExecuteInfo_Student() {
|
|
|
- // 基础任务,必须提交作业
|
|
|
- if (this.my_execute_info.is_finished === 'false' && this.teaching_type === 12 && this.file_list.length <= 0) {
|
|
|
- return this.$message.warning('请先提交作业');
|
|
|
- }
|
|
|
+ fileUpload('Open', file).then(({ file_info_list }) => {
|
|
|
+ if (file_info_list.length > 0) {
|
|
|
+ const { file_id, file_name, file_url } = file_info_list[0];
|
|
|
+ file_list.value.push({ file_id, file_name, file_url });
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
- const homework_file_id_list = [];
|
|
|
- this.file_list.forEach((item) => {
|
|
|
- homework_file_id_list.push(item.file_id);
|
|
|
- });
|
|
|
- FillMyTaskExecuteInfo_Student({
|
|
|
- task_id: this.id,
|
|
|
- homework_file_id_list,
|
|
|
- student_message: this.student_message,
|
|
|
- is_finished: true
|
|
|
- }).then(() => {
|
|
|
- this.$message.success(this.$i18n.t('Key337'));
|
|
|
- this.$router.go(0);
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- fillTaskExecuteInfo_Student_live() {
|
|
|
- FillMyTaskExecuteInfo_Student({
|
|
|
- task_id: this.id,
|
|
|
- is_finished: true,
|
|
|
- student_remark: this.student_remark,
|
|
|
- student_score: this.student_score
|
|
|
- }).then(() => {
|
|
|
- this.$message.success(this.$i18n.t('Key336'));
|
|
|
- this.$router.go(0);
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- enterLive() {
|
|
|
- CreateEnterLiveRoomSession({
|
|
|
- task_id: this.id
|
|
|
- }).then(({ live_room_sys_user_id, room_id, session_id, room_user_id }) => {
|
|
|
- this.$router.push({
|
|
|
- path: `/live/student`,
|
|
|
- query: { live_room_sys_user_id, room_id, session_id, task_id: this.id, room_user_id }
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- // 完成任务
|
|
|
- finishTask(id, is_finished, group_id_selected_info) {
|
|
|
- if (this.my_execute_info.is_finished === 'true' && is_finished === 'false') {
|
|
|
- return this.$message.warning(this.$i18n.t('Key338'));
|
|
|
- }
|
|
|
- this.previewGroupId = group_id_selected_info ?? '[]';
|
|
|
- if (is_finished === 'true') {
|
|
|
- this.dialogVisible_completion = true;
|
|
|
- this.curCoursewareId = id;
|
|
|
- } else {
|
|
|
- this.dialogVisible = true;
|
|
|
- this.coursewareId = id;
|
|
|
- }
|
|
|
- },
|
|
|
+function deleteFile(i) {
|
|
|
+ file_list.value.splice(i, 1);
|
|
|
+}
|
|
|
|
|
|
- dialogClose() {
|
|
|
- this.dialogVisible = false;
|
|
|
- this.coursewareId = '';
|
|
|
- },
|
|
|
+function download(FileID) {
|
|
|
+ FileDownload(FileID).then((data) => {
|
|
|
+ console.log(data);
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
- dialogClose_completion() {
|
|
|
- this.dialogVisible_completion = false;
|
|
|
- this.curCoursewareId = '';
|
|
|
- }
|
|
|
+function viewFile(fileName, fileId) {
|
|
|
+ showCurFileName.value = fileName;
|
|
|
+ showCurFileId.value = fileId;
|
|
|
+ visible.value = true;
|
|
|
+}
|
|
|
+
|
|
|
+function dialogShowFileClose() {
|
|
|
+ visible.value = false;
|
|
|
+ showCurFileName.value = '';
|
|
|
+ showCurFileId.value = '';
|
|
|
+}
|
|
|
+
|
|
|
+function fillTaskExecuteInfo_Student() {
|
|
|
+ // 基础任务,必须提交作业
|
|
|
+ if (my_execute_info.value.is_finished === 'false' && teaching_type.value === 12 && file_list.value.length <= 0) {
|
|
|
+ return Message.error('请先提交作业');
|
|
|
}
|
|
|
-};
|
|
|
+
|
|
|
+ const homework_file_id_list = [];
|
|
|
+ file_list.value.forEach((item) => {
|
|
|
+ homework_file_id_list.push(item.file_id);
|
|
|
+ });
|
|
|
+ FillMyTaskExecuteInfo_Student({
|
|
|
+ task_id: id,
|
|
|
+ homework_file_id_list,
|
|
|
+ student_message: student_message.value,
|
|
|
+ is_finished: true
|
|
|
+ }).then(() => {
|
|
|
+ Message.success($t('Key337'));
|
|
|
+ router.go(0);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function fillTaskExecuteInfo_Student_live() {
|
|
|
+ FillMyTaskExecuteInfo_Student({
|
|
|
+ task_id: id,
|
|
|
+ is_finished: true,
|
|
|
+ student_remark: student_remark.value,
|
|
|
+ student_score: student_score.value
|
|
|
+ }).then(() => {
|
|
|
+ Message.success($t('Key336'));
|
|
|
+ router.go(0);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function enterLive() {
|
|
|
+ CreateEnterLiveRoomSession({
|
|
|
+ task_id: id
|
|
|
+ }).then(({ live_room_sys_user_id, room_id, session_id, room_user_id }) => {
|
|
|
+ router.push({
|
|
|
+ path: `/live/student`,
|
|
|
+ query: { live_room_sys_user_id, room_id, session_id, task_id: id, room_user_id }
|
|
|
+ });
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 完成任务
|
|
|
+function finishTask(id, is_finished, group_id_selected_info) {
|
|
|
+ if (my_execute_info.value.is_finished === 'true' && is_finished === 'false') {
|
|
|
+ return Message.error($t('Key338'));
|
|
|
+ }
|
|
|
+ previewGroupId.value = group_id_selected_info ?? '[]';
|
|
|
+ if (is_finished === 'true') {
|
|
|
+ dialogVisible_completion.value = true;
|
|
|
+ curCoursewareId.value = id;
|
|
|
+ } else {
|
|
|
+ dialogVisible.value = true;
|
|
|
+ coursewareId.value = id;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function dialogClose() {
|
|
|
+ dialogVisible.value = false;
|
|
|
+ coursewareId.value = '';
|
|
|
+}
|
|
|
+
|
|
|
+function dialogClose_completion() {
|
|
|
+ dialogVisible_completion.value = false;
|
|
|
+ curCoursewareId.value = '';
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|