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.

219 lines
4.9 KiB

2 years ago
<template>
<view class="container">
<image class="logo" :src="require('@/static/index-logo.png')"></image>
<image class="logo1" :src="require('@/static/index-logo1.png')"></image>
<view style="height:100px;color:red" @click="clearHistory"></view>
<view class="titlewrap">
<image class="title" :src="require('@/static/index-title.png')"></image>
<view class="title-progress">
<view class="progress-text">{{progressPercentage}}%</view>
<view>interval0::::{{interval0}}</view>
<view>isOk::::{{isOk}}</view>
<view>token:::{{token}}</view>
<view>user:::{{user}}</view>
<view>isShare::::{{isShare}}</view>
<view>inter::::{{interval}}</view>
<view>shareFalse101::::{{shareFalse101}}</view>
<view class="progress-bar-container">
<view class="progress-bar" :style="{'width':progressPercentage+'%'}"></view>
</view>
</view>
</view>
<!-- <view class="support">
<view>
<p>主办单位中共苏州工业园区斜塘街道工作委员会</p>
<p>承办单位江苏有线苏州分公司</p>
</view>
</view> -->
</view>
</template>
<script>
export default {
data() {
return {
progressPercentage: 0,
interval0:null,
interval:null,
isShare:false,
shareFalse101:0,
isOk:'未请求完毕',
token:'--1',
user:'--2'
}
},
async onLoad() {
uni.showModal({
title:'index--onload'
})
this.startBefore()
uni.showModal({
title:'end--startBefore'
})
await this.$onLaunched;
uni.showModal({
title:'this.$onLaunched'
})
this.token = uni.getStorageSync('tadk2_lifeData').vuex_token
this.user = uni.getStorageSync('tadk2_lifeData').vuex_user
console.log("请求完毕,开始执行")
this.isOk =" 请求完毕,开始执行"
this.start();
},
beforeDestroy() {
clearInterval(this.interval0);
clearInterval(this.interval);
},
methods: {
clearHistory() {
// 获取当前窗口的history对象
const history = window.history;
// 使用pushState方法将当前URL替换为一个不可见的新URL从而清除历史记录
history.pushState(null, "", "#");
// 添加popstate事件监听器当用户点击后退按钮时将再次触发该事件并清除历史记录
window.addEventListener("popstate", function(event) {
history.pushState(null, "", "#");
});
},
startBefore(){
this.interval0 = setInterval(() => {
if(this.progressPercentage<33){
this.progressPercentage++;
}else{
clearInterval(this.interval0);
}
}, 50);
},
start() {
this.interval = setInterval(() => {
this.isShare = uni.getStorageSync('tadk2_lifeData').vuex_share?true:false
const userInfo = uni.getStorageSync('tadk2_lifeData').vuex_user
if(this.isShare){
if(this.progressPercentage<100){
this.progressPercentage++;
}else{
clearInterval(this.interval);
if(userInfo && userInfo.mobile){
uni.navigateTo({
url:'/pages/map/map'
})
}else{
uni.navigateTo({
url:'/pages/login/login'
})
}
}
}else{
if(this.progressPercentage<99){
this.progressPercentage++;
}else{
this.shareFalse101 = this.progressPercentage
}
}
}, 50);
},
},
}
</script>
<style lang="scss">
.container {
height: 100vh;
width: 100vw;
background: #e1f1f2;
position: relative;
.logo {
width: 59rpx;
height: 106rpx;
position: absolute;
top: 35rpx;
left: 65rpx;
}
.logo1 {
width: 97rpx;
height: 86rpx;
position: absolute;
top: 45rpx;
left: 140rpx
}
.titlewrap{
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
.title {
width: 633rpx;
height: 498rpx;
}
.title-progress{
margin-top:30rpx;
.progress-text{
text-align: center;
color:#156e68;
font-size: 60rpx;
margin-bottom:20rpx
}
.progress-bar-container {
width: 90%;
height: 55rpx;
background-color: #f7f1e1;
overflow: hidden;
border:4rpx solid #156e68;
border-radius: 20rpx;
margin:0 auto;
font-size: 0;
}
.progress-bar {
height: 100%;
background-color: #156e68;
width:0;
border-radius:0 16rpx 16rpx 0;
// transition: width 0.5s;
// animation: width100 5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
// @keyframes width100 {
// 0% {
// width:0%
// }
// 30% {
// width:30%
// }
// 50%{
// width:30%
// }
// 70%{
// width:70%
// }
// 100% {
// width:100%
// }
// }
}
}
.support {
position: absolute;
bottom: 10rpx;
width: 100%;
font-size: 24rpx;
color: #666;
font-family: '宋体';
opacity: 1;
text-align: center;
z-index: 9;
}
}
</style>