修改界面

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

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

Loading…
Cancel
Save