yangyin
2024-02-29 734861d6f6fe651c3a8333d05cb6630378c0bcfb
feat: 新增记住密码功能
已修改3个文件
63 ■■■■ 文件已修改
login/login/index.js 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
login/login/index.wxml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
login/login/index.wxss 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
login/login/index.js
@@ -5,6 +5,7 @@
  data: {
    phone: '',
    password: '',
    checked: false,
    imageWidth: 100,
    imageHeight: 100,
    inputViewWidth: 100,
@@ -34,6 +35,12 @@
  passwordInput: function (e) {
    this.setData({
      password: e.detail.value
    })
  },
   // 记住密码框
   rememberPwd(e) {
    this.setData({
      checked: e.detail.value.includes('1')
    })
  },
  // 获取输入电话号码
@@ -127,8 +134,8 @@
    //   SVersion: sysInfo.version
    // }
    let data={
      LoginName: this.data.phone,
      LoginPwd: this.data.password,
      LoginName: that.data.phone,
      LoginPwd: that.data.password,
      Software:Constant.Software
    }
    // console.log(JSON.stringify(data),110)
@@ -177,13 +184,21 @@
        if(Token){
          isNeedToken = true
        }
        let Checked={}
        if(that.data.checked){
          Checked={
            phone:that.data.phone,
            password:that.data.password,
            checked:that.data.checked
          }
        }
        let ExpreTime = new Date().getTime() //获取当前时间戳
        wx.setStorageSync('AccountInfo',Checked)
        wx.setStorageSync('AccessToken', {
          Token:Token,
          ExpreTime:ExpreTime,
          isNeedToken:isNeedToken
          isNeedToken:isNeedToken,
        })
        var return_user = return_data.User;
@@ -352,7 +367,16 @@
    var screenHight = screenSize.height;
    var screenWidthScale = screenSize.width / 750;
    var screenHightScale = screenSize.height / 1334;
   if(wx.getStorageSync('AccountInfo')&&wx.getStorageSync('AccountInfo').checked)
   {
     let getPhone=wx.getStorageSync('AccountInfo').phone
     let getPassword=wx.getStorageSync('AccountInfo').password
     that.setData({
      phone:getPhone,
      password:getPassword,
      checked: wx.getStorageSync('AccountInfo').checked
     })
   }
    that.setData({
      imageWidth: screenWidth,
      imageHeight: screenHightScale * 520 + 10,
@@ -360,7 +384,7 @@
      inputViewWidth: screenWidth,
      inputViewHeight: screenHightScale * 88,
      inputWidth: screenWidth,
      inputHeight: screenHightScale * 177
      inputHeight: screenHightScale * 177,
    });
  },
login/login/index.wxml
@@ -23,6 +23,12 @@
      <icon wx:if="{{!isShowPwd}}" class="cuIcon-attention" bindtap="changePwdView" style="font-size: 30rpx;line-height: 2;"></icon>
      <icon wx:else class="cuIcon-attentionforbid" bindtap="changePwdView" style="font-size: 30rpx;line-height: 2;"></icon>
    </view>
    <view class="psdBox">
      <checkbox-group bindchange="rememberPwd">
      <checkbox value="1" checked="{{checked}}" />
      <label for="check">记住密码</label>
    </checkbox-group>
    </view>
  </view>
  <view class="loginBtnView">
    <button class="loginBtnReal" type="primary" bindtap="tapBindUserReal" style="background-color: #39b5de;">登录</button>
login/login/index.wxss
@@ -150,4 +150,23 @@
  bottom: 0rpx;
  margin-top: 10px;
  margin-bottom: 20px;
}
.psdBox {
    margin: 14rpx 20rpx 28rpx 20rpx
}
checkbox .wx-checkbox-input {
    width: 28rpx;
    height: 28rpx;
}
checkbox .wx-checkbox-input {
    border-color: #409eff;
    background-color: transparent;
    transition: background-color .3s;
}
checkbox .wx-checkbox-input.wx-checkbox-input-checked {
    color: #fff;
    background-color: #409eff;
}
radio::before, checkbox::before {
  right: 0px;
}