Merge branch 'master' of ssh://gitlab.dongwu-inc.com:10022/BOE/fe-manage

This commit is contained in:
songwc
2022-11-01 12:34:58 +08:00
25 changed files with 1021 additions and 392 deletions

View File

@@ -1,5 +1,5 @@
import http from "./config"; import http from "./config";
// import qs from 'qs'; import qs from 'qs';
/** /**
@@ -34,6 +34,8 @@ import http from "./config";
* *
*/ */
//上传文件
export const uploadFile = (obj) => http.post('/test/testRequest', qs.stringify({ obj }));
// 接口-请求 // 接口-请求

19
src/api/indexActivity.js Normal file
View File

@@ -0,0 +1,19 @@
import http from "./config";
//获取活动信息接口
export const getActivity = (obj) => http.get('/activity', { params: obj });
//创建活动接口
export const createActivity = (obj) => http.post('/activity/createActivity', obj);
//删除活动接口
export const deleteActivity = (obj) => http.post('/activity/deleteActivity', { params: obj });
//修改活动接口
export const updateActivity = (obj) => http.post('/activity/updateActivity', obj);
//修改活动是否为必修接口
export const updateActivityToCompulsory = (obj) => http.post('/activity/updateActivityToCompulsory', { params: obj });
//修改活动是否为选修接口
export const updateActivityToElective = (obj) => http.post('/activity/updateActivityToElective', { params: obj });

13
src/api/indexDiscuss.js Normal file
View File

@@ -0,0 +1,13 @@
import http from "./config";
//创建讨论
export const createDiscuss = (obj) => http.post('/discuss/createDiscuss', obj);
//获取讨论信息接口
export const getDiscussDetail = (obj) => http.post('/discuss/getDiscussDetail', { params: obj });
//删除讨论接口
export const deleteDiscuss = (obj) => http.post('/discuss/deleteDiscuss', { params: obj });
//修改讨论接口
export const updateDiscuss = (obj) => http.post('/discuss/updateDiscuss', { params: obj });

63
src/api/indexEval.js Normal file
View File

@@ -0,0 +1,63 @@
import http from "./config";
// import qs from 'qs';
/**
* 接口传参数方式get
* axios.get('/user', {
* params: {
* id: 12345
* name: user
* }
* }).then(res => console.log(res))
*
* 接口传参三种方式post/put/patch
*
* 1.'Content-Type'= 'multipart/form-data',传参格式为 formData。
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded'
* request的Header:'Content-Type'= 'multipart/form-data'
* var formData=new FormData();
* formData.append('user',123456);formData.append('pass',12345678);
* axios.post("/notice",formData).then()
*
* 2.'Content-Type'= 'application/x-www-form-urlencoded',传参格式为 query 形式,使用$qs.stringify。
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded'
* request的Header:'Content-Type'= 'application/x-www-form-urlencoded'
* let data = {"code":"1234","name":"yyyy"};
* axios.post(`${this.$url}/test/testRequest`,qs.stringify({data})).then()
*
* 3.'Content-Type'= 'application/json传参格式为 raw (JSON格式)。
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded'
* request的Header:'Content-Type'= 'application/json;charset=UTF-8'
* let data = {"code":"1234","name":"yyyy"}
* axios.post(`${this.$url}/test/testRequest`,data).then()
*
*/
// 接口-请求
//创建测评
export const createEvaluation = (obj) => http.post('/evaluation/createEvaluation', obj,);
//上传组件
export const fileUp = (obj) => http.post('/file/upload', obj,);
//删除测评信息
export const deleteEvaluationById = (obj) => http.post('/evaluation/deleteEvaluationById', { params: obj })
//根据ID获取测评信息详情
export const queryEvaluationDetailById = (obj) => http.post('/evaluation/queryEvaluationDetailById', { params: obj })
//修改测评信息
export const updateEvaluation = (obj) => http.post('/evaluation/updateEvaluation', obj)
// 测试方法
// import * as api from '../../api/index'
// api.getLearnPath({}).then(res => {
// console.log(res)
// }).catch(err => {
// console.log(err)
// })

14
src/api/indexExam.js Normal file
View File

@@ -0,0 +1,14 @@
import http from "./config";
// 创建考试信息接口
export const createExamination = (obj) => http.post('/examination/createExamination',obj,{
headers: {
'token': '123'
}
});
// 根据Id删除考试信息
export const deleteExaminationById = (obj) => http.post('/examination/deleteExaminationById',obj);
// 根据ID获取考试信息详情
export const queryExaminationDetailById = (obj) => http.post('/examination/queryExaminationDetailById',obj);
// 创建考试信息接口
export const updateExamination = (obj) => http.post('/examination/updateExamination',obj);

60
src/api/indexInvist.js Normal file
View File

@@ -0,0 +1,60 @@
import http from "./config";
// import qs from 'qs';
/**
* 接口传参数方式get
* axios.get('/user', {
* params: {
* id: 12345
* name: user
* }
* }).then(res => console.log(res))
*
* 接口传参三种方式post/put/patch
*
* 1.'Content-Type'= 'multipart/form-data',传参格式为 formData。
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded'
* request的Header:'Content-Type'= 'multipart/form-data'
* var formData=new FormData();
* formData.append('user',123456);formData.append('pass',12345678);
* axios.post("/notice",formData).then()
*
* 2.'Content-Type'= 'application/x-www-form-urlencoded',传参格式为 query 形式,使用$qs.stringify。
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded'
* request的Header:'Content-Type'= 'application/x-www-form-urlencoded'
* let data = {"code":"1234","name":"yyyy"};
* axios.post(`${this.$url}/test/testRequest`,qs.stringify({data})).then()
*
* 3.'Content-Type'= 'application/json传参格式为 raw (JSON格式)。
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded'
* request的Header:'Content-Type'= 'application/json;charset=UTF-8'
* let data = {"code":"1234","name":"yyyy"}
* axios.post(`${this.$url}/test/testRequest`,data).then()
*
*/
// 接口-请求
//创建评估
export const createAppraiseMessage = (obj) => http.post('/survey/createAppraiseMessage', obj,);
//删除评估信息
export const deleteAppraise = (obj) => http.post('/survey/deleteAppraise', { params: obj })
//根据ID获取评估信息详情
export const queryAppraiseDetailById = (obj) => http.post('/survey/queryAppraiseDetailById', { params: obj })
//修改评估信息
export const updateAppraiseMessage = (obj) => http.post('/survey/updateAppraiseMessage', obj)
// 测试方法
// import * as api from '../../api/index'
// api.getLearnPath({}).then(res => {
// console.log(res)
// }).catch(err => {
// console.log(err)
// })

8
src/api/indexLevel.js Normal file
View File

@@ -0,0 +1,8 @@
import http from "./config";
//新建或编辑关卡
export const editChapter = (obj) => http.post('/admin/router/editChapter', obj, {
headers: {
'token': '123'
}
});

0
src/api/indexVote.js Normal file
View File

14
src/api/indexWork.js Normal file
View File

@@ -0,0 +1,14 @@
import http from "./config";
// 创建作业信息接口
export const createWorkTask = (obj) => http.post('/work/createWorkTask',obj,{
headers: {
'token': '123'
}
});
// 删除作业信息接口
export const deleteWorkTask = (obj) => http.post('/work/deleteWorkTask',obj);
// 根据ID获取作业信息详情
export const queryWorkDetailById = (obj) => http.post('/work/queryWorkDetailById',obj);
// 修改作业信息接口
export const updateWorkTaskUsing = (obj) => http.post('/work/updateWorkTask',obj);

View File

@@ -188,7 +188,7 @@
</a-menu-item> </a-menu-item>
<a-menu-item key="sub5" @titleClick="titleClick"> <a-menu-item key="sub5" @titleClick="titleClick">
<span>调研</span> <span>评估</span>
</a-menu-item> </a-menu-item>
<a-menu-item key="sub6" @titleClick="titleClick"> <a-menu-item key="sub6" @titleClick="titleClick">

View File

@@ -65,6 +65,7 @@
v-model:value="textV2" v-model:value="textV2"
placeholder="请输入活动说明" placeholder="请输入活动说明"
allow-clear allow-clear
maxlength="150"
/> />
</div> </div>
</div> </div>
@@ -75,6 +76,7 @@
<div class="btnbox"> <div class="btnbox">
<a-range-picker <a-range-picker
style="width: 424px" style="width: 424px"
v-model:value="time"
:placeholder="[' 开始时间', ' 结束时间']" :placeholder="[' 开始时间', ' 结束时间']"
/> />
</div> </div>
@@ -118,7 +120,7 @@
<a-input <a-input
v-model:value="inputV3" v-model:value="inputV3"
style="width: 424px; height: 32px" style="width: 424px; height: 32px"
placeholder="请输入授课老师" placeholder="请输入活动地址"
/> />
</div> </div>
</div> </div>
@@ -143,7 +145,7 @@
border-radius: 8px; border-radius: 8px;
overflow: hidden; overflow: hidden;
" "
:v-model:value="inputV4" v-model:value="inputV4"
/> />
<span style="color: #999999; margin-left: 8px">分钟</span> <span style="color: #999999; margin-left: 8px">分钟</span>
</div> </div>
@@ -159,7 +161,7 @@
border-radius: 8px; border-radius: 8px;
overflow: hidden; overflow: hidden;
" "
:v-model:value="inputV5" v-model:value="inputV5"
/> />
<span style="color: #999999; margin-left: 8px">分钟</span> <span style="color: #999999; margin-left: 8px">分钟</span>
</div> </div>
@@ -180,7 +182,7 @@
border-radius: 8px; border-radius: 8px;
overflow: hidden; overflow: hidden;
" "
:v-model:value="inputV6" v-model:value="inputV6"
/> />
<span style="color: #999999; margin-left: 8px" <span style="color: #999999; margin-left: 8px"
>分钟提前签退则记为早退</span >分钟提前签退则记为早退</span
@@ -207,14 +209,17 @@
</div> </div>
</div> </div>
<div class="main_btns"> <div class="main_btns">
<button class="btn1">取消</button> <button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2">确定</button> <button class="btn2" @click="createActivity">确定</button>
</div> </div>
</div> </div>
</a-drawer> </a-drawer>
</template> </template>
<script> <script>
import { reactive, toRefs, ref } from "vue"; import { reactive, toRefs, ref } from "vue";
import * as api from "../../api/indexActivity";
import { message } from "ant-design-vue";
import { toDate } from "../../api/method.js";
const rowSelection = ref({ const rowSelection = ref({
checkStrictly: false, checkStrictly: false,
onChange: (selectedRowKeys, selectedRows) => { onChange: (selectedRowKeys, selectedRows) => {
@@ -252,10 +257,20 @@ export default {
textV1: "", textV1: "",
textV2: "", textV2: "",
radioV1: "", radioV1: "",
time: "",
}); });
const closeDrawer = () => { const closeDrawer = () => {
ctx.emit("update:addactiveVisible", false); ctx.emit("update:addactiveVisible", false);
state.radioV1 = ""; state.radioV1 = "";
state.inputV1 = "";
state.inputV2 = "";
state.inputV3 = "";
state.inputV4 = "";
state.inputV5 = "";
state.inputV6 = "";
state.textV1 = "";
state.textV2 = "";
state.time = "";
}; };
const afterVisibleChange = (bool) => { const afterVisibleChange = (bool) => {
console.log("state", bool); console.log("state", bool);
@@ -265,12 +280,64 @@ export default {
state.radioV1 = ""; state.radioV1 = "";
} }
}; };
//创建活动
const createActivity = () => {
if(!state.inputV1) return message.warning("请输入活动名称");
if(!state.inputV2) return message.warning("请输入活动时长");
if(!state.textV1) return message.warning("请输入活动公告");
if(!state.inputV3) return message.warning("请输入活动地址");
let startTime = toDate(new Date(state.time[0].$d).getTime() / 1000, "Y-M-D");
let endTime = toDate(new Date(state.time[1].$d).getTime() / 1000, "Y-M-D");
let obj = {
activityAddress: state.inputV3, //活动地址
activityDuration: state.inputV2, //活动时长
activityExplain: state.textV2, //活动说明
activityEndTime: endTime, //活动结束时间
activityId: 0, //活动ID
activityName: state.inputV1, //活动名称
activityNotice: state.textV1, //活动公告
activityStartTime: startTime, //活动开始时间
activityTag: "", //活动逻辑删除标识
afterSignIn: state.inputV5, //活动开始后多少分钟签到
beforeSignIn: state.inputV4, //活动开始前多少分钟签到
createTime: "", //创建时间
createUser: 0, //创建人
signOutTime: state.inputV6, //签退开始时间
standardSettings: state.radioV1, //标准设置
updateTime: "", //更新时间
updateUser: 0, //更新人
};
api
.createActivity(obj)
.then((res) => {
setTimeout(() => {
console.log("创建成功", res);
message.success("创建成功");
state.radioV1 = "";
state.inputV1 = "";
state.inputV2 = "";
state.inputV3 = "";
state.inputV4 = "";
state.inputV5 = "";
state.inputV6 = "";
state.textV1 = "";
state.textV2 = "";
state.time = "";
ctx.emit("update:addactiveVisible", false);
}, 1000);
})
.catch((err) => {
console.log("创建失败",err);
})
};
return { return {
...toRefs(state), ...toRefs(state),
afterVisibleChange, afterVisibleChange,
closeDrawer, closeDrawer,
rowSelection, rowSelection,
cloradio1, cloradio1,
createActivity,
}; };
}, },
}; };
@@ -298,6 +365,9 @@ export default {
.contentMain { .contentMain {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.ant-picker {
border-radius: 8px;
}
.main_left { .main_left {
padding-right: 30px; padding-right: 30px;
flex: 1; flex: 1;

View File

@@ -33,7 +33,8 @@
v-model:value="inputV1" v-model:value="inputV1"
style="width: 424px; height: 32px" style="width: 424px; height: 32px"
placeholder="请输入讨论名称" placeholder="请输入讨论名称"
maxlength="20" show-count
:maxlength="20"
/> />
</div> </div>
</div> </div>
@@ -46,6 +47,8 @@
v-model:value="textV1" v-model:value="textV1"
placeholder="请输入讨论说明" placeholder="请输入讨论说明"
allow-clear allow-clear
show-count
:maxlength="200"
/> />
</div> </div>
</div> </div>
@@ -60,14 +63,16 @@
</div> </div>
</div> </div>
<div class="main_btns"> <div class="main_btns">
<button class="btn1">取消</button> <button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2">确定</button> <button class="btn2" @click="createDiscuss">确定</button>
</div> </div>
</div> </div>
</a-drawer> </a-drawer>
</template> </template>
<script> <script>
import { reactive, toRefs, ref } from "vue"; import { reactive, toRefs, ref } from "vue";
import * as api from "../../api/indexDiscuss";
import { message } from "ant-design-vue";
const rowSelection = ref({ const rowSelection = ref({
checkStrictly: false, checkStrictly: false,
onChange: (selectedRowKeys, selectedRows) => { onChange: (selectedRowKeys, selectedRows) => {
@@ -103,15 +108,51 @@ export default {
}); });
const closeDrawer = () => { const closeDrawer = () => {
ctx.emit("update:adddiscussVisible", false); ctx.emit("update:adddiscussVisible", false);
state.inputV1 = "";
state.textV1 = "";
}; };
const afterVisibleChange = (bool) => { const afterVisibleChange = (bool) => {
console.log("state", bool); console.log("state", bool);
}; };
//创建讨论
const createDiscuss = () => {
if(!state.inputV1) return message.warning("请输入讨论名称");
let obj = {
discussName: state.inputV1, //讨论名称
discussExplain: state.textV1, //讨论说明
discussSettings: state.checkedC1, //讨论设置
createTime: "", //创建时间
createUser: 0, //创建人
discussFlag: "", //活动逻辑删除标识
discussId: 0, //讨论Id
discussTag: "", //是否必修的标识
updateTime: "", //更新时间
updateUser: 0, //更新人
projectId: 0, //项目id
};
api
.createDiscuss(obj)
.then((res) => {
setTimeout(() => {
console.log("创建成功", res);
state.inputV1 = "";
state.textV1 = "";
message.success("创建成功");
ctx.emit("update:adddiscussVisible", false);
}, 1000);
})
.catch((err) => {
console.log("创建失败", err);
});
};
return { return {
...toRefs(state), ...toRefs(state),
afterVisibleChange, afterVisibleChange,
closeDrawer, closeDrawer,
rowSelection, rowSelection,
createDiscuss,
}; };
}, },
}; };
@@ -160,6 +201,9 @@ export default {
display: flex; display: flex;
flex: 1; flex: 1;
align-items: center; align-items: center;
.ant-input {
height: 100%;
}
.xkbtn { .xkbtn {
cursor: pointer; cursor: pointer;
width: 130px; width: 130px;
@@ -185,39 +229,21 @@ export default {
margin-right: 5px; margin-right: 5px;
} }
} }
.kqszbox { .textarea {
.qdqtbox { width: 423px;
margin-left: 56px; .ant-input {
width: 100%;
} }
.setbox { .ant-input-textarea-show-count {
display: flex; position: relative;
flex-wrap: wrap;
margin-top: 10px;
margin-bottom: 24px;
.timerbox {
margin-top: 6px;
margin-right: 32px;
display: flex;
align-items: center;
flex-wrap: nowrap;
} }
.ant-input-textarea-show-count::after {
position: absolute;
right: 10px;
bottom: 0px;
} }
} .ant-input {
.btnbox2 {
display: flex;
flex-direction: column;
justify-content: flex-start;
.xkbtn {
cursor: pointer;
width: 130px;
height: 40px;
background: #388be1;
border-radius: 8px; border-radius: 8px;
border: 0;
margin-right: 16px 8px 32px 0;
color: #fff;
margin-top: 16px;
margin-bottom: 60px;
} }
} }
} }

View File

@@ -61,7 +61,10 @@
</div> </div>
<div class="btnbox"> <div class="btnbox">
<a-range-picker <a-range-picker
style="width: 424px;" style="width: 424px"
v-model:value="time"
format="YYYY-MM-DD HH:mm:ss"
@change="onChange"
:placeholder="[' 开始时间', ' 结束时间']" :placeholder="[' 开始时间', ' 结束时间']"
/> />
</div> </div>
@@ -77,7 +80,7 @@
list-type="picture-card" list-type="picture-card"
class="avatar-uploader" class="avatar-uploader"
:show-upload-list="false" :show-upload-list="false"
action="https://www.mocky.io/v2/5cc8019d300000980a055e76" action="/api/file/upload"
:before-upload="beforeUpload" :before-upload="beforeUpload"
@change="handleChange" @change="handleChange"
> >
@@ -93,14 +96,19 @@
</div> </div>
</div> </div>
<div class="main_btns"> <div class="main_btns">
<button class="btn1">取消</button> <button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2">确定</button> <button class="btn2" @click="createEvalText">确定</button>
</div> </div>
</div> </div>
</a-drawer> </a-drawer>
</template> </template>
<script> <script>
import { reactive, toRefs, ref } from "vue"; import { reactive, toRefs, ref } from "vue";
import { useRouter } from "vue-router";
import * as api from "../../api/indexEval";
import { message } from "ant-design-vue";
// import { toDate } from "../../api/method";
const router = useRouter();
const rowSelection = ref({ const rowSelection = ref({
checkStrictly: false, checkStrictly: false,
onChange: (selectedRowKeys, selectedRows) => { onChange: (selectedRowKeys, selectedRows) => {
@@ -117,6 +125,11 @@
console.log(selected, selectedRows, changeRows); console.log(selected, selectedRows, changeRows);
}, },
}); });
function getBase64(img, callback) {
const reader = new FileReader();
reader.addEventListener('load', () => callback(reader.result));
reader.readAsDataURL(img);
}
export default { export default {
name: "AddEval", name: "AddEval",
// components: { // components: {
@@ -131,18 +144,120 @@
const state = reactive({ const state = reactive({
inputV1: "", inputV1: "",
inputV2: "", inputV2: "",
time: undefined,
endTime: undefined,
startTime: undefined,
}); });
const closeDrawer = () => { const closeDrawer = () => {
ctx.emit("update:addevalVisible", false); ctx.emit("update:addevalVisible", false);
state.inputV1 = "";
state.inputV2 = "";
state.time = undefined;
}; };
const afterVisibleChange = (bool) => { const afterVisibleChange = (bool) => {
console.log("state", bool); console.log("state", bool);
}; };
const onChange = () => {
state.endTime = state.time[0].$d.toString;
state.startTime = state.time[1].$d.toString;
}
//上传组件
const fileList = ref([]);
const loading = ref(false);
const imageUrl = ref('');
const handleChange = info => {
if (info.file.status === 'uploading') {
loading.value = true;
return;
}
if (info.file.status === 'done') {
// 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');
}
}
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 < 2;
if (!isLt2M) {
message.error('Image must smaller than 2MB!');
}
return isJpgOrPng && isLt2M;
}
// const fileUp = () => {
// let obj = {
// file
// }
// }
//创建测评信息
const createEvalText = () => {
if (!state.inputV1) return message.info("请输入测评名称");
console.log(state.time);
console.log(state.time[0]);
console.log(state.time[0].$d.toString);
console.log(state.time[1].$d.toString);
let obj = {
evaluationName: state.inputV1,
createTime: "",
createUser: 0,
evaluationEndTime: state.endTime,
evaluationFlag: "",
evaluationId: "",
evaluationPictureAddress: "",
evaluationStartTime: state.startTime,
evaluationTag: "",
evaluationTypeId: 0,
evaluationTypeName: "",
updateTime: "",
updateUser: 0,
};
api
.createEvaluation(obj)
.then((res) => {
setTimeout(() => {
console.log("创建成功", res);
message.success("创建成功");
console.log(obj);
// state.createLoading = false;
router.push("/leveladd");
// getLearnPath();
}, 1000);
})
.catch((err) => {
console.log("创建失败", err);
// state.createLoading = false;
});
};
return { return {
...toRefs(state), ...toRefs(state),
afterVisibleChange, afterVisibleChange,
closeDrawer, closeDrawer,
rowSelection, rowSelection,
createEvalText,
onChange,
//上传组件
fileList,
loading,
imageUrl,
handleChange,
beforeUpload,
}; };
}, },
}; };

View File

@@ -63,6 +63,7 @@
<div class="btnbox"> <div class="btnbox">
<a-range-picker <a-range-picker
style="width: 424px" style="width: 424px"
v-model:value="choosedTime"
:placeholder="[' 开始时间', ' 结束时间']" :placeholder="[' 开始时间', ' 结束时间']"
/> />
</div> </div>
@@ -78,7 +79,15 @@
<span style="margin-right: 3px">附件</span> <span style="margin-right: 3px">附件</span>
</div> </div>
<div class="btnbox"> <div class="btnbox">
<a-upload
v-model:file-list="fileList"
name="file"
action="/api/file/upload"
:headers="headers"
@change="handleChange"
>
<button class="xkbtn">上传附件</button> <button class="xkbtn">上传附件</button>
</a-upload>
</div> </div>
</div> </div>
<div class="main_item" style="margin-top:-25px;"> <div class="main_item" style="margin-top:-25px;">
@@ -91,14 +100,18 @@
</div> </div>
</div> </div>
<div class="main_btns"> <div class="main_btns">
<button class="btn1">取消</button> <button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2">确定</button> <button class="btn2" @click="addHomework">确定</button>
</div> </div>
</div> </div>
</a-drawer> </a-drawer>
</template> </template>
<script> <script>
import { reactive, toRefs, ref } from "vue"; import { reactive, toRefs, ref } from "vue";
import {message} from"ant-design-vue";
import {createWorkTask} from "@/api/indexWork"
import dayjs from 'dayjs';
const rowSelection = ref({ const rowSelection = ref({
checkStrictly: false, checkStrictly: false,
onChange: (selectedRowKeys, selectedRows) => { onChange: (selectedRowKeys, selectedRows) => {
@@ -129,18 +142,65 @@ export default {
const state = reactive({ const state = reactive({
inputV1: "", inputV1: "",
textV1:"", textV1:"",
choosedTime:[],
}); });
const handleChange = info => {
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
if (info.file.status === 'done') {
message.success(`${info.file.name} 文件上传成功`);
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 文件上传失败.`);
}
};
const fileList = ref([]);
const closeDrawer = () => { const closeDrawer = () => {
ctx.emit("update:addhomeworkVisible", false); ctx.emit("update:addhomeworkVisible", false);
}; };
const afterVisibleChange = (bool) => { const afterVisibleChange = (bool) => {
console.log("state", bool); console.log("state", bool);
}; };
const addHomework = () => {
if(state.choosedTime.length && state.inputV1 && state.textV1){
createWorkTask({
"createTime": "",
"createUser": 0,
"submitEndTime": dayjs(state.choosedTime[1]).format("YYYY-MM-DD"),
"submitStartTime": dayjs(state.choosedTime[0]).format("YYYY-MM-DD"),
"updateTime": "",
"updateUser": 0,
"workEnclosureAddress": "",
"workFlag": "",
"workId": 0,
"workName": state.inputV1,
"workRequirement": state.textV1,
"workTag": ""
}).then((res)=>{
message.success(`添加成功${res}`)
ctx.emit("update:addhomeworkVisible", false);
}).catch((err)=>{
message.error(`添加失败${err}`)
})
}
else{
message.error(`字段不能为空`)
return 0
}
}
return { return {
...toRefs(state), ...toRefs(state),
afterVisibleChange, afterVisibleChange,
closeDrawer, closeDrawer,
rowSelection, rowSelection,
addHomework,
handleChange,
fileList,
headers: {
"token":"123"
},
}; };
}, },
}; };

View File

@@ -3,13 +3,13 @@
:visible="addinvistVisible" :visible="addinvistVisible"
class="drawerStyle addinvistDrawer" class="drawerStyle addinvistDrawer"
width="80%" width="80%"
title="添加调研" title="添加评估"
placement="right" placement="right"
@after-visible-change="afterVisibleChange" @after-visible-change="afterVisibleChange"
> >
<div class="drawerMain"> <div class="drawerMain">
<div class="header"> <div class="header">
<div class="headerTitle">添加调研</div> <div class="headerTitle">添加评估</div>
<img <img
style="width: 29px; height: 29px; cursor: pointer" style="width: 29px; height: 29px; cursor: pointer"
src="../../assets/images/basicinfo/close.png" src="../../assets/images/basicinfo/close.png"
@@ -76,7 +76,7 @@
<div class="textarea"> <div class="textarea">
<a-textarea <a-textarea
v-model:value="textV1" v-model:value="textV1"
placeholder="请输入调研说明" placeholder="请输入评估说明"
allow-clear allow-clear
maxlength="150" maxlength="150"
/> />
@@ -85,14 +85,18 @@
</div> </div>
</div> </div>
<div class="main_btns"> <div class="main_btns">
<button class="btn1">取消</button> <button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2">确定</button> <button class="btn2" @click="createInvist">确定</button>
</div> </div>
</div> </div>
</a-drawer> </a-drawer>
</template> </template>
<script> <script>
import { reactive, toRefs, ref } from "vue"; import { reactive, toRefs, ref } from "vue";
import { useRouter } from "vue-router";
import * as api from "../../api/indexInvist";
import { message } from "ant-design-vue";
const router = useRouter();
const options1 = ref([ const options1 = ref([
{ {
value: "value1", value: "value1",
@@ -132,16 +136,56 @@ export default {
}); });
const closeDrawer = () => { const closeDrawer = () => {
ctx.emit("update:addinvistVisible", false); ctx.emit("update:addinvistVisible", false);
state.inputV1 = "";
state.textV1 = "";
}; };
const afterVisibleChange = (bool) => { const afterVisibleChange = (bool) => {
console.log("state", bool); console.log("state", bool);
}; };
//创建评估信息
const createInvist = () => {
if (!state.inputV1) return message.info("请输入测评名称");
// if (!state.inputV2) return message.info("请选择测评");
// if (!state.organizationSelectName) return message.info("请选择归属组织");
// state.createLoading = true;
let obj = {
appraiseName: state.inputV1,
appraiseEndTime: "",
appraiseExplain: state.textV1,
appraiseFlag: "",
appraiseId: 0,
appraiseStartTime: "",
appraiseTag: "",
createTime: "",
createUser: 0,
researchId: 0,
researchName: "",
updateTime: "",
updateUser: 0,
};
api
.createAppraiseMessage(obj)
.then((res) => {
setTimeout(() => {
console.log("创建成功", res);
message.success("创建成功");
// state.createLoading = false;
router.push("/leveladd");
// getLearnPath();
}, 1000);
})
.catch((err) => {
console.log("创建失败", err);
// state.createLoading = false;
});
};
return { return {
...toRefs(state), ...toRefs(state),
afterVisibleChange, afterVisibleChange,
closeDrawer, closeDrawer,
rowSelection, rowSelection,
options1, options1,
createInvist,
}; };
}, },
}; };
@@ -285,4 +329,3 @@ export default {
} }
} }
</style> </style>

View File

@@ -43,7 +43,7 @@
</div> </div>
<div class="textarea"> <div class="textarea">
<a-textarea <a-textarea
v-model:value="textV1" v-model:value="testV1"
placeholder="请输入考试说明" placeholder="请输入考试说明"
allow-clear allow-clear
maxlength="150" maxlength="150"
@@ -66,6 +66,7 @@
style="width: 424px" style="width: 424px"
placeholder="请输入考试名称" placeholder="请输入考试名称"
:options="options1" :options="options1"
v-model:value="choosedTest"
allowClear allowClear
showSearch showSearch
/> />
@@ -83,6 +84,7 @@
</div> </div>
<div class="btnbox"> <div class="btnbox">
<a-range-picker <a-range-picker
v-model:value="testTime"
style="width: 424px" style="width: 424px"
:placeholder="[' 开始时间', ' 结束时间']" :placeholder="[' 开始时间', ' 结束时间']"
/> />
@@ -199,14 +201,17 @@
</div> </div>
</div> </div>
<div class="main_btns"> <div class="main_btns">
<button class="btn1">取消</button> <button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2">确定</button> <button class="btn2" @click="addTest">确定</button>
</div> </div>
</div> </div>
</a-drawer> </a-drawer>
</template> </template>
<script> <script>
import { reactive, toRefs, ref } from "vue"; import { reactive, toRefs, ref } from "vue";
import {message} from"ant-design-vue";
import {createExamination} from "@/api/indexExam"
import dayjs from 'dayjs';
const rowSelection = ref({ const rowSelection = ref({
checkStrictly: false, checkStrictly: false,
onChange: (selectedRowKeys, selectedRows) => { onChange: (selectedRowKeys, selectedRows) => {
@@ -244,7 +249,19 @@ export default {
radioV2: "", radioV2: "",
radioV3: "", radioV3: "",
radioV4: "", radioV4: "",
choosedTest: "",
testTime:"",
}); });
const options1 = ref([
{
label:'math',
value:'math',
},
{
label:'eng',
value:'eng',
},
])
const closeDrawer = () => { const closeDrawer = () => {
ctx.emit("update:addtestVisible", false); ctx.emit("update:addtestVisible", false);
state.radioV1 = ""; state.radioV1 = "";
@@ -252,6 +269,44 @@ export default {
state.radioV3 = ""; state.radioV3 = "";
state.radioV4 = ""; state.radioV4 = "";
}; };
const addTest = () => {
if(state.testTime.length
&& state.inputV1&& state.inputV2&& state.inputV3&& state.inputV4
&& state.radioV1&& state.radioV2&& state.radioV3
){
createExamination({
"createTime": "",
"createUser": 0,
"examinationDuration": state.inputV2,
"examinationEndTime": dayjs(state.testTime[1]).format("YYYY-MM-DD"),
"examinationExplain": state.testV1,
"examinationFlag": "",
"examinationId": 0,
"examinationLimit": state.inputV3,
"examinationName": state.inputV1,
"examinationPaperId": 0,
"examinationPaperName": state.choosedTest,
"examinationStartTime": dayjs(state.testTime[0]).format("YYYY-MM-DD"),
"examinationTag": "",
"passLine": state.inputV4,
"questionArrangement": state.radioV4,
"scoringModel": state.radioV3,
"showAnalysis": state.radioV2,
"showAnswers": state.radioV1,
"updateTime": "",
"updateUser": 0
}).then((res)=>{
message.success(`添加成功${res}`)
ctx.emit("update:addtestVisible", false);
}).catch((err)=>{
message.error(`添加失败${err}`)
})
}
else{
message.error(`字段不能为空`)
return 0
}
}
const afterVisibleChange = (bool) => { const afterVisibleChange = (bool) => {
console.log("state", bool); console.log("state", bool);
}; };
@@ -284,6 +339,8 @@ export default {
cloradio2, cloradio2,
cloradio3, cloradio3,
cloradio4, cloradio4,
addTest,
options1,
}; };
}, },
}; };

View File

@@ -1776,7 +1776,7 @@ export default {
} }
.learningPath { .learningPath {
width: 100%; width: 100%;
height: 100%; // height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative; position: relative;
@@ -1983,10 +1983,11 @@ export default {
} }
} }
.tableBox { .tableBox {
padding-bottom: 20px;
.pa { .pa {
position: absolute; // position: absolute;
bottom: 20px; // bottom: 20px;
left: 0; // left: 0;
width: 100%; width: 100%;
// height: 20px; // height: 20px;
// background-color: red; // background-color: red;

View File

@@ -342,7 +342,7 @@
? require('../../assets/images/leveladd/huo.png') ? require('../../assets/images/leveladd/huo.png')
: item.course === '测评' : item.course === '测评'
? require('../../assets/images/leveladd/ce.png') ? require('../../assets/images/leveladd/ce.png')
: item.course === '调研' : item.course === '评估'
? require('../../assets/images/leveladd/diao.png') ? require('../../assets/images/leveladd/diao.png')
: item.course === '投票' : item.course === '投票'
? require('../../assets/images/leveladd/tou.png') ? require('../../assets/images/leveladd/tou.png')
@@ -441,7 +441,7 @@
item.course === '外链' || item.course === '外链' ||
item.course === '讨论' || item.course === '讨论' ||
item.course === '直播' || item.course === '直播' ||
item.course === '调研' || item.course === '评估' ||
item.course === '投票' || item.course === '投票' ||
item.course === '活动' item.course === '活动'
? showTime(item.course, item.name) ? showTime(item.course, item.name)
@@ -1083,7 +1083,7 @@ export default {
percent: 20, percent: 20,
}, },
{ {
course: "调研", course: "评估",
name: "管理直播间", name: "管理直播间",
classify: "必修", classify: "必修",
beginTime: "2022-09-16 14:03", beginTime: "2022-09-16 14:03",

View File

@@ -85,8 +85,8 @@
<div class="co1">{{ value2.length }}/100</div> <div class="co1">{{ value2.length }}/100</div>
</div> </div>
<div class="btn"> <div class="btn">
<button class="btn1">取消</button> <button class="btn1" @click="closeModal">取消</button>
<button class="btn2">确定</button> <button class="btn2" @click="editChapter">确定</button>
</div> </div>
</div> </div>
</div> </div>
@@ -217,7 +217,7 @@
<div class="img"> <div class="img">
<img src="../../assets/images/leveladd/diao.png" /> <img src="../../assets/images/leveladd/diao.png" />
</div> </div>
<div class="text">调研</div> <div class="text">评估</div>
</div> </div>
<div class="lin"></div> <div class="lin"></div>
</div> </div>
@@ -504,6 +504,8 @@
import { reactive, toRefs, onMounted, onUnmounted } from "vue"; import { reactive, toRefs, onMounted, onUnmounted } from "vue";
import AddStu from "../../components/drawers/AddLevelAddStu"; import AddStu from "../../components/drawers/AddLevelAddStu";
import ImpStu from "../../components/drawers/AddLevelImportStu"; import ImpStu from "../../components/drawers/AddLevelImportStu";
import * as api from "../../api/indexLevel";
import { message } from "ant-design-vue";
export default { export default {
name: "LevelAddDetail", name: "LevelAddDetail",
components: { components: {
@@ -808,6 +810,33 @@ export default {
isActive: false, isActive: false,
projectChecked: null, //项目单选框 projectChecked: null, //项目单选框
}); });
//新建或编辑关卡
const editChapter = () => {
if(!state.value1) return message.warning("请输入关卡名称");
let obj = {
name: state.value1,
remark: state.value2,
routerId: 0,
};
api
.editChapter(obj)
.then((res) => {
setTimeout(() => {
console.log("创建成功", res);
message.success("创建成功");
state.value1 = "";
state.value2 = "";
state.modal = false;
// state.createLoading = false;
//state.currentPage = 1;
// getLearnPath();
}, 1000);
})
.catch((err) => {
console.log("创建失败", err);
});
}
const showDrawer = () => { const showDrawer = () => {
state.visible = true; state.visible = true;
}; };
@@ -819,6 +848,8 @@ export default {
}; };
const closeModal = () => { const closeModal = () => {
state.modal = false; state.modal = false;
state.value1 = "";
state.value2 = "";
}; };
const afterVisibleChange = (bool) => { const afterVisibleChange = (bool) => {
console.log("visible", bool); console.log("visible", bool);
@@ -1164,6 +1195,7 @@ export default {
showDeleteALLModal, showDeleteALLModal,
delete_exit, delete_exit,
drawertableColumns, drawertableColumns,
editChapter,
}; };
}, },
}; };
@@ -1289,9 +1321,9 @@ export default {
width: 100px; width: 100px;
height: 40px; height: 40px;
border-radius: 4px; border-radius: 4px;
border: 1px solid #387df7; border: 1px solid #409EFF;
font-size: 14px; font-size: 14px;
color: #387df7; color: #409EFF;
cursor: pointer; cursor: pointer;
background: #ffffff; background: #ffffff;
margin-right: 20px; margin-right: 20px;
@@ -1304,7 +1336,7 @@ export default {
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
border: 0; border: 0;
background: #388be1; background: #409EFF;
} }
} }
} }

View File

@@ -135,7 +135,7 @@
? require('../../assets/images/leveladd/huo.png') ? require('../../assets/images/leveladd/huo.png')
: item.course === '测评' : item.course === '测评'
? require('../../assets/images/leveladd/ce.png') ? require('../../assets/images/leveladd/ce.png')
: item.course === '调研' : item.course === '评估'
? require('../../assets/images/leveladd/diao.png') ? require('../../assets/images/leveladd/diao.png')
: item.course === '投票' : item.course === '投票'
? require('../../assets/images/leveladd/tou.png') ? require('../../assets/images/leveladd/tou.png')
@@ -225,7 +225,7 @@
item.course === '外链' || item.course === '外链' ||
item.course === '讨论' || item.course === '讨论' ||
item.course === '直播' || item.course === '直播' ||
item.course === '调研' || item.course === '评估' ||
item.course === '投票' || item.course === '投票' ||
item.course === '活动' item.course === '活动'
? showTime(item.course, item.name) ? showTime(item.course, item.name)
@@ -609,7 +609,7 @@ export default defineComponent({
percent: 20, percent: 20,
}, },
{ {
course: "调研", course: "评估",
name: "管理直播间", name: "管理直播间",
classify: "必修", classify: "必修",
beginTime: "2022-09-16 14:03", beginTime: "2022-09-16 14:03",

View File

@@ -216,13 +216,13 @@
<div class="img"> <div class="img">
<img src="../../assets/images/leveladd/diao.png" /> <img src="../../assets/images/leveladd/diao.png" />
</div> </div>
<div class="text">调研</div> <div class="text">评估</div>
</div> </div>
<!-- 添加调研侧弹窗 --> <!-- 添加评估侧弹窗 -->
<div> <div>
<add-invist v-model:addinvistVisible="addinvistvisible" /> <add-invist v-model:addinvistVisible="addinvistvisible" />
</div> </div>
<!-- 添加调研侧弹窗 --> <!-- 添加评估侧弹窗 -->
<div class="lin"></div> <div class="lin"></div>
</div> </div>
<div class="item" @click="showDrawerAddVote"> <div class="item" @click="showDrawerAddVote">

View File

@@ -296,7 +296,7 @@
? require('../../assets/images/leveladd/huo.png') ? require('../../assets/images/leveladd/huo.png')
: item.course === '测评' : item.course === '测评'
? require('../../assets/images/leveladd/ce.png') ? require('../../assets/images/leveladd/ce.png')
: item.course === '调研' : item.course === '评估'
? require('../../assets/images/leveladd/diao.png') ? require('../../assets/images/leveladd/diao.png')
: item.course === '投票' : item.course === '投票'
? require('../../assets/images/leveladd/tou.png') ? require('../../assets/images/leveladd/tou.png')
@@ -395,7 +395,7 @@
item.course === '外链' || item.course === '外链' ||
item.course === '讨论' || item.course === '讨论' ||
item.course === '直播' || item.course === '直播' ||
item.course === '调研' || item.course === '评估' ||
item.course === '投票' || item.course === '投票' ||
item.course === '活动' item.course === '活动'
? showTime(item.course, item.name) ? showTime(item.course, item.name)
@@ -2233,7 +2233,7 @@ export default {
percent: 20, percent: 20,
}, },
{ {
course: "调研", course: "评估",
name: "管理直播间", name: "管理直播间",
classify: "必修", classify: "必修",
beginTime: "2022-09-16 14:03", beginTime: "2022-09-16 14:03",

View File

@@ -1,4 +1,4 @@
<!-- 调研管理-管理页面 --> <!-- 评估管理-管理页面 -->
<template> <template>
<div class="managepage"> <div class="managepage">
<div class="up"> <div class="up">

View File

@@ -1,4 +1,4 @@
<!-- 调研管理-创建评估页面 --> <!-- 评估管理-创建评估页面 -->
<template> <template>
<div class="researchadd"> <div class="researchadd">
<div class="header"> <div class="header">
@@ -221,7 +221,7 @@
</div> </div>
<div class="scoretext">非常不满意</div> <div class="scoretext">非常不满意</div>
</div> </div>
<div class="name" style="margin-bottom: 20px;"> <div class="name" style="margin-bottom: 20px">
<div class="namebox"> <div class="namebox">
<img <img
class="nameimg" class="nameimg"
@@ -236,7 +236,7 @@
</div> </div>
<div class="assess" style="margin-left: 50px; position: relative"> <div class="assess" style="margin-left: 50px; position: relative">
<div class="assesstype">权重比例</div> <div class="assesstype">权重比例</div>
<div class="assesswhole" style="background: #FFFFFF">20</div> <div class="assesswhole" style="background: #ffffff">20</div>
<div class="ratio">%</div> <div class="ratio">%</div>
</div> </div>
</div> </div>
@@ -247,8 +247,12 @@
<div class="inname" style="margin-top: 13px">您的其他意见</div> <div class="inname" style="margin-top: 13px">您的其他意见</div>
</div> </div>
<div class="in"> <div class="in">
<a-textarea v-model:value="valuep" style="height: 110px" show-count <a-textarea
:maxlength="200"/> v-model:value="valuep"
style="height: 110px"
show-count
:maxlength="200"
/>
</div> </div>
</div> </div>
<div class="footer"> <div class="footer">
@@ -449,15 +453,15 @@ export default {
align-items: center; align-items: center;
margin-left: 41px; margin-left: 41px;
.addtypen { .addtypen {
color: #6F6F6F; color: #6f6f6f;
font-size: 14px; font-size: 14px;
} }
.types { .types {
cursor: pointer; cursor: pointer;
width: 80px; width: 80px;
height: 40px; height: 40px;
color: #409EFF; color: #409eff;
border: 1px solid #409EFF; border: 1px solid #409eff;
border-radius: 4px; border-radius: 4px;
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -497,11 +501,11 @@ export default {
height: 40px; height: 40px;
margin-top: 20px; margin-top: 20px;
margin-right: 30px; margin-right: 30px;
border: 1px solid #409EFF; border: 1px solid #409eff;
border-radius: 8px; border-radius: 8px;
cursor: pointer; cursor: pointer;
.del_text { .del_text {
color: #409EFF; color: #409eff;
font-size: 14px; font-size: 14px;
margin-left: 5px; margin-left: 5px;
} }
@@ -589,7 +593,7 @@ export default {
} }
} }
.inname { .inname {
color: #6F6F6F; color: #6f6f6f;
font-size: 14px; font-size: 14px;
margin-left: 7px; margin-left: 7px;
font-weight: 700; font-weight: 700;
@@ -601,12 +605,12 @@ export default {
display: flex; display: flex;
width: 226px; width: 226px;
height: 40px; height: 40px;
border: 1px solid #56A3F9; border: 1px solid #56a3f9;
//margin-bottom: 20px; //margin-bottom: 20px;
.assesstype { .assesstype {
width: 50%; width: 50%;
background: #56A3F9; background: #56a3f9;
color: #FFFFFF; color: #ffffff;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@@ -615,7 +619,7 @@ export default {
width: 50%; width: 50%;
background: rgba(86, 163, 249, 0.1); background: rgba(86, 163, 249, 0.1);
font-size: 14px; font-size: 14px;
color: #6F6F6F; color: #6f6f6f;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@@ -624,7 +628,7 @@ export default {
position: absolute; position: absolute;
right: 10px; right: 10px;
top: 8px; top: 8px;
color: #6F6F6F; color: #6f6f6f;
font-size: 14px; font-size: 14px;
} }
} }
@@ -645,7 +649,6 @@ export default {
// height: 120%; // height: 120%;
width: 100%; width: 100%;
height: 35px; height: 35px;
} }
.ant-select-selector { .ant-select-selector {
border-radius: 5px; border-radius: 5px;

View File

@@ -30,9 +30,7 @@
list-type="picture-card" list-type="picture-card"
class="avatar-uploader" class="avatar-uploader"
:show-upload-list="false" :show-upload-list="false"
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
:before-upload="beforeUpload" :before-upload="beforeUpload"
@change="handleChange"
> >
<!-- <img v-if="imageUrl" :src="imageUrl" alt="avatar" /> <!-- <img v-if="imageUrl" :src="imageUrl" alt="avatar" />
<div v-else> <div v-else>
@@ -48,12 +46,12 @@ import { reactive, toRefs } from "vue";
import AddVote from "../../components/drawers/AddVote"; import AddVote from "../../components/drawers/AddVote";
// import { PlusOutlined, LoadingOutlined } from "@ant-design/icons-vue"; // import { PlusOutlined, LoadingOutlined } from "@ant-design/icons-vue";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import * as api from "../../api/index1";
function getBase64(img, callback) { // function getBase64(img, callback) {
const reader = new FileReader(); // const reader = new FileReader();
reader.addEventListener("load", () => callback(reader.result)); // reader.addEventListener("load", () => callback(reader.result));
reader.readAsDataURL(img); // reader.readAsDataURL(img);
} // }
export default { export default {
name: "SystemManage", name: "SystemManage",
components: { components: {
@@ -78,16 +76,29 @@ export default {
}; };
const handleChange = (info) => { const handleChange = (info) => {
if (info.file.status === "uploading") { if (info.file.status === "uploading") {
console.log("uploading", info.file);
state.loading = true; state.loading = true;
return; return;
} }
if (info.file.status === "done") { if (info.file.status === "done") {
// Get this url from response in real world. console.log("done", info.file);
getBase64(info.file.originFileObj, (base64Url) => { let obj = {
state.imageUrl = base64Url; file: info.file,
state.loading = false; };
api
.uploadFile(obj)
.then((res) => {
console.log("res", res);
})
.then((err) => {
console.log("err", err);
}); });
// Get this url from response in real world.
// getBase64(info.file.originFileObj, (base64Url) => {
// state.imageUrl = base64Url;
// state.loading = false;
// });
} }
if (info.file.status === "error") { if (info.file.status === "error") {
@@ -97,6 +108,7 @@ export default {
}; };
const beforeUpload = (file) => { const beforeUpload = (file) => {
console.log("file", file);
const isJpgOrPng = const isJpgOrPng =
file.type === "image/jpeg" || file.type === "image/png"; file.type === "image/jpeg" || file.type === "image/png";
@@ -109,8 +121,25 @@ export default {
if (!isLt2M) { if (!isLt2M) {
message.error("Image must smaller than 2MB!"); message.error("Image must smaller than 2MB!");
} }
if (isJpgOrPng && isLt2M) {
return isJpgOrPng && isLt2M; let obj = {
file: file,
};
api
.uploadFile(obj)
.then((res) => {
console.log("res", res);
})
.then((err) => {
console.log("err", err);
});
// Get this url from response in real world.
// getBase64(info.file.originFileObj, (base64Url) => {
// state.imageUrl = base64Url;
// state.loading = false;
// });
}
// return isJpgOrPng && isLt2M;
}; };
return { return {