调试快速登录
This commit is contained in:
		@@ -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({
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user