<template>
	<view class="ezy-shop-info-page">
		<view class="icon-title-navBar-box">
			<view class="nav-bar-icon" @click="handleBack"></view>
			<text class="nav-bar-title">商品详情</text>
		</view>
		<view class="shop-info-body">
			<view class="img-content-box">
				<img :src="imageUrl" alt="" />
			</view>
			<view class="fx-btn-row">
				<view @click="fenxiang" class="fx-btn">
					<icon class="fx-icon"></icon>
					<view>分享</view>
				</view>
				<ezyActiveVue @click="handleStudy" class="ezy-btn-active bmxx-btn">立即报名学习</ezyActiveVue>
			</view>
		</view>
		

<!--  分享  -->
    <SharePopup ref="sharePopup" :type="2" title="商品详情" desc="商品详情"
                :image="imageUrl" currentPage="tupian"
                @success="handleShareSuccess" @error="handleShareError" />
	</view>
</template>

<script setup>
	import {
		reactive,
		ref
	} from "vue";
	import {
		onLoad,
		onShow
	} from "@dcloudio/uni-app"
	import * as shopHttp from "@/api/shop.js"
  import {getAppCp1Info} from "@/api/shop";
  import ezyActiveVue from "@/components/ezyActive/ezyActive.vue";
  import SharePopup from "@/components/sharePopUp/index.vue"
  import {toast} from "uview-plus";
	
	const imageUrl = ref(null);
  const sharePopup = ref(null);

	onLoad(() => {
		initPage()
	})

	function initPage() {
		shopHttp.getAppCp3Info().then(res => {
			imageUrl.value = res.data.image;
		})
	}

  function handleShareError() {
    toast('分享失败')
  }

  function handleShareSuccess() {
    toast('分享成功')
  }
	
	function fenxiang() {
    sharePopup.value.open();
  }
	function handleStudy() {
		uni.navigateTo({
			url: '/pages/chanpinShop/cp3/dingdan'
		})
	}
	
	function handleBack() {
		uni.navigateBack()
	}
</script>

<style>

</style>
