<template>
	<view>
		<view class="banner">
			<swiper class="box" autoplay circular>
				<swiper-item v-for="(item,index) in banner" :key="item.id" @click="go_link(item.jumpURL)">
					<view class="item">
						<view class="img">
							<image :src="item.imgURL"></image>
						</view>
						<view class="title">
							<view>{{item.title}}</view>
							<view class="num">
								— <text> {{index+1}} </text> —
							</view>
						</view>
					</view>
				</swiper-item>
			</swiper>
		</view>
	</view>
</template>

<script>
	export default {
		name:"t-i-banner-2",
		props: [
			"banner",
			"mine_code"
		],
		data() {
			return {
				
			}
		},
		methods:{
			go_link(link){
				console.log(link)
				
				// 二维码
				if (link.indexOf("pageId") != -1 && link.indexOf("app:") == -1) {
					let pageId = ""
				
					function GetQueryString(name) {
						var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
						var r = link.match(reg);
						if (r != null) return unescape(r[2]);
						return null;
					}
					console.log(GetQueryString("pageId"))
					if (GetQueryString("pageId")) {
						pageId = GetQueryString("pageId")
					} else {
						pageId = link.split('=')[1]
					}
				
					uni.navigateTo({
						url: "../../index/record/record?pageId=" + pageId + "&mine_code=" + this.mine_code,
					})
				}// h5
				if (link.indexOf("pageId") == -1 && link.indexOf("app:") == -1) {
					console.log("H5")
					uni.navigateTo({
						url:"../../index/h5/h5?url=" + link
					})
				}

				
			}
		}
	}
</script>

<style lang="scss">
	.banner{
		margin-top: -60rpx;
		.box{
			width: 750rpx;
			height: 620rpx;
			
			.item{
				width: 750rpx;
				.img{
					text-align: center;
					image{
						width: 750rpx;
						height: 485rpx;
						
					}
				}
				.title{
					box-sizing: border-box;
					padding: 0 25rpx;
					width: 750rpx;
					height: 130rpx;
					
					line-height: 1.5;
					font-size: 32rpx;
					
					position: relative;
					
					.num{
						position: absolute;
						bottom: 35rpx;
						right: 25rpx;
						color: #ACB0AC;
						text{
							color: #23A2EE;
						}
					}
				}
			}
		}
	}
</style>
