微信登录完成
This commit is contained in:
parent
ae9d715bdd
commit
959450d588
|
|
@ -13,25 +13,40 @@
|
||||||
/**
|
/**
|
||||||
* h5,app-plus(nvue下也为app-plus),mp-weixin,mp-alipay......
|
* h5,app-plus(nvue下也为app-plus),mp-weixin,mp-alipay......
|
||||||
*/
|
*/
|
||||||
var that=this
|
//var that=this
|
||||||
// 小程序自动登录
|
// 小程序自动登录
|
||||||
|
uni.showLoading({
|
||||||
|
title:'微信自动登录中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
uni.login({
|
uni.login({
|
||||||
provider: 'weixin',
|
provider: 'weixin',
|
||||||
success: function (loginRes) {
|
success: (loginRes)=>{
|
||||||
that.$u.api.wxmplogin({code:loginRes.code}).then(res=>{
|
this.$u.api.wxmplogin({code:loginRes.code}).then(res=>{
|
||||||
that.$u.vuex('vuex_token', res.data.access)
|
this.$u.vuex('vuex_token', res.data.access)
|
||||||
}).catch(e=>{uni.reLaunch({
|
this.$u.api.getUserInfo().then(res=>{
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title:"登录成功",
|
||||||
|
icon:"none"
|
||||||
|
})
|
||||||
|
uni.reLaunch({
|
||||||
|
url:"/pages/home/home"
|
||||||
|
})
|
||||||
|
this.$u.vuex('vuex_user', res.data)
|
||||||
|
})
|
||||||
|
}).catch(e=>{
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title:"暂未绑定微信!",
|
||||||
|
icon:"none"
|
||||||
|
})
|
||||||
|
uni.reLaunch({
|
||||||
url:'/pages/login/login'
|
url:'/pages/login/login'
|
||||||
})})
|
})})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// this.$u.api.getUserInfo().then(res=>{
|
|
||||||
// this.$u.vuex('vuex_user', res.data)
|
|
||||||
// }).catch(e=>{
|
|
||||||
// uni.reLaunch({
|
|
||||||
// url:'/pages/login/login'
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,15 @@
|
||||||
// }]
|
// }]
|
||||||
// },
|
// },
|
||||||
"pages": [
|
"pages": [
|
||||||
|
{
|
||||||
|
"path" : "pages/login/login",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "验证码登录",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/home/home",
|
"path" : "pages/home/home",
|
||||||
"style" :
|
"style" :
|
||||||
|
|
@ -28,15 +37,6 @@
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
,{
|
|
||||||
"path" : "pages/login/login",
|
|
||||||
"style" :
|
|
||||||
{
|
|
||||||
"navigationBarTitleText": "验证码登录",
|
|
||||||
"enablePullDownRefresh": false
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
,{
|
,{
|
||||||
"path" : "pages/login/login_password",
|
"path" : "pages/login/login_password",
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
<u-form-item label="拍照取证">
|
<u-form-item label="拍照取证">
|
||||||
<u-image
|
<u-image
|
||||||
@click="imgListPreview(index)"
|
@click="imgListPreview(index)"
|
||||||
width="260rpx" height="260rpx" :src="item" v-for="(item, index) in fileList" v-bind:key="index" style="margin: 8rpx;"></u-image>
|
width="260rpx" height="260rpx" :src="item" v-for="(item, index) in fileList" v-bind:key="index" style="margin: 2rpx;"></u-image>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
|
|
||||||
</u-form>
|
</u-form>
|
||||||
|
|
|
||||||
|
|
@ -315,8 +315,8 @@ class UserViewSet(PageOrNot, ModelViewSet):
|
||||||
'perms': perms,
|
'perms': perms,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
user = UserThird.objects.get(user=user,type='wx_mp').user
|
usert = UserThird.objects.get(user=user,type='wx_mp')
|
||||||
data['wxmp_openid'] = user.openid
|
data['wxmp_openid'] = usert.openid
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return Response(data)
|
return Response(data)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue