|
@@ -25,7 +25,7 @@
|
|
|
<input
|
|
|
name="password"
|
|
|
type="password"
|
|
|
- v-model="loginParams.password || 'Ectrip2020'"
|
|
|
+ v-model="loginParams.password"
|
|
|
placeholder="请输入密码"
|
|
|
/>
|
|
|
</view>
|
|
@@ -78,7 +78,7 @@ export default {
|
|
|
codeSeconds: 0, // 验证码发送时间间隔
|
|
|
loginByPass: true,
|
|
|
smsCodeBtnDisabled: true,
|
|
|
- userInfo: null,
|
|
|
+ userInfo: null
|
|
|
};
|
|
|
},
|
|
|
|
|
@@ -103,8 +103,36 @@ export default {
|
|
|
this.userInfo = uni.getStorageSync('wechatUserInfo');
|
|
|
|
|
|
this.getCaptchaImage();
|
|
|
+ this.changeLogin();
|
|
|
},
|
|
|
- methods: {
|
|
|
+ methods: {
|
|
|
+ //获取用户信息
|
|
|
+ changeLogin(){
|
|
|
+ let that = this
|
|
|
+ // 授权
|
|
|
+ // 获取用户详细信息, 可以获取到说明已经授权过, 直接拿到用户信息
|
|
|
+ uni.getUserInfo({
|
|
|
+ provider: 'weixin',
|
|
|
+ //授权成功的回调
|
|
|
+ success(res) {
|
|
|
+ uni.showToast({
|
|
|
+ title:'授权成功',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ // that.wechatuserinfo = res.userInfo
|
|
|
+ console.log(res)
|
|
|
+ uni.setStorageSync('wechatUserInfo',res.userInfo )
|
|
|
+ },
|
|
|
+ //第一次进入小程序
|
|
|
+ fail() {
|
|
|
+ uni.showToast({
|
|
|
+ title: '请点击授权进行登录',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
loginTest(mobile, password) {
|
|
|
this.loginParams.mobile = mobile;
|
|
|
this.loginParams.password = password;
|
|
@@ -184,7 +212,7 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 提交表单
|
|
|
- async toLogin() {
|
|
|
+ async toLogin() {
|
|
|
let cheRes, loginApi;
|
|
|
if (this.loginByPass) {
|
|
|
loginApi = loginByPass;
|
|
@@ -214,7 +242,7 @@ export default {
|
|
|
},
|
|
|
// 登录
|
|
|
async handleLogin(params, loginApi) {
|
|
|
- this.btnLoading = true;
|
|
|
+ this.btnLoading = true;
|
|
|
await this.$http
|
|
|
.post(loginApi, params)
|
|
|
.then((r) => {
|
|
@@ -235,7 +263,7 @@ export default {
|
|
|
}
|
|
|
uni.removeStorageSync('backToPage');
|
|
|
uni.removeStorageSync('wechatUserInfo');
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
this.$mRouter.reLaunch({ route: '/pages/index/index' });
|
|
|
}
|
|
|
})
|