1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

调试快速登录

This commit is contained in:
2023-03-28 13:14:40 +08:00
parent 76ad164d4e
commit 614e04ed1b
9 changed files with 446 additions and 36 deletions

View File

@@ -15,7 +15,11 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if (app.globalData.debugMode) {
this.setData({
debugMode: true,
})
}
},
/**
@@ -75,6 +79,14 @@ Page({
this.setData(newData)
},
fastLogin() {
this.setData({
username: "user",
password: "user",
})
this.login()
},
login() {
console.log("login userInput", this.data.username, this.data.password)
if (!this.data.username || !this.data.password) {
@@ -102,6 +114,21 @@ Page({
let result = d.data;
if (result.success) {
// 登录成功
if (result.data.userInfo.role != 2) {
wx.showModal({
title: '你不是社区居民',
content: '请前往网页版登录',
complete: (res) => {
if (res.cancel) {
}
if (res.confirm) {
}
}
})
}
wx.setStorageSync("userInfo", result.data.userInfo);
console.log("userInfo", wx.getStorageSync("userInfo"))
wx.switchTab({

View File

@@ -12,6 +12,7 @@
</view>
<view class="loginBtnView">
<!--按钮-->
<button wx:if="{{debugMode}}" class="loginBtn" type="warn" bindtap="fastLogin">DEBUG快速登录user</button>
<button class="loginBtn" type="primary" bindtap="login">登录</button>
<button class="loginBtn" type="secondary" bindtap="visitor">访客申请</button>
</view>