deming/components/remaining/remaining.vue

334 lines
7.9 KiB
Vue
Raw Normal View History

2020-06-18 14:57:26 +08:00
<template>
2020-06-02 08:49:13 +08:00
<view>
2020-06-19 19:20:33 +08:00
<!-- <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">
2020-08-04 19:39:31 +08:00
<video id="myVideo" enable-progress-gesture="false" :src=" 'https://' + vide0_url" autoplay controls="false" @error="videoErrorCallback"
2020-07-14 08:30:28 +08:00
enable-danmu danmu-btn></video>
2020-06-19 19:20:33 +08:00
</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>
2020-06-02 08:49:13 +08:00
<!-- 轮播图 -->
2020-07-15 16:04:31 +08:00
<view class="uni-padding-wrap" v-if="banner" >
2020-07-14 08:30:28 +08:00
<view>
<view class="uni-padding-wrap">
<view class="page-section swiper">
<view class="page-section-spacing">
2020-08-04 14:36:35 +08:00
<swiper class="swiper" :indicator-dots="true" :style="{height:heightOut+'px'}" :autoplay="false" :interval="3000" :duration="1000" @animationfinish="">
2020-08-01 11:16:53 +08:00
<swiper-item v-for="(item,index) in list" :key="index">
2020-07-14 08:30:28 +08:00
<view class="swiper-item uni-bg-red">
<image :src=" 'https://' + item.launch_path"></image>
</view>
2020-08-04 19:39:31 +08:00
<view class="btn-init" v-if="parseInt(index) == 2" @click="goNext">立即体验</view>
2020-07-15 16:04:31 +08:00
</swiper-item>
2020-07-14 08:30:28 +08:00
</swiper>
</view>
2020-06-19 19:20:33 +08:00
</view>
2020-06-02 08:49:13 +08:00
</view>
</view>
</view>
<!-- 用户协议弹窗 -->
<view class="welcome_backes" v-if="protocol">
<view class="content">
2020-06-18 14:57:26 +08:00
<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>
2020-06-02 08:49:13 +08:00
<view class="to_agree" @click="to_agree">我同意</view>
</view>
2020-06-18 14:57:26 +08:00
</view>
</view>
</template>
<script>
2020-07-01 17:32:36 +08:00
import common from '@/static/js/common.js'
2020-06-18 14:57:26 +08:00
export default {
data() {
return {
2020-07-31 08:45:30 +08:00
remaining: 11,
2020-06-19 19:20:33 +08:00
type: true,
banner: false,
protocol: false,
2020-07-14 08:30:28 +08:00
heightOut: '',
2020-06-19 19:20:33 +08:00
imgurl: [],
2020-07-14 08:30:28 +08:00
vide0_url: '',
2020-06-18 14:57:26 +08:00
agreement: { // 用户协议内容
document_title: "",
document_content: ""
2020-06-19 19:20:33 +08:00
},
2020-07-14 08:30:28 +08:00
heightesStyle : {
height : ''
},
2020-06-19 19:20:33 +08:00
title: 'video',
src: '',
2020-07-14 08:30:28 +08:00
inputValue: '',
controls: false,
list: [],
background: ['color1', 'color2', 'color3'],
indicatorDots: true,
interval: 2000,
2020-08-04 19:39:31 +08:00
duration: 500,
swiper_index: "",
2020-06-18 14:57:26 +08:00
};
2020-06-19 19:20:33 +08:00
},
onReady: function(res) {
2020-08-04 14:36:35 +08:00
this.videoContext = uni.createVideoContext('myVideo');
2020-06-02 08:49:13 +08:00
},
methods: {
2020-06-19 19:20:33 +08:00
apiwelcome() {
2020-06-17 12:09:28 +08:00
this.$u.api.documentInfo({
2020-06-19 19:20:33 +08:00
document_code: 'agreement'
}).then((res) => {
2020-06-18 14:57:26 +08:00
if (res.errCode == 0) {
let agreement = res.data;
2020-06-19 19:20:33 +08:00
// console.log(agreement.document_content)
2020-07-01 17:32:36 +08:00
agreement.document_content = common.unescapeHTML(agreement.document_content);
2020-06-18 14:57:26 +08:00
// console.log(agreement);
this.agreement = agreement;
}
2020-06-17 12:09:28 +08:00
})
// 启动页
2020-06-19 19:20:33 +08:00
this.$u.api.pageList({}).then((res) => {
console.log('协议', res)
let data_image = res.data.welcome_page
2020-07-14 08:30:28 +08:00
let vide0_url = res.data.start_page[0].launch_path
2020-06-19 19:20:33 +08:00
this.list = data_image;
this.vide0_url = vide0_url;
2020-06-17 12:09:28 +08:00
})
},
2020-06-02 08:49:13 +08:00
// 3秒倒计时
2020-06-19 19:20:33 +08:00
remaining_time() {
this.timer = setInterval(() => {
2020-06-02 08:49:13 +08:00
this.remaining--;
2020-06-19 19:20:33 +08:00
if (this.remaining <= 0) {
2020-06-02 08:49:13 +08:00
clearInterval(this.timer);
2020-06-19 19:20:33 +08:00
console.log("完了")
2020-08-04 14:36:35 +08:00
this.type = !this.type;
2020-06-02 08:49:13 +08:00
this.banner = !this.banner;
}
2020-06-19 19:20:33 +08:00
}, 1000);
2020-06-02 08:49:13 +08:00
},
2020-06-19 19:20:33 +08:00
leap_over() {
2020-06-02 08:49:13 +08:00
this.type = !this.type
this.banner = !this.banner;
2020-07-14 08:30:28 +08:00
clearInterval(this.timer)
// 获取屏幕高度
this.getSystemInfo()
2020-06-02 08:49:13 +08:00
},
2020-06-19 19:20:33 +08:00
leap_overto() {
2020-07-14 08:30:28 +08:00
this.protocol = true;
this.banner = false;
2020-06-02 08:49:13 +08:00
},
2020-06-19 19:20:33 +08:00
getSystemInfo() {
2020-07-14 08:30:28 +08:00
let that = this;
2020-06-02 08:49:13 +08:00
// 获取屏幕高度
uni.getSystemInfo({
2020-06-19 19:20:33 +08:00
success: function(res) {
2020-07-14 08:30:28 +08:00
that.heightOut = res.windowHeight;
2020-07-31 08:45:30 +08:00
console.log(that.heightOut)
2020-06-19 19:20:33 +08:00
}
2020-06-02 08:49:13 +08:00
});
},
2020-08-04 19:39:31 +08:00
// 立即体验
goNext() {
this.protocol = true;
this.banner = false;
},
2020-06-02 08:49:13 +08:00
// 我同意
2020-06-19 19:20:33 +08:00
to_agree() {
2020-07-31 08:45:30 +08:00
uni.setStorage({
key: 'launchFlag',
data: true,
success: function() {
2020-08-04 14:36:35 +08:00
console.log('点击存储launchFlag');
2020-07-31 08:45:30 +08:00
}
});
2020-06-02 08:49:13 +08:00
uni.navigateTo({
2020-06-19 19:20:33 +08:00
url: '/pageA/login/login'
2020-06-02 08:49:13 +08:00
});
2020-06-19 19:20:33 +08:00
},
// 视频引入
bindInputBlur: function(e) {
2020-08-04 14:36:35 +08:00
this.inputValue = e.target.value;
console.log(e.target.value);
2020-06-19 19:20:33 +08:00
},
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) {
2020-07-31 08:45:30 +08:00
console.log('视频错误信息:',e);
2020-06-19 19:20:33 +08:00
},
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('')
2020-07-14 08:30:28 +08:00
},
2020-07-15 16:04:31 +08:00
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值
}
})
2020-06-02 08:49:13 +08:00
}
2020-07-14 08:30:28 +08:00
},
mounted() {
2020-08-04 14:36:35 +08:00
this.refreshToken_function();
2020-07-14 08:30:28 +08:00
// 3秒倒计时调用
2020-08-04 14:36:35 +08:00
this.remaining_time();
this.apiwelcome();
2020-07-14 08:30:28 +08:00
}
2020-06-18 14:57:26 +08:00
}
</script>
2020-06-02 08:49:13 +08:00
2020-06-18 14:57:26 +08:00
<style lang="scss" scoped>
2020-07-14 08:30:28 +08:00
.uni-padding-wrap{
// height: 400rpx;
}
2020-08-04 19:39:31 +08:00
.btn-init {
z-index: 1000;
position: absolute;
bottom: 100rpx;
right: 30%;
width: 300rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
color: #fff;
border-radius: 40rpx;
background-color: #007AFF;
}
2020-06-19 19:20:33 +08:00
.welcome_jumpes {
2020-08-04 19:39:31 +08:00
z-index: 100;
2020-06-02 08:49:13 +08:00
position: absolute;
2020-07-31 08:45:30 +08:00
top: 80rpx;
right: 60rpx;
width: 100rpx;
height: 40rpx;
border-radius: 20rpx;
2020-07-15 16:04:31 +08:00
font-size: 22rpx;
2020-06-02 08:49:13 +08:00
text-align: center;
2020-07-31 08:45:30 +08:00
line-height: 40rpx;
2020-06-02 08:49:13 +08:00
color: #fff;
2020-07-31 08:45:30 +08:00
background-color: rgba(0,0,0,0.5);
2020-06-02 08:49:13 +08:00
}
2020-07-14 08:30:28 +08:00
#myVideo {
2020-08-04 14:36:35 +08:00
width: 100%;
2020-06-19 19:20:33 +08:00
}
2020-07-14 08:30:28 +08:00
uni-video {
2020-06-19 19:20:33 +08:00
width: 100%;
2020-08-04 14:36:35 +08:00
height: 100%;
2020-06-19 19:20:33 +08:00
}
2020-07-14 08:30:28 +08:00
.uni-video-container {
background-color: none !important;
2020-06-19 19:20:33 +08:00
}
2020-07-14 08:30:28 +08:00
2020-06-02 08:49:13 +08:00
.welcome_images {
width: 100%;
2020-07-31 08:45:30 +08:00
height: 100vh;
2020-06-02 08:49:13 +08:00
position: fixed;
}
2020-06-19 19:20:33 +08:00
uni-swiper,
uni-view,
uni-image {
2020-06-02 08:49:13 +08:00
width: 100%;
2020-06-18 14:57:26 +08:00
// position: fixed;
2020-07-31 08:45:30 +08:00
height: 100vh;
2020-06-02 08:49:13 +08:00
}
2020-06-19 19:20:33 +08:00
uni-image {
2020-06-02 08:49:13 +08:00
width: 100%;
}
2020-06-19 19:20:33 +08:00
2020-06-02 08:49:13 +08:00
// 轮播图分页器颜色
2020-06-19 19:20:33 +08:00
uni-swiper .uni-swiper-dot-active {
background-color: #fff !important;
2020-06-02 08:49:13 +08:00
}
2020-06-19 19:20:33 +08:00
.welcome_backes {
2020-06-02 08:49:13 +08:00
width: 100%;
position: fixed;
height: 100%;
2020-06-19 19:20:33 +08:00
background: #999999;
.content {
width: 558rpx;
height: 730rpx;
background: rgba(255, 255, 255, 1);
2020-06-02 08:49:13 +08:00
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
margin: auto;
2020-06-19 19:20:33 +08:00
.title {
width: 558rpx;
2020-06-02 08:49:13 +08:00
text-align: center;
2020-06-19 19:20:33 +08:00
height: 29rpx;
font-size: 30rpx;
font-weight: bold;
color: rgba(51, 51, 51, 1);
line-height: 29rpx;
2020-06-02 08:49:13 +08:00
margin: 30rpx 0 24rpx 0;
}
2020-06-19 19:20:33 +08:00
2020-06-18 14:57:26 +08:00
.scroll {
height: 560rpx;
2020-06-19 19:20:33 +08:00
.protocol_content {
width: 494rpx;
height: 528rpx;
font-size: 24rpx;
font-weight: 400;
color: rgba(51, 51, 51, 1);
2020-06-18 14:57:26 +08:00
display: block;
text-align: left;
margin: 80rpx auto 33rpx;
letter-spacing: 1rpx;
text-align: justify;
line-height: 36rpx;
}
2020-06-02 08:49:13 +08:00
}
2020-06-19 19:20:33 +08:00
.to_agree {
width: 558rpx;
font-size: 30rpx;
font-weight: bold;
color: rgba(255, 121, 16, 1);
2020-06-02 08:49:13 +08:00
text-align: center;
padding-top: 27rpx;
border-top: #D8D8D8 solid 1px;
}
}
2020-06-18 14:57:26 +08:00
}
2020-07-14 08:30:28 +08:00
</style>