You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							95 lines
						
					
					
						
							1.6 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							95 lines
						
					
					
						
							1.6 KiB
						
					
					
				
								<template>
							 | 
						|
									<view class="content">
							 | 
						|
										<block v-if="$isRight(full)">
							 | 
						|
											<image class="img" :src="full.image" mode="widthFix" @click="clickAd"></image>
							 | 
						|
											<view class="tips" @click="next">跳过 {{ num }}s</view>
							 | 
						|
										</block>
							 | 
						|
									</view>
							 | 
						|
								</template>
							 | 
						|
								
							 | 
						|
								<script>
							 | 
						|
									export default {
							 | 
						|
										data(){
							 | 
						|
											return {
							 | 
						|
												num: 5,
							 | 
						|
												timer: null,
							 | 
						|
												full: {}
							 | 
						|
											}
							 | 
						|
										},
							 | 
						|
										onLoad(){
							 | 
						|
											this.getAd();
							 | 
						|
										},
							 | 
						|
										onUnload(){
							 | 
						|
											if(this.timer){
							 | 
						|
												clearInterval(this.timer);
							 | 
						|
												this.timer = null;
							 | 
						|
											}
							 | 
						|
										},
							 | 
						|
										methods: {
							 | 
						|
											getAd(){
							 | 
						|
												this.$http.get({
							 | 
						|
													api: '/api/ad'
							 | 
						|
												}).then(res => {
							 | 
						|
													this.full = res.data.data.full;
							 | 
						|
													if(this.$isRight(res.data.data.full)){
							 | 
						|
														this.startTime();
							 | 
						|
													}else{
							 | 
						|
														this.next();
							 | 
						|
													}
							 | 
						|
												}).catch(rej => {
							 | 
						|
													this.next();
							 | 
						|
												})
							 | 
						|
											},
							 | 
						|
											startTime(){
							 | 
						|
												this.timer = setInterval(() => {
							 | 
						|
													this.num--;
							 | 
						|
													if(this.num <= 0){
							 | 
						|
														clearInterval(this.timer);
							 | 
						|
														this.timer = null;
							 | 
						|
														this.next();
							 | 
						|
													}
							 | 
						|
												}, 1000);
							 | 
						|
											},
							 | 
						|
											next(){
							 | 
						|
												this.$url('/pages/index/index/index', {type: 'redirect'});
							 | 
						|
											},
							 | 
						|
											clickAd(){
							 | 
						|
												this.$url(this.full.url, {type: 'redirect'});
							 | 
						|
											}
							 | 
						|
										}
							 | 
						|
									}
							 | 
						|
								</script>
							 | 
						|
								
							 | 
						|
								<style>
							 | 
						|
									page{
							 | 
						|
										overflow: hidden;
							 | 
						|
									}
							 | 
						|
								</style>
							 | 
						|
								<style lang="scss" scoped="scoped">
							 | 
						|
									.content{
							 | 
						|
										position: relative;
							 | 
						|
										width: 100vw;
							 | 
						|
										height: 100vh;
							 | 
						|
										.img{
							 | 
						|
											width: 100%;
							 | 
						|
											height: 100%;
							 | 
						|
											position: absolute;
							 | 
						|
											z-index: 9;
							 | 
						|
										}
							 | 
						|
										.tips{
							 | 
						|
											position: absolute;
							 | 
						|
											right: 32rpx;
							 | 
						|
											top: 132rpx;
							 | 
						|
											width: 144rpx;
							 | 
						|
											height: 55rpx;
							 | 
						|
											background-color: rgba(0,0,0,0.5);
							 | 
						|
											color: #FFFFFF;
							 | 
						|
											font-size: 26rpx;
							 | 
						|
											display: flex;
							 | 
						|
											justify-content: center;
							 | 
						|
											align-items: center;
							 | 
						|
											border-radius: 28rpx;
							 | 
						|
											z-index: 999;
							 | 
						|
										}
							 | 
						|
									}
							 | 
						|
								</style>
							 |