<template>
	<view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			
		},
		onLoad(){
			uni.showLoading({
			    title: '加载中...'
			})
			let _this=this
			uni.getProvider({
				service: 'oauth',
				success(proRes){
					uni.login({
					  provider:proRes.provider[0],
					  success: function (res) {
							if(res.code){
								  let data={
									  code:res.code,
									  source:3
								  }
								  _this.$request('wechat/wx/getUserInfoByCode',data).then(res => {
									uni.hideLoading()
									if(res.code=='00'){
										let openid=res.data.openid
										uni.setStorageSync('openid',openid)
										uni.navigateBack({
											delta:1
										})
									}else{
										uni.removeStorageSync('openid')
										uni.showToast({
											title:res.message,
											icon:"none"
										})
									}
								  }).catch((err)=>{
									  uni.removeStorageSync('openid')
								  })
							}
					   }
					})
				}
			})
			
		},
	}
</script>

<style>

</style>
