Commit a87d01dc29ce9c70f06a67342ba5d9dec4c5c29f

Authored by wuxw
1 parent 8adb868d

v1.9 业主页面男女 bug 修复

src/api/owner/ownerApi.js
@@ -93,7 +93,7 @@ export function uploadImage(data) { @@ -93,7 +93,7 @@ export function uploadImage(data) {
93 formData.append('communityId', getCommunityId()) 93 formData.append('communityId', getCommunityId())
94 94
95 request({ 95 request({
96 - url: 'uploadImage', 96 + url: '/callComponent/upload/uploadFile/uploadImage',
97 method: 'post', 97 method: 'post',
98 data: formData, 98 data: formData,
99 headers: { 99 headers: {
@@ -101,11 +101,7 @@ export function uploadImage(data) { @@ -101,11 +101,7 @@ export function uploadImage(data) {
101 } 101 }
102 }).then(response => { 102 }).then(response => {
103 const res = response.data 103 const res = response.data
104 - if (res.code == 0) {  
105 resolve(res) 104 resolve(res)
106 - } else {  
107 - reject(new Error(res.msg || '上传图片失败'))  
108 - }  
109 }).catch(error => { 105 }).catch(error => {
110 reject(error) 106 reject(error)
111 }) 107 })
src/components/owner/addOwner.vue
@@ -177,10 +177,11 @@ export default { @@ -177,10 +177,11 @@ export default {
177 177
178 async loadAttributes() { 178 async loadAttributes() {
179 try { 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 this.attrs = data.filter(item => item.specShow === 'Y') 181 this.attrs = data.filter(item => item.specShow === 'Y')
182 182
183 for (const attr of this.attrs) { 183 for (const attr of this.attrs) {
  184 + attr.value = ''
184 if (attr.specType === '3344') { 185 if (attr.specType === '3344') {
185 attr.values = await getAttrValue(attr.specCd) 186 attr.values = await getAttrValue(attr.specCd)
186 attr.value = '' 187 attr.value = ''
@@ -207,8 +208,8 @@ export default { @@ -207,8 +208,8 @@ export default {
207 async uploadImage({ file }) { 208 async uploadImage({ file }) {
208 try { 209 try {
209 const res = await uploadImage({ file }) 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 } catch (error) { 213 } catch (error) {
213 this.$message.error(this.$t('listOwner.upload.failed')) 214 this.$message.error(this.$t('listOwner.upload.failed'))
214 } 215 }
src/components/owner/editOwner.vue
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 <el-col :span="12" class="text-center"> 37 <el-col :span="12" class="text-center">
38 <el-image style="width: 200px; height: 150px; border: 1px dashed #ccc;" 38 <el-image style="width: 200px; height: 150px; border: 1px dashed #ccc;"
39 :src="form.ownerPhotoUrl || '/img/noPhoto.jpg'" fit="cover" /> 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 <el-button size="small" type="primary"> 41 <el-button size="small" type="primary">
42 {{ $t('common.upload') }} 42 {{ $t('common.upload') }}
43 </el-button> 43 </el-button>
@@ -179,10 +179,14 @@ export default { @@ -179,10 +179,14 @@ export default {
179 179
180 async loadAttributes() { 180 async loadAttributes() {
181 try { 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 this.attrs = data.filter(item => item.specShow === 'Y') 186 this.attrs = data.filter(item => item.specShow === 'Y')
184 187
185 for (const attr of this.attrs) { 188 for (const attr of this.attrs) {
  189 + attr.value = ''
186 if (attr.specType === '3344') { 190 if (attr.specType === '3344') {
187 attr.values = await getAttrValue(attr.specCd) 191 attr.values = await getAttrValue(attr.specCd)
188 } 192 }
@@ -214,8 +218,9 @@ export default { @@ -214,8 +218,9 @@ export default {
214 async uploadImage({ file }) { 218 async uploadImage({ file }) {
215 try { 219 try {
216 const res = await uploadImage({ file }) 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 } catch (error) { 224 } catch (error) {
220 this.$message.error(this.$t('listOwner.upload.failed')) 225 this.$message.error(this.$t('listOwner.upload.failed'))
221 } 226 }
src/views/owner/listOwner.vue
@@ -274,7 +274,7 @@ export default { @@ -274,7 +274,7 @@ export default {
274 274
275 async getColumns() { 275 async getColumns() {
276 try { 276 try {
277 - const data = await getAttrSpecList({ 277 + const {data} = await getAttrSpecList({
278 page: 1, 278 page: 1,
279 row: 100, 279 row: 100,
280 tableName: 'building_owner_attr' 280 tableName: 'building_owner_attr'