优化引导页可手动关闭跳转
parent
3f9f627568
commit
6bfc7d50fd
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view :style="{height: windowHeight+'px'}" style="overflow: hidden;">
|
<view :style="{height: windowHeight+'px'}" style="overflow: hidden;">
|
||||||
<image :src="ad_img" mode="widthFix" style="width: 100%;"></image>
|
<image :src="ad_img" mode="widthFix" style="width: 100%;"></image>
|
||||||
|
<view @tap="closeEv" class="disjcac count-box colf fon28 radius10" :style="{top:statuHeigh+10+'px'}">{{count}} 关闭</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -9,8 +10,14 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
windowHeight:uni.getSystemInfoSync().windowHeight,
|
windowHeight:uni.getSystemInfoSync().windowHeight,
|
||||||
|
statuHeigh:uni.getSystemInfoSync().statusBarHeight,
|
||||||
// ad_img:'/static/public/icon-guide.png',
|
// ad_img:'/static/public/icon-guide.png',
|
||||||
ad_img:''
|
ad_img:'',
|
||||||
|
count:6,//右上角倒计时数
|
||||||
|
timeNum:6000,//页面延迟跳转秒
|
||||||
|
countTimer:null,//控制右上角倒计时事件
|
||||||
|
timeNumTimer:null,//控制页面延迟跳转事件
|
||||||
|
omg:0//判断是否已经登录过0:未登录 1:登录过
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
@ -18,11 +25,25 @@
|
||||||
this.$requst.get('/universal/api.other/advertise').then(res=>{
|
this.$requst.get('/universal/api.other/advertise').then(res=>{
|
||||||
if(res.code) {
|
if(res.code) {
|
||||||
this.ad_img = res.data.ad_img;
|
this.ad_img = res.data.ad_img;
|
||||||
uni.setStorageSync('adImg',this.ad_img);
|
this.countTimer = setInterval(()=>{
|
||||||
|
if(this.count >= 1){
|
||||||
|
this.count--
|
||||||
|
}
|
||||||
|
},1000)
|
||||||
|
this.timeNumTimer = setTimeout(()=>{
|
||||||
|
this.goPage();
|
||||||
|
},this.timeNum)
|
||||||
|
// uni.setStorageSync('adImg',this.ad_img);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 关闭事件
|
||||||
|
closeEv(){
|
||||||
|
clearInterval(this.countTimer);
|
||||||
|
clearTimeout(this.timeNumTimer);
|
||||||
|
this.goPage();
|
||||||
|
},
|
||||||
checkContext(){
|
checkContext(){
|
||||||
if(uni.getStorageSync('password')) {
|
if(uni.getStorageSync('password')) {
|
||||||
// 是否登录过,登录过就直接刷新token重新登录
|
// 是否登录过,登录过就直接刷新token重新登录
|
||||||
|
@ -42,18 +63,18 @@
|
||||||
this.$toolAll.tools.showToast(res.msg);
|
this.$toolAll.tools.showToast(res.msg);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.goPage(1);
|
this.omg = 1;
|
||||||
} else {
|
} else {
|
||||||
this.goPage(0);
|
this.omg = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 跳转页面
|
// 跳转页面
|
||||||
goPage(index) {
|
goPage() {
|
||||||
let arr = [
|
let arr = [
|
||||||
'/pages/login/login',
|
'/pages/login/login',
|
||||||
'/pages/tabbar/pagehome/pagehome'
|
'/pages/tabbar/pagehome/pagehome'
|
||||||
]
|
]
|
||||||
setTimeout(()=>{uni.reLaunch({url:arr[index]})},3000)
|
uni.reLaunch({url:arr[this.omg]})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,4 +82,10 @@
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
page{background-color: #FFFFFF;}
|
page{background-color: #FFFFFF;}
|
||||||
|
.count-box{
|
||||||
|
background-color: rgba(0, 0, 0, .3);
|
||||||
|
padding: 16rpx 30rpx;
|
||||||
|
position: fixed;
|
||||||
|
right: 20rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue