mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 03:49:37 +08:00
描述:选择园区
This commit is contained in:
parent
a6caeb7dba
commit
ea934fd837
1
.cloudbase/container/debug.json
Normal file
1
.cloudbase/container/debug.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"containers":[],"config":{}}
|
12
miniprogram/api/user/park.js
Normal file
12
miniprogram/api/user/park.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import {
|
||||||
|
request
|
||||||
|
} from '../selfRequest';
|
||||||
|
|
||||||
|
|
||||||
|
// 园区列表
|
||||||
|
export function selectParkListRq() {
|
||||||
|
return request({
|
||||||
|
url: '/api/room/selectParkList',
|
||||||
|
method: "get",
|
||||||
|
});
|
||||||
|
}
|
@ -200,9 +200,23 @@ Page({
|
|||||||
_this.setData({
|
_this.setData({
|
||||||
userDetail
|
userDetail
|
||||||
})
|
})
|
||||||
|
// 登录用户是否选择园区
|
||||||
|
_this.userIsPark()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
app.getlogin()
|
app.getlogin()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// 登录用户是否选择园区
|
||||||
|
userIsPark() {
|
||||||
|
let parkId = wx.getStorageSync('parkId');
|
||||||
|
if (!parkId) {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/index/parkList/parkList',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,72 +1,98 @@
|
|||||||
let app = getApp()
|
const app = getApp()
|
||||||
|
|
||||||
|
import {
|
||||||
|
selectParkListRq
|
||||||
|
} from "../../../api/user/park.js"
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
DOMAIN_NAME: app.DOMAIN_NAME,
|
IMG_NAME: app.IMG_NAME,
|
||||||
currentTab: 0,
|
dataList: []
|
||||||
homelist: [],
|
},
|
||||||
name: ''
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad() {
|
onLoad(options) {
|
||||||
this.getList()
|
let _this = this;
|
||||||
},
|
_this.setData({
|
||||||
|
...options,
|
||||||
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',
|
|
||||||
})
|
})
|
||||||
}
|
// 园区列表
|
||||||
})
|
_this.getParkList();
|
||||||
},
|
},
|
||||||
|
|
||||||
navDetail(e) {
|
// 园区列表
|
||||||
const eventChannel = this.getOpenerEventChannel()
|
getParkList() {
|
||||||
let homelist = this.data.homelist
|
let _this = this
|
||||||
let index = e.currentTarget.dataset.index
|
selectParkListRq().then(res => {
|
||||||
wx.navigateBack({
|
console.log('selectParkListRq', res);
|
||||||
url: '../logs/logs',
|
_this.setData({
|
||||||
success() {
|
dataList: res.data
|
||||||
eventChannel.emit('acceptDataFromOpenedPage', {
|
})
|
||||||
data: homelist[index]
|
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
getName(e) {
|
// 选择园区
|
||||||
this.setData({
|
selectPark(e) {
|
||||||
name: e.detail.value
|
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() {
|
||||||
|
|
||||||
|
}
|
||||||
})
|
})
|
@ -1,24 +1,15 @@
|
|||||||
<!-- <view class='borderTop borderBottom' style='height:100rpx;background:white;display:flex'>
|
<view class="containerView public">
|
||||||
<input type="text" bindinput="getName"/>
|
|
||||||
<view style="width:22%;text-align:center;line-height:100rpx;font-size:30rpx;color:#6C6C6C" bindtap="search">搜索</view>
|
<view class="itemListView">
|
||||||
</view> -->
|
<view class="itemView" wx:for="{{dataList}}" wx:key="*this"
|
||||||
<scroll-view style="height:100%;" scroll-y="true">
|
bind:tap="selectPark"
|
||||||
<view wx:for='{{parkList}}' wx:key="index" data-index="{{index}}" style="background: white;">
|
data-obj="{{item}}">
|
||||||
<view bindtap="changePark" data-id="{{item.id}}"
|
<image class="img" src="{{ item.bannerImages.length > 0 ? IMG_NAME + item.bannerImages[0].name : '' }}" mode="aspectFill" />
|
||||||
data-name="{{item.parkName}}">
|
<view class="contentView">
|
||||||
<view class="detailbox" style="width: 90%;margin: 0 auto;">
|
<view class="name">{{item.name}}</view>
|
||||||
<view style="padding: 3% 0;" class="borderBottom">
|
<view class="describe">{{item.address}}</view>
|
||||||
<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>
|
</view>
|
||||||
<view class="detailTextC">{{item.address}}</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
</scroll-view>
|
</view>
|
@ -1,13 +1,47 @@
|
|||||||
.detailbox{
|
.itemListView{
|
||||||
position: relative;
|
padding: 20rpx 0;
|
||||||
}
|
}
|
||||||
input{
|
|
||||||
width: 72%;
|
.itemListView .itemView{
|
||||||
height: 80rpx;
|
border-bottom: 1px solid rgb(126, 126, 126, 0.2);
|
||||||
margin-top: 10rpx;
|
padding: 30rpx 30rpx;
|
||||||
margin-left: 6%;
|
display: flex;
|
||||||
background-color: #F3F3F3;
|
justify-content: flex-start;
|
||||||
border-radius: 8rpx;
|
align-items: center;
|
||||||
box-sizing: border-box;
|
}
|
||||||
padding-left: 20rpx;
|
|
||||||
|
.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;
|
||||||
}
|
}
|
@ -68,6 +68,8 @@ Page({
|
|||||||
wx.setStorageSync('user', user)
|
wx.setStorageSync('user', user)
|
||||||
wx.setStorageSync('userId', user.id)
|
wx.setStorageSync('userId', user.id)
|
||||||
wx.setStorageSync('token', token)
|
wx.setStorageSync('token', token)
|
||||||
|
wx.setStorageSync('parkId', user.parkId)
|
||||||
|
wx.setStorageSync('parkName', user.parkName)
|
||||||
// 跳转首页
|
// 跳转首页
|
||||||
wx.reLaunch({
|
wx.reLaunch({
|
||||||
url: '/pages/index/index',
|
url: '/pages/index/index',
|
||||||
|
@ -55,53 +55,14 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
parkChange(e) {
|
parkChange(e) {
|
||||||
var that = this
|
let that = this
|
||||||
that.data.parkList.forEach(item => {
|
that.data.parkList.forEach(item => {
|
||||||
if (that.data.park[e.detail.value] == item.parkName) {
|
if (that.data.park[e.detail.value] == item.parkName) {
|
||||||
wx.request({
|
that.setData({
|
||||||
url: app.DOMAIN_NAME + '/user/profile/update',
|
parkindex: e.detail.value
|
||||||
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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
wx.setStorageSync('parkId', item.id)
|
||||||
|
wx.setStorageSync('parkName', item.parkName)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -6,6 +6,13 @@
|
|||||||
"condition": {
|
"condition": {
|
||||||
"miniprogram": {
|
"miniprogram": {
|
||||||
"list": [
|
"list": [
|
||||||
|
{
|
||||||
|
"name": "pages/index/parkList/parkList",
|
||||||
|
"pathName": "pages/index/parkList/parkList",
|
||||||
|
"query": "",
|
||||||
|
"launchMode": "default",
|
||||||
|
"scene": null
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "pages/meeting/invite/invite",
|
"name": "pages/meeting/invite/invite",
|
||||||
"pathName": "pages/meeting/invite/invite",
|
"pathName": "pages/meeting/invite/invite",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user