| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 | 
							- // pages/password/index.js
 
- import http from '../../utils/http'
 
- import api from '../../utils/api'
 
- import util from '../../utils/util'
 
- const app = getApp()
 
- Page({
 
-   /**
 
-    * 页面的初始数据
 
-    */
 
-   data: {
 
-     old: '',
 
-     new: '',
 
-     new_confirm: ''
 
-   },
 
-   /**
 
-    * 生命周期函数--监听页面加载
 
-    */
 
-   onLoad: function (options) {
 
-   },
 
-   updateInput: function(e) {
 
-     app.updateInput(this, e)
 
-   },
 
-   save: function(e) {
 
-     if(!this.data.old) {
 
-       util.error('旧密码必填')
 
-       return false
 
-     }
 
-     if(!this.data.new) {
 
-       util.error('新密码必填')
 
-       return false
 
-     }
 
-     if(this.data.new.length < 6) {
 
-       util.error('密码至少6位')
 
-       return false
 
-     }
 
-     if(!util.checkPass(this.data.new)) {
 
-       util.error('密码必须同时包含数字和字母')
 
-       return false
 
-     }
 
-     if(this.data.new != this.data.new_confirm) {
 
-       util.error('两次输入的密码不一致')
 
-       return false
 
-     }
 
-     http({
 
-       url: 'users/changePassword',
 
-       data: this.data,
 
-       success: function(res) {
 
-         if(res.code == 0) {
 
-           util.success('更改成功')
 
-         } else {
 
-           util.error(res.msg)
 
-         }
 
-       }
 
-     })
 
-   },
 
-   /**
 
-    * 生命周期函数--监听页面初次渲染完成
 
-    */
 
-   onReady: function () {
 
-   },
 
-   /**
 
-    * 生命周期函数--监听页面显示
 
-    */
 
-   onShow: function () {
 
-   },
 
-   /**
 
-    * 生命周期函数--监听页面隐藏
 
-    */
 
-   onHide: function () {
 
-   },
 
-   /**
 
-    * 生命周期函数--监听页面卸载
 
-    */
 
-   onUnload: function () {
 
-   },
 
-   /**
 
-    * 页面相关事件处理函数--监听用户下拉动作
 
-    */
 
-   onPullDownRefresh: function () {
 
-   },
 
-   /**
 
-    * 页面上拉触底事件的处理函数
 
-    */
 
-   onReachBottom: function () {
 
-   },
 
-   /**
 
-    * 用户点击右上角分享
 
-    */
 
-   onShareAppMessage: function () {
 
-   }
 
- })
 
 
  |