From 9e931e9f6bcea16e33cc6d45e71f9feeff9c510c Mon Sep 17 00:00:00 2001 From: gxwebsoft Date: Wed, 23 Aug 2023 13:09:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=88=BF=E4=BA=A7=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.js | 4 +- pages/house/house.vue | 2 +- pages/index/index.vue | 7 +- sub_pages/dealer/poster/poster.vue | 2 +- sub_pages/house/add.vue | 17 ++- sub_pages/house/detail.vue | 8 +- sub_pages/house/house.vue | 168 ++++++++++++++------- sub_pages/user/poster/poster.vue | 4 +- sub_pages/user/poster/poster2.vue | 2 +- uni_modules/uview-ui/libs/mixin/mpShare.js | 9 +- 10 files changed, 149 insertions(+), 74 deletions(-) diff --git a/config.js b/config.js index 45357d2..fe3ca80 100755 --- a/config.js +++ b/config.js @@ -9,12 +9,12 @@ module.exports = { appSecret: '1f1d186d98ea4620ac65afbf34940051', // 开发环境 - apiUrl: "http://127.0.0.1:9090/api", + // apiUrl: "http://127.0.0.1:9090/api", // socketUrl: 'ws://localhost:9190', // fileUrl: 'https://file.wsdns.cn', // 测试环境 - // apiUrl: 'https://server.gxwebsoft.com/api', + apiUrl: 'https://server.gxwebsoft.com/api', socketUrl: 'wss://server.gxwebsoft.com', fileUrl: 'https://file.wsdns.cn', diff --git a/pages/house/house.vue b/pages/house/house.vue index 73542e6..6678fd7 100644 --- a/pages/house/house.vue +++ b/pages/house/house.vue @@ -69,7 +69,7 @@ reset: true }, { - name: '必看房源', + name: '必看好房', reset: false } ]; diff --git a/pages/index/index.vue b/pages/index/index.vue index e5c90b2..1e89b91 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -64,7 +64,7 @@ reset: true }, { - name: '必看房源', + name: '必看好房', reset: false } ]; @@ -104,6 +104,9 @@ this.getDict() this.list = [] this.onRefreshList() + uni.$u.mpShare = { + title: '爱尚家找房' + } }, onShow() {}, onBackPress() {}, @@ -208,7 +211,7 @@ font-size: 28rpx; } .input{ - width: 250rpx; + width: 330rpx; } } } diff --git a/sub_pages/dealer/poster/poster.vue b/sub_pages/dealer/poster/poster.vue index 2d1ccbf..a4400f6 100644 --- a/sub_pages/dealer/poster/poster.vue +++ b/sub_pages/dealer/poster/poster.vue @@ -104,7 +104,7 @@ }, onShareAppMessage() { return { - title: '高端婚恋交友平台', + title: '爱尚家找房', path: 'pages/index/index?user_id=' + uni.getStorageSync('userId'), imageUrl: 'https://file-jimei.oss-cn-shenzhen.aliyuncs.com/static/mp-share.png' } diff --git a/sub_pages/house/add.vue b/sub_pages/house/add.vue index 487829c..86ff887 100644 --- a/sub_pages/house/add.vue +++ b/sub_pages/house/add.vue @@ -196,7 +196,7 @@ dateFormat } from '@/utils/util.js' import * as UserApi from '@/api/user' - import { updateHouseInfo,getHouseInfo } from '@/api/house-info.js' + import { updateHouseInfo,getHouseInfo,addHouseInfo } from '@/api/house-info.js' import * as UploadApi from '@/api/upload' import * as DictApi from '@/api/dict.js' @@ -225,7 +225,8 @@ // 表单数据 form: { houseTitle: '', - area: '' + area: '', + status: 10 }, fileList1: [], loading: false, @@ -288,7 +289,12 @@ // 微信小程序需要用此写法 // this.$refs.datetimePicker.setFormatter(this.formatter) }, - + onUnload() { + const eventChannel = this.getOpenerEventChannel(); + eventChannel.emit('reload', { + status: true + }); + }, methods: { getDict() { DictApi.listDictionary().then(res => { @@ -409,15 +415,20 @@ if (app.disabled === true) return console.log("app.tempFile: ", app.tempFile); this.$refs.uForm.validate().then(() => { + app.disabled = true app.form.houseLabel = JSON.stringify(app.houseLabel) app.form.files = JSON.stringify(app.fileList1) const saveOrUpdate = app.selectId > 0 ? updateHouseInfo : addHouseInfo; saveOrUpdate(app.form).then(result => { app.$toast('保存成功') + setTimeout(() => { + uni.navigateBack() + },1000) }).catch(err => { uni.$u.toast(err) }) }).catch(errors => { + console.log('errors: ',errors); uni.$u.toast('校验失败') }) diff --git a/sub_pages/house/detail.vue b/sub_pages/house/detail.vue index 47547c5..929dca6 100644 --- a/sub_pages/house/detail.vue +++ b/sub_pages/house/detail.vue @@ -165,7 +165,7 @@ reset: true }, { - name: '必看房源', + name: '必看好房', reset: false } ]; @@ -324,6 +324,12 @@ app.swiperList = app.form.files app.form.houseLabel = JSON.parse(res.data.houseLabel) || [] // app.form.supporting = JSON.parse(res.data.supporting) || [] + + uni.$u.mpShare = { + title: `${app.form.houseTitle} ${app.form.monthlyRent}元/月 ${app.form.houseType} ${app.form.extent}m²`, + path: `sub_pages/house/detail?houseId=${app.form.houseId}&user_id=${uni.getStorageSync('userId')}` + // path: '' + app.form.houseId + app.form.monthlyRent + '&user_id=' + uni.getStorageSync('userId') + } }).catch(err => { app.$error(err.message) }) diff --git a/sub_pages/house/house.vue b/sub_pages/house/house.vue index a796b56..5ce3a29 100644 --- a/sub_pages/house/house.vue +++ b/sub_pages/house/house.vue @@ -7,15 +7,13 @@ :actionStyle="actionStyle"> - - {{ select }} - + @@ -32,15 +30,20 @@ - - - - + + + + - - + + + + + {{ item.houseTitle }} @@ -56,7 +59,7 @@ - + @@ -85,7 +88,8 @@ page: 1, where: {}, select: [], - bgColor: '#ffffff', + checked: false, + bgColor: '#ff0000', selectId: 0 } }, @@ -94,8 +98,7 @@ * 生命周期函数--监听页面加载 */ onLoad() { - this.list = [] - this.onRefreshList() + this.onSearch() // this.getDict() }, @@ -135,45 +138,79 @@ } else { app.canReset = false } - console.log("app.list: ",app.list); + console.log("app.list: ", app.list); resolve(list) }) }) }, - - onEdit(){ - const { selectId } = this - if(selectId > 0){ + + onEdit() { + const { + selectId + } = this + if(selectId == 0){ + this.$error('请选择房源') + return false + } + if (selectId > 0) { this.$push('sub_pages/house/add?id=' + selectId) } - + }, - - onDel(){ + + onDel() { const app = this - const { selectId } = this - if(selectId > 0){ - HouseInfoApi.removeHouseInfo(selectId).then(res => { - - }) - } + app.list.map(d => { + if (d.selected == true) { + HouseInfoApi.removeHouseInfo(d.houseId).then(res => { + app.$success(res.message) + }) + } + }) + app.onSearch() }, - onStatus(status){ - console.log('this.select: ',this.select); + onStatus(status) { + const app = this + app.list.map(d => { + if (d.selected == true) { + HouseInfoApi.updateHouseInfo({ + houseId: d.houseId, + status + }) + } + }) + app.onSearch() }, onSearch() { - console.log('this.where: ',this.where); this.list = [] this.page = 1 + this.checked = false this.onRefreshList() - // this.$push('/sub_pages/member/member', this.where) }, - onBadge(id){ - this.selectId = id - this.bgColor = '#ff0000' - this.select.push(id) - console.log('this.select: ',this.select); + onBadge(item, index) { + this.list[index].selected = true + this.selectId = item.houseId + }, + addHouseInfo(id) { + const app = this + uni.navigateTo({ + url: `/sub_pages/house/add?id=` + id, + events: { + reload: ({ + status // false + }) => { + app.onSearch() + } + } + }) + }, + onRadio(e) { + const { list } = this + this.list = list.map((d) => { + d.selected = true + return d + }) } } } @@ -186,6 +223,7 @@