<template>
	<view>
		<web-view :src="urlParams" @message="addMessage" id="myWebView"></web-view> 
	</view>
</template>

<script>
	import { getCode } from "@/api/jn/login.js"
	export default {
		data() {
			return {
				urlParams:"",
			};
		},
		mounted() {
			let token = uni.getStorageSync("token")
			if (token) {
				getCode({"accesstoken":token}).then(res=>{
					console.log(res,'获取code的');
					this.urlParams = `https://t-kd-process-app.jsszkd.com/pages/oauth2/login?code=${res.data.code}&clientId=221224176384&redirect=/pages/tasks/tasksManage`
					console.log(this.urlParams,"urlParams");
				})
			}
		},
		methods: {
			addMessage(event){
				if(event.detail.data[0].action == 'to-home') {
					console.log("进入判断了");
					this.$tab.switchTab("/pages/mine/index");
				}
			},
		}
	}
</script>

<style lang="scss">

</style>
