<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: res.code,
							petName: '',
							modelPhone: '',
						};
						_this.$request
							.post({
								url: 'api/douyin/code2Session',
								data: para
							})
							.then(
								(res) => {
									console.log(res);
									uni.setStorageSync("user", res.data.user);
									uni.setStorageSync("token", res.data.token);
									uni.setStorageSync("openId", res.data.openId);
								},
								(err) => {
									console.log("登录失败", err);
								}
							);
					},
				})
				// #endif
			}
		}
	}
</script>

<style>
	/*每个页面公共css */
	@font-face {
		font-family: 'Alibaba PuHuiTi 2.0';
		src: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.woff2') format('woff2'),
			url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.woff') format('woff'),
			url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.ttf') format('truetype');
		font-weight: normal;
		font-style: normal;
		font-display: swap;
	}

	@font-face {
		font-family: 'ZhankuKuaiLeTi';
		src: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/ZhankuKuaiLeTi.ttf') format('truetype');
		font-weight: normal;
		font-style: normal;
		font-display: swap;
	}

	@font-face {
		font-family: 'YanShiXieHeiTi';
		src: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/font/演示斜黑体.otf') format('truetype');
		font-weight: normal;
		font-style: normal;
		font-display: swap;
	}
</style>