This commit is contained in:
kclf
2022-12-06 11:53:08 +08:00
parent f3b8b3c3df
commit 6edbaec1bc
3 changed files with 25 additions and 29 deletions

View File

@@ -129,13 +129,22 @@
action="/manageApi/vote/baseVoteupload"
v-model:file-list="fileList"
> -->
<a-upload
:before-upload="beforeUpload"
:multiple="false"
:max-count="1"
v-model:file-list="fileList"
>
<a-upload :before-upload="beforeUpload" :max-count="1">
<button class="xkbtn">点击上传</button>
<template #itemRender="{ file, actions }">
<a-space v-if="file.type.indexOf('sheet') > -1">
<span :style="file.status === 'error' ? 'color: red' : ''">
{{ file.name }}
</span>
<a href="javascript:;" @click="actions.remove">
<img
src="../../assets/del.png"
alt="del"
style="width: 12px; height: 12px"
/>
</a>
</a-space>
</template>
</a-upload>
<div v-if="voteCount > 0">
<a-tag color="processing">
@@ -286,36 +295,22 @@ export default {
// 限制文件格式上传
const beforeUpload = (file) => {
console.log(file);
if (file.type.indexOf("sheet") == -1) {
message.destroy();
message.error("请上传正确的文件格式");
console.log(state.fileList);
state.fileList = [];
return;
return false;
}
// let resFileList = [...info.fileList];
// resFileList.map((file) => {
// if (file.response) {
// // Component will show file.url as link
// file.url = file.response.url;
// console.log("file========", file);
// console.log("file========", file.response);
// state.voteCount = file.response.data;
// }
// });
const formData = new FormData();
formData.append("uploadFile", file);
baseVoteupload(formData).then((res) => {
if (res.data.code === 200) {
console.log(res);
state.basevote = res.data.data;
}
});
return false;
};
//删除题干信息接口