baigl #261

Merged
baigl merged 14 commits from baigl into main 2024-09-24 16:34:39 +08:00
5 changed files with 129 additions and 49 deletions
Showing only changes of commit 820a4e04f7 - Show all commits

View File

@ -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 = [];

View File

@ -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')

View File

@ -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
}

View File

@ -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();
}
}

View File

@ -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 {