<script>
	export default {
		onLaunch: function() {
			this.createUser();
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			//查询用户信息
			createUser() {
				let _this = this;
				// #ifdef H5
				this.$request
					.get({
						url: 'system/temporaryUser',
						loadingTip: "加载中..."
					})
					.then((res) => {
						uni.setStorageSync("user", res.data.user);
						uni.setStorageSync("token", res.data.token);
					});
				// #endif

				// #ifdef MP-TOUTIAO
				tt.login({
					success(res) {
						let para = {
							code: code,
							petName: '',
							modelPhone: '',
						};
						_this.$request
							.post({
								url: 'api/douyin/code2Session',
								data: para
							})
							.then(
								(res) => {
									uni.setStorageSync("user", res.data.user);
									uni.setStorageSync("token", res.data.token);
								},
								(err) => {
									console.log("登录失败", err);
								}
							);
					},
				})
				// #endif
			}
		}
	}
</script>

<style>
	/*每个页面公共css */
	@font-face {
		font-family: 'Alibaba PuHuiTi 2.0';
		src: url('../../static/images/EQtest/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.woff2') format('woff2'),
			url('../../static/images/EQtest/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.woff') format('woff'),
			url('../../static/images/EQtest/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.ttf') format('truetype');
		font-weight: normal;
		font-style: normal;
		font-display: swap;
	}
</style>