325 lines
7.6 KiB
Vue
325 lines
7.6 KiB
Vue
<template>
|
|
<view>
|
|
<!-- <image v-if="type" class="welcome_images" src="../../static/pageA/welcome_img.jpg" mode="aspectFill"></image> -->
|
|
<view v-if="type" id="video_mp4">
|
|
<view class="page-body">
|
|
<view class="page-section">
|
|
<video id="myVideo" :src=" 'https://' + vide0_url" autoplay controls="false" @error="videoErrorCallback"
|
|
enable-danmu danmu-btn></video>
|
|
<cover-view class="time">abc</cover-view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view v-if="type" class="welcome_jumpes" @click="leap_over">跳过{{remaining}}</view>
|
|
<view v-if="banner" class="welcome_jumpes" @click="leap_overto">跳过</view>
|
|
<!-- 轮播图 -->
|
|
<view class="uni-padding-wrap" v-if="banner" >
|
|
<view>
|
|
<view class="uni-padding-wrap">
|
|
<view class="page-section swiper">
|
|
<view class="page-section-spacing">
|
|
<swiper class="swiper" :indicator-dots="true" :style="{height:heightOut+'px'}" :autoplay="false" :interval="3000" :duration="1000" @animationfinish="">
|
|
<swiper-item v-for="(item,index) in list" :key="index">
|
|
<view class="swiper-item uni-bg-red">
|
|
<image :src=" 'https://' + item.launch_path"></image>
|
|
<view v-if="index == 3">立即体验</view>
|
|
</view>
|
|
</swiper-item>
|
|
</swiper>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- 用户协议弹窗 -->
|
|
<view class="welcome_backes" v-if="protocol">
|
|
<view class="content">
|
|
<view class="title">{{ agreement.document_title }}</view>
|
|
<!-- <text class="protocol_content"></text> -->
|
|
<scroll-view scroll-y class="scroll">
|
|
<rich-text class="protocol_content" :nodes="agreement.document_content"></rich-text>
|
|
</scroll-view>
|
|
<view class="to_agree" @click="to_agree">我同意</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import common from '@/static/js/common.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
remaining: 11,
|
|
type: true,
|
|
banner: false,
|
|
protocol: false,
|
|
heightOut: '',
|
|
imgurl: [],
|
|
vide0_url: '',
|
|
agreement: { // 用户协议内容
|
|
document_title: "",
|
|
document_content: ""
|
|
},
|
|
heightesStyle : {
|
|
height : ''
|
|
},
|
|
title: 'video',
|
|
src: '',
|
|
inputValue: '',
|
|
controls: false,
|
|
list: [],
|
|
background: ['color1', 'color2', 'color3'],
|
|
indicatorDots: true,
|
|
interval: 2000,
|
|
duration: 500
|
|
};
|
|
},
|
|
onReady: function(res) {
|
|
this.videoContext = uni.createVideoContext('myVideo');
|
|
},
|
|
methods: {
|
|
apiwelcome() {
|
|
this.$u.api.documentInfo({
|
|
document_code: 'agreement'
|
|
}).then((res) => {
|
|
if (res.errCode == 0) {
|
|
let agreement = res.data;
|
|
// console.log(agreement.document_content)
|
|
agreement.document_content = common.unescapeHTML(agreement.document_content);
|
|
// console.log(agreement);
|
|
this.agreement = agreement;
|
|
}
|
|
})
|
|
// 启动页
|
|
this.$u.api.pageList({}).then((res) => {
|
|
console.log('协议', res)
|
|
let data_image = res.data.welcome_page
|
|
let vide0_url = res.data.start_page[0].launch_path
|
|
this.list = data_image;
|
|
this.vide0_url = vide0_url;
|
|
})
|
|
},
|
|
// 3秒倒计时
|
|
remaining_time() {
|
|
this.timer = setInterval(() => {
|
|
this.remaining--;
|
|
if (this.remaining <= 0) {
|
|
clearInterval(this.timer);
|
|
console.log("完了")
|
|
this.type = !this.type;
|
|
this.banner = !this.banner;
|
|
}
|
|
}, 1000);
|
|
},
|
|
leap_over() {
|
|
this.type = !this.type
|
|
this.banner = !this.banner;
|
|
clearInterval(this.timer)
|
|
// 获取屏幕高度
|
|
this.getSystemInfo()
|
|
},
|
|
leap_overto() {
|
|
this.protocol = true;
|
|
this.banner = false;
|
|
},
|
|
getSystemInfo() {
|
|
let that = this;
|
|
// 获取屏幕高度
|
|
uni.getSystemInfo({
|
|
success: function(res) {
|
|
that.heightOut = res.windowHeight;
|
|
console.log(that.heightOut)
|
|
}
|
|
});
|
|
},
|
|
// 我同意
|
|
to_agree() {
|
|
uni.setStorage({
|
|
key: 'launchFlag',
|
|
data: true,
|
|
success: function() {
|
|
console.log('点击存储launchFlag');
|
|
}
|
|
});
|
|
uni.navigateTo({
|
|
url: '/pageA/login/login'
|
|
});
|
|
},
|
|
// 视频引入
|
|
bindInputBlur: function(e) {
|
|
this.inputValue = e.target.value;
|
|
console.log(e.target.value);
|
|
},
|
|
bindButtonTap: function() {
|
|
var that = this
|
|
uni.chooseVideo({
|
|
sourceType: ['album', 'camera'],
|
|
maxDuration: 60,
|
|
camera: ['front', 'back'],
|
|
success: function(res) {
|
|
this.src = res.tempFilePath
|
|
}
|
|
})
|
|
},
|
|
bindSendDanmu: function() {
|
|
this.videoContext.sendDanmu({
|
|
text: this.inputValue,
|
|
color: this.getRandomColor()
|
|
})
|
|
},
|
|
videoErrorCallback: function(e) {
|
|
console.log('视频错误信息:',e);
|
|
},
|
|
getRandomColor: function() {
|
|
const rgb = []
|
|
for (let i = 0; i < 3; ++i) {
|
|
let color = Math.floor(Math.random() * 256).toString(16)
|
|
color = color.length == 1 ? '0' + color : color
|
|
rgb.push(color)
|
|
}
|
|
return '#' + rgb.join('')
|
|
},
|
|
refreshToken_function(){
|
|
this.$u.api.refreshToken({}).then((res) => {
|
|
console.log(res)
|
|
if (res.errCode == 0) {
|
|
let token = res.data.token;
|
|
uni.setStorageSync('token', token);//存储toke值
|
|
}
|
|
})
|
|
}
|
|
},
|
|
mounted() {
|
|
this.refreshToken_function();
|
|
// 3秒倒计时调用
|
|
this.remaining_time();
|
|
this.apiwelcome();
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.uni-padding-wrap{
|
|
// height: 400rpx;
|
|
}
|
|
.welcome_jumpes {
|
|
z-index: 10000;
|
|
position: absolute;
|
|
top: 80rpx;
|
|
right: 60rpx;
|
|
width: 100rpx;
|
|
height: 40rpx;
|
|
border-radius: 20rpx;
|
|
font-size: 22rpx;
|
|
text-align: center;
|
|
line-height: 40rpx;
|
|
color: #fff;
|
|
background-color: rgba(0,0,0,0.5);
|
|
}
|
|
|
|
#myVideo {
|
|
width: 100%;
|
|
.time {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 10rpx;
|
|
height: 10rpx;
|
|
color: #fff;
|
|
font-size: 30rpx;
|
|
}
|
|
}
|
|
|
|
uni-video {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.uni-video-container {
|
|
background-color: none !important;
|
|
}
|
|
|
|
.welcome_images {
|
|
width: 100%;
|
|
height: 100vh;
|
|
position: fixed;
|
|
}
|
|
|
|
uni-swiper,
|
|
uni-view,
|
|
uni-image {
|
|
width: 100%;
|
|
// position: fixed;
|
|
height: 100vh;
|
|
}
|
|
|
|
uni-image {
|
|
width: 100%;
|
|
}
|
|
|
|
// 轮播图分页器颜色
|
|
uni-swiper .uni-swiper-dot-active {
|
|
background-color: #fff !important;
|
|
}
|
|
|
|
.welcome_backes {
|
|
width: 100%;
|
|
position: fixed;
|
|
height: 100%;
|
|
background: #999999;
|
|
|
|
.content {
|
|
width: 558rpx;
|
|
height: 730rpx;
|
|
background: rgba(255, 255, 255, 1);
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
top: 0;
|
|
margin: auto;
|
|
|
|
.title {
|
|
width: 558rpx;
|
|
text-align: center;
|
|
height: 29rpx;
|
|
font-size: 30rpx;
|
|
font-weight: bold;
|
|
color: rgba(51, 51, 51, 1);
|
|
line-height: 29rpx;
|
|
margin: 30rpx 0 24rpx 0;
|
|
}
|
|
|
|
.scroll {
|
|
height: 560rpx;
|
|
|
|
.protocol_content {
|
|
width: 494rpx;
|
|
height: 528rpx;
|
|
font-size: 24rpx;
|
|
font-weight: 400;
|
|
color: rgba(51, 51, 51, 1);
|
|
display: block;
|
|
text-align: left;
|
|
margin: 80rpx auto 33rpx;
|
|
letter-spacing: 1rpx;
|
|
text-align: justify;
|
|
line-height: 36rpx;
|
|
|
|
}
|
|
}
|
|
|
|
.to_agree {
|
|
width: 558rpx;
|
|
font-size: 30rpx;
|
|
font-weight: bold;
|
|
color: rgba(255, 121, 16, 1);
|
|
text-align: center;
|
|
padding-top: 27rpx;
|
|
border-top: #D8D8D8 solid 1px;
|
|
}
|
|
}
|
|
}
|
|
</style>
|