<!--
 * @Author: 张涛
 * @Date: 2023-11-06 14:17:42
 * @LastEditors: 张涛
 * @LastEditTime: 2023-11-07 10:48:23
 * @FilePath: \JiangNingUmale-App\subcontract\mine\event\index.vue
-->
<template>
  <view>
    <web-view :src="urlParams" id="myWebView" @message="addMessage" @load="myonload"></web-view>  
  </view>
</template>

<script>
	import { getCode } from "@/api/jn/login.js"
export default {
	data(){
		return {
			urlParams: "",
		}
	},
	onLoad(){
		let token = uni.getStorageSync("token")
		console.log(token,'传入的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/events/eventsManage`
			})
		}
	},
	methods: {
		addMessage(event){
			if(event.detail.data[0].action == 'to-home') {
				console.log("进入判断了");
				this.$tab.switchTab("/pages/mine/index");
			}
		},
		myonload(){}
	}
};
</script>

<style lang="scss" scoped></style>
