tianyi 3 weeks ago
parent
commit
14edfd5560
  1. 3
      pages/index/index.vue
  2. 4
      pages/login/login.vue
  3. 113
      pages/login/regist.vue

3
pages/index/index.vue

@ -351,6 +351,9 @@
case 'tj':
url = '/pages/shop/dataStatistics'
break;
case 'dy':
url = '/pages/myCenter/setPrint'
break;
case 'db':
url = '/pages/shop/shopOrderList?index=' + index
break;

4
pages/login/login.vue

@ -36,9 +36,9 @@
</view>
</block>
<view class="small-btn">
<view class="reg-btn" @click="loginType = !loginType">
<!-- <view class="reg-btn" @click="loginType = !loginType">
切换登录方式
</view>
</view> -->
<!-- <navigator v-if="loginType == false" class="forget-pass" url="/pages/login/regist?type=3">
{{i18n.login.forgetPass}}
</navigator> -->

113
pages/login/regist.vue

@ -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>

Loading…
Cancel
Save