<script>
	import plv from "./pages3/static/polyv-sdk/index";
	import config from "./common/config.js";
	export default {
		onLaunch: function(option) {
			uni.hideTabBar();
			let inviteCode = option.inviteCode;
			if (inviteCode && inviteCode != "") {
				uni.setStorageSync("inviteCode", inviteCode);
			}
			this.getApiData();

			this.$store.dispatch("getConfig");
		},
		methods: {
			getApiData() {
				const url = config.BASE_URL + '/app/common/get/plv/info'; // 例如 'https://api.example.com/data'
				uni.request({
					url: url,
					method: 'GET', // 根据需要可以是 'POST', 'PUT' 等
					success: (res) => {
						// console.log('获取数据成功:', res.data.data.apiId);
						plv.setApp({
							apiId: res.data.data.apiId,
							apiSecret: res.data.data.apiSecret
						});
					},
					fail: (err) => {
						console.error('获取数据失败:', err);
					}
				});
			}
		},
		onShow: function(option) {
			this.$store.commit("setScene", option.scene || 0);
		},
		onHide: function() {
			uni.$emit("playPause");
		},
	};
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "/iconfont/iconfont.css";
	@import "uview-ui/index.scss";

	button {
		background: none;
		overflow: auto;
	}
</style>