2022-03-14 09:09:10 +00:00
|
|
|
|
<template>
|
2022-03-16 11:40:58 +00:00
|
|
|
|
<view :style="{height: windowHeight+'px'}" style="overflow: hidden;">
|
2022-05-28 05:06:22 +00:00
|
|
|
|
<image :src="ad_img" mode="widthFix" style="width: 100%;"></image>
|
2022-07-25 10:26:45 +00:00
|
|
|
|
<view @tap="closeEv" class="disjcac count-box colf fon28 radius10" :class="ifH5?'app-h5-count-box' :'wx-count-box'" :style="{top:ifH5 ? statuHeigh+10+'px' :''}">{{count}} 关闭</view>
|
2022-03-14 09:09:10 +00:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2022-05-20 09:46:27 +00:00
|
|
|
|
windowHeight:uni.getSystemInfoSync().windowHeight,
|
2022-05-28 05:42:06 +00:00
|
|
|
|
statuHeigh:uni.getSystemInfoSync().statusBarHeight,
|
2022-05-28 05:06:22 +00:00
|
|
|
|
// ad_img:'/static/public/icon-guide.png',
|
2022-05-28 05:42:06 +00:00
|
|
|
|
ad_img:'',
|
2022-06-21 09:53:12 +00:00
|
|
|
|
count:3,//右上角倒计时数
|
|
|
|
|
timeNum:3000,//页面延迟跳转秒
|
2022-05-28 05:42:06 +00:00
|
|
|
|
countTimer:null,//控制右上角倒计时事件
|
|
|
|
|
timeNumTimer:null,//控制页面延迟跳转事件
|
2022-07-25 10:26:45 +00:00
|
|
|
|
omg:0,//判断是否已经登录过0:未登录 1:登录过
|
|
|
|
|
ifH5:0
|
2022-03-14 09:09:10 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
2022-07-25 10:26:45 +00:00
|
|
|
|
// #ifdef APP-PLUS || H5
|
|
|
|
|
this.ifH5 = true;
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
this.ifH5 = false;
|
|
|
|
|
// #endif
|
2022-08-19 07:02:10 +00:00
|
|
|
|
// this.checkContext();
|
2022-07-25 10:26:45 +00:00
|
|
|
|
if(uni.getStorageSync('guideImg')){
|
|
|
|
|
this.ad_img = uni.getStorageSync('guideImg');
|
|
|
|
|
// 调用倒计时事件
|
|
|
|
|
this.countDownEv();
|
2022-08-19 07:02:10 +00:00
|
|
|
|
} else {
|
2022-07-25 10:26:45 +00:00
|
|
|
|
this.$requst.get('/universal/api.other/advertise').then(res=>{
|
|
|
|
|
if(res.code) {
|
|
|
|
|
this.ad_img = res.data.ad_img;
|
|
|
|
|
uni.setStorageSync('guideImg',this.ad_img);
|
|
|
|
|
// 调用倒计时事件
|
|
|
|
|
this.countDownEv();
|
|
|
|
|
// uni.setStorageSync('adImg',this.ad_img);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-03-14 09:09:10 +00:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
2022-07-25 10:26:45 +00:00
|
|
|
|
// 倒计时事件
|
|
|
|
|
countDownEv(){
|
|
|
|
|
this.countTimer = setInterval(()=>{
|
|
|
|
|
if(this.count > 1){
|
|
|
|
|
this.count--
|
|
|
|
|
}
|
|
|
|
|
},1000)
|
|
|
|
|
this.timeNumTimer = setTimeout(()=>{
|
2022-08-19 07:02:10 +00:00
|
|
|
|
this.checkContext();
|
2022-07-25 10:26:45 +00:00
|
|
|
|
},this.timeNum)
|
|
|
|
|
},
|
2022-05-28 05:42:06 +00:00
|
|
|
|
// 关闭事件
|
|
|
|
|
closeEv(){
|
|
|
|
|
clearInterval(this.countTimer);
|
|
|
|
|
clearTimeout(this.timeNumTimer);
|
2022-08-19 07:02:10 +00:00
|
|
|
|
this.checkContext();
|
2022-05-28 05:42:06 +00:00
|
|
|
|
},
|
2022-03-14 09:09:10 +00:00
|
|
|
|
checkContext(){
|
2022-05-13 09:39:50 +00:00
|
|
|
|
if(uni.getStorageSync('password')) {
|
2022-05-16 10:35:30 +00:00
|
|
|
|
// 是否登录过,登录过就直接刷新token重新登录
|
2022-05-13 09:39:50 +00:00
|
|
|
|
let params = {
|
|
|
|
|
login_type: 'account', // 登陆手机类型: mobile:手机登陆、account:账号密码登陆
|
|
|
|
|
phone: '', // 手机号码,login_type 为 mobile 时必填
|
|
|
|
|
password: uni.getStorageSync('password'), // 密码,login_type 为 account 时必填
|
|
|
|
|
sms_code: '', // 短信验证码,login_type 为 mobile 时必填
|
|
|
|
|
username: uni.getStorageSync('phone'), //账号,login_type 为 account 时必填
|
|
|
|
|
affiliation: uni.getStorageSync('unitName') // 单位名称
|
|
|
|
|
}
|
|
|
|
|
this.$requst.post('/universal/api.login/login',params).then(res=>{
|
|
|
|
|
if(res.code==1) {
|
2022-07-28 10:19:08 +00:00
|
|
|
|
this.$store.commit('setUid',res.data.uid);
|
2022-05-13 09:39:50 +00:00
|
|
|
|
// 缓存token和角色类型
|
|
|
|
|
uni.setStorageSync('token',res.data.token);
|
2022-08-19 07:02:10 +00:00
|
|
|
|
this.omg = 1;
|
|
|
|
|
this.goPage();
|
|
|
|
|
} else {
|
2022-05-13 09:39:50 +00:00
|
|
|
|
this.$toolAll.tools.showToast(res.msg);
|
2022-08-19 07:02:10 +00:00
|
|
|
|
this.omg = 0;
|
|
|
|
|
this.goPage();
|
2022-05-13 09:39:50 +00:00
|
|
|
|
}
|
|
|
|
|
})
|
2022-04-29 11:00:02 +00:00
|
|
|
|
} else {
|
2022-05-28 05:42:06 +00:00
|
|
|
|
this.omg = 0;
|
2022-08-19 07:02:10 +00:00
|
|
|
|
this.goPage();
|
2022-04-29 11:00:02 +00:00
|
|
|
|
}
|
2022-05-13 09:39:50 +00:00
|
|
|
|
},
|
|
|
|
|
// 跳转页面
|
2022-05-28 05:42:06 +00:00
|
|
|
|
goPage() {
|
2022-05-13 09:39:50 +00:00
|
|
|
|
let arr = [
|
|
|
|
|
'/pages/login/login',
|
|
|
|
|
'/pages/tabbar/pagehome/pagehome'
|
|
|
|
|
]
|
2022-05-28 05:42:06 +00:00
|
|
|
|
uni.reLaunch({url:arr[this.omg]})
|
2022-03-14 09:09:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
2022-03-22 10:15:22 +00:00
|
|
|
|
page{background-color: #FFFFFF;}
|
2022-05-28 05:42:06 +00:00
|
|
|
|
.count-box{
|
|
|
|
|
background-color: rgba(0, 0, 0, .3);
|
2022-08-19 07:02:10 +00:00
|
|
|
|
/* padding: 16rpx 30rpx; */
|
|
|
|
|
width: 120rpx;
|
|
|
|
|
height: 60rpx;
|
2022-07-25 10:26:45 +00:00
|
|
|
|
}
|
|
|
|
|
.app-h5-count-box{
|
2022-05-28 05:42:06 +00:00
|
|
|
|
position: fixed;
|
|
|
|
|
right: 20rpx;
|
|
|
|
|
}
|
2022-07-25 10:26:45 +00:00
|
|
|
|
.wx-count-box{
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 40rpx;
|
|
|
|
|
left: 50%;
|
|
|
|
|
transform: translateX(-50%);
|
|
|
|
|
}
|
2022-03-14 09:09:10 +00:00
|
|
|
|
</style>
|