You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
4.6 KiB
JavaScript
170 lines
4.6 KiB
JavaScript
//index.js
|
|
//获取应用实例
|
|
var app = getApp()
|
|
Page({
|
|
data: {
|
|
userOldPwd: '',
|
|
userNewPwd1: '',
|
|
userNewPwd2: ''
|
|
},
|
|
//用户名和密码输入框事件
|
|
userOldPwdInput:function(e){
|
|
this.setData({
|
|
userOldPwd:e.detail.value
|
|
})
|
|
},
|
|
userNewPwd1Input:function(e){
|
|
this.setData({
|
|
userNewPwd1:e.detail.value
|
|
})
|
|
},
|
|
userNewPwd2Input:function(e){
|
|
this.setData({
|
|
userNewPwd2:e.detail.value
|
|
})
|
|
},
|
|
|
|
ConfirmClick:function(){
|
|
if(this.data.userOldPwd.length == 0 || this.data.userNewPwd1.length == 0){
|
|
this.setData({
|
|
infoMess:'温馨提示:新旧密码都不能为空!',
|
|
})
|
|
}if(this.data.userNewPwd1.length != this.data.userNewPwd2.length ){
|
|
this.setData({
|
|
infoMess:'温馨提示:新密码两次录入必须内容一致',
|
|
})
|
|
}else{
|
|
//console.log(this.data.userName+':'+this.data.userPwd)
|
|
this.setData({
|
|
infoMess:'保存中......',
|
|
})
|
|
let that=this;
|
|
let url = getApp().globalData.serverUrl + '/FHDriverInterface';
|
|
//let url="http://112.226.192.143:10200/CommMng/BasicDataRef/GetUserRefList";
|
|
//let url="http://112.226.192.143:10200/Dispatch/WxApp/FirstLogin";
|
|
|
|
var openid=getApp().globalData.baseInfo.OPENID;
|
|
var userOldPwd=this.data.userOldPwd;
|
|
var userNewPwd1=this.data.userNewPwd1;
|
|
var userNewPwd2=this.data.userNewPwd2;
|
|
wx.login({
|
|
success(res) {
|
|
if (res.code) {
|
|
|
|
// var param={
|
|
// openid:openid,
|
|
// formname:'修改密码',
|
|
// userOldPwd:userOldPwd,
|
|
// userNewPwd1:userNewPwd1,
|
|
// userNewPwd2:userNewPwd2
|
|
// };
|
|
var jsonstr=JSON.stringify(
|
|
{
|
|
openid:openid,
|
|
formname:'修改密码',
|
|
userOldPwd:userOldPwd,
|
|
userNewPwd1:userNewPwd1,
|
|
userNewPwd2:userNewPwd2
|
|
}
|
|
);
|
|
|
|
wx.request({
|
|
header: {'content-type': 'application/x-www-form-urlencoded'},
|
|
url: url,
|
|
method: 'POST',
|
|
data: {
|
|
jsonstr
|
|
},
|
|
success: function(r) {
|
|
console.log(r)
|
|
if (r.data.Success==true) {
|
|
|
|
wx.reLaunch({
|
|
url: '/pages/ds/ds'
|
|
})
|
|
|
|
}else{
|
|
that.setData({
|
|
infoMess:(r.data.Message)
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
}
|
|
},
|
|
authLogin(e) {
|
|
var that = this
|
|
wx.login({
|
|
success(res) {
|
|
if (res.code) {
|
|
let url = getApp().globalData.serverUrl + '/GetDriverInfo';
|
|
url = url+'?code='+res.code;
|
|
wx.request({
|
|
url: getApp().globalData.serverUrl + '/GetDriverInfo',
|
|
method: 'POST',
|
|
data: {
|
|
scene: that.data.scene,
|
|
code: res.code
|
|
},
|
|
success: function(r) {
|
|
console.log(r)
|
|
if (r.data == 'ok') {
|
|
wx.reLaunch({
|
|
url: '/pages/index/index'
|
|
})
|
|
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
},
|
|
onLoad: function () {
|
|
console.log('onLoad')
|
|
var that = this
|
|
wx.login({
|
|
success(res) {
|
|
if (res.code) {
|
|
console.log('code:' + res.code)
|
|
//发起网络请求
|
|
wx.request({
|
|
url: getApp().globalData.serverUrl + '/GetDriverInfo?code=' + res.code,
|
|
success: function (res) {
|
|
wx.hideLoading()
|
|
if (res.data.ErrorCode == 0) {
|
|
console.log(res.data)
|
|
var baseInfo = res.data.BaseInfo
|
|
//var detailInfo = res.data.DetailInfo
|
|
getApp().globalData.baseInfo = baseInfo
|
|
//getApp().globalData.detailInfo = detailInfo
|
|
that.setData({
|
|
baseInfo: baseInfo
|
|
})
|
|
|
|
//that.checkBind();
|
|
} else if (res.data.ErrorCode == -1) {
|
|
// wx.reLaunch({
|
|
// url: '/pages/register/register'
|
|
// })
|
|
that.setData({
|
|
hasNoUsedr: true
|
|
})
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
this.setData({
|
|
infoMess:'登录失败!请检查账号和密码是否准确',
|
|
})
|
|
console.log('登录失败!' + res.errMsg)
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}) |