|
@@ -8,10 +8,12 @@
|
|
|
:data="uploadData"
|
|
|
:show-file-list="false"
|
|
|
:on-success="handleAvatarSuccess"
|
|
|
- :before-upload="uploadFile">
|
|
|
+ :before-upload="uploadFile"
|
|
|
+ accept=".png">
|
|
|
+ <el-button type="primary">点击上传</el-button>
|
|
|
<!-- <img v-if="imageUrl" :src="imageUrl" class="avatar" /> -->
|
|
|
- <el-image v-if="imageUrl" style="width: 120px; height: 30px" :src="imageUrl" fit="scale-down" />
|
|
|
- <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
|
|
+ <!-- <el-image v-if="imageUrl" style="width: 120px; height: 30px" :src="imageUrl" fit="scale-down" />
|
|
|
+ <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon> -->
|
|
|
</el-upload>
|
|
|
</div>
|
|
|
<div style="color: #999999; font-size: 12px; padding: 8px 0 16px 0">请上传 120px * 30px 或同等比例的背景透明 png 格式图片</div>
|
|
@@ -55,7 +57,7 @@ const getLogo = () => {
|
|
|
proxy.post("/tenantInfo/getLogo", {}).then((res) => {
|
|
|
if (res && res.length > 0 && res[0].fileUrl) {
|
|
|
imageUrl.value = res[0].fileUrl;
|
|
|
- fileList.value[0].fileUrl = res[0].fileUrl
|
|
|
+ fileList.value[0].fileUrl = res[0].fileUrl;
|
|
|
} else {
|
|
|
imageUrl.value = "/img/logo2.png";
|
|
|
}
|
|
@@ -65,6 +67,13 @@ const getLogo = () => {
|
|
|
getLogo();
|
|
|
const uploadData = ref({});
|
|
|
const uploadFile = async (file) => {
|
|
|
+ if (file.type !== "image/png") {
|
|
|
+ ElMessage.error("请上传png格式图片!");
|
|
|
+ return false;
|
|
|
+ // } else if (rawFile.size / 1024 / 1024 > 2) {
|
|
|
+ // ElMessage.error('Avatar picture size can not exceed 2MB!')
|
|
|
+ // return false
|
|
|
+ }
|
|
|
const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
uploadData.value = res.uploadBody;
|
|
|
file.id = res.id;
|
|
@@ -113,9 +122,9 @@ const clickSubmit = () => {
|
|
|
padding: 20px;
|
|
|
background-color: white;
|
|
|
}
|
|
|
-::v-deep(.el-upload) {
|
|
|
- border: 2px dashed #eeeeee;
|
|
|
-}
|
|
|
+// ::v-deep(.el-upload) {
|
|
|
+// // border: 2px dashed #eeeeee;
|
|
|
+// }
|
|
|
.avatar-uploader .avatar {
|
|
|
width: 120px;
|
|
|
height: 30px;
|