mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 04:16:47 +08:00
评估接口+课程部分
This commit is contained in:
@@ -123,7 +123,7 @@ export default {
|
||||
inputV1: "",
|
||||
inputV2: "",
|
||||
time: undefined,
|
||||
endTimes : "",
|
||||
endTimes: "",
|
||||
startTimes: "",
|
||||
picUrl: "",
|
||||
tableData: [],
|
||||
@@ -145,46 +145,47 @@ export default {
|
||||
|
||||
//上传组件
|
||||
function getBase64(img, callback) {
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener('load', () => callback(reader.result));
|
||||
reader.readAsDataURL(img);
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener("load", () => callback(reader.result));
|
||||
reader.readAsDataURL(img);
|
||||
}
|
||||
|
||||
|
||||
const fileList = ref([]);
|
||||
const loading = ref(false);
|
||||
const imageUrl = ref('');
|
||||
const imageUrl = ref("");
|
||||
|
||||
const handleChange = (info) => {
|
||||
if (info.file.status === 'uploading') {
|
||||
loading.value = true;
|
||||
return;
|
||||
}
|
||||
if (info.file.status === 'done') {
|
||||
console.log('上传图片返回的信息 %o', info)
|
||||
state.picUrl = info.file.response.data;
|
||||
// Get this url from response in real world.
|
||||
getBase64(info.file.originFileObj, (base64Url) => {
|
||||
imageUrl.value = base64Url;
|
||||
const handleChange = (info) => {
|
||||
if (info.file.status === "uploading") {
|
||||
loading.value = true;
|
||||
return;
|
||||
}
|
||||
if (info.file.status === "done") {
|
||||
console.log("上传图片返回的信息 %o", info);
|
||||
state.picUrl = info.file.response.data;
|
||||
// Get this url from response in real world.
|
||||
getBase64(info.file.originFileObj, (base64Url) => {
|
||||
imageUrl.value = base64Url;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
if (info.file.status === 'error') {
|
||||
loading.value = false;
|
||||
message.error('upload error');
|
||||
}
|
||||
}
|
||||
if (info.file.status === "error") {
|
||||
loading.value = false;
|
||||
message.error("upload error");
|
||||
}
|
||||
};
|
||||
|
||||
const beforeUpload = (file) => {
|
||||
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
|
||||
if (!isJpgOrPng) {
|
||||
message.error('You can only upload JPG file!');
|
||||
}
|
||||
const isLt2M = file.size / 1024 / 1024 < 1;
|
||||
if (!isLt2M) {
|
||||
message.error('Image must smaller than 1MB!');
|
||||
}
|
||||
return isJpgOrPng && isLt2M;
|
||||
};
|
||||
const beforeUpload = (file) => {
|
||||
const isJpgOrPng =
|
||||
file.type === "image/jpeg" || file.type === "image/png";
|
||||
if (!isJpgOrPng) {
|
||||
message.error("You can only upload JPG file!");
|
||||
}
|
||||
const isLt2M = file.size / 1024 / 1024 < 1;
|
||||
if (!isLt2M) {
|
||||
message.error("Image must smaller than 1MB!");
|
||||
}
|
||||
return isJpgOrPng && isLt2M;
|
||||
};
|
||||
|
||||
// const getTableDate = (tableData) => {
|
||||
// let data = tableData;
|
||||
@@ -219,11 +220,17 @@ export default {
|
||||
//创建测评信息
|
||||
const createEvalText = () => {
|
||||
if (!state.inputV1) return message.info("请输入测评名称");
|
||||
if ( state.time != undefined) {
|
||||
state.endTimes = toDate(new Date(state.time[0].$d).getTime() / 1000, "Y-M-D")
|
||||
state.startTimes = toDate(new Date(state.time[1].$d).getTime() / 1000, "Y-M-D")
|
||||
}
|
||||
|
||||
if (state.time != undefined) {
|
||||
state.endTimes = toDate(
|
||||
new Date(state.time[0].$d).getTime() / 1000,
|
||||
"Y-M-D"
|
||||
);
|
||||
state.startTimes = toDate(
|
||||
new Date(state.time[1].$d).getTime() / 1000,
|
||||
"Y-M-D"
|
||||
);
|
||||
}
|
||||
|
||||
let obj = {
|
||||
evaluationName: state.inputV1,
|
||||
createTime: "",
|
||||
|
||||
Reference in New Issue
Block a user