|
|
@@ -1,9 +1,9 @@
|
|
|
<template>
|
|
|
<div class="coursewareManagement-addPage">
|
|
|
- <div class="page-container-top-max-big-box">
|
|
|
+ <div class="page-container-top-max-big-box-shadow">
|
|
|
<p class="top-1-p">{{newData.id?'编辑课件':'添加课件'}}</p>
|
|
|
<p class="top-2-p" @click="backPage()">返回</p>
|
|
|
- <p class="top-3-p" @click="resetButton()">重置</p>
|
|
|
+ <p class="top-3-p" v-if="newData.id" @click="resetButton()">重置</p>
|
|
|
<p class="top-4-p" @click="submitButton()">保存</p>
|
|
|
</div>
|
|
|
<div class="bottom-max-big-box scrollbar-box">
|
|
|
@@ -22,44 +22,51 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="知识点" prop="data2">
|
|
|
- <el-select v-model="newData.data2" placeholder="请选择知识点" style="width: 400px">
|
|
|
- <el-option
|
|
|
- v-for="dict in optionListB"
|
|
|
- :key="dict.value"
|
|
|
- :label="dict.label"
|
|
|
- :value="dict.value"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
+ <el-form-item label="知识点" prop="knowledgePointId">
|
|
|
+ <el-cascader
|
|
|
+ style="width: 400px"
|
|
|
+ v-model="newData.knowledgePointId"
|
|
|
+ :options="optionListB"
|
|
|
+ :props="{
|
|
|
+ emitPath:false,
|
|
|
+ checkStrictly: true,
|
|
|
+ value: 'id',
|
|
|
+ label: 'knowledgePointName',
|
|
|
+ children: 'children',
|
|
|
+ }"
|
|
|
+ :show-all-levels="false"
|
|
|
+ filterable
|
|
|
+ placeholder="请选择知识点"
|
|
|
+ ></el-cascader>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="form-box">
|
|
|
<div class="form-flex-box">
|
|
|
- <el-form-item label="是否共享" prop="data11" style="width:560px;">
|
|
|
+ <el-form-item label="是否共享" prop="shareStatus" style="width:560px;">
|
|
|
<el-switch
|
|
|
- :active-value="true"
|
|
|
- :inactive-value="false"
|
|
|
- v-model="newData.data11"
|
|
|
+ :active-value="1"
|
|
|
+ :inactive-value="0"
|
|
|
+ v-model="newData.shareStatus"
|
|
|
active-color="#0183FB"
|
|
|
inactive-color="#AAAAAA">
|
|
|
</el-switch>
|
|
|
- <span style="margin-left:15px;">{{newData.data11?'共享开启,全校所有学院单位都可见':'不共享,仅本学院单位及上级都可见'}}</span>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="专业类别" prop="data3">
|
|
|
- <el-select v-model="newData.data3" placeholder="请选择专业类别" style="width: 400px">
|
|
|
- <el-option
|
|
|
- v-for="dict in optionListC"
|
|
|
- :key="dict.value"
|
|
|
- :label="dict.label"
|
|
|
- :value="dict.value"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
+ <span style="margin-left:15px;">{{newData.shareStatus==1?'共享开启,全校所有学院单位都可见':'不共享,仅本学院单位及上级都可见'}}</span>
|
|
|
</el-form-item>
|
|
|
+ <!--<el-form-item label="专业类别" prop="disciplineTypeId">-->
|
|
|
+ <!--<el-select v-model="newData.disciplineTypeId" placeholder="请选择专业类别" style="width: 400px">-->
|
|
|
+ <!--<el-option-->
|
|
|
+ <!--v-for="dict in optionListC"-->
|
|
|
+ <!--:key="dict.id"-->
|
|
|
+ <!--:label="dict.disciplineName"-->
|
|
|
+ <!--:value="dict.id"-->
|
|
|
+ <!--/>-->
|
|
|
+ <!--</el-select>-->
|
|
|
+ <!--</el-form-item>-->
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="form-box" v-if="newData.materialType == 1">
|
|
|
- <el-form-item label="视频上传" prop="data41">
|
|
|
+ <el-form-item label="视频上传" prop="attachments">
|
|
|
<div class="form-flex-box">
|
|
|
<uploader
|
|
|
style="width:400px;"
|
|
|
@@ -82,20 +89,21 @@
|
|
|
<!-- <uploader-list></uploader-list> -->
|
|
|
<!-- <uploader-files> </uploader-files>-->
|
|
|
</uploader>
|
|
|
- <video v-if="newData.data41" :src="newData.data41" controls
|
|
|
+ <video v-if="newData.attachments[0]" :src="newData.attachments[0].attachmentPath" controls
|
|
|
style="width: 424px;height:240px;margin-left: 20px;"></video>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
<div class="form-box" v-if="newData.materialType == 1">
|
|
|
<el-form-item label="">
|
|
|
- <el-input v-model="newData.data411" placeholder="添加视频水印文字" maxLength="20" style="width:960px;"></el-input>
|
|
|
+ <el-input v-model="newData.watermark" placeholder="添加视频水印文字" maxLength="20" style="width:960px;"></el-input>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
- <div class="form-box" v-if="newData.materialType == 2">
|
|
|
- <el-form-item label="文档上传" prop="data42">
|
|
|
+ <div class="form-box" v-if="newData.materialType == 3">
|
|
|
+ <el-form-item label="文档上传" prop="attachments">
|
|
|
<div class="form-flex-box">
|
|
|
<el-upload
|
|
|
+ v-if="!newData.id"
|
|
|
style="width:400px;"
|
|
|
drag multiple
|
|
|
accept=".xlsx, .docx, .pdf"
|
|
|
@@ -110,84 +118,106 @@
|
|
|
<p style="line-height:25px;color:#333;">支持docx/xlsx/pdf格式文档</p>
|
|
|
<p style="line-height:25px;color:#333;">支持批量上传文档</p>
|
|
|
</el-upload>
|
|
|
+ <el-upload
|
|
|
+ v-if="newData.id"
|
|
|
+ style="width:400px;"
|
|
|
+ drag
|
|
|
+ accept=".xlsx, .docx, .pdf"
|
|
|
+ :action="uploadImgUrl"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="handleAvatarSuccess"
|
|
|
+ :headers="headers"
|
|
|
+ :before-upload="beforeAvatarUpload">
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
+ <p style="line-height:25px;color:#333;">上传文件大小不超过1G</p>
|
|
|
+ <p style="line-height:25px;color:#333;">支持docx/xlsx/pdf格式文档</p>
|
|
|
+ <p style="line-height:25px;color:#333;">支持批量上传文档</p>
|
|
|
+ </el-upload>
|
|
|
<div class="for-up-list-box scrollbar-box">
|
|
|
- <div v-for="(item,index) in newData.data42" :key="index">
|
|
|
+ <div v-for="(item,index) in newData.attachments" :key="index">
|
|
|
<p class="el-icon-circle-check"></p>
|
|
|
- <p>{{item.name}}</p>
|
|
|
+ <p>{{item.attachmentName}}</p>
|
|
|
<p class="el-icon-close" @click="delList(index)"></p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
- <div class="form-box" v-if="newData.materialType == 3">
|
|
|
- <el-form-item label="文章内容" prop="data43">
|
|
|
+ <div class="form-box" v-if="newData.materialType == 4" style="width:1120px;">
|
|
|
+ <el-form-item label="文章内容" prop="articleContent">
|
|
|
<div class="rich-text" >
|
|
|
- <UEditor ref="UEditor" :content="newData.data43" :min-height="192" :width="960" :height="330"/>
|
|
|
+ <tinymce-container
|
|
|
+ v-model="newData.articleContent"
|
|
|
+ :height="500"
|
|
|
+ :max-length="5000"
|
|
|
+ :upload-url="editorUploadUrl"
|
|
|
+ :upload-headers="editorUploadHeaders"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
<div class="form-box">
|
|
|
- <el-form-item label="课件名称" prop="data5" v-if="!upDataNumType">
|
|
|
- <el-input v-model="newData.data5" placeholder="请输入课件名称" maxLength="20" style="width:960px;"></el-input>
|
|
|
+ <el-form-item label="课件名称" prop="coursewareName" v-if="!newData.attachments[1]">
|
|
|
+ <el-input v-model="newData.coursewareName" placeholder="请输入课件名称" maxLength="20" style="width:960px;"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="课件名称" v-if="upDataNumType">
|
|
|
- <el-input :disabled="upDataNumType" placeholder="系统自动使用文件名" maxLength="20" style="width:960px;"></el-input>
|
|
|
+ <el-form-item label="课件名称" v-if="newData.attachments[1]">
|
|
|
+ <el-input :disabled="newData.attachments[1]" placeholder="系统自动使用文件名" maxLength="20" style="width:960px;"></el-input>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
<div class="form-box">
|
|
|
- <el-form-item label="要求时长" prop="data6">
|
|
|
+ <el-form-item label="要求时长" prop="minLearningDuration">
|
|
|
<el-input-number class="form-input-number"
|
|
|
style="width:200px"
|
|
|
:min="0"
|
|
|
:max="9999"
|
|
|
:step="1" :precision="0" step-strictly
|
|
|
- v-model="newData.data6">
|
|
|
+ v-model="newData.minLearningDuration">
|
|
|
</el-input-number>
|
|
|
- <span style="margin-left:15px;">学时</span>
|
|
|
+ <span style="margin-left:15px;">分钟</span>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
<div class="form-box">
|
|
|
<div class="form-flex-box">
|
|
|
- <el-form-item label="可得学时" prop="data7" style="width:410px;">
|
|
|
+ <el-form-item label="可得学时" prop="autoCreditHours" style="width:410px;">
|
|
|
<el-switch
|
|
|
- :active-value="true"
|
|
|
- :inactive-value="false"
|
|
|
- v-model="newData.data7"
|
|
|
+ :active-value="0"
|
|
|
+ :inactive-value="1"
|
|
|
+ v-model="newData.autoCreditHours"
|
|
|
active-color="#0183FB"
|
|
|
inactive-color="#AAAAAA">
|
|
|
</el-switch>
|
|
|
- <span style="margin-left:15px;">{{newData.data7?'手工填写开启':'手工填写关闭,系统自动计算'}}</span>
|
|
|
+ <span style="margin-left:15px;">{{newData.autoCreditHours==0?'手工填写开启':'手工填写关闭,系统自动计算'}}</span>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="" prop="data8" label-width="0">
|
|
|
+ <el-form-item label="" prop="creditHours" label-width="0">
|
|
|
<el-input-number class="form-input-number"
|
|
|
- :disabled="!newData.data7"
|
|
|
+ :disabled="newData.autoCreditHours==1"
|
|
|
style="width:120px"
|
|
|
:min="0"
|
|
|
:max="9999"
|
|
|
:step="1" :precision="0" step-strictly
|
|
|
- v-model="newData.data8">
|
|
|
+ v-model="newData.creditHours">
|
|
|
</el-input-number>
|
|
|
<span style="margin-left:15px;">分钟</span>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="可得积分" prop="data9" style="width:410px;" label-width="150px">
|
|
|
+ <el-form-item label="可得积分" prop="autoPoints" style="width:410px;" label-width="150px">
|
|
|
<el-switch
|
|
|
- :active-value="true"
|
|
|
- :inactive-value="false"
|
|
|
- v-model="newData.data9"
|
|
|
+ :active-value="0"
|
|
|
+ :inactive-value="1"
|
|
|
+ v-model="newData.autoPoints"
|
|
|
active-color="#0183FB"
|
|
|
inactive-color="#AAAAAA">
|
|
|
</el-switch>
|
|
|
- <span style="margin-left:15px;">{{newData.data9?'手工填写开启':'手工填写关闭,系统自动计算'}}</span>
|
|
|
+ <span style="margin-left:15px;">{{newData.autoPoints==0?'手工填写开启':'手工填写关闭,系统自动计算'}}</span>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="" prop="data10" label-width="0">
|
|
|
+ <el-form-item label="" prop="points" label-width="0">
|
|
|
<el-input-number class="form-input-number"
|
|
|
- :disabled="!newData.data9"
|
|
|
+ :disabled="newData.autoPoints==1"
|
|
|
style="width:120px"
|
|
|
:min="0"
|
|
|
:max="9999"
|
|
|
:step="1" :precision="0" step-strictly
|
|
|
- v-model="newData.data10">
|
|
|
+ v-model="newData.points">
|
|
|
</el-input-number>
|
|
|
<span style="margin-left:15px;">积分</span>
|
|
|
</el-form-item>
|
|
|
@@ -202,24 +232,32 @@
|
|
|
<script>
|
|
|
//import { getDicts } from "@/api/commonality/noPermission";
|
|
|
//import { systemUserSelect } from "@/api/commonality/permission";
|
|
|
- //import { getInfo } from "@/api/basicsModules/index";
|
|
|
+ import {
|
|
|
+ examElKnowledgePointTreeList,examElDisciplineTypeList,
|
|
|
+ examElCoursewareAdd,examElCoursewareEdit,examElCoursewareDetail,
|
|
|
+ } from "@/api/safetyEducationExaminationNew/index";
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
+ import TinymceContainer from "@/components/tinymceContainer/index.vue";
|
|
|
import axios from "axios";
|
|
|
import SparkMD5 from "spark-md5";
|
|
|
let httpHeader=window.location.href.split('://')[0]+'://'
|
|
|
export default {
|
|
|
name: 'addPage',
|
|
|
+ components: { TinymceContainer },
|
|
|
props:{
|
|
|
propsData:{},
|
|
|
},
|
|
|
data(){
|
|
|
return{
|
|
|
+ editorUploadUrl: this.uploadUrl(),
|
|
|
+ editorUploadHeaders: {
|
|
|
+ Authorization:getToken(),
|
|
|
+ },
|
|
|
//文件上传相关
|
|
|
uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
|
|
|
headers: {
|
|
|
Authorization:getToken(),
|
|
|
},
|
|
|
- upDataNumType:false,
|
|
|
//页面状态
|
|
|
buttonType:1,
|
|
|
optionListA:[{value:1,label:'视频'},{value:3,label:'文档'},{value:4,label:'文章'}],
|
|
|
@@ -227,46 +265,41 @@
|
|
|
optionListC:[],
|
|
|
newData:{
|
|
|
materialType:null,
|
|
|
- data2:null,
|
|
|
- data3:null,
|
|
|
- data41:'',
|
|
|
- data411:'',
|
|
|
- data42:[],
|
|
|
- data43:'',
|
|
|
- data5:'',
|
|
|
- data6:0,
|
|
|
- data7:true,
|
|
|
- data8:0,
|
|
|
- data9:true,
|
|
|
- data10:0,
|
|
|
- data11:true,
|
|
|
+ knowledgePointId:null,
|
|
|
+ disciplineTypeId:null,
|
|
|
+ watermark:'',
|
|
|
+ attachments:[],
|
|
|
+ articleContent:'',
|
|
|
+ coursewareName:'',
|
|
|
+ minLearningDuration:0,
|
|
|
+ autoCreditHours:0,
|
|
|
+ creditHours:0,
|
|
|
+ autoPoints:0,
|
|
|
+ points:0,
|
|
|
+ shareStatus:1,
|
|
|
},
|
|
|
rules:{
|
|
|
materialType: [
|
|
|
{ required: true, message: "请选择课件类型", trigger: "blur" },
|
|
|
{ required: true, message: "请选择课件类型", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
],
|
|
|
- data2: [
|
|
|
+ knowledgePointId: [
|
|
|
{ required: true, message: "请选择知识点", trigger: "blur" },
|
|
|
{ required: true, message: "请选择知识点", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
],
|
|
|
- data3: [
|
|
|
+ disciplineTypeId: [
|
|
|
{ required: true, message: "请选择专业类别", trigger: "blur" },
|
|
|
{ required: true, message: "请选择专业类别", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
],
|
|
|
- data41: [
|
|
|
- { required: true, message: "请上传课件", trigger: "blur" },
|
|
|
- { required: true, message: "请上传课件", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
- ],
|
|
|
- data42: [
|
|
|
+ attachments: [
|
|
|
{ required: true, message: "请上传课件", trigger: "blur" },
|
|
|
{ required: true, message: "请上传课件", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
],
|
|
|
- data43: [
|
|
|
+ articleContent: [
|
|
|
{ required: true, message: "请输入文章", trigger: "blur" },
|
|
|
{ required: true, message: "请输入文章", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
],
|
|
|
- data5: [
|
|
|
+ coursewareName: [
|
|
|
{ required: true, message: "请输入课件名称", trigger: "blur" },
|
|
|
{ required: true, message: "请输入课件名称", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
],
|
|
|
@@ -275,7 +308,7 @@
|
|
|
fileSizeLimit:1,
|
|
|
fileList:[],
|
|
|
options: {
|
|
|
- target: httpHeader+this.judgmentNetworkReturnAddress()+"/system/file/upload/chunk2",
|
|
|
+ target: httpHeader+this.judgmentNetworkReturnAddress()+"/exam/file/upload/chunk2",
|
|
|
// 开启服务端分片校验功能
|
|
|
testChunks: true,
|
|
|
single: true,
|
|
|
@@ -322,15 +355,43 @@
|
|
|
},
|
|
|
},
|
|
|
created(){
|
|
|
-
|
|
|
+ this.getData();
|
|
|
},
|
|
|
mounted(){
|
|
|
-
|
|
|
+ this.examElKnowledgePointTreeList();
|
|
|
+ // this.examElDisciplineTypeList();
|
|
|
},
|
|
|
methods:{
|
|
|
getData(){
|
|
|
-
|
|
|
- this.$refs.UEditor.text=unescape(this.subjectData.details)
|
|
|
+ if(this.propsData.id){
|
|
|
+ examElCoursewareDetail({id:this.propsData.id}).then(response => {
|
|
|
+ this.$set(this,'newData',{
|
|
|
+ id:response.data.id,
|
|
|
+ materialType:response.data.materialType,
|
|
|
+ knowledgePointId:response.data.knowledgePointId,
|
|
|
+ disciplineTypeId:'',
|
|
|
+ watermark:response.data.watermark?response.data.watermark:'',
|
|
|
+ coursewareName:response.data.coursewareName,
|
|
|
+ minLearningDuration:response.data.minLearningDuration,
|
|
|
+ autoCreditHours:response.data.autoCreditHours,
|
|
|
+ creditHours:response.data.creditHours?response.data.creditHours:0,
|
|
|
+ autoPoints:response.data.autoPoints,
|
|
|
+ points:response.data.points?response.data.points:0,
|
|
|
+ shareStatus:response.data.shareStatus,
|
|
|
+ });
|
|
|
+ if(response.data.materialType == 1 || response.data.materialType == 3){
|
|
|
+ this.$set(this.newData,'attachments',[{
|
|
|
+ attachmentPath:response.data.attachmentPath,
|
|
|
+ attachmentName:response.data.attachmentName?response.data.attachmentName:'',
|
|
|
+ attachmentSize:response.data.attachmentSize,
|
|
|
+ }]);
|
|
|
+ this.$set(this.newData,'articleContent','');
|
|
|
+ }else if(response.data.materialType == 4){
|
|
|
+ this.$set(this.newData,'attachments',[]);
|
|
|
+ this.$set(this.newData,'articleContent',response.data.articleContent);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
// 返回按钮
|
|
|
backPage(){
|
|
|
@@ -338,55 +399,90 @@
|
|
|
},
|
|
|
//重置
|
|
|
resetButton(){
|
|
|
-
|
|
|
+ let self = this;
|
|
|
+ this.$confirm('确认重置数据?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(function() {
|
|
|
+ }).then(() => {
|
|
|
+ self.getData();
|
|
|
+ }).catch(() => {});
|
|
|
},
|
|
|
//提交
|
|
|
submitButton(){
|
|
|
- if(this.newData.materialType == 3){
|
|
|
- this.$set(this.newData,'data43',escape(this.$refs.UEditor.text));
|
|
|
- }
|
|
|
+ let self = this;
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
-
|
|
|
+ this.$confirm('是否确认保存?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(function() {
|
|
|
+ }).then(() => {
|
|
|
+ if(self.newData.id){
|
|
|
+ //编辑课件
|
|
|
+ self.examElCoursewareEdit();
|
|
|
+ }else{
|
|
|
+ //新增课件
|
|
|
+ self.examElCoursewareAdd();
|
|
|
+ }
|
|
|
+ }).catch(() => {});
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ //新增课件
|
|
|
+ examElCoursewareAdd(){
|
|
|
+ let obj = this.newData;
|
|
|
+ examElCoursewareAdd(obj).then(response => {
|
|
|
+ this.msgSuccess(response.message)
|
|
|
+ this.$parent.tableButton(6);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //编辑课件
|
|
|
+ examElCoursewareEdit(){
|
|
|
+ let obj = this.newData;
|
|
|
+ examElCoursewareEdit(obj).then(response => {
|
|
|
+ this.msgSuccess(response.message)
|
|
|
+ this.$parent.tableButton(6);
|
|
|
+ });
|
|
|
+ },
|
|
|
//类型切换
|
|
|
changeUpDataNumType(){
|
|
|
- if(this.newData.materialType == 2){
|
|
|
- if(this.newData.data42[1]){
|
|
|
- this.$set(this,'upDataNumType',true);
|
|
|
- }else{
|
|
|
- this.$set(this,'upDataNumType',false);
|
|
|
- }
|
|
|
- }else{
|
|
|
- this.$set(this,'upDataNumType',false);
|
|
|
- }
|
|
|
+ this.$set(this.newData,'attachments',[]);
|
|
|
},
|
|
|
//删除文档
|
|
|
delList(index){
|
|
|
- this.newData.data42.splice(index,1);
|
|
|
- if(this.newData.materialType == 2){
|
|
|
- if(this.newData.data42[1]){
|
|
|
- this.$set(this,'upDataNumType',true);
|
|
|
- }else{
|
|
|
- this.$set(this,'upDataNumType',false);
|
|
|
- }
|
|
|
+ this.newData.attachments.splice(index,1);
|
|
|
+ if(!this.newData.attachments[1]){
|
|
|
+ this.$set(this.newData,'coursewareName',this.getLeftPart(this.newData.attachments[0].attachmentName));
|
|
|
+ }else{
|
|
|
+ this.$set(this.newData,'coursewareName','');
|
|
|
}
|
|
|
},
|
|
|
//文档上传验证
|
|
|
handleAvatarSuccess(res) {
|
|
|
- if(this.newData.data42.length>9){
|
|
|
+ if(this.newData.attachments.length>9){
|
|
|
this.msgError('已到达上传数量上限')
|
|
|
return
|
|
|
}
|
|
|
- this.newData.data42.push(res.data);
|
|
|
- if(this.newData.materialType == 2){
|
|
|
- if(this.newData.data42[1]){
|
|
|
- this.$set(this,'upDataNumType',true);
|
|
|
- }else{
|
|
|
- this.$set(this,'upDataNumType',false);
|
|
|
- }
|
|
|
+ if(this.newData.id){
|
|
|
+ this.$set(this.newData,'attachments',[{
|
|
|
+ attachmentPath:res.data.url,
|
|
|
+ attachmentName:this.getLeftPart(res.data.name),
|
|
|
+ attachmentSize:res.data.size+'',
|
|
|
+ }]);
|
|
|
+ }else{
|
|
|
+ this.newData.attachments.push({
|
|
|
+ attachmentPath:res.data.url,
|
|
|
+ attachmentName:this.getLeftPart(res.data.name),
|
|
|
+ attachmentSize:res.data.size+'',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if(!this.newData.attachments[1]){
|
|
|
+ this.$set(this.newData,'coursewareName',this.getLeftPart(res.data.name));
|
|
|
+ }else{
|
|
|
+ this.$set(this.newData,'coursewareName','');
|
|
|
}
|
|
|
},
|
|
|
beforeAvatarUpload(file) {
|
|
|
@@ -418,7 +514,7 @@
|
|
|
fileSuccess(rootFile, file, response, chunk) {
|
|
|
const result = JSON.parse(response);
|
|
|
if (result.code==200 && !this.skip) {
|
|
|
- axios.post(httpHeader+this.judgmentNetworkReturnAddress()+"/system/file/upload/merge", {
|
|
|
+ axios.post(httpHeader+this.judgmentNetworkReturnAddress()+"/exam/file/upload/merge", {
|
|
|
identifier: file.uniqueIdentifier,
|
|
|
filename: file.name,
|
|
|
totalChunks: chunk.offset,
|
|
|
@@ -428,17 +524,28 @@
|
|
|
}
|
|
|
}).then((res) => {
|
|
|
if (res.data.code==200) {
|
|
|
- // this.$set(this.newData,'data41',this.formatFilePath(res.data.data));
|
|
|
- this.$set(this.newData,'data41','http://192.168.1.8/statics/bigFile/20260721/3a0a0c04-9c34-484d-8fb2-2e46e2d241c8.mp4');
|
|
|
+ this.$set(this.newData,'attachments',[{
|
|
|
+ attachmentPath:res.data.data.url,
|
|
|
+ attachmentName:this.getLeftPart(res.data.data.name),
|
|
|
+ attachmentSize:res.data.data.size+'',
|
|
|
+ }]);
|
|
|
+ this.$set(this.newData,'coursewareName',this.getLeftPart(res.data.data.name));
|
|
|
+ this.$set(this.newData,'minLearningDuration',Math.floor(seconds / res.data.data.duration));
|
|
|
} else {
|
|
|
-
|
|
|
+ this.msgError('上传出错,请稍后再试')
|
|
|
}
|
|
|
}).catch(function (error) {
|
|
|
});
|
|
|
} else {
|
|
|
-
|
|
|
+ this.msgError('上传出错,请稍后再试')
|
|
|
}
|
|
|
},
|
|
|
+ getLeftPart(str) {
|
|
|
+ const index = str.lastIndexOf('.');
|
|
|
+ // 如果没有找到 '.',直接返回原字符串
|
|
|
+ if (index === -1) return str;
|
|
|
+ return str.substring(0, index);
|
|
|
+ },
|
|
|
fileComplete(rootFile) {
|
|
|
// 一个根文件(文件夹)成功上传完成。
|
|
|
this.fileName=rootFile.name;
|
|
|
@@ -449,10 +556,7 @@
|
|
|
},
|
|
|
filesAdded(file, fileList, event) {
|
|
|
file.forEach((item)=>{
|
|
|
- if(["image/png","image/jpeg","image/jpg","image/gif",
|
|
|
- "application/pdf",
|
|
|
- "video/mp4",
|
|
|
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document"].indexOf(item.fileType) === -1){
|
|
|
+ if(["video/mp4"].indexOf(item.fileType) === -1){
|
|
|
this.msgError("文件格式不支持,请上传正确的文件.");
|
|
|
file.ignored = true;
|
|
|
}else{
|
|
|
@@ -497,10 +601,32 @@
|
|
|
fileReader.readAsArrayBuffer(blobSlice.call(file.file, start, end));
|
|
|
}
|
|
|
},
|
|
|
- formatFilePath(path) {
|
|
|
- if (!path) return '';
|
|
|
- return path.replace(/\\/g, '/');
|
|
|
- }
|
|
|
+ //知识点
|
|
|
+ examElKnowledgePointTreeList(){
|
|
|
+ examElKnowledgePointTreeList({}).then(response => {
|
|
|
+ const list = response.data || [];
|
|
|
+ this.formatTreeData(list);
|
|
|
+ this.$set(this, 'optionListB', list);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //查询全部专业类别
|
|
|
+ examElDisciplineTypeList(){
|
|
|
+ examElDisciplineTypeList({}).then(response => {
|
|
|
+ this.$set(this,'optionListC',response.data);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ formatTreeData(data) {
|
|
|
+ data.forEach(item => {
|
|
|
+ // 如果 children 存在,且是数组,且长度为 0(即 children: [])
|
|
|
+ if (Array.isArray(item.children) && item.children.length === 0) {
|
|
|
+ // 将 children 设为 undefined(或直接 delete item.children;)
|
|
|
+ item.children = undefined;
|
|
|
+ } else if (item.children && item.children.length > 0) {
|
|
|
+ // 如果还有下一级,继续递归处理
|
|
|
+ this.formatTreeData(item.children);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
}
|
|
|
</script>
|