描述:授权登录同意修改

This commit is contained in:
SelfRidicule 2024-04-09 15:19:40 +08:00
parent 9e1df4a22d
commit a036458531
7 changed files with 33 additions and 96 deletions

View File

@ -101,10 +101,11 @@ export function selectReservationByIdRq(id) {
}
// 获取公司地址信息经纬度
export function selectCoordinateRq() {
export function selectCoordinateRq(data) {
return request({
url: '/api/roomContent/selectCoordinate',
method: "get",
data
});
}

View File

@ -44,7 +44,7 @@ export function request(params) {
success(res) {
// 清空所有缓存
wx.clearStorageSync()
wx.reLaunch({
wx.navigateTo({
url: '/pages/login/login',
})
}

View File

@ -186,7 +186,7 @@ App({
confirmText: '好的',
content: '请先登录后再点击查看',
success: res => {
wx.reLaunch({
wx.navigateTo({
url: '/pages/login/login',
})
}

View File

@ -71,9 +71,7 @@ Page({
wx.setStorageSync('parkId', user.parkId)
wx.setStorageSync('parkName', user.parkName)
// 跳转首页
wx.reLaunch({
url: '/pages/index/index',
})
wx.navigateBack()
},
/**

View File

@ -16,16 +16,6 @@ import {
inviteRecordPersonListRq
} from "../../../api/meeting/meetingRoom.js"
import {
openDoorRq
} from "../../../api/meeting/equipment.js"
import {
loginRq,
registerPhone
} from "../../../api/login/login.js"
Page({
/**
@ -47,8 +37,6 @@ Page({
detail: null,
joinPersonList: [],
address: {},
openid: null,
authorizationShow: true,
participateShow: false,
openDoorShow: false,
},
@ -61,18 +49,14 @@ Page({
_this.setData({
...options
})
// 获取详情
_this.getDetail();
// 获取地址信息
_this.getAddress()
// 自动登录获取openid
_this.autoLogin()
},
// 获取地址信息
getAddress() {
getAddress(parkId) {
let _this = this;
selectCoordinateRq().then(res => {
selectCoordinateRq({
parkId
}).then(res => {
_this.setData({
address: res,
mapData: {
@ -100,10 +84,15 @@ Page({
_this.setData({
detail
})
// 获取地址信息
_this.getAddress(detail.parkId)
// 查询参与会议预约人员列表
_this.getInviteRecordPersonList()
// 判断是否参与过会议
_this.whetherParticipate()
})
// 查询参与会议预约人员列表
_this.getInviteRecordPersonList()
},
// 查询参与会议预约人员列表
getInviteRecordPersonList() {
let _this = this;
@ -126,60 +115,6 @@ Page({
})
},
// 自动登录获取openid
autoLogin() {
let _this = this;
wx.login({
success(wxRes) {
loginRq({
"jsCode": wxRes.code
}).then(res => {
console.log('loginRq', res);
_this.setData({
openid: res.openid
})
// 判断用户是否注册
if (res.token) {
// 用户授权成功
_this.userAuthorizationSuccess(res.openid, res.user, res.token.token)
}
})
}
})
},
// 获取手机号
getPhoneNumber(e) {
let _this = this;
console.log('getPhoneNumber', e)
registerPhone({
"code": e.detail.code,
"openid": _this.data.openid
}).then(res => {
console.log('registerPhone', res);
// 用户授权成功
_this.userAuthorizationSuccess(res.openid, res.user, res.token.token)
})
},
// 用户授权成功
userAuthorizationSuccess(openid, user, token) {
let _this = this;
_this.setData({
authorizationShow: false
})
// 清空所有缓存
wx.clearStorageSync()
// 存储用户信息
wx.setStorageSync('openid', openid)
wx.setStorageSync('user', user)
wx.setStorageSync('userId', user.id)
wx.setStorageSync('token', token)
// 判断是否参与过会议
_this.whetherParticipate();
},
// 判断是否参与过会议
whetherParticipate() {
let _this = this
@ -216,7 +151,7 @@ Page({
participateShow: false,
openDoorShow: true
})
// 查询参与会议预约人员列表
// 查询参与会议预约人员列表
_this.getInviteRecordPersonList()
} else { //参与失败
Notify({
@ -246,7 +181,15 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
let _this = this;
let userId = wx.getStorageSync('userId');
if (userId) {
// 获取详情
_this.getDetail();
} else {
app.getlogin()
return
}
},
/**

View File

@ -48,11 +48,6 @@
</view>
</view>
<!-- 授权登录 -->
<view class="submitBtn" wx:if="{{authorizationShow}}">授权登录
<button class="loginBtn" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button>
</view>
<!-- 接受邀请 -->
<view class="submitBtn" wx:if="{{participateShow}}" bind:tap="participateMeeting">接受邀请</view>
<!-- 点击开门 -->

View File

@ -6,6 +6,13 @@
"condition": {
"miniprogram": {
"list": [
{
"name": "pages/meeting/invite/invite",
"pathName": "pages/meeting/invite/invite",
"query": "id=126",
"launchMode": "default",
"scene": null
},
{
"name": "pages/index/parkList/parkList",
"pathName": "pages/index/parkList/parkList",
@ -34,13 +41,6 @@
"launchMode": "default",
"scene": null
},
{
"name": "pages/meeting/invite/invite",
"pathName": "pages/meeting/invite/invite",
"query": "id=14",
"launchMode": "default",
"scene": null
},
{
"name": "pages/meeting/meetingRoom/meetingBooked/meetingBooked",
"pathName": "pages/meeting/meetingRoom/meetingBooked/meetingBooked",