diff --git a/src/renderer/src/components/FileUpload/index.vue b/src/renderer/src/components/FileUpload/index.vue index 77d07fc..e1ce984 100644 --- a/src/renderer/src/components/FileUpload/index.vue +++ b/src/renderer/src/components/FileUpload/index.vue @@ -7,7 +7,6 @@ :before-upload="handleBeforeUpload" :file-list="fileList" :limit="limit" - :on-progress="handlePPTUploadProgress" :on-error="handleUploadError" :on-exceed="handleExceed" :on-success="handleUploadSuccess" @@ -72,14 +71,13 @@ const emit = defineEmits(); const number = ref(0); const uploadList = ref([]); const baseUrl = import.meta.env.VITE_APP_BASE_API; -// const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址 -const uploadFileUrl = ref("http://27.128.240.72:7865/dev-api/common/upload"); // 上传文件服务器地址 +const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址 const headers = ref({ Authorization: "Bearer " + getToken() }); const fileList = ref([]); const showTip = computed( () => props.isShowTip && (props.fileType || props.fileSize) ); -console.log("uploadFileUrl", uploadFileUrl); + watch(() => props.modelValue, val => { if (val) { let temp = 1; @@ -119,7 +117,6 @@ const handleBeforeUpload = (file) =>{ return false; } } - console.log('正在上传文件,请稍候……'); proxy.$modal.loading("正在上传文件,请稍候..."); number.value++; return true; @@ -127,24 +124,16 @@ const handleBeforeUpload = (file) =>{ // 文件个数超出 function handleExceed() { - console.log('文件个数超出'); proxy.$modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`); } -/**文件上传中处理 */ -const handlePPTUploadProgress = (event, file, fileList) =>{ - // this.uploadPPT.isUploading = true; - console.log('文件上传中'+file); -}; // 上传失败 function handleUploadError(err) { - console.log('上传失败'); proxy.$modal.msgError("上传文件失败"); } // 上传成功回调 function handleUploadSuccess(res, file) { - console.log('上传成功'); if (res.code === 200) { uploadList.value.push({ name: res.fileName, url: res.url }); uploadedSuccessfully(); @@ -165,8 +154,6 @@ function handleDelete(index) { // 上传结束处理 function uploadedSuccessfully() { - console.log('上传结束'+ number.value); - console.log('上传结束uploadList.value.length'+ uploadList.value.length); if (number.value > 0 && uploadList.value.length === number.value) { fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value); uploadList.value = []; diff --git a/src/renderer/src/main.js b/src/renderer/src/main.js index be69725..395ec45 100644 --- a/src/renderer/src/main.js +++ b/src/renderer/src/main.js @@ -15,6 +15,7 @@ import App from './App.vue' import router from './router' import log from 'electron-log/renderer' // 渲染进程日志-文件记录 import customComponent from '@/components/common' // 自定义组件 +import plugins from './plugins' // plugins插件 if(process.env.NODE_ENV != 'development') { // 非开发环境,将日志打印到日志文件 Object.assign(console, log.functions) // 渲染进程日志-控制台替换 @@ -40,4 +41,5 @@ app.use(router) .use(store) .use(ElementPlus, { locale: zhLocale }) .use(customComponent) // 自定义组件 + .use(plugins) .mount('#app') \ No newline at end of file diff --git a/src/renderer/src/plugins/index.js b/src/renderer/src/plugins/index.js new file mode 100644 index 0000000..8b5c431 --- /dev/null +++ b/src/renderer/src/plugins/index.js @@ -0,0 +1,18 @@ +// import tab from './tab' +// import auth from './auth' +// import cache from './cache' +import modal from './modal' +// import download from './download' + +export default function installPlugins(app){ + // 页签操作 + // app.config.globalProperties.$tab = tab + // // 认证对象 + // app.config.globalProperties.$auth = auth + // // 缓存对象 + // app.config.globalProperties.$cache = cache + // 模态框对象 + app.config.globalProperties.$modal = modal + // 下载文件 + // app.config.globalProperties.$download = download +} diff --git a/src/renderer/src/plugins/modal.js b/src/renderer/src/plugins/modal.js new file mode 100644 index 0000000..b59e14d --- /dev/null +++ b/src/renderer/src/plugins/modal.js @@ -0,0 +1,82 @@ +import { ElMessage, ElMessageBox, ElNotification, ElLoading } from 'element-plus' + +let loadingInstance; + +export default { + // 消息提示 + msg(content) { + ElMessage.info(content) + }, + // 错误消息 + msgError(content) { + ElMessage.error(content) + }, + // 成功消息 + msgSuccess(content) { + ElMessage.success(content) + }, + // 警告消息 + msgWarning(content) { + ElMessage.warning(content) + }, + // 弹出提示 + alert(content) { + ElMessageBox.alert(content, "系统提示") + }, + // 错误提示 + alertError(content) { + ElMessageBox.alert(content, "系统提示", { type: 'error' }) + }, + // 成功提示 + alertSuccess(content) { + ElMessageBox.alert(content, "系统提示", { type: 'success' }) + }, + // 警告提示 + alertWarning(content) { + ElMessageBox.alert(content, "系统提示", { type: 'warning' }) + }, + // 通知提示 + notify(content) { + ElNotification.info(content) + }, + // 错误通知 + notifyError(content) { + ElNotification.error(content); + }, + // 成功通知 + notifySuccess(content) { + ElNotification.success(content) + }, + // 警告通知 + notifyWarning(content) { + ElNotification.warning(content) + }, + // 确认窗体 + confirm(content) { + return ElMessageBox.confirm(content, "系统提示", { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: "warning", + }) + }, + // 提交内容 + prompt(content) { + return ElMessageBox.prompt(content, "系统提示", { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: "warning", + }) + }, + // 打开遮罩层 + loading(content) { + loadingInstance = ElLoading.service({ + lock: true, + text: content, + background: "rgba(0, 0, 0, 0.7)", + }) + }, + // 关闭遮罩层 + closeLoading() { + loadingInstance.close(); + } +} diff --git a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue index 71b02d9..d9f8af7 100644 --- a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue +++ b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue @@ -844,46 +844,37 @@ const handleClassWorkSave = async () => { } } else if(classWorkForm.worktype === "常规作业"){ - this.fileLoading = true - var formObj = {}; - formObj.id = 0; - formObj.workdate = this.classWorkForm.workdate; - formObj.deaddate = ''; - formObj.entpid = this.userStore.deptId; - formObj.level = 1; - formObj.parentid = 0; - formObj.worktype = this.classWorkForm.worktype; - formObj.workkey = ''; - formObj.worktag = ''; - formObj.uniquekey = this.classWorkForm.uniquekey; - formObj.classid = 0; - formObj.classcourseid = 0; - formObj.entpcourseid = this.courseObj.id; - formObj.slideid = 0; - formObj.title = this.classWorkForm.title; - formObj.workcodes = JSON.stringify(this.fileHomeworkList); - formObj.edusubject = this.courseObj.edusubject; - formObj.evalid = this.courseObj.evalid; - formObj.edustage = this.userStore.edustage; - formObj.status = '10'; //2024-09-11 作业布置分离后的 新模版数据; 之前老版本为空 - formObj.edituserid = this.userStore.id; - formObj.entpcourseworklist = JSON.stringify([{'id':-2, 'score': '10'}]); + fileLoading.value = true + cform.workcodes = JSON.stringify(fileHomeworkList.value); + cform.entpcourseworklist = JSON.stringify([{'id':-2, 'score': '10'}]); try { - addClassworkReturnId(formObj).then(() => { - this.classWorkForm.worktype = "习题训练"; - this.chooseWorkLists = []; - this.fileHomeworkList = [] - this.whiteboardObj = ''; + addClassworkReturnId(cform).then(() => { + ElMessage({ type: 'success', message: '作业设计成功!'}); + // 重置提交表单 + classWorkForm.worktype = "常规作业"; + classWorkForm.uniquekey = props.uniquekey, // 作业唯一标识 作业名称 + classWorkForm.title = ""; + classWorkForm.quizlist = [], // 作业习题列表内容 + + // 情况选择的资源缓存 + chooseWorkLists.value = []; + whiteboardObj.value = ''; // ? // 清空白板 + fileHomeworkList.value = []; // 常规作业list // refresh the list //这里分离了,所以不需要更新表单数据了 // this.getClassWorkAllList(); - this.newWorkSpace = false; - this.newWorkSpaceEdit = false; - this.workEdit = false; + + // TODO 后续看是否跳转到 作业布置页面 + + //TODO 下面3个后续看是啥 + // this.newWorkSpace = false; + // this.newWorkSpaceEdit = false; + // this.workEdit = false; + + fileLoading.value = false }) } finally { - this.fileLoading = false - + fileLoading.value = false } } else {