房源信息模块
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
</u-form-item>
|
||||
<u-form-item prop="area">
|
||||
<u-cell title="城市" @click="onArea" :isLink="true">
|
||||
<u-input slot="value" class="input" v-model="form.area" inputAlign="right" maxlength="30"
|
||||
<u-input slot="value" class="input" v-model="form.city" inputAlign="right" maxlength="30"
|
||||
:border="false" placeholder="请选择所在城市" />
|
||||
</u-cell>
|
||||
</u-form-item>
|
||||
@@ -129,7 +129,7 @@
|
||||
<view class="form-wrapper">
|
||||
<view class="images">
|
||||
<u-upload :fileList="fileList1" :maxSize="3145728" :width="72" :height="72"
|
||||
@afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="6"></u-upload>
|
||||
@afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="9"></u-upload>
|
||||
</view>
|
||||
</view>
|
||||
</u-form-item>
|
||||
@@ -180,7 +180,7 @@
|
||||
<!-- 操作按钮 -->
|
||||
<view class="footer">
|
||||
<view class="btn-wrapper">
|
||||
<u-button text="发布" color="linear-gradient(to bottom, #27b0fd, #3f72f4)" :disabled="disabled"
|
||||
<u-button text="保存" color="linear-gradient(to bottom, #27b0fd, #3f72f4)" :disabled="disabled"
|
||||
shape="circle" @click="handleSubmit()"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -196,7 +196,7 @@
|
||||
dateFormat
|
||||
} from '@/utils/util.js'
|
||||
import * as UserApi from '@/api/user'
|
||||
import * as HouseInfoApi from '@/api/house-info.js'
|
||||
import { updateHouseInfo,getHouseInfo } from '@/api/house-info.js'
|
||||
import * as UploadApi from '@/api/upload'
|
||||
import * as DictApi from '@/api/dict.js'
|
||||
|
||||
@@ -212,6 +212,7 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
selectId : 0,
|
||||
tabs,
|
||||
tabIndex: 10,
|
||||
dict: null,
|
||||
@@ -270,7 +271,14 @@
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad() {
|
||||
onLoad(options) {
|
||||
if(options.id > 0){
|
||||
uni.setNavigationBarTitle({
|
||||
title: '编辑房源'
|
||||
})
|
||||
this.selectId = options.id
|
||||
this.getHouse(options.id)
|
||||
}
|
||||
this.getDict()
|
||||
},
|
||||
|
||||
@@ -287,6 +295,16 @@
|
||||
this.dict = res.data;
|
||||
})
|
||||
},
|
||||
getHouse(id){
|
||||
const app = this
|
||||
console.log('id: ',id);
|
||||
getHouseInfo(id).then(res => {
|
||||
console.log('res: ',res);
|
||||
app.form = res.data
|
||||
app.houseLabel = JSON.parse(app.form.houseLabel) || []
|
||||
app.fileList1 = JSON.parse(app.form.files) || []
|
||||
})
|
||||
},
|
||||
onChangeTab(e) {
|
||||
const app = this
|
||||
app.tabIndex = e.value
|
||||
@@ -393,8 +411,9 @@
|
||||
this.$refs.uForm.validate().then(() => {
|
||||
app.form.houseLabel = JSON.stringify(app.houseLabel)
|
||||
app.form.files = JSON.stringify(app.fileList1)
|
||||
HouseInfoApi.addHouseInfo(app.form).then(result => {
|
||||
app.$toast(result.message)
|
||||
const saveOrUpdate = app.selectId > 0 ? updateHouseInfo : addHouseInfo;
|
||||
saveOrUpdate(app.form).then(result => {
|
||||
app.$toast('保存成功')
|
||||
}).catch(err => {
|
||||
uni.$u.toast(err)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user