TM
2020-12-15 d3315d7eac567c749d56cf3b4f209d83512c47c0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
let $api = require('../../utils/ajaxFn.js')
let md5 = require('../../utils/md5.js')
let validator = require('../../utils/validator.js')
const app = getApp()
Page({
  data: {
    userStyle:{},
    newTwo:"",
    info:{
        newPwd: "",
        oldPwd: ""
    },
    userInfo:{}
  },
  onLoad() {
    this.setData({
      userStyle:app.userStyle,
      userInfo:app.userInfo
    })
  },
  getOld(e){
    this.setData({
      'info.oldPwd':e.detail.value
    })
  },
  getNem(e){
    this.setData({
      'info.newPwd':e.detail.value
    })
  },
  getNemTwo(e){
    this.setData({
      newTwo: e.detail.value
    })
  },
  save(){
    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: '两次新密码不一致,请确认',
        duration: 2000,
      });
      return
    }
    $api.ajax(
      '/sib/user/updatePwd',
      'POST',
      (res)=>{
 
      },
      (err)=>{
 
      },
      true,
      {
        newPwd: md5.hex_md5(this.data.userInfo.mblNo+this.data.info.newPwd),
        oldPwd: md5.hex_md5(this.data.userInfo.mblNo+this.data.info.oldPwd) 
      }
    )
  }
});