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': case 'tj':
url = '/pages/shop/dataStatistics' url = '/pages/shop/dataStatistics'
break; break;
case 'dy':
url = '/pages/myCenter/setPrint'
break;
case 'db': case 'db':
url = '/pages/shop/shopOrderList?index=' + index url = '/pages/shop/shopOrderList?index=' + index
break; break;

4
pages/login/login.vue

@ -36,9 +36,9 @@
</view> </view>
</block> </block>
<view class="small-btn"> <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"> <!-- <navigator v-if="loginType == false" class="forget-pass" url="/pages/login/regist?type=3">
{{i18n.login.forgetPass}} {{i18n.login.forgetPass}}
</navigator> --> </navigator> -->

113
pages/login/regist.vue

@ -8,12 +8,18 @@
:placeholder="i18n.login.placePhone" /> :placeholder="i18n.login.placePhone" />
</view> </view>
<view class="section row"> <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> <view class="sectiontitle">{{i18n.bind.yanzhengma}}</view>
<input :focus="codeFocus" :maxlength="6" type="number" placeholder-style="color:#C9C9C9;font-size:16px;" <input :focus="codeFocus" :maxlength="6" type="number" placeholder-style="color:#C9C9C9;font-size:16px;"
v-model="code" :placeholder="i18n.login.placeCode" class="codeinput" /> v-model="code" :placeholder="i18n.login.placeCode" class="codeinput" />
<view class="getcode" :style="canshowcode == true? 'color: rgba(255,77,41,1);': 'color: #C9C9C9;'" <view class="getcode" :style="canshowcode == true? 'color: rgba(255,77,41,1);': 'color: #C9C9C9;'"
@click="getSmsCode">{{codetimes}}</view> @click="getSmsCode">{{codetimes}}</view>
</view> </view> -->
<view class="section row"> <view class="section row">
<view class="sectiontitle">{{i18n.login.loginPWD}}</view> <view class="sectiontitle">{{i18n.login.loginPWD}}</view>
<input class="phoneinput" @input="password_input" :password="true" <input class="phoneinput" @input="password_input" :password="true"
@ -39,6 +45,7 @@
return { return {
password: '', password: '',
password2: '', password2: '',
oldpsd:'',
phone: '', phone: '',
code: '', code: '',
type: 0, type: 0,
@ -130,6 +137,8 @@
}) })
}, },
submit() { submit() {
let userInfo = JSON.parse(uni.getStorageSync('area'));
if (this.password != this.password2) { if (this.password != this.password2) {
uni.showToast({ uni.showToast({
title: this.i18n.bind.liangcimimabuyizhi, title: this.i18n.bind.liangcimimabuyizhi,
@ -139,95 +148,23 @@
} }
var dic = {} var dic = {}
dic.mobile = this.phone dic.mobile = this.phone
dic.code = this.code dic.username = userInfo.shop.contactPhone
dic.pass = this.password dic.password = this.oldpsd
dic.newPass = this.password
// #ifdef MP-WEIXIN dic.userId = userInfo.user.id
dic.env = 'weixin' this.NB.sendRequest("/user/modifyPassAndMobile", dic, false, 'post','application/x-www-form-urlencoded').then(data => {
// #endif uni.clearStorageSync();
var url = '' uni.showToast({
if (this.type == 1) { title:'修改成功',
url = 'Login.Reg' duration:1000
} 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
}
}) })
.catch(function(imError) { uni.reLaunch({
console.warn('login error:', imError); // url: '/pages/login/login'
}); });
// }).catch(data => {
let promise = uni.$TUIKit.updateMyProfile({ console.log(data)
avatar: info.avatar, })
nick: info.user_nickname }
});
promise.then(function(imResponse) {
}).catch(function(imError) {
console.warn('updateMyProfile error:', imError); //
});
},
} }
} }
</script> </script>

Loading…
Cancel
Save