|
@@ -19,7 +19,7 @@
|
|
</u-form-item>
|
|
</u-form-item>
|
|
</u-form>
|
|
</u-form>
|
|
</view>
|
|
</view>
|
|
- <button class="loginBtn" :class="{able:canLogin()}" @click="login" v-if="current==0">
|
|
|
|
|
|
+ <button class="loginBtn" :class="{able:canLogin()}" @click="pwlogin" v-if="current==0">
|
|
登录
|
|
登录
|
|
</button>
|
|
</button>
|
|
<button :disabled="isUse" :class="{able:canLogin()}" class="loginBtn" @click="sms_login" v-if="current==1">
|
|
<button :disabled="isUse" :class="{able:canLogin()}" class="loginBtn" @click="sms_login" v-if="current==1">
|
|
@@ -27,7 +27,7 @@
|
|
</button>
|
|
</button>
|
|
<view style="width: 100%;margin: 40rpx auto;">
|
|
<view style="width: 100%;margin: 40rpx auto;">
|
|
<view style="display: flex;align-items: center;color: #007AFF;font-size: 24rpx;justify-content:center;">
|
|
<view style="display: flex;align-items: center;color: #007AFF;font-size: 24rpx;justify-content:center;">
|
|
- <navigator hover-class="none" url="/pages2/register/register" style="margin: 0 40rpx;">立即注册</navigator>
|
|
|
|
|
|
+ <navigator hover-class="none" :url="'/pages2/register/register?scanCode=' + scanCode" style="margin: 0 40rpx;">立即注册</navigator>
|
|
<view style="width: 3rpx;height: 20rpx;background-color: #007AFF;"></view>
|
|
<view style="width: 3rpx;height: 20rpx;background-color: #007AFF;"></view>
|
|
<navigator hover-class="none" url="/pages2/register/forget" style="margin: 0 40rpx;">忘记密码</navigator>
|
|
<navigator hover-class="none" url="/pages2/register/forget" style="margin: 0 40rpx;">忘记密码</navigator>
|
|
</view>
|
|
</view>
|
|
@@ -115,14 +115,18 @@ export default {
|
|
current: 0,
|
|
current: 0,
|
|
codeTips: '',
|
|
codeTips: '',
|
|
isUse:false,
|
|
isUse:false,
|
|
|
|
+ scanCode: '', // pc端扫码登录获取的标志码
|
|
isBack:false
|
|
isBack:false
|
|
};
|
|
};
|
|
},
|
|
},
|
|
onLoad(option) {
|
|
onLoad(option) {
|
|
|
|
+ console.log('dsfs-----:', option)
|
|
this.$refs.uForm1.setRules(this.rules)
|
|
this.$refs.uForm1.setRules(this.rules)
|
|
this.$refs.uForm2.setRules(this.rules)
|
|
this.$refs.uForm2.setRules(this.rules)
|
|
if(option.isBack){
|
|
if(option.isBack){
|
|
this.isBack = option.isBack;
|
|
this.isBack = option.isBack;
|
|
|
|
+ } else if (option.scanCode) {
|
|
|
|
+ this.scanCode = option.scanCode
|
|
}
|
|
}
|
|
let that = this;
|
|
let that = this;
|
|
// this.from = option.from;
|
|
// this.from = option.from;
|
|
@@ -144,47 +148,56 @@ export default {
|
|
encryptedData: e.detail.encryptedData,
|
|
encryptedData: e.detail.encryptedData,
|
|
iv: e.detail.iv
|
|
iv: e.detail.iv
|
|
}).then(res => {
|
|
}).then(res => {
|
|
- if(res.data.data.full_info){
|
|
|
|
- //信息完善,直接进入页面
|
|
|
|
- uni.setStorageSync('user_account', res.data.data.user_account);
|
|
|
|
- uni.setStorageSync('token', res.data.data.token);
|
|
|
|
- this.$api.getInfo().then(resdata => {
|
|
|
|
- if(resdata.data.code == 200){
|
|
|
|
- this.$store.state.userInfo = resdata.data.data;
|
|
|
|
|
|
+ this.loginCallback(res, 'wxlogin')
|
|
|
|
+ // if(res.data.data.full_info){
|
|
|
|
+ // //信息完善,直接进入页面
|
|
|
|
+ // uni.setStorageSync('user_account', res.data.data.user_account);
|
|
|
|
+ // uni.setStorageSync('token', res.data.data.token);
|
|
|
|
+ // // /app/user/getInfo 登录用户信息
|
|
|
|
+ // this.$api.getInfo().then(resdata => {
|
|
|
|
+ // if(resdata.data.code == 200){
|
|
|
|
+ // this.$store.state.userInfo = resdata.data.data;
|
|
|
|
|
|
- if(!this.isBack){
|
|
|
|
- let goPath = uni.getStorageSync('goPath')
|
|
|
|
|
|
+ // if (this.scanCode) { // pc扫码进来登录成功
|
|
|
|
+ // this.submitCode()
|
|
|
|
+ // } else if(!this.isBack){
|
|
|
|
+ // let goPath = uni.getStorageSync('goPath')
|
|
|
|
|
|
- if(goPath == 'course') {
|
|
|
|
- uni.redirectTo({
|
|
|
|
- url:'/pages2/wd/class'
|
|
|
|
- })
|
|
|
|
- this.$method.setUuid(new Date().valueOf() + "")
|
|
|
|
- } else if(goPath == 'bank') {
|
|
|
|
- uni.redirectTo({
|
|
|
|
- url:'/pages2/wd/question_bank'
|
|
|
|
- })
|
|
|
|
- this.$method.setUuid(new Date().valueOf() + "")
|
|
|
|
- } else {
|
|
|
|
- uni.reLaunch({
|
|
|
|
- url:'/pages/index/index'
|
|
|
|
- })
|
|
|
|
|
|
+ // if(goPath == 'course') {
|
|
|
|
+ // uni.redirectTo({
|
|
|
|
+ // url:'/pages2/wd/class'
|
|
|
|
+ // })
|
|
|
|
+ // this.$method.setUuid(new Date().valueOf() + "")
|
|
|
|
+ // } else if(goPath == 'bank') {
|
|
|
|
+ // uni.redirectTo({
|
|
|
|
+ // url:'/pages2/wd/question_bank'
|
|
|
|
+ // })
|
|
|
|
+ // this.$method.setUuid(new Date().valueOf() + "")
|
|
|
|
+ // } else {
|
|
|
|
+ // uni.reLaunch({
|
|
|
|
+ // url:'/pages/index/index'
|
|
|
|
+ // })
|
|
|
|
|
|
- this.$method.setUuid(new Date().valueOf() + "")
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- uni.navigateBack();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // this.$method.setUuid(new Date().valueOf() + "")
|
|
|
|
+ // }
|
|
|
|
+ // }else{
|
|
|
|
+ // uni.navigateBack();
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
|
|
- });
|
|
|
|
|
|
+ // });
|
|
|
|
|
|
- }else{
|
|
|
|
- //未完善信息,存为临时信息
|
|
|
|
- uni.setStorageSync('user_account_temp', res.data.data.user_account);
|
|
|
|
- uni.setStorageSync('token_temp', res.data.data.token);
|
|
|
|
- this.$navTo.togo('/pages2/register/bind');
|
|
|
|
- }
|
|
|
|
|
|
+ // }else{
|
|
|
|
+ // //未完善信息,存为临时信息
|
|
|
|
+ // uni.setStorageSync('user_account_temp', res.data.data.user_account);
|
|
|
|
+ // uni.setStorageSync('token_temp', res.data.data.token);
|
|
|
|
+ // if (this.scanCode) {
|
|
|
|
+ // this.$navTo.togo('/pages2/register/bind', this.scanCode)
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$navTo.togo('/pages2/register/bind');
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // }
|
|
|
|
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -222,43 +235,50 @@ export default {
|
|
res => {
|
|
res => {
|
|
that.isUse = false
|
|
that.isUse = false
|
|
if (res.data.code == 200) {
|
|
if (res.data.code == 200) {
|
|
- if(res.data.data.full_info){
|
|
|
|
- //信息完善,直接进入页面
|
|
|
|
- uni.setStorageSync('user_account', res.data.data.user_account);
|
|
|
|
- uni.setStorageSync('token', res.data.data.token);
|
|
|
|
- that.$api.getInfo().then(resdata => {
|
|
|
|
- if(resdata.data.code == 200){
|
|
|
|
- that.$store.state.userInfo = resdata.data.data;
|
|
|
|
|
|
+ this.loginCallback(res, 'smslogin')
|
|
|
|
+ // if(res.data.data.full_info){
|
|
|
|
+ // //信息完善,直接进入页面
|
|
|
|
+ // uni.setStorageSync('user_account', res.data.data.user_account);
|
|
|
|
+ // uni.setStorageSync('token', res.data.data.token);
|
|
|
|
+ // that.$api.getInfo().then(resdata => {
|
|
|
|
+ // if(resdata.data.code == 200){
|
|
|
|
+ // that.$store.state.userInfo = resdata.data.data;
|
|
|
|
|
|
- if(!that.isBack){
|
|
|
|
- let goPath = uni.getStorageSync('goPath')
|
|
|
|
|
|
+ // if (this.scanCode) { // pc扫码进来登录成功
|
|
|
|
+ // this.submitCode()
|
|
|
|
+ // } else if(!that.isBack){
|
|
|
|
+ // let goPath = uni.getStorageSync('goPath')
|
|
|
|
|
|
- if(goPath == 'course') {
|
|
|
|
- uni.redirectTo({
|
|
|
|
- url:'/pages2/wd/class'
|
|
|
|
- })
|
|
|
|
- } else if(goPath == 'bank') {
|
|
|
|
- uni.redirectTo({
|
|
|
|
- url:'/pages2/wd/question_bank'
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- uni.reLaunch({
|
|
|
|
- url:'/pages/index/index'
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- uni.navigateBack();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // if(goPath == 'course') {
|
|
|
|
+ // uni.redirectTo({
|
|
|
|
+ // url:'/pages2/wd/class'
|
|
|
|
+ // })
|
|
|
|
+ // } else if(goPath == 'bank') {
|
|
|
|
+ // uni.redirectTo({
|
|
|
|
+ // url:'/pages2/wd/question_bank'
|
|
|
|
+ // })
|
|
|
|
+ // } else {
|
|
|
|
+ // uni.reLaunch({
|
|
|
|
+ // url:'/pages/index/index'
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // }else{
|
|
|
|
+ // uni.navigateBack();
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
|
|
- });
|
|
|
|
|
|
+ // });
|
|
|
|
|
|
- }else{
|
|
|
|
- //未完善信息,存为临时信息
|
|
|
|
- uni.setStorageSync('user_account_temp', res.data.data.user_account);
|
|
|
|
- uni.setStorageSync('token_temp', res.data.data.token);
|
|
|
|
- that.$navTo.togo('/pages2/register/bind');
|
|
|
|
- }
|
|
|
|
|
|
+ // }else{
|
|
|
|
+ // //未完善信息,存为临时信息
|
|
|
|
+ // uni.setStorageSync('user_account_temp', res.data.data.user_account);
|
|
|
|
+ // uni.setStorageSync('token_temp', res.data.data.token);
|
|
|
|
+ // if (this.scanCode) {
|
|
|
|
+ // this.$navTo.togo('/pages2/register/bind', this.scanCode)
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$navTo.togo('/pages2/register/bind');
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
} else {
|
|
} else {
|
|
that.$u.toast(res.data.msg);
|
|
that.$u.toast(res.data.msg);
|
|
}
|
|
}
|
|
@@ -290,7 +310,7 @@ export default {
|
|
|
|
|
|
return encrypt.encrypt(data);
|
|
return encrypt.encrypt(data);
|
|
},
|
|
},
|
|
- login(){
|
|
|
|
|
|
+ pwlogin(){
|
|
let that = this
|
|
let that = this
|
|
if(!this.form.account){
|
|
if(!this.form.account){
|
|
this.$u.toast('请输入手机号码/身份证号');
|
|
this.$u.toast('请输入手机号码/身份证号');
|
|
@@ -306,33 +326,42 @@ export default {
|
|
that.isUse = true
|
|
that.isUse = true
|
|
let form = JSON.parse(JSON.stringify(this.form))
|
|
let form = JSON.parse(JSON.stringify(this.form))
|
|
form.pwd = this.encryptor(form.pwd)
|
|
form.pwd = this.encryptor(form.pwd)
|
|
|
|
+ // 账号登录用户 /app/common/account_login
|
|
that.$api.accountLogin(form).then(
|
|
that.$api.accountLogin(form).then(
|
|
res => {
|
|
res => {
|
|
that.isUse = false
|
|
that.isUse = false
|
|
if (res.data.code == 200) {
|
|
if (res.data.code == 200) {
|
|
- if(res.data.data.full_info){
|
|
|
|
- //信息完善,直接进入页面
|
|
|
|
- uni.setStorageSync('user_account', res.data.data.user_account);
|
|
|
|
- uni.setStorageSync('token', res.data.data.token);
|
|
|
|
- that.$api.getInfo().then(resdata => {
|
|
|
|
- if(resdata.data.code == 200){
|
|
|
|
- that.$store.state.userInfo = resdata.data.data;
|
|
|
|
- if(!that.isBack){
|
|
|
|
- uni.reLaunch({
|
|
|
|
- url:'/pages/index/index'
|
|
|
|
- })
|
|
|
|
- }else{
|
|
|
|
- uni.navigateBack();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ this.loginCallback(res, 'pwlogin')
|
|
|
|
+ // if(res.data.data.full_info){
|
|
|
|
+ // //信息完善,直接进入页面
|
|
|
|
+ // uni.setStorageSync('user_account', res.data.data.user_account);
|
|
|
|
+ // uni.setStorageSync('token', res.data.data.token);
|
|
|
|
+ // that.$api.getInfo().then(resdata => {
|
|
|
|
+ // if(resdata.data.code == 200){
|
|
|
|
+ // that.$store.state.userInfo = resdata.data.data;
|
|
|
|
+ // if (this.scanCode) { // pc扫码进来登录成功
|
|
|
|
+ // this.submitCode()
|
|
|
|
+ // } else if(!that.isBack){
|
|
|
|
+ // uni.reLaunch({
|
|
|
|
+ // url:'/pages/index/index'
|
|
|
|
+ // })
|
|
|
|
+ // }else{
|
|
|
|
+ // uni.navigateBack();
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
|
|
- });
|
|
|
|
- }else{
|
|
|
|
- //未完善信息,存为临时信息
|
|
|
|
- uni.setStorageSync('user_account_temp', res.data.data.user_account);
|
|
|
|
- uni.setStorageSync('token_temp', res.data.data.token);
|
|
|
|
- that.$navTo.togo('/pages2/register/bind');
|
|
|
|
- }
|
|
|
|
|
|
+ // });
|
|
|
|
+ // }else{
|
|
|
|
+ // //未完善信息,存为临时信息
|
|
|
|
+ // uni.setStorageSync('user_account_temp', res.data.data.user_account);
|
|
|
|
+ // uni.setStorageSync('token_temp', res.data.data.token);
|
|
|
|
+ // // that.$navTo.togo('/pages2/register/bind');
|
|
|
|
+ // if (this.scanCode) {
|
|
|
|
+ // this.$navTo.togo('/pages2/register/bind', this.scanCode)
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$navTo.togo('/pages2/register/bind');
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
} else {
|
|
} else {
|
|
that.$u.toast(res.data.msg);
|
|
that.$u.toast(res.data.msg);
|
|
}
|
|
}
|
|
@@ -432,6 +461,77 @@ export default {
|
|
}
|
|
}
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ // 微信、密码、验证码 登录成功的回调
|
|
|
|
+ loginCallback(res, types) {
|
|
|
|
+ console.log('登录后的回调',res)
|
|
|
|
+ if(res.data.data.full_info){
|
|
|
|
+ //信息完善,直接进入页面
|
|
|
|
+ uni.setStorageSync('user_account', res.data.data.user_account);
|
|
|
|
+ uni.setStorageSync('token', res.data.data.token);
|
|
|
|
+ // /app/user/getInfo 登录用户信息
|
|
|
|
+ this.$api.getInfo().then(resdata => {
|
|
|
|
+ if(resdata.data.code == 200){
|
|
|
|
+ this.$store.state.userInfo = resdata.data.data;
|
|
|
|
+
|
|
|
|
+ if (this.scanCode) { // pc扫码进来登录成功
|
|
|
|
+ this.submitCode()
|
|
|
|
+ } else if(!this.isBack){
|
|
|
|
+ let goPath = ''
|
|
|
|
+ if (types == 'wxlogin' || types == 'smslogin') { //密码登录不用判断电脑goPath, 直接到首页
|
|
|
|
+ goPath = uni.getStorageSync('goPath')
|
|
|
|
+ }
|
|
|
|
+ if(goPath == 'course') {
|
|
|
|
+ console.log('course')
|
|
|
|
+ uni.redirectTo({
|
|
|
|
+ url:'/pages2/wd/class'
|
|
|
|
+ })
|
|
|
|
+ types == 'wxlogin' && this.$method.setUuid(new Date().valueOf() + "")
|
|
|
|
+ } else if(goPath == 'bank') {
|
|
|
|
+ console.log('bank')
|
|
|
|
+ uni.redirectTo({
|
|
|
|
+ url:'/pages2/wd/question_bank'
|
|
|
|
+ })
|
|
|
|
+ types == 'wxlogin' && this.$method.setUuid(new Date().valueOf() + "")
|
|
|
|
+ } else {
|
|
|
|
+ console.log('密码登录不用判断电脑goPath, 直接到首页')
|
|
|
|
+ uni.reLaunch({
|
|
|
|
+ url:'/pages/index/index'
|
|
|
|
+ })
|
|
|
|
+ types == 'wxlogin' && this.$method.setUuid(new Date().valueOf() + "")
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+ console.log('直接返回')
|
|
|
|
+ uni.navigateBack();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ //未完善信息,存为临时信息
|
|
|
|
+ uni.setStorageSync('user_account_temp', res.data.data.user_account);
|
|
|
|
+ uni.setStorageSync('token_temp', res.data.data.token);
|
|
|
|
+ if (this.scanCode) {
|
|
|
|
+ this.$navTo.togo('/pages2/register/bind', this.scanCode)
|
|
|
|
+ } else {
|
|
|
|
+ this.$navTo.togo('/pages2/register/bind');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // scanLoginCheck小程序校验PC登录二维码,执行登录获取到令牌,然后把扫码的路径最后面的6位标识码提交给后台就行
|
|
|
|
+ submitCode() {
|
|
|
|
+ console.log('跳转请求提交code到接口', this.scanCode)
|
|
|
|
+ this.$api.scanLoginCheck({
|
|
|
|
+ scanCode: this.scanCode
|
|
|
|
+ }).then((res) => {
|
|
|
|
+ if (res.data.code == 200) {
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages4/login/pcLoginSuccess'
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|