Commit a87d01dc29ce9c70f06a67342ba5d9dec4c5c29f
1 parent
8adb868d
v1.9 业主页面男女 bug 修复
Showing
4 changed files
with
15 additions
and
13 deletions
src/api/owner/ownerApi.js
| ... | ... | @@ -93,7 +93,7 @@ export function uploadImage(data) { |
| 93 | 93 | formData.append('communityId', getCommunityId()) |
| 94 | 94 | |
| 95 | 95 | request({ |
| 96 | - url: 'uploadImage', | |
| 96 | + url: '/callComponent/upload/uploadFile/uploadImage', | |
| 97 | 97 | method: 'post', |
| 98 | 98 | data: formData, |
| 99 | 99 | headers: { |
| ... | ... | @@ -101,11 +101,7 @@ export function uploadImage(data) { |
| 101 | 101 | } |
| 102 | 102 | }).then(response => { |
| 103 | 103 | const res = response.data |
| 104 | - if (res.code == 0) { | |
| 105 | 104 | resolve(res) |
| 106 | - } else { | |
| 107 | - reject(new Error(res.msg || '上传图片失败')) | |
| 108 | - } | |
| 109 | 105 | }).catch(error => { |
| 110 | 106 | reject(error) |
| 111 | 107 | }) | ... | ... |
src/components/owner/addOwner.vue
| ... | ... | @@ -177,10 +177,11 @@ export default { |
| 177 | 177 | |
| 178 | 178 | async loadAttributes() { |
| 179 | 179 | try { |
| 180 | - const data = await getAttrSpecList({ page: 1, row: 100, tableName: 'building_owner_attr' }) | |
| 180 | + const {data} = await getAttrSpecList({ page: 1, row: 100, tableName: 'building_owner_attr' }) | |
| 181 | 181 | this.attrs = data.filter(item => item.specShow === 'Y') |
| 182 | 182 | |
| 183 | 183 | for (const attr of this.attrs) { |
| 184 | + attr.value = '' | |
| 184 | 185 | if (attr.specType === '3344') { |
| 185 | 186 | attr.values = await getAttrValue(attr.specCd) |
| 186 | 187 | attr.value = '' |
| ... | ... | @@ -207,8 +208,8 @@ export default { |
| 207 | 208 | async uploadImage({ file }) { |
| 208 | 209 | try { |
| 209 | 210 | const res = await uploadImage({ file }) |
| 210 | - this.form.ownerPhoto = res.data.fileId | |
| 211 | - this.form.ownerPhotoUrl = res.data.url | |
| 211 | + this.form.ownerPhoto = res.fileId | |
| 212 | + this.form.ownerPhotoUrl = res.url | |
| 212 | 213 | } catch (error) { |
| 213 | 214 | this.$message.error(this.$t('listOwner.upload.failed')) |
| 214 | 215 | } | ... | ... |
src/components/owner/editOwner.vue
| ... | ... | @@ -37,7 +37,7 @@ |
| 37 | 37 | <el-col :span="12" class="text-center"> |
| 38 | 38 | <el-image style="width: 200px; height: 150px; border: 1px dashed #ccc;" |
| 39 | 39 | :src="form.ownerPhotoUrl || '/img/noPhoto.jpg'" fit="cover" /> |
| 40 | - <el-upload class="mt-10" :show-file-list="false" :before-upload="beforeUpload" :http-request="uploadImage"> | |
| 40 | + <el-upload class="mt-10" :show-file-list="false" :before-upload="beforeUpload" :http-request="uploadImage" action=""> | |
| 41 | 41 | <el-button size="small" type="primary"> |
| 42 | 42 | {{ $t('common.upload') }} |
| 43 | 43 | </el-button> |
| ... | ... | @@ -179,10 +179,14 @@ export default { |
| 179 | 179 | |
| 180 | 180 | async loadAttributes() { |
| 181 | 181 | try { |
| 182 | - const data = await getAttrSpecList({ page: 1, row: 100, tableName: 'building_owner_attr' }) | |
| 182 | + const {data} = await getAttrSpecList({ page: 1, row: 100, tableName: 'building_owner_attr' }) | |
| 183 | + if (data.length == 0) { | |
| 184 | + return | |
| 185 | + } | |
| 183 | 186 | this.attrs = data.filter(item => item.specShow === 'Y') |
| 184 | 187 | |
| 185 | 188 | for (const attr of this.attrs) { |
| 189 | + attr.value = '' | |
| 186 | 190 | if (attr.specType === '3344') { |
| 187 | 191 | attr.values = await getAttrValue(attr.specCd) |
| 188 | 192 | } |
| ... | ... | @@ -214,8 +218,9 @@ export default { |
| 214 | 218 | async uploadImage({ file }) { |
| 215 | 219 | try { |
| 216 | 220 | const res = await uploadImage({ file }) |
| 217 | - this.form.ownerPhoto = res.data.fileId | |
| 218 | - this.form.ownerPhotoUrl = res.data.url | |
| 221 | + this.form.ownerPhoto = res.fileId | |
| 222 | + this.form.ownerPhotoUrl = res.url | |
| 223 | + this.$forceUpdate() | |
| 219 | 224 | } catch (error) { |
| 220 | 225 | this.$message.error(this.$t('listOwner.upload.failed')) |
| 221 | 226 | } | ... | ... |
src/views/owner/listOwner.vue