|
@@ -79,7 +79,7 @@
|
|
<script>
|
|
<script>
|
|
import { mapState,mapMutations } from 'vuex'
|
|
import { mapState,mapMutations } from 'vuex'
|
|
import authorize from '@/common/config/authorize.js'
|
|
import authorize from '@/common/config/authorize.js'
|
|
- import wxLogin from "@/common/config/wxLogin.js"
|
|
|
|
|
|
+ import wxLogin from '@/common/config/wxLogin.js'
|
|
export default{
|
|
export default{
|
|
data() {
|
|
data() {
|
|
return{
|
|
return{
|
|
@@ -102,22 +102,22 @@
|
|
},
|
|
},
|
|
onLoad(option) {
|
|
onLoad(option) {
|
|
console.log(option)
|
|
console.log(option)
|
|
- uni.setStorageSync('bind_id', option.userID);
|
|
|
|
|
|
+ uni.setStorageSync('bind_id', option.userId)
|
|
this.getVerificationCode()
|
|
this.getVerificationCode()
|
|
this.getWxAuthorize()
|
|
this.getWxAuthorize()
|
|
},
|
|
},
|
|
methods:{
|
|
methods:{
|
|
...mapMutations(['login','logout','wxLogin']),
|
|
...mapMutations(['login','logout','wxLogin']),
|
|
async getWxAuthorize(){
|
|
async getWxAuthorize(){
|
|
- const wechatCode = await authorize.getCode('weixin');// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
|
|
|
|
- const getUserInfo = await authorize.getUserInfo('weixin');
|
|
|
|
|
|
+ const wechatCode = await authorize.getCode('weixin')// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
|
|
|
|
+ const getUserInfo = await authorize.getUserInfo('weixin')
|
|
this.UserService.UserLoginAuthApplets({
|
|
this.UserService.UserLoginAuthApplets({
|
|
code:wechatCode,
|
|
code:wechatCode,
|
|
encryptedData:getUserInfo.encryptedData,
|
|
encryptedData:getUserInfo.encryptedData,
|
|
iv:getUserInfo.iv ,
|
|
iv:getUserInfo.iv ,
|
|
})
|
|
})
|
|
.then(response =>{
|
|
.then(response =>{
|
|
- this.login(response.data);
|
|
|
|
|
|
+ this.login(response.data)
|
|
this.$store.commit('updateStatus',response.data)
|
|
this.$store.commit('updateStatus',response.data)
|
|
uni.setStorageSync('token',response.data.token)
|
|
uni.setStorageSync('token',response.data.token)
|
|
uni.setStorageSync('unionId',response.data.unionId)
|
|
uni.setStorageSync('unionId',response.data.unionId)
|
|
@@ -171,15 +171,15 @@
|
|
},
|
|
},
|
|
getMobileCodeFn(){//获取手机验证码
|
|
getMobileCodeFn(){//获取手机验证码
|
|
if( this.bindMobile == ''){
|
|
if( this.bindMobile == ''){
|
|
- this.$util.msg('请输入手机号',2000);
|
|
|
|
|
|
+ this.$util.msg('请输入手机号',2000)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
if(!this.$reg.isMobile(this.bindMobile)){
|
|
if(!this.$reg.isMobile(this.bindMobile)){
|
|
- this.$util.msg('请输入正确的手机号',2000);
|
|
|
|
|
|
+ this.$util.msg('请输入正确的手机号',2000)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
if( this.imageCode == ''){
|
|
if( this.imageCode == ''){
|
|
- this.$util.msg('请输入图形验证码',2000);
|
|
|
|
|
|
+ this.$util.msg('请输入图形验证码',2000)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
let params = {
|
|
let params = {
|
|
@@ -190,20 +190,20 @@
|
|
imgCode:this.imageCode,
|
|
imgCode:this.imageCode,
|
|
token:this.imageCodetoken,
|
|
token:this.imageCodetoken,
|
|
}
|
|
}
|
|
- this.isMobileDisabled = true;
|
|
|
|
|
|
+ this.isMobileDisabled = true
|
|
this.PublicService.GetBindMobileCode(params)
|
|
this.PublicService.GetBindMobileCode(params)
|
|
.then(res =>{
|
|
.then(res =>{
|
|
- const TIME_COUNT = 60;
|
|
|
|
|
|
+ const TIME_COUNT = 60
|
|
this.$util.msg('验证短信已发送',2000)
|
|
this.$util.msg('验证短信已发送',2000)
|
|
if (!this.codeTime) {
|
|
if (!this.codeTime) {
|
|
- this.count = TIME_COUNT;
|
|
|
|
- this.isMobileDisabled = true;
|
|
|
|
|
|
+ this.count = TIME_COUNT
|
|
|
|
+ this.isMobileDisabled = true
|
|
this.codeTime = setInterval(() => {
|
|
this.codeTime = setInterval(() => {
|
|
if (this.count > 1 && this.count <= TIME_COUNT) {
|
|
if (this.count > 1 && this.count <= TIME_COUNT) {
|
|
this.count--
|
|
this.count--
|
|
this.mobileCodeText = this.count +'s重新发送'
|
|
this.mobileCodeText = this.count +'s重新发送'
|
|
} else {
|
|
} else {
|
|
- this.isMobileDisabled = false;
|
|
|
|
|
|
+ this.isMobileDisabled = false
|
|
clearInterval(this.codeTime)
|
|
clearInterval(this.codeTime)
|
|
this.codeTime = null
|
|
this.codeTime = null
|
|
this.mobileCodeText = '获取验证码'
|
|
this.mobileCodeText = '获取验证码'
|
|
@@ -213,7 +213,7 @@
|
|
})
|
|
})
|
|
.catch( error =>{
|
|
.catch( error =>{
|
|
this.$util.msg(error.msg,2000)
|
|
this.$util.msg(error.msg,2000)
|
|
- this.isMobileDisabled = false;
|
|
|
|
|
|
+ this.isMobileDisabled = false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
GetUserProfile(){//获取用户微信个人信息
|
|
GetUserProfile(){//获取用户微信个人信息
|