完成房产模块功能

This commit is contained in:
gxwebsoft
2023-08-23 13:09:58 +08:00
parent 93e0876e13
commit 9e931e9f6b
10 changed files with 149 additions and 74 deletions

View File

@@ -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',

View File

@@ -69,7 +69,7 @@
reset: true
},
{
name: '必看房',
name: '必看房',
reset: false
}
];

View File

@@ -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;
}
}
}

View File

@@ -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'
}

View File

@@ -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('校验失败')
})

View File

@@ -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}`,
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)
})

View File

@@ -7,15 +7,13 @@
:actionStyle="actionStyle"></u-search>
</view>
</u-sticky>
{{ select }}
<view class="order-total">
<view class="pay-btn">
<view class="btn">
<u-button text="上架" plain size="small" @click="onStatus(0)"></u-button>
</view>
<view class="btn">
<u-button text="下架" plain size="small" @click="onStatus(1)"></u-button>
<u-button text="下架" plain size="small" @click="onStatus(10)"></u-button>
</view>
<view class="btn">
<u-button text="删除" plain size="small" @click="onDel()"></u-button>
@@ -32,15 +30,20 @@
</view>
</view>
<view class="house">
<view class="btn">
<u-radio-group v-model="select">
<u-radio activeColor="red" label="全选"></u-radio>
</u-radio-group>
<view class="btn" @click="onRadio">
<label class="radio"><radio value="r1" color="#ff0000" :checked="checked" />全选</label>
<!-- <u-radio activeColor="red" v-model="select" label="全选" @change="onRadio"></u-radio> -->
<!-- <u-radio label="取消" @change="onRadio"></u-radio> -->
</view>
<view class="list">
<block v-for="(item,index) in list" :key="index">
<view class="item" @click="$push('sub_pages/house/add?id=' + item.houseId)">
<view class="badge" @click.stop="onBadge(item.houseId)"><u-badge :isDot="true" type="info" :bgColor="item.houseId == selectId ? bgColor : ''"></u-badge></view>
<view class="item" @click="addHouseInfo(item.houseId)">
<view class="badge" @click.stop="onBadge(item,index)"><u-badge :isDot="true" type="info"
:bgColor="item.selected ? bgColor : ''"></u-badge></view>
<view class="status">
<u-tag :text="item.status == 0 ? '上架' : '下架'" plain
:type="item.status == 0 ? 'success' : 'error'"></u-tag>
</view>
<image class="image" :src="item.files[0].url" mode="widthFix"></image>
<view class="info">
<view class="title">{{ item.houseTitle }}</view>
@@ -56,7 +59,7 @@
<u-gap></u-gap>
<view class="float">
<view class="release">
<u-button text="添加房源" type="primary" shape="circle" @click="$push('sub_pages/house/add')"></u-button>
<u-button text="添加房源" type="primary" shape="circle" @click="addHouseInfo"></u-button>
</view>
</view>
</view>
@@ -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()
},
@@ -142,7 +145,13 @@
},
onEdit() {
const { selectId } = this
const {
selectId
} = this
if(selectId == 0){
this.$error('请选择房源')
return false
}
if (selectId > 0) {
this.$push('sub_pages/house/add?id=' + selectId)
}
@@ -151,29 +160,57 @@
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);
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 @@
</style>
<style lang="scss" scoped>
.container {}
.search-wrapper {
display: flex;
height: 64rpx;
@@ -269,10 +307,12 @@
.pay-btn {
display: flex;
.btn {
margin-right: 16rpx;
}
}
.total-price {
display: flex;
align-items: center;
@@ -289,43 +329,59 @@
color: #ff0000;
}
}
.house {
margin: 30rpx auto;
width: 680rpx;
.btn {
width: 150rpx;
margin: 40rpx 0;
}
.list {
width: 680rpx;
margin: auto;
.item {
border-radius: 30rpx 30rpx 0 0;
box-shadow: 0 3rpx 10rpx 0px #999999;
background-color: #FFFFFF;
margin: 50rpx auto;
position: relative;
.badge {
position: absolute;
left: 30rpx;
top: 30rpx;
}
.status {
position: absolute;
right: 30rpx;
top: 30rpx;
}
.image {
width: 680rpx;
height: 360rpx;
border-radius: 30rpx 30rpx 0 0;
}
.info {
padding: 20rpx 20rpx;
display: flex;
flex-direction: column;
.title {
font-size: 40rpx;
}
.desc {
color: #999999;
font-size: 28rpx;
}
.price {
color: #ff0000;
font-size: 30rpx;
@@ -334,12 +390,14 @@
}
}
}
.float {
width: 750rpx;
display: flex;
justify-content: center;
position: fixed;
bottom: 100rpx;
.release {
width: 500rpx;
opacity: 0.9;

View File

@@ -181,13 +181,13 @@
console.log(res.target)
}
return {
title: '高端婚恋交友平台',
title: '爱尚家找房',
path: 'pages/index/index?user_id=' + uni.getStorageSync('userId')
}
},
onShareAppMessage() {
return {
title: '高端婚恋交友平台',
title: '爱尚家找房',
path: 'pages/index/index?user_id=' + uni.getStorageSync('userId'),
imageUrl: 'https://oss.jimeigroup.cn/static/mp-share.png'
}

View File

@@ -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'
}

View File

@@ -2,15 +2,12 @@ module.exports = {
onLoad() {
// 设置默认的转发参数
uni.$u.mpShare = {
title: '', // 默认为小程序名称
path: '', // 默认为当前页面路径
title: '爱尚家找房', // 默认为小程序名称
path: 'pages/index/index?user_id=' + uni.getStorageSync('userId'), // 默认为当前页面路径
imageUrl: '' // 默认为当前页面的截图
}
},
onShareAppMessage() {
return {
title: '高端婚恋交友平台',
path: 'pages/index/index?user_id=' + uni.getStorageSync('userId')
}
return uni.$u.mpShare
}
}