|
|
|
@ -8,12 +8,18 @@ |
|
|
|
:placeholder="i18n.login.placePhone" /> |
|
|
|
</view> |
|
|
|
<view class="section row"> |
|
|
|
<view class="sectiontitle">旧密码</view> |
|
|
|
<input class="phoneinput" :password="true" |
|
|
|
placeholder-style="color:#C9C9C9;font-size:16px;" v-model="oldpsd" |
|
|
|
placeholder="请输入旧密码" /> |
|
|
|
</view> |
|
|
|
<!-- <view class="section row"> |
|
|
|
<view class="sectiontitle">{{i18n.bind.yanzhengma}}</view> |
|
|
|
<input :focus="codeFocus" :maxlength="6" type="number" placeholder-style="color:#C9C9C9;font-size:16px;" |
|
|
|
v-model="code" :placeholder="i18n.login.placeCode" class="codeinput" /> |
|
|
|
<view class="getcode" :style="canshowcode == true? 'color: rgba(255,77,41,1);': 'color: #C9C9C9;'" |
|
|
|
@click="getSmsCode">{{codetimes}}</view> |
|
|
|
</view> |
|
|
|
</view> --> |
|
|
|
<view class="section row"> |
|
|
|
<view class="sectiontitle">{{i18n.login.loginPWD}}</view> |
|
|
|
<input class="phoneinput" @input="password_input" :password="true" |
|
|
|
@ -39,6 +45,7 @@ |
|
|
|
return { |
|
|
|
password: '', |
|
|
|
password2: '', |
|
|
|
oldpsd:'', |
|
|
|
phone: '', |
|
|
|
code: '', |
|
|
|
type: 0, |
|
|
|
@ -130,6 +137,8 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
submit() { |
|
|
|
let userInfo = JSON.parse(uni.getStorageSync('area')); |
|
|
|
|
|
|
|
if (this.password != this.password2) { |
|
|
|
uni.showToast({ |
|
|
|
title: this.i18n.bind.liangcimimabuyizhi, |
|
|
|
@ -139,95 +148,23 @@ |
|
|
|
} |
|
|
|
var dic = {} |
|
|
|
dic.mobile = this.phone |
|
|
|
dic.code = this.code |
|
|
|
dic.pass = this.password |
|
|
|
|
|
|
|
// #ifdef MP-WEIXIN |
|
|
|
dic.env = 'weixin' |
|
|
|
// #endif |
|
|
|
var url = '' |
|
|
|
if (this.type == 1) { |
|
|
|
url = 'Login.Reg' |
|
|
|
|
|
|
|
} else { |
|
|
|
url = 'Rider.Login.Forget' |
|
|
|
} |
|
|
|
|
|
|
|
this.NB.sendRequest(url, dic, true).then(data => { |
|
|
|
|
|
|
|
this.saveLocal(data.info[0]) |
|
|
|
}).catch(data => { |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
// #ifdef MP-WEIXIN |
|
|
|
var that = this |
|
|
|
uni.login({ |
|
|
|
success: res => { |
|
|
|
uni.hideLoading(); |
|
|
|
uni.request({ |
|
|
|
url: getApp().globalData.site_url + "App.Login.getUnionid", |
|
|
|
method: 'GET', |
|
|
|
data: { |
|
|
|
'code': res.code |
|
|
|
}, |
|
|
|
success: function(res2) { |
|
|
|
var openid = res2.data.data.openid; |
|
|
|
getApp().globalData.openid = openid; |
|
|
|
that.NB.sendRequest('Login.Reg', dic, true).then(data => { |
|
|
|
setTimeout(() => { |
|
|
|
uni.navigateBack({ |
|
|
|
delta: 1 |
|
|
|
}); |
|
|
|
}, 1000) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
// #endif |
|
|
|
}, |
|
|
|
saveLocal(info) { |
|
|
|
getApp().globalData.userinfo = info |
|
|
|
uni.setStorage({ |
|
|
|
key: 'userinfo', |
|
|
|
data: info, |
|
|
|
success: function() { |
|
|
|
setTimeout(() => { |
|
|
|
uni.reLaunch({ |
|
|
|
url: '../index/index' |
|
|
|
}) |
|
|
|
}, 1000) |
|
|
|
} |
|
|
|
}); |
|
|
|
var uiddd = info.im.userId; |
|
|
|
const userSig = info.im.UserSig; |
|
|
|
uni.$TUIKit.login({ |
|
|
|
userID: uiddd, |
|
|
|
userSig: userSig |
|
|
|
}) |
|
|
|
.then(function(imResponse) { |
|
|
|
|
|
|
|
if (imResponse.data.repeatLogin === true) { |
|
|
|
// 标识帐号已登录,本次登录操作为重复登录。v2.5.1 起支持 |
|
|
|
|
|
|
|
} |
|
|
|
dic.username = userInfo.shop.contactPhone |
|
|
|
dic.password = this.oldpsd |
|
|
|
dic.newPass = this.password |
|
|
|
dic.userId = userInfo.user.id |
|
|
|
this.NB.sendRequest("/user/modifyPassAndMobile", dic, false, 'post','application/x-www-form-urlencoded').then(data => { |
|
|
|
uni.clearStorageSync(); |
|
|
|
uni.showToast({ |
|
|
|
title:'修改成功', |
|
|
|
duration:1000 |
|
|
|
}) |
|
|
|
.catch(function(imError) { |
|
|
|
console.warn('login error:', imError); // 登录失败的相关信息 |
|
|
|
uni.reLaunch({ |
|
|
|
url: '/pages/login/login' |
|
|
|
}); |
|
|
|
// 修改个人标配资料 |
|
|
|
let promise = uni.$TUIKit.updateMyProfile({ |
|
|
|
avatar: info.avatar, |
|
|
|
nick: info.user_nickname |
|
|
|
}); |
|
|
|
promise.then(function(imResponse) { |
|
|
|
|
|
|
|
}).catch(function(imError) { |
|
|
|
console.warn('updateMyProfile error:', imError); // 更新资料失败的相关信息 |
|
|
|
}); |
|
|
|
}, |
|
|
|
}).catch(data => { |
|
|
|
console.log(data) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|