提交 f2071bd4 编写于 作者: L linju

123

上级 c0e157ac
......@@ -7,8 +7,12 @@
</view>
</template>
<script>
export default {
<script>
import {
mapGetters,
mapMutations
} from 'vuex';
export default {
data() {
return {
config: {
......@@ -83,11 +87,16 @@
})
*/
},
methods: {
methods: {
...mapMutations({
setUserInfo: 'user/login'
}),
login(type) {
let oauthService = this.oauthServices.find((service) => service.id == type)
// #ifdef APP-PLUS
uni.showLoading({mask: true});
//请勿直接使用前端获取的unionid或openid直接用于登陆,前端的数据都是不可靠的
if(type=='weixin'){
oauthService.authorize(({code})=>{
console.log(code);
......@@ -120,23 +129,35 @@
// #endif
},
quickLogin(params,type){
//请勿直接使用authResult中的unionid或openid直接用于登陆,前端的数据都是不可靠的
console.log({params,type});
uniCloud.callFunction({//联网验证登陆
"name": "user-center",
"data": {
"action": "login_by_"+type,
params
},
success: (e) => {
success:async (e) => {
uni.hideLoading()
console.log(e.result);
uni.showModal({
content: JSON.stringify(e.result),
showCancel: false
});
if(type=='univerify'){
uni.closeAuthView()
// uni.showModal({
// content: JSON.stringify(e.result),
// showCancel: false
// });
if(e.result.code === 0){
uni.setStorageSync('uni_id_uid', e.result.uid)
uni.setStorageSync('uni_id_token', e.result.token)
uni.setStorageSync('uni_id_token_expired', e.result.tokenExpired)
console.log('66666=',e.result.uid,e.result.token,e.result.tokenExpired);
delete e.result.userInfo.token
this.setUserInfo(e.result.userInfo)
if(type=='univerify'){
uni.closeAuthView()
}
uni.showToast({
title: '登陆成功',
icon: 'none'
});
uni.navigateBack()
}
},
fail: (err) => {
......
......@@ -3,6 +3,9 @@ const PACKAGE_INFO_KEY = '__package_info__'
export default function() {
// #ifdef APP-PLUS
return '先关了'
plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
uniCloud.callFunction({
name: 'check-version',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册