修改界面

master
夜笙歌 5 months ago
parent c53c26f2f2
commit 8f0adc13ec

@ -219,9 +219,14 @@
<el-input v-model="form.contactAddress" placeholder="请输入联系人地址"/>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item label="首页标题" prop="tenantBoardTopic">
<el-input v-model="form.tenantBoardTopic" placeholder="请输入首页标题"/>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item label="监控平台显示" prop="contactAddress">
<el-select v-model="form.tenantField" placeholder="请选择">
<el-select v-model="form.tenantField" placeholder="请选择" clearable>
<el-option
label="图片"
value="1">
@ -242,7 +247,8 @@
<el-form-item label="首页图片" prop="tenantBoardPic">
<el-upload
class="avatar-uploader"
action="https://jsonplaceholder.typicode.com/posts/"
:action="uploadImgUrl"
:headers="headers"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
@ -269,11 +275,16 @@
<script>
import {addTenant, delTenant, getTenant, listTenant, updateTenant} from "@/api/business/tenant";
import {getToken} from "@/utils/auth";
export default {
name: "Tenant",
dicts: ['hw_tenant_industry', 'hw_tenant_type'],
data() {
return {
uploadImgUrl: process.env.VUE_APP_BASE_API + "/file/upload", //
headers: {
Authorization: "Bearer " + getToken(),
},
//
loading: true,
//
@ -464,19 +475,20 @@ export default {
this.industryVisible = tenantType === this.TENANT_TYPE_ENTERPRISE;
},
handleAvatarSuccess(res, file) {
this.form.tenantBoardPic = URL.createObjectURL(file.raw);
this.form.tenantBoardPic = res.data.url;
},
beforeAvatarUpload(file) {
const isJPG = file.type === 'image/jpeg';
const isJPG1 = file.type === 'image/png';
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isJPG) {
if (!(isJPG || isJPG1)) {
this.$message.error('上传头像图片只能是 JPG 格式!');
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 2MB!');
}
return isJPG && isLt2M;
return (isJPG || isJPG1) && isLt2M;
}
}
};

Loading…
Cancel
Save