|
|
@@ -10,14 +10,15 @@
|
|
|
<textarea v-model="loginInfo" maxlength="-1" style="height: 120upx;"></textarea>
|
|
|
</view>
|
|
|
<view class="logi-btn">
|
|
|
- <button class="u-button full" open-type="getPhoneNumber" @getphonenumber="toLogin" v-if="checkTrueState">手机号一键登录</button>
|
|
|
- <button class="u-button full" @click="toLoginCheck" v-else>手机号授权登录</button>
|
|
|
+ <button class="u-button full" @click="getUserInfo" v-if="checkTrueState">快捷一键登录</button>
|
|
|
+ <!-- <button class="u-button full" open-type="getPhoneNumber" @getphonenumber="toLogin" v-if="checkTrueState">手机号一键登录</button> -->
|
|
|
+ <button class="u-button full" @click="toLoginCheck" v-else>快捷登录</button>
|
|
|
<button class="u-button" @click="reback">返回</button>
|
|
|
</view>
|
|
|
<view class="login-footer">
|
|
|
<view :class="checkTrueState?'checkBox active':'checkBox'" @click="checkTrue"></view>
|
|
|
<view @click="checkTrue">我已阅读并同意</view>
|
|
|
- <text @click="$dialog.navTo('/pages/web/web?lk=service')">用户协议、</text><text @click="$dialog.navTo('/pages/web/web?lk=privacy')">隐私协议</text>
|
|
|
+ <text @click="toWeb('privacy')">用户协议、</text><text @click="toWeb('privacy')">隐私协议</text>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
@@ -58,22 +59,59 @@ export default {
|
|
|
},
|
|
|
checkTrue(){
|
|
|
app.checkTrueState = !app.checkTrueState;
|
|
|
+ },
|
|
|
+ toWeb(type){
|
|
|
+ uni.navigateTo({
|
|
|
+ url:"/pages/web/web?lk="+type
|
|
|
+ })
|
|
|
},
|
|
|
toLoginCheck(){
|
|
|
if (!app.checkTrueState) {
|
|
|
return app.$dialog.showSuccess("请先阅读并同意用户协议以及隐私政策");
|
|
|
}
|
|
|
+ },
|
|
|
+ getUserInfo(e){
|
|
|
+ uni.getUserProfile({
|
|
|
+ force: true,
|
|
|
+ success(resp) {
|
|
|
+ if (resp.errMsg == 'getUserProfile:ok') {
|
|
|
+ var detail = {};
|
|
|
+ detail.avatar = resp.userInfo.avatarUrl
|
|
|
+ detail.nickname = resp.userInfo.nickName
|
|
|
+ detail.login = app.loginCode
|
|
|
+ Api.nickname(detail).then((res)=>{
|
|
|
+ if (res.code == 0) {
|
|
|
+ return app.$dialog.showSuccess(res.msg);
|
|
|
+ }
|
|
|
+ uni.setStorageSync("user_token", res.data.access_token)
|
|
|
+ uni.navigateBack();
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail(e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
toLogin(e){
|
|
|
var detail = e.detail;
|
|
|
- detail.login = app.loginCode;
|
|
|
- Api.login(detail).then((res)=>{
|
|
|
- if (res.code == 0) {
|
|
|
- return app.$dialog.showSuccess(res.msg);
|
|
|
- }
|
|
|
- uni.setStorageSync("user_token", res.data.access_token)
|
|
|
- uni.navigateBack();
|
|
|
+ detail.login = app.loginCode;
|
|
|
+ uni.getUserProfile({
|
|
|
+ force: true,
|
|
|
+ success(resp) {
|
|
|
+ console.log("success",resp)
|
|
|
+ },
|
|
|
+ fail(e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
})
|
|
|
+ // Api.login(detail).then((res)=>{
|
|
|
+ // if (res.code == 0) {
|
|
|
+ // return app.$dialog.showSuccess(res.msg);
|
|
|
+ // }
|
|
|
+ // uni.setStorageSync("user_token", res.data.access_token)
|
|
|
+ // uni.navigateBack();
|
|
|
+ // })
|
|
|
},
|
|
|
}
|
|
|
}
|