<!--
 * @Author: lijiahui jiahui.li@eb.manpower.com.cn
 * @Date: 2025-10-14 14:55:56
 * @LastEditors: lijiahui jiahui.li@eb.manpower.com.cn
 * @LastEditTime: 2025-10-16 16:33:18
 * @FilePath: \activity-platform-webd:\gongzuo\momclub-front\subPackages\xmhAactivity\bridgePage\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
	<view class="bridge-container">
		<view class="logo-wrap">
			<img :src="cdnUrl+'scan/xmyx-logo.png'" class="logo" alt=""></img>
			<view class="slogan">星妈优选 | 下单品质生活</view>
			<view class="small-logo">
				<img :src="cdnUrl+'scan/share-icon.png'" class="logo2" alt=""></img>
				<view class="mini">小程序</view>
			</view>
		</view>
		<view class="open" @click="handleClick">立即打开</view>
	</view>
</template>

<script setup>
	import { ref, computed, onMounted } from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	import { getParams, getCdnUrl } from '../utils/common.js'

	const urlParams = ref({})
	const cdnUrl = ref('')
	const appId = ref('') //优选小程序appId
	const targetUrl = ref('') //优选小程序目标地址

	onMounted(()=>{
		console.log('bridgePage onMounted')
	})

	const handleClick = () => {
		const jumpParams = {
			appId: appId.value,
			path: targetUrl.value,
			extraData: {},
			envVersion: "release",
		};
		uni.openEmbeddedMiniProgram(jumpParams);
	};
  
	onLoad(async ()=>{
		urlParams.value = getParams()
		cdnUrl.value = getCdnUrl(urlParams.value.env)
		appId.value = urlParams.value.env === 'prod' ? 'wx4205ec55b793245e' : 'wxabebc35e71e66795'
		targetUrl.value = decodeURIComponent(urlParams.value.targetUrl)
		console.log('params---', urlParams.value)
		console.log('cdnUrl---', cdnUrl.value)
		console.log('appId---', appId.value)
		console.log('targetUrl---', targetUrl.value)
	})

</script>

<style lang="less" scoped>
	.bridge-container {
		height: 100%;
		width: 100%;
		.logo-wrap {
			margin-top: 71px;
			display: flex;
			align-items: center;
			justify-content: center;
			flex-direction: column;
			.logo {
				width: 52px;
				height: 55px;
			}
			.slogan {
				margin-top: 17px;
				font-size: 16px;
				color: #000;
				font-weight: 400;
			}
			.small-logo {
				display: flex;
				align-items: center;
				justify-content: center;
				margin-top: 15px;
				.logo2 {
					width: 11px;
					height: 11px;
				}
				.mini {
					font-size: 12px;
					color: #A9A9A9;
					font-weight: 400;
				}
			}
		}
		.open {
			margin: auto;
			width: 162px;
			height: 37px;
			background: #49C265;
			border-radius: 4px;
			text-align: center;
			line-height: 37px;
			font-size: 14px;
			color: #fff;
			font-weight: 400;
			margin-top: 330px;
		}
	}
</style>