描述:选择园区

This commit is contained in:
SelfRidicule 2024-04-02 17:51:41 +08:00
parent a6caeb7dba
commit ea934fd837
9 changed files with 188 additions and 140 deletions

View File

@ -0,0 +1 @@
{"containers":[],"config":{}}

View File

@ -0,0 +1,12 @@
import {
request
} from '../selfRequest';
// 园区列表
export function selectParkListRq() {
return request({
url: '/api/room/selectParkList',
method: "get",
});
}

View File

@ -200,9 +200,23 @@ Page({
_this.setData({
userDetail
})
// 登录用户是否选择园区
_this.userIsPark()
})
} else {
app.getlogin()
return
}
},
// 登录用户是否选择园区
userIsPark() {
let parkId = wx.getStorageSync('parkId');
if (!parkId) {
wx.navigateTo({
url: '/pages/index/parkList/parkList',
})
}
},

View File

@ -1,72 +1,98 @@
let app = getApp()
const app = getApp()
import {
selectParkListRq
} from "../../../api/user/park.js"
Page({
/**
* 页面的初始数据
*/
data: {
DOMAIN_NAME: app.DOMAIN_NAME,
currentTab: 0,
homelist: [],
name: ''
},
/**
* 页面的初始数据
*/
data: {
IMG_NAME: app.IMG_NAME,
dataList: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {
this.getList()
},
getList() {
var that = this
app.AjaxRequest('get', {
'content-type': 'application/json'
}, '/park/list', {}, function (res) {
that.setData({
parkList: res.data
})
})
},
changePark(e) {
app.AjaxRequest('POST', {
'content-type': 'application/json',
'Authorization': 'Bearer ' + app.Getopenid()
}, '/user/profile/update', {
parkId: e.currentTarget.dataset.id
}, function (ret) {
if (ret.code == 0) {
wx.setStorageSync('parkId', e.currentTarget.dataset.id)
wx.setStorageSync('parkName', e.currentTarget.dataset.name)
wx.reLaunch({
url: '/pages/index/index',
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let _this = this;
_this.setData({
...options,
})
}
})
},
navDetail(e) {
const eventChannel = this.getOpenerEventChannel()
let homelist = this.data.homelist
let index = e.currentTarget.dataset.index
wx.navigateBack({
url: '../logs/logs',
success() {
eventChannel.emit('acceptDataFromOpenedPage', {
data: homelist[index]
// 园区列表
_this.getParkList();
},
// 园区列表
getParkList() {
let _this = this
selectParkListRq().then(res => {
console.log('selectParkListRq', res);
_this.setData({
dataList: res.data
})
})
}
})
},
},
getName(e) {
this.setData({
name: e.detail.value
})
},
// 选择园区
selectPark(e) {
console.log('e.currentTarget.dataset', e);
let obj = e.currentTarget.dataset.obj;
wx.setStorageSync('parkId', obj.id)
wx.setStorageSync('parkName', obj.name)
// 销毁当前页面
wx.navigateBack();
},
search() {
this.getList(this.data.name)
}
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,24 +1,15 @@
<!-- <view class='borderTop borderBottom' style='height:100rpx;background:white;display:flex'>
<input type="text" bindinput="getName"/>
<view style="width:22%;text-align:center;line-height:100rpx;font-size:30rpx;color:#6C6C6C" bindtap="search">搜索</view>
</view> -->
<scroll-view style="height:100%;" scroll-y="true">
<view wx:for='{{parkList}}' wx:key="index" data-index="{{index}}" style="background: white;">
<view bindtap="changePark" data-id="{{item.id}}"
data-name="{{item.parkName}}">
<view class="detailbox" style="width: 90%;margin: 0 auto;">
<view style="padding: 3% 0;" class="borderBottom">
<image src="{{item.pic? DOMAIN_NAME+item.pic: '/images/user-unlogin.jpg'}}"
style="width:100rpx;height:100rpx;oberflow:hidden;border-radius:10%;" mode="widthFix"></image>
<view style="display: inline-block;line-height: 46rpx;margin-left: 4%;width: 80%;">
<view class="titleC"
style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;font-size:12pt;margin:0;">
{{item.parkName}}
<view class="containerView public">
<view class="itemListView">
<view class="itemView" wx:for="{{dataList}}" wx:key="*this"
bind:tap="selectPark"
data-obj="{{item}}">
<image class="img" src="{{ item.bannerImages.length > 0 ? IMG_NAME + item.bannerImages[0].name : '' }}" mode="aspectFill" />
<view class="contentView">
<view class="name">{{item.name}}</view>
<view class="describe">{{item.address}}</view>
</view>
<view class="detailTextC">{{item.address}}</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>

View File

@ -1,13 +1,47 @@
.detailbox{
position: relative;
.itemListView{
padding: 20rpx 0;
}
input{
width: 72%;
height: 80rpx;
margin-top: 10rpx;
margin-left: 6%;
background-color: #F3F3F3;
border-radius: 8rpx;
box-sizing: border-box;
padding-left: 20rpx;
.itemListView .itemView{
border-bottom: 1px solid rgb(126, 126, 126, 0.2);
padding: 30rpx 30rpx;
display: flex;
justify-content: flex-start;
align-items: center;
}
.itemListView .itemView:active{
background-color: rgb(126, 126, 126, 0.2);
}
.itemListView .itemView .img{
flex-shrink: 0;
width: 100rpx;
height: 100rpx;
}
.itemListView .itemView .contentView{
flex: 1;
margin-left: 30rpx;
overflow: hidden;
}
.itemListView .itemView .contentView .name{
font-size: 30rpx;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
white-space: nowrap;
}
.itemListView .itemView .contentView .describe{
margin-top: 10rpx;
font-size: 24rpx;
color: gray;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
white-space: nowrap;
}

View File

@ -68,6 +68,8 @@ Page({
wx.setStorageSync('user', user)
wx.setStorageSync('userId', user.id)
wx.setStorageSync('token', token)
wx.setStorageSync('parkId', user.parkId)
wx.setStorageSync('parkName', user.parkName)
// 跳转首页
wx.reLaunch({
url: '/pages/index/index',

View File

@ -55,53 +55,14 @@ Page({
},
parkChange(e) {
var that = this
let that = this
that.data.parkList.forEach(item => {
if (that.data.park[e.detail.value] == item.parkName) {
wx.request({
url: app.DOMAIN_NAME + '/user/profile/update',
data: {
parkId: item.id
},
method: 'POST',
header: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + app.Getopenid()
},
success(ret) {
if (ret.data.code == 402 || ret.data.code == 401) {
wx.hideLoading()
wx.showModal({
confirmText: '确认',
content: '身份已过期,需重登录',
success(res) {
wx.removeStorageSync('MemberInfo')
wx.removeStorageSync('token')
if (res.confirm) {
wx.reLaunch({
url: '/pages/login/login'
})
}
}
})
} else if (ret.data.code != 0) {
wx.hideLoading()
wx.showModal({
confirmText: '好的',
content: ret.data.msg || '服务器开小差去了,请重试',
showCancel: false
})
} else if (ret.data.code == 0) {
that.setData({
parkindex: e.detail.value
})
wx.setStorageSync('parkId', item.id)
wx.setStorageSync('parkName', item.parkName)
wx.navigateBack()
wx.hideLoading()
}
}
that.setData({
parkindex: e.detail.value
})
wx.setStorageSync('parkId', item.id)
wx.setStorageSync('parkName', item.parkName)
}
})
},

View File

@ -6,6 +6,13 @@
"condition": {
"miniprogram": {
"list": [
{
"name": "pages/index/parkList/parkList",
"pathName": "pages/index/parkList/parkList",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pages/meeting/invite/invite",
"pathName": "pages/meeting/invite/invite",