gyh change
This commit is contained in:
@@ -43,11 +43,11 @@
|
||||
<u-mask :show="show" @click="show = false">
|
||||
<view class="warp">
|
||||
<view class="rect" @tap.stop>
|
||||
<view class="rect_view" @click="rect_qq()">
|
||||
<view class="rect_view" @click="loginOther(1)">
|
||||
<image src="../../static/pageA/qq.png" class="image"></image>
|
||||
<view>QQ登录</view>
|
||||
</view>
|
||||
<view class="rect_view">
|
||||
<view class="rect_view" @click="loginOther(2)">
|
||||
<image src="../../static/pageA/weixin.png" class="image"></image>
|
||||
<view>微信登录</view>
|
||||
</view>
|
||||
@@ -61,7 +61,9 @@
|
||||
</template>
|
||||
<script>
|
||||
import identifying from '@/components/logininput/identifying'
|
||||
import { mapMutations } from 'vuex';
|
||||
import {
|
||||
mapMutations
|
||||
} from 'vuex';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -83,29 +85,43 @@
|
||||
sms_code: '', //验证码
|
||||
// 协议渲染
|
||||
pact_text: [{
|
||||
"id": '1',
|
||||
"text": "《用户协议》"
|
||||
}, {
|
||||
"id": '2',
|
||||
"text": "《隐私协议》"
|
||||
}, {
|
||||
"id": '3',
|
||||
"text": "《使用协议》"
|
||||
},
|
||||
|
||||
]
|
||||
"id": '1',
|
||||
"text": "《用户协议》"
|
||||
}, {
|
||||
"id": '2',
|
||||
"text": "《隐私协议》"
|
||||
}, {
|
||||
"id": '3',
|
||||
"text": "《使用协议》"
|
||||
}, ],
|
||||
temp_url: "", // 上个页面路径
|
||||
pagesArr: ["pages/mine/index"], // 特殊路径
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
// 数据的请求
|
||||
this.apiwelcome();
|
||||
},
|
||||
onShow() {
|
||||
let pages = getCurrentPages();
|
||||
let prePage = pages[pages.length - 2];
|
||||
this.temp_url = prePage.route;
|
||||
// console.log(this.temp_url);
|
||||
},
|
||||
// 切断正常返回
|
||||
onBackPress(e) {
|
||||
console.log(1, e);
|
||||
if (this.pagesArr.includes(this.temp_url) && !this.hasLogin) {
|
||||
uni.switchTab({
|
||||
url: '../../pages/index/index'
|
||||
})
|
||||
return true;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['loginIn']),
|
||||
apiwelcome() {
|
||||
this.$u.api.sendSmsCode({
|
||||
|
||||
}).then((res) => {
|
||||
this.$u.api.sendSmsCode({}).then((res) => {
|
||||
console.log(res)
|
||||
})
|
||||
},
|
||||
@@ -189,8 +205,7 @@
|
||||
// type: 'success',
|
||||
// url: '/pageA/topick/topick'
|
||||
// })
|
||||
}
|
||||
if (res.errCode == 1) {
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
@@ -199,40 +214,75 @@
|
||||
})
|
||||
},
|
||||
// qq授权登录
|
||||
rect_qq() {
|
||||
console.log("授权QQ")
|
||||
var vm = this;
|
||||
loginOther(type) {
|
||||
var me = this;
|
||||
uni.getProvider({
|
||||
service: 'oauth',
|
||||
success: function(res) {
|
||||
console.log('qq', res) //weixin
|
||||
if (~res.provider.indexOf('qq')) {
|
||||
success: (res) => {
|
||||
if (type == 1) {
|
||||
uni.login({
|
||||
provider: 'qq',
|
||||
success: function(loginRes) {
|
||||
console.log(loginRes)
|
||||
this.getApplogin(loginRes)
|
||||
vm.$HTTP({
|
||||
method: 'GET',
|
||||
baseURL: 'https://graph.qq.com/user/get_user_info',
|
||||
url: '',
|
||||
data: {
|
||||
openid: loginRes.authResult.openid,
|
||||
access_token: loginRes.authResult.access_token,
|
||||
appid: '101884160'
|
||||
},
|
||||
load: true
|
||||
}).then((data) => {
|
||||
console.log(data)
|
||||
|
||||
}, (err) => {
|
||||
console.log(err)
|
||||
});
|
||||
success: (qqres) => {
|
||||
console.log(qqres);
|
||||
uni.getUserInfo({
|
||||
provider: 'qq',
|
||||
success: (data) => {
|
||||
console.log(data);
|
||||
this.$u.api.qqLogin({
|
||||
member_qqopenid: data.userInfo.openId,
|
||||
member_nickname: data.userInfo.nickName,
|
||||
member_avatar: data.userInfo.avatarUrl,
|
||||
}).then(res => {
|
||||
console.log(res.errCode);
|
||||
if (res.errCode == 0) {
|
||||
this.loginIn(res.data.token);
|
||||
this.show = false;
|
||||
uni.switchTab({
|
||||
url: "../../pages/index/index"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: (e) => {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log("错误")
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (wxres) => {
|
||||
console.log(wxres);
|
||||
uni.getUserInfo({
|
||||
provider: 'weixin',
|
||||
success: (data) => {
|
||||
console.log(data);
|
||||
this.$u.api.wechatLogin({
|
||||
member_wxopenid: data.userInfo.openId,
|
||||
member_nickname: data.userInfo.nickName,
|
||||
member_avatar: data.userInfo.avatarUrl,
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode == 0) {
|
||||
this.loginIn(res.data.token);
|
||||
this.show = false;
|
||||
uni.switchTab({
|
||||
url: "../../pages/index/index"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: (e) => {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: (e) => {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -242,10 +292,6 @@
|
||||
url: '/pageA/register/register'
|
||||
});
|
||||
},
|
||||
// 授权登录
|
||||
getApplogin() {
|
||||
console.log("11")
|
||||
},
|
||||
// 选中某个复选框时,由checkbox时触发
|
||||
checkboxChange(e) {
|
||||
//console.log(e);
|
||||
|
||||
Reference in New Issue
Block a user