|
@@ -26,7 +26,6 @@ class Index extends Component {
|
|
|
addr1: '',
|
|
|
addr2: '',
|
|
|
addr3: '',
|
|
|
- pri_image: '',
|
|
|
formObj: {
|
|
|
house_type: '1室1厅1卫',
|
|
|
hide_status: '1',
|
|
@@ -73,8 +72,9 @@ class Index extends Component {
|
|
|
owner_phone: cObj.owner_phone || '',
|
|
|
introduce: cObj.introduce || '',
|
|
|
remarked: cObj.remarked || '',
|
|
|
+ pri_image: cObj.pri_image || '',
|
|
|
+ house_img: cObj.house_img || '',
|
|
|
},
|
|
|
- pri_image: cObj.pri_image || '',
|
|
|
imgArr: (cObj.images && cObj.images.length > 0) ? cObj.images.split(',') : [],
|
|
|
addr1: addr[0],
|
|
|
addr2: addr[1],
|
|
@@ -87,7 +87,7 @@ class Index extends Component {
|
|
|
|
|
|
|
|
|
saveHandle () {
|
|
|
- const { formObj, imgArr, pri_image, addr1, addr2, addr3 } = this.state
|
|
|
+ const { formObj, imgArr, addr1, addr2, addr3 } = this.state
|
|
|
let house_no = ''
|
|
|
if (addr1 && addr2 && addr3) {
|
|
|
house_no = `${addr1}-${addr2}-${addr3}`
|
|
@@ -95,7 +95,7 @@ class Index extends Component {
|
|
|
Taro.$msg('请输入楼栋单号房间号')
|
|
|
return
|
|
|
}
|
|
|
- // console.log(formObj.estate_id, formObj.title, pri_image)
|
|
|
+ // console.log(formObj.estate_id, formObj.title, formObj.pri_image)
|
|
|
let apiStr = 'apieshouseadd'
|
|
|
let params = {
|
|
|
estate_id: formObj.estate_id,
|
|
@@ -115,18 +115,18 @@ class Index extends Component {
|
|
|
introduce: formObj.introduce,
|
|
|
remarked: formObj.remarked,
|
|
|
hide_status: formObj.hide_status,
|
|
|
- pri_image: pri_image,
|
|
|
+ pri_image: formObj.pri_image,
|
|
|
+ house_img: formObj.house_img,
|
|
|
images: imgArr.join(','),
|
|
|
}
|
|
|
if (formObj.id) {
|
|
|
apiStr = 'apieshouseedit'
|
|
|
params.id = formObj.id
|
|
|
}
|
|
|
- if (formObj.estate_id && formObj.title && pri_image) {
|
|
|
+ if (formObj.estate_id && formObj.title && formObj.pri_image) {
|
|
|
Taro.api.room[apiStr](params).then(res => {
|
|
|
if (!formObj.id) {
|
|
|
this.setState({
|
|
|
- pri_image: '',
|
|
|
formObj: {
|
|
|
house_type: '1室1厅1卫',
|
|
|
hide_status: '1',
|
|
@@ -160,10 +160,12 @@ class Index extends Component {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- addHouseCertImg () {
|
|
|
- this.uploadComImg((curImg) => {
|
|
|
+ dealImgHandle (key) {
|
|
|
+ this.uploadComImg((val) => {
|
|
|
+ let { formObj } = this.state
|
|
|
+ formObj[key] = val
|
|
|
this.setState({
|
|
|
- pri_image: curImg,
|
|
|
+ formObj
|
|
|
})
|
|
|
})
|
|
|
}
|
|
@@ -187,7 +189,7 @@ class Index extends Component {
|
|
|
success: function (res) {
|
|
|
const tempFilePaths = res.tempFilePaths
|
|
|
Taro.uploadFile({
|
|
|
- url: `https://api.honglouplus.com/api/upload/cloud`,
|
|
|
+ url: `https://api.honglouplus.com/api/upload/cloudpir`,
|
|
|
filePath: tempFilePaths[0],
|
|
|
name: 'upload',
|
|
|
formData: {
|
|
@@ -218,9 +220,12 @@ class Index extends Component {
|
|
|
}
|
|
|
previewImageHandle (current, arr) {
|
|
|
const { imgArr } = this.state
|
|
|
+ let nArr = imgArr.map(item => {
|
|
|
+ return item + '_plus'
|
|
|
+ })
|
|
|
Taro.previewImage({
|
|
|
current,
|
|
|
- urls: imgArr
|
|
|
+ urls: nArr
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -269,7 +274,7 @@ class Index extends Component {
|
|
|
|
|
|
|
|
|
render () {
|
|
|
- const { formObj, imgArr, pri_image } = this.state
|
|
|
+ const { formObj, imgArr } = this.state
|
|
|
const dictData = Taro.getStorageSync('dictData')
|
|
|
const roomDecMoreOptions = {arr: dictData.room_dec}
|
|
|
const houseRoomYearMoreOptions = {arr: dictData.house_room_year}
|
|
@@ -280,7 +285,7 @@ class Index extends Component {
|
|
|
const imgItems = imgArr.map((src, index) => {
|
|
|
return (
|
|
|
<View className="si-op" key={index}>
|
|
|
- <Image src={src} className="img" onClick={this.previewImageHandle.bind(this, src)} />
|
|
|
+ <Image src={src + '_plus'} className="img" onClick={this.previewImageHandle.bind(this, src + '_plus')} />
|
|
|
<Image src={closeIcon} className="i" onClick={this.delImg.bind(this, index)}/>
|
|
|
</View>
|
|
|
)
|
|
@@ -439,21 +444,38 @@ class Index extends Component {
|
|
|
bc={this.baseFormChange.bind(this)}
|
|
|
/>
|
|
|
</View>
|
|
|
-
|
|
|
- <View className="scoped-box">
|
|
|
- <View className="sb-title">封面主图片(必填)</View>
|
|
|
- <View className="scoped-img">
|
|
|
- {
|
|
|
- pri_image
|
|
|
- ?
|
|
|
- <View className="si-op" onClick={this.addHouseCertImg.bind(this)}>
|
|
|
- <Image src={pri_image} className="img"/>
|
|
|
- </View>
|
|
|
- :
|
|
|
- <View className="si-op" onClick={this.addHouseCertImg.bind(this)}>
|
|
|
- <Image src={addIcon} className="img"/>
|
|
|
- </View>
|
|
|
- }
|
|
|
+ <View className='scoped-has-right'>
|
|
|
+ <View className="scoped-box">
|
|
|
+ <View className="sb-title">封面主图片(必填)</View>
|
|
|
+ <View className="scoped-img">
|
|
|
+ {
|
|
|
+ formObj.pri_image
|
|
|
+ ?
|
|
|
+ <View className="si-op" onClick={this.dealImgHandle.bind(this, 'pri_image')}>
|
|
|
+ <Image src={formObj.pri_image + '_plus'} className="img"/>
|
|
|
+ </View>
|
|
|
+ :
|
|
|
+ <View className="si-op" onClick={this.dealImgHandle.bind(this, 'pri_image')}>
|
|
|
+ <Image src={addIcon} className="img"/>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ <View className="scoped-box shr-r">
|
|
|
+ <View className="sb-title">户型图</View>
|
|
|
+ <View className="scoped-img">
|
|
|
+ {
|
|
|
+ formObj.house_img
|
|
|
+ ?
|
|
|
+ <View className="si-op" onClick={this.dealImgHandle.bind(this, 'house_img')}>
|
|
|
+ <Image src={formObj.house_img + '_plus'} className="img"/>
|
|
|
+ </View>
|
|
|
+ :
|
|
|
+ <View className="si-op" onClick={this.dealImgHandle.bind(this, 'house_img')}>
|
|
|
+ <Image src={addIcon} className="img"/>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+ </View>
|
|
|
</View>
|
|
|
</View>
|
|
|
<View className="scoped-box">
|