<script>
export default {
	onLaunch: function() {
		console.log('App Launch');
		let pageUrl = window.location.href;
		
		let code =this.getQueryString('code');
		console.log(code,"lldd");
		let appid="wx5a2c9f7e82918b85"
		
		let redirect_uri = encodeURIComponent(pageUrl);
		// let redirect_uri = pageUrl;
		console.log(redirect_uri)
		let authUrl =
			`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=STATE&connect_redirect=1#wechat_redirect`;
		if (code) {
			uni.setStorageSync("code",code)
		} else {
			window.location.href = authUrl;
			console.log("没有code")
			// return await Promise.reject("跳转授权");
		}
	},
	onShow: function() {
		console.log('App Show');
		// setTimeout(()=>{
		//   uni.hideTabBar()  
		// },100)
	},
	methods:{
		getQueryString(name) {
			let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
			let r = window.location.search.substr(1).match(reg);
			if (r !== null) return unescape(r[2]);
			return null;
		},
	},
	
	onHide: function() {
		console.log('App Hide');
	}
};
</script>

<style lang="scss"> 
@import "@/uni_modules/uview-ui/index.scss";
/*每个页面公共css */
@import 'colorui/main.css';
@import 'colorui/icon.css';
@import 'style/FontStyle.css';
body{
	-webkit-text-size-adjust:none;
}
/* 超出一行省略号 */
.one-omit {
	white-space: nowrap; /*规定段落中的文本不进行换行*/
	overflow: hidden; /*内容会被修剪，并且其余内容是不可见的。*/
	text-overflow: ellipsis; /*显示省略号来代表被修剪的文本*/
}

.two-omit {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	overflow: hidden;
	text-overflow: ellipsis;
	-webkit-box-orient: vertical;
}
img{
	width: 100%;
}

</style>
