xiaokuang před 4 měsíci
rodič
revize
466c9deffd
1 změnil soubory, kde provedl 70 přidání a 9 odebrání
  1. 70 9
      pages/index/home.vue

+ 70 - 9
pages/index/home.vue

@@ -89,7 +89,19 @@
 			</view>
 		</view>
 		<contact-us :show.sync="showContactUs" :qrcode_url="q_url" />
-    <float-button @custom-event="updateContactStatus()"></float-button>
+		<float-button @custom-event="updateContactStatus()"></float-button>
+		<van-overlay :show="isShow">
+			<view class="ad-wrapper">
+				<view class="img-btn-box">
+					<view class="ad-space" @tap="navigateToAdLink(adInfo.ad_link)">
+						<image :src="adInfo.ad_file" mode="widthFix" class="ad-img" />
+					</view>
+					<view class="home-ad-close" @click="isShow = false">
+						<van-icon name="close" />
+					</view>
+				</view>
+			</view>
+		</van-overlay>
 	</view>
 </template>
 
@@ -102,9 +114,11 @@
 	import NewsRecommend from '@/pages/news/components/news-recommend.vue'
 	import ContactUs from '@/pages/index/components/contact-us.vue'
 	import PopupAd from '@/pages/index/components/popup-ad.vue'
-  import floatButton from "@/components/layout/float-button";
+	import floatButton from "@/components/layout/float-button"
+	import VanOverlay from '@/wxcomponents/vant/overlay/index'
 	import {
-		getDashboardInfo
+		getDashboardInfo,
+		getAdInfo
 	} from '@/api'
 
 	export default {
@@ -112,7 +126,7 @@
 			styleIsolation: 'shared'
 		},
 		components: {
-      floatButton,
+			floatButton,
 			NavBar,
 			UScrollView,
 			USwiper,
@@ -120,7 +134,8 @@
 			UPanel,
 			NewsRecommend,
 			ContactUs,
-			PopupAd
+			PopupAd,
+			VanOverlay
 		},
 		data() {
 			return {
@@ -176,11 +191,16 @@
 				// 合作方列表
 				part1: [],
 				part2: [],
-				part3: []
+				part3: [],
+				isShow: true,
+				adInfo: {
+					ad_file: 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da70a6c76a.png?x-oss-process=image/resize,w_200'
+				}
 			}
 		},
 		created() {
 			this.getDashboardData()
+			this.getAdData()
 		},
 		methods: {
 			onClickNavIcon(item) {
@@ -226,6 +246,16 @@
 			updateContactStatus(data) {
 				this.showContactUs = data.showContactUs
 				this.q_url = data.q_url
+			},
+			getAdData() {
+				getAdInfo({
+					number: "IndexPopUp001"
+				}).then(res => {
+					this.adInfo = res.data[0]
+				})
+			},
+			navigateToAdLink(href) {
+				this.navigateTo(href)
 			}
 			// onVisitClick() {
 			// 	getBuoyInfo().then(res => {
@@ -239,6 +269,39 @@
 </script>
 
 <style lang="scss">
+	.ad-wrapper {
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		height: 100%;
+
+		.img-btn-box {
+			display: flex;
+			justify-content: center;
+			width: 500rpx;
+			position: relative;
+
+			.ad-space {
+				width: 100%;
+
+				.ad-img {
+					width: 100%;
+				}
+			}
+		}
+
+		.home-ad-close{
+			position: absolute;
+			top: -70rpx;
+			right: -70rpx;
+			.van-icon-close{
+				font-size: 60rpx;
+				color: #FFFFFF;
+				cursor: pointer;
+			}
+		}
+	}
+
 	.logo {
 		width: 150rpx;
 		height: 37rpx;
@@ -437,6 +500,4 @@
 			object-fit: contain;
 		}
 	}
-
-
-</style>
+</style>