作业设计-常规作业
This commit is contained in:
parent
2e2e29808f
commit
820a4e04f7
|
@ -7,7 +7,6 @@
|
||||||
:before-upload="handleBeforeUpload"
|
:before-upload="handleBeforeUpload"
|
||||||
:file-list="fileList"
|
:file-list="fileList"
|
||||||
:limit="limit"
|
:limit="limit"
|
||||||
:on-progress="handlePPTUploadProgress"
|
|
||||||
:on-error="handleUploadError"
|
:on-error="handleUploadError"
|
||||||
:on-exceed="handleExceed"
|
:on-exceed="handleExceed"
|
||||||
:on-success="handleUploadSuccess"
|
:on-success="handleUploadSuccess"
|
||||||
|
@ -72,14 +71,13 @@ const emit = defineEmits();
|
||||||
const number = ref(0);
|
const number = ref(0);
|
||||||
const uploadList = ref([]);
|
const uploadList = ref([]);
|
||||||
const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
||||||
// const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址
|
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 headers = ref({ Authorization: "Bearer " + getToken() });
|
const headers = ref({ Authorization: "Bearer " + getToken() });
|
||||||
const fileList = ref([]);
|
const fileList = ref([]);
|
||||||
const showTip = computed(
|
const showTip = computed(
|
||||||
() => props.isShowTip && (props.fileType || props.fileSize)
|
() => props.isShowTip && (props.fileType || props.fileSize)
|
||||||
);
|
);
|
||||||
console.log("uploadFileUrl", uploadFileUrl);
|
|
||||||
watch(() => props.modelValue, val => {
|
watch(() => props.modelValue, val => {
|
||||||
if (val) {
|
if (val) {
|
||||||
let temp = 1;
|
let temp = 1;
|
||||||
|
@ -119,7 +117,6 @@ const handleBeforeUpload = (file) =>{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('正在上传文件,请稍候……');
|
|
||||||
proxy.$modal.loading("正在上传文件,请稍候...");
|
proxy.$modal.loading("正在上传文件,请稍候...");
|
||||||
number.value++;
|
number.value++;
|
||||||
return true;
|
return true;
|
||||||
|
@ -127,24 +124,16 @@ const handleBeforeUpload = (file) =>{
|
||||||
|
|
||||||
// 文件个数超出
|
// 文件个数超出
|
||||||
function handleExceed() {
|
function handleExceed() {
|
||||||
console.log('文件个数超出');
|
|
||||||
proxy.$modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`);
|
proxy.$modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`);
|
||||||
}
|
}
|
||||||
/**文件上传中处理 */
|
|
||||||
const handlePPTUploadProgress = (event, file, fileList) =>{
|
|
||||||
// this.uploadPPT.isUploading = true;
|
|
||||||
console.log('文件上传中'+file);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 上传失败
|
// 上传失败
|
||||||
function handleUploadError(err) {
|
function handleUploadError(err) {
|
||||||
console.log('上传失败');
|
|
||||||
proxy.$modal.msgError("上传文件失败");
|
proxy.$modal.msgError("上传文件失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传成功回调
|
// 上传成功回调
|
||||||
function handleUploadSuccess(res, file) {
|
function handleUploadSuccess(res, file) {
|
||||||
console.log('上传成功');
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uploadList.value.push({ name: res.fileName, url: res.url });
|
uploadList.value.push({ name: res.fileName, url: res.url });
|
||||||
uploadedSuccessfully();
|
uploadedSuccessfully();
|
||||||
|
@ -165,8 +154,6 @@ function handleDelete(index) {
|
||||||
|
|
||||||
// 上传结束处理
|
// 上传结束处理
|
||||||
function uploadedSuccessfully() {
|
function uploadedSuccessfully() {
|
||||||
console.log('上传结束'+ number.value);
|
|
||||||
console.log('上传结束uploadList.value.length'+ uploadList.value.length);
|
|
||||||
if (number.value > 0 && uploadList.value.length === number.value) {
|
if (number.value > 0 && uploadList.value.length === number.value) {
|
||||||
fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value);
|
fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value);
|
||||||
uploadList.value = [];
|
uploadList.value = [];
|
||||||
|
|
|
@ -15,6 +15,7 @@ import App from './App.vue'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
import log from 'electron-log/renderer' // 渲染进程日志-文件记录
|
import log from 'electron-log/renderer' // 渲染进程日志-文件记录
|
||||||
import customComponent from '@/components/common' // 自定义组件
|
import customComponent from '@/components/common' // 自定义组件
|
||||||
|
import plugins from './plugins' // plugins插件
|
||||||
|
|
||||||
if(process.env.NODE_ENV != 'development') { // 非开发环境,将日志打印到日志文件
|
if(process.env.NODE_ENV != 'development') { // 非开发环境,将日志打印到日志文件
|
||||||
Object.assign(console, log.functions) // 渲染进程日志-控制台替换
|
Object.assign(console, log.functions) // 渲染进程日志-控制台替换
|
||||||
|
@ -40,4 +41,5 @@ app.use(router)
|
||||||
.use(store)
|
.use(store)
|
||||||
.use(ElementPlus, { locale: zhLocale })
|
.use(ElementPlus, { locale: zhLocale })
|
||||||
.use(customComponent) // 自定义组件
|
.use(customComponent) // 自定义组件
|
||||||
|
.use(plugins)
|
||||||
.mount('#app')
|
.mount('#app')
|
|
@ -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
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -844,46 +844,37 @@ const handleClassWorkSave = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(classWorkForm.worktype === "常规作业"){
|
else if(classWorkForm.worktype === "常规作业"){
|
||||||
this.fileLoading = true
|
fileLoading.value = true
|
||||||
var formObj = {};
|
cform.workcodes = JSON.stringify(fileHomeworkList.value);
|
||||||
formObj.id = 0;
|
cform.entpcourseworklist = JSON.stringify([{'id':-2, 'score': '10'}]);
|
||||||
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'}]);
|
|
||||||
try {
|
try {
|
||||||
addClassworkReturnId(formObj).then(() => {
|
addClassworkReturnId(cform).then(() => {
|
||||||
this.classWorkForm.worktype = "习题训练";
|
ElMessage({ type: 'success', message: '作业设计成功!'});
|
||||||
this.chooseWorkLists = [];
|
// 重置提交表单
|
||||||
this.fileHomeworkList = []
|
classWorkForm.worktype = "常规作业";
|
||||||
this.whiteboardObj = '';
|
classWorkForm.uniquekey = props.uniquekey, // 作业唯一标识 作业名称
|
||||||
|
classWorkForm.title = "";
|
||||||
|
classWorkForm.quizlist = [], // 作业习题列表内容
|
||||||
|
|
||||||
|
// 情况选择的资源缓存
|
||||||
|
chooseWorkLists.value = [];
|
||||||
|
whiteboardObj.value = ''; // ? // 清空白板
|
||||||
|
fileHomeworkList.value = []; // 常规作业list
|
||||||
// refresh the list
|
// refresh the list
|
||||||
//这里分离了,所以不需要更新表单数据了
|
//这里分离了,所以不需要更新表单数据了
|
||||||
// this.getClassWorkAllList();
|
// this.getClassWorkAllList();
|
||||||
this.newWorkSpace = false;
|
|
||||||
this.newWorkSpaceEdit = false;
|
// TODO 后续看是否跳转到 作业布置页面
|
||||||
this.workEdit = false;
|
|
||||||
|
//TODO 下面3个后续看是啥
|
||||||
|
// this.newWorkSpace = false;
|
||||||
|
// this.newWorkSpaceEdit = false;
|
||||||
|
// this.workEdit = false;
|
||||||
|
|
||||||
|
fileLoading.value = false
|
||||||
})
|
})
|
||||||
} finally {
|
} finally {
|
||||||
this.fileLoading = false
|
fileLoading.value = false
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue