| | |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
|
| | | <el-form-item label="上传设备图片" prop="pic">
|
| | | <el-upload class="avatar-uploader" action="/mdc/account/uploadPic" :show-file-list="false"
|
| | | accept=".jpg, .png"
|
| | | :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
|
| | | <img v-if="dataForm.pic" :src="dataForm.pic" class="avatar">
|
| | | <i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
| | |
| | | cancel() {
|
| | | this.$emit('close')
|
| | | },
|
| | | beforeAvatarUpload() {
|
| | | beforeAvatarUpload(file) {
|
| | | const typeArry = ['.jpg', '.png', '.JPG', '.PNG'];
|
| | | const type = file.name.substring(file.name.lastIndexOf('.'));
|
| | | const isImage = typeArry.indexOf(type) > -1;
|
| | | if (!isImage) {
|
| | | this.$message.error('上传文件必须为图片');
|
| | | }
|
| | | return isImage;
|
| | |
|
| | | },
|
| | | handleAvatarSuccess(res) {
|