TM
2020-12-15 d3315d7eac567c749d56cf3b4f209d83512c47c0
pages/changePassword/changePassword.js
@@ -1,5 +1,6 @@
let $api = require('../../utils/ajaxFn.js')
let md5 = require('../../utils/md5.js')
let validator = require('../../utils/validator.js')
const app = getApp()
Page({
  data: {
@@ -8,31 +9,46 @@
    info:{
       newPwd: "",
       oldPwd: ""
    }
    },
    userInfo:{}
  },
  onLoad() {
    this.setData({
      userStyle:app.userStyle
      userStyle:app.userStyle,
      userInfo:app.userInfo
    })
  },
  getOld(e){
    this.setData({
      'info.oldPwd':md5.hex_md5(e.detail.value)
      'info.oldPwd':e.detail.value
    })
  },
  getNem(e){
    this.setData({
      'info.newPwd':md5.hex_md5(e.detail.value)
      'info.newPwd':e.detail.value
    })
  },
  getNemTwo(e){
    console.log(3)
    this.setData({
      newTwo: md5.hex_md5(e.detail.value)
      newTwo: e.detail.value
    })
  },
  save(){
    console.log(this.data.newTwo,this.data.info)
    console.log(this.data.userInfo.mblNo,this.data.newTwo,this.data.info)
    if(validator.checkValEmpty(this.data.info.oldPwd)){
      my.showToast({
        content: '请输入原密码',
        duration: 2000,
      });
      return
    }
    if(validator.checkValEmpty(this.data.info.newPwd)){
      my.showToast({
        content: '请输入新密码',
        duration: 2000,
      });
      return
    }
    if(this.data.newTwo != this.data.info.newPwd){
      my.showToast({
        content: '两次新密码不一致,请确认',
@@ -51,7 +67,8 @@
      },
      true,
      {
        ...this.data.info
        newPwd: md5.hex_md5(this.data.userInfo.mblNo+this.data.info.newPwd),
        oldPwd: md5.hex_md5(this.data.userInfo.mblNo+this.data.info.oldPwd)
      }
    )
  }