mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-10 03:16:44 +08:00
测评上传
This commit is contained in:
@@ -13,7 +13,9 @@ export const save = (obj) => http.post(`${ACTIVITYAPI}/evaluation/save`,obj)
|
|||||||
//保存测评详情
|
//保存测评详情
|
||||||
export const saveEvaluationDetail = (obj) => http.post(`${ACTIVITYAPI}/evaluation/detail/saveEvaluationDetail`,obj)
|
export const saveEvaluationDetail = (obj) => http.post(`${ACTIVITYAPI}/evaluation/detail/saveEvaluationDetail`,obj)
|
||||||
//测评封面上传
|
//测评封面上传
|
||||||
export const uploadImage = (obj) => http.post(`${ACTIVITYAPI}/evaluation/upload-image`,obj)
|
export const uploadImage = (obj) => http.post(`${ACTIVITYAPI}/evaluation/upload-image`,obj,{
|
||||||
|
headers: { "Content-Type": "multipart/form-data",token:getCookieForName("token") },
|
||||||
|
})
|
||||||
//权限管理
|
//权限管理
|
||||||
export const adminList = (obj) => http.post(`${ACTIVITYAPI}/permission/adminList`,obj)
|
export const adminList = (obj) => http.post(`${ACTIVITYAPI}/permission/adminList`,obj)
|
||||||
//权限启用
|
//权限启用
|
||||||
|
|||||||
@@ -202,12 +202,12 @@
|
|||||||
<div class="bg_body_input">
|
<div class="bg_body_input">
|
||||||
<a-upload
|
<a-upload
|
||||||
name="file"
|
name="file"
|
||||||
:file-list="filesList"
|
|
||||||
:headers="headers"
|
:headers="headers"
|
||||||
|
:file-list="filesList"
|
||||||
:before-upload="beforeUpload3"
|
:before-upload="beforeUpload3"
|
||||||
>
|
>
|
||||||
<!-- action="/activityApi/evaluation/import"
|
<!-- @change="handleChange" -->
|
||||||
@change="handleChange" -->
|
<!-- action="/activityApi/evaluation/import" -->
|
||||||
<div class="upload_box">
|
<div class="upload_box">
|
||||||
<span>选择文件</span>
|
<span>选择文件</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -218,7 +218,7 @@
|
|||||||
<div class="mbl_items12">
|
<div class="mbl_items12">
|
||||||
<div
|
<div
|
||||||
class="i12_box1"
|
class="i12_box1"
|
||||||
v-for="(item, index) in filesList"
|
v-for="(item, index) in valueAll"
|
||||||
:key="index"
|
:key="index"
|
||||||
>
|
>
|
||||||
<div class="file_img"></div>
|
<div class="file_img"></div>
|
||||||
@@ -255,6 +255,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<a-button
|
<a-button
|
||||||
class="btn btn6"
|
class="btn btn6"
|
||||||
|
:loading="uploadDownLoad"
|
||||||
@click="formData.id&&btShow?showUpload():reportUpload()"
|
@click="formData.id&&btShow?showUpload():reportUpload()"
|
||||||
>
|
>
|
||||||
确定
|
确定
|
||||||
@@ -594,6 +595,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="aeLoading" style="z-index:999999" :style="{ display: uploadDownLoad ? 'flex' : 'none' }">
|
||||||
|
<a-spin :spinning="uploadDownLoad" tip="" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -632,6 +636,9 @@ import { message } from "ant-design-vue";
|
|||||||
const userInfo = computed(() => store.state.userInfo);
|
const userInfo = computed(() => store.state.userInfo);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
|
stateType:'',
|
||||||
|
uploadDownLoad: false,
|
||||||
|
uploadDownId: '',
|
||||||
loadData: false,
|
loadData: false,
|
||||||
saveList: [],
|
saveList: [],
|
||||||
powerStatus:{},
|
powerStatus:{},
|
||||||
@@ -1002,6 +1009,7 @@ import { message } from "ant-design-vue";
|
|||||||
}
|
}
|
||||||
const bgupload1 = (record) => {
|
const bgupload1 = (record) => {
|
||||||
console.log(record,'record')
|
console.log(record,'record')
|
||||||
|
state.uploadDownId =record.id
|
||||||
state.btShowEdit = trueFalse(record.permission,2)
|
state.btShowEdit = trueFalse(record.permission,2)
|
||||||
state.uploadId = record.id
|
state.uploadId = record.id
|
||||||
state.uploadName = userInfo.value.realName
|
state.uploadName = userInfo.value.realName
|
||||||
@@ -1039,21 +1047,24 @@ import { message } from "ant-design-vue";
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
state.tableLoading = true
|
state.tableLoading = true
|
||||||
state.bg_results = true
|
|
||||||
if(state.uploadStatus){
|
if(state.uploadStatus){
|
||||||
console.log(state.uploadStatus,'state.uploadStatus')
|
console.log(state.uploadStatus,'state.uploadStatus')
|
||||||
await save({
|
await save({
|
||||||
|
id: state.uploadDownId,
|
||||||
creatId:userInfo.value.userId,
|
creatId:userInfo.value.userId,
|
||||||
creatName:userInfo.value.realName,
|
creatName:userInfo.value.realName,
|
||||||
prefix:'',
|
prefix:'',
|
||||||
remarks:state.formData.remarks,
|
remarks:state.formData.remarks,
|
||||||
evaluationName:state.formData.evaluationName,
|
evaluationName:state.formData.evaluationName,
|
||||||
detailIds:state.idValue,
|
detailIds:state.idValue,
|
||||||
|
imagePath:state.formData.imageUrl
|
||||||
}).then((res)=>{
|
}).then((res)=>{
|
||||||
console.log(res.data,'data')
|
console.log(res.data,'data')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(state.valueAll.length != 0 && !state.loadData){
|
if(state.valueAll.length != 0 && !state.loadData){
|
||||||
|
state.bg_results = true
|
||||||
state.valueAll.forEach((item)=>{
|
state.valueAll.forEach((item)=>{
|
||||||
if(item.createId){
|
if(item.createId){
|
||||||
item.createId = userInfo.value.userId
|
item.createId = userInfo.value.userId
|
||||||
@@ -1063,6 +1074,17 @@ import { message } from "ant-design-vue";
|
|||||||
console.log(res.data,'json')
|
console.log(res.data,'json')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
//else{
|
||||||
|
// state.bg_results = true
|
||||||
|
// state.valueAll.forEach((item)=>{
|
||||||
|
// if(item.createId){
|
||||||
|
// item.createId = userInfo.value.userId
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// await saveEvaluationDetail({evaluationDetailListlist:state.valueAll,pid:state.uploadId}).then((res)=>{
|
||||||
|
// console.log(res.data,'json')
|
||||||
|
// })
|
||||||
|
// }
|
||||||
of_exit()
|
of_exit()
|
||||||
listData()
|
listData()
|
||||||
}
|
}
|
||||||
@@ -1073,6 +1095,7 @@ import { message } from "ant-design-vue";
|
|||||||
//上传图片
|
//上传图片
|
||||||
const headers = { token: getCookieForName("token") };
|
const headers = { token: getCookieForName("token") };
|
||||||
const beforeUpload = (file) => {
|
const beforeUpload = (file) => {
|
||||||
|
console.log(file,'file')
|
||||||
const isJpgOrPng =
|
const isJpgOrPng =
|
||||||
file.type === "image/jpg" ||
|
file.type === "image/jpg" ||
|
||||||
file.type === "image/png"
|
file.type === "image/png"
|
||||||
@@ -1088,21 +1111,18 @@ import { message } from "ant-design-vue";
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const formDatas = new FormData();
|
const formDatas = new FormData();
|
||||||
console.log(formDatas.append("file", file),'formDatas')
|
|
||||||
formDatas.append("file", file);
|
formDatas.append("file", file);
|
||||||
console.log(formDatas, 'aaaa')
|
|
||||||
uploadImage(formDatas).then((res) => {
|
uploadImage(formDatas).then((res) => {
|
||||||
if (res.data.code === 200) {
|
if (res.status === 200) {
|
||||||
console.log(res.data.data, 45);
|
state.formData.imageUrl = res.data.split('Path:')[1];
|
||||||
state.formData.imageUrl = process.env.VUE_APP_FILE_PATH + res.data.data;
|
|
||||||
formData.value.liveCover = process.env.VUE_APP_FILE_PATH + res.data.data;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
const beforeUpload3 = async (file) => {
|
const beforeUpload3 = async (file) => {
|
||||||
|
state.stateType = file.type
|
||||||
const pattern = /^([0-9\u4e00-\u9fa5\a-z\A-Z]+-){2}[0-9\u4e00-\u9fa5\a-z\A-Z]+\.\w*$/;
|
const pattern = /^([0-9\u4e00-\u9fa5\a-z\A-Z]+-){2}[0-9\u4e00-\u9fa5\a-z\A-Z]+\.\w*$/;
|
||||||
console.log(file, 'aaaa')
|
console.log(file,'file')
|
||||||
if (!pattern.test(file.name)) {
|
if (!pattern.test(file.name)) {
|
||||||
message.error('上传文件名称格式不对')
|
message.error('上传文件名称格式不对')
|
||||||
return false
|
return false
|
||||||
@@ -1115,6 +1135,7 @@ import { message } from "ant-design-vue";
|
|||||||
message.error("仅支持zip、pdf格式!");
|
message.error("仅支持zip、pdf格式!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
state.uploadDownLoad = true
|
||||||
const formDatas = new FormData();
|
const formDatas = new FormData();
|
||||||
formDatas.append("file", file);
|
formDatas.append("file", file);
|
||||||
if(state.uploadId){
|
if(state.uploadId){
|
||||||
@@ -1129,10 +1150,19 @@ import { message } from "ant-design-vue";
|
|||||||
}
|
}
|
||||||
await importList(formDatas).then((res)=>{
|
await importList(formDatas).then((res)=>{
|
||||||
if(res.code === 200){
|
if(res.code === 200){
|
||||||
state.idValue = res.data.map(item=>item.id)
|
if(state.stateType == "application/pdf"){
|
||||||
state.valueAll = res.data
|
state.idValue = res.data.map(item=>item.id)
|
||||||
console.log(state.valueAll,'valueAll')
|
state.valueAll = res.data
|
||||||
|
}else{
|
||||||
|
state.idValue = res.data.evaluationDetailList.map(item=>item.id)
|
||||||
|
state.valueAll = res.data.evaluationDetailList
|
||||||
|
}
|
||||||
|
console.log(state.valueAll,'state.valueAll')
|
||||||
|
state.uploadDownLoad = false
|
||||||
}
|
}
|
||||||
|
}).catch((err)=>{
|
||||||
|
state.uploadDownLoad = false
|
||||||
|
console.log(err,'err')
|
||||||
})
|
})
|
||||||
// try {
|
// try {
|
||||||
// const response = await axios.post('/activityApi/evaluation/import', formDatas);
|
// const response = await axios.post('/activityApi/evaluation/import', formDatas);
|
||||||
@@ -1147,6 +1177,8 @@ import { message } from "ant-design-vue";
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
const handleChange = (info) => {
|
const handleChange = (info) => {
|
||||||
|
// return
|
||||||
|
console.log(info,'inffofofoffo')
|
||||||
let resFileList = [...info.fileList];
|
let resFileList = [...info.fileList];
|
||||||
|
|
||||||
resFileList = resFileList.slice(-2);
|
resFileList = resFileList.slice(-2);
|
||||||
@@ -1201,6 +1233,7 @@ import { message } from "ant-design-vue";
|
|||||||
// }
|
// }
|
||||||
// 编辑
|
// 编辑
|
||||||
const openEdit = (record) => {
|
const openEdit = (record) => {
|
||||||
|
state.uploadDownId =record.id
|
||||||
state.bg_check = true
|
state.bg_check = true
|
||||||
state.btShow = true
|
state.btShow = true
|
||||||
state.btShowEdit = false
|
state.btShowEdit = false
|
||||||
@@ -1296,6 +1329,7 @@ import { message } from "ant-design-vue";
|
|||||||
await savePermission({userList:state.saveList,pid:state.saveListPid})
|
await savePermission({userList:state.saveList,pid:state.saveListPid})
|
||||||
saveListItem()
|
saveListItem()
|
||||||
of_addsetting()
|
of_addsetting()
|
||||||
|
listData()
|
||||||
}
|
}
|
||||||
const powerSetting = async (record) => {
|
const powerSetting = async (record) => {
|
||||||
state.powerStatus = (record)
|
state.powerStatus = (record)
|
||||||
@@ -1599,7 +1633,12 @@ import { message } from "ant-design-vue";
|
|||||||
.mbl_items12 {
|
.mbl_items12 {
|
||||||
// width: 300px;
|
// width: 300px;
|
||||||
margin-left: 128px;
|
margin-left: 128px;
|
||||||
|
.item_text{
|
||||||
|
width: 300px;
|
||||||
|
white-space: nowrap; /* 不换行 */
|
||||||
|
overflow: hidden; /* 超出部分隐藏 */
|
||||||
|
text-overflow: ellipsis; /* 使用省略号表示被隐藏的部分 */
|
||||||
|
}
|
||||||
.i12_box1 {
|
.i12_box1 {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
Reference in New Issue
Block a user