体育大屏
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.
 
 
 
 

371 lines
8.8 KiB

<template>
<view class="home">
<view class="header1">
<view class="logo">
<image src="@/static/logo.png"></image>
</view>
<view class="info">
<view class="a">劳拉之星|{{saiName}}</view>
<view class="b">
<text>当前时间:{{date}}</text>
{{timer}}
</view>
</view>
</view>
<view class="body">
<view class="a">
<view class="xh"><text>序号</text></view>
<view class="xm"><text>项目</text></view>
<view class="jls" v-if="is_have_check"><text>检录室</text></view>
<view class="dyc"><text>第一次\n广播</text></view>
<view class="dec"><text>第二次\n广播</text></view>
<view class="dsc"><text>第三次\n广播</text></view>
<view class="gb" v-if="is_have_check"><text>关闭\n检录室</text></view>
<view class="jcsj"><text>进场时间</text></view>
<view class="bjsj"><text>比赛时间</text></view>
<view class="jl"><text>检录状态</text></view>
</view>
<view class="b">
<vue-seamless-scroll :data="slist" :class-option="defineScroll">
<view class="item" :class="a.check_status != 1?'item-on':''" v-for="(a,i) in slist" :key="i">
<view class="xh"><text>{{a.num}}</text></view>
<view class="xm">{{a.name}}</view>
<view class="jls" v-if="is_have_check">{{a.check_num}}</view>
<view class="dyc">{{a.first_time}}</view>
<view class="dec">{{a.second_time}}</view>
<view class="dsc">{{a.third_time}}</view>
<view class="gb" v-if="is_have_check">{{a.close_time}}</view>
<view class="jcsj">{{a.entry_time}}</view>
<view class="bjsj">{{a.start_time}}</view>
<view class="jl" :class="a.check_status == 2?'jl-on':''">
<text>{{a.check_text}}</text>
</view>
</view>
</vue-seamless-scroll>
<!-- <view class="item item-on" v-for="i in 3" :key="i">
<view class="xh"><text>1</text></view>
<view class="xm">男子U20组100米预赛第2组</view>
<view class="jls">2</view>
<view class="dyc">10:27</view>
<view class="dec">10:32</view>
<view class="dsc">10:37</view>
<view class="gb">10:42</view>
<view class="jcsj">10:47</view>
<view class="bjsj">10:52</view>
<view class="jl jl-on">
<text>正在检录</text>
</view>
</view>
<view class="item" v-for="i in 3" :key="i">
<view class="xh"><text>1</text></view>
<view class="xm">男子U20组100米预赛第2组</view>
<view class="jls">2</view>
<view class="dyc">1027</view>
<view class="dec">1032</view>
<view class="dsc">1037</view>
<view class="gb">1042</view>
<view class="jcsj">1047</view>
<view class="bjsj">1052</view>
<view class="jl">
<text>等待检录</text>
</view>
</view> -->
</view>
</view>
</view>
</template>
<script>
import vueSeamlessScroll from 'vue-seamless-scroll'
let timer = null,gtimer=null,ptimer=null;
const app = getApp();
export default {
components: {
vueSeamlessScroll
},
// 定义计算属性,默认执行一次(监听,类似于data概念);
computed: {
defineScroll() {
return {
step: 0.5, // 数值越大速度滚动越快
limitMoveNum: 2, // 开始无缝滚动的数据量 this.dataList.length
hoverStop: false, // 是否开启鼠标悬停stop
direction: 1, // 0向下 1向上 2向左 3向右
openWatch: true, // 开启数据实时监控刷新dom
// 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
singleHeight: 0,
// 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
singleWidth: 0,
waitTime: 1000, // 单步运动停止的时间(默认值1000ms)
};
},
},
data() {
return {
marginTop: 0,
date: "",
timer: "",
saiName: "",
id: "",
slist: [],
is_have_check:false
}
},
onLoad() {
this.saiName = uni.getStorageSync("saiName");
this.id = uni.getStorageSync("sid");
this.is_have_check = uni.getStorageSync("slist").is_have_check
this.initTime();
if(app.globalData.socketWBObj){
app.globalData.socketWBObj.closeSocket();
}
app.globalData.socketWBObj = new this.$websocketUtils(2);
clearTimeout(gtimer)
const that = this;
gtimer=setInterval(()=>{
console.log(app.globalData.socketWBObj.isOpenSocket)
if(app.globalData.socketWBObj.isOpenSocket){
console.log({cmd:'get_check_in','matchs_id': that.sid})
app.globalData.socketWBObj.send(JSON.stringify({cmd:'get_check_in','matchs_id': that.id}))
}
},60000)
//监听获取消息
uni.$on('socketMessage', res=>{
if(res){
var { cmd, data } = res.data !='链接成功'?JSON.parse(res.data):{};
//成绩
if(cmd == 'score'){
uni.setStorageSync("slist",data)
uni.navigateTo({
url: '/pages/index/index'
})
}else if(cmd == 'declare') {//宣告
uni.setStorageSync("slist",data)
uni.navigateTo({
url: '/pages/index/index'
})
}else if(cmd == 'schedule') {//日程
uni.setStorageSync("slist",data)
uni.navigateTo({
url: '/pages/index/index'
})
}else if(cmd == 'check_in') {//检录
this.slist = data.list
this.is_have_check = data.is_have_check
}else if(cmd == 'award') {//颁奖
uni.setStorageSync("slist",data)
uni.navigateTo({
url: '/pages/index/index'
})
}else if(cmd == 'clear') {//清屏
uni.navigateTo({
url: '/pages/index/index'
})
}
}
})
},
destroyed() {
clearInterval(timer)
clearInterval(gimer)
},
methods: {
initTime() {
const that = this;
that.formatTime();
clearInterval(timer)
timer = setInterval(function() {
that.formatTime()
},1000)
},
/**
* 当前时间格式化 formatTime(new Data())
*/
formatTime() {
const year = new Date().getFullYear()
const month = new Date().getMonth() + 1
const day = new Date().getDate()
const hour = new Date().getHours()
const minute = new Date().getMinutes()
const second = new Date().getSeconds()
this.date = [year, month, day].map(this.formatNumber).join('-')
this.timer = [hour, minute, second].map(this.formatNumber).join(':')
},
/**
* 数字补位
*/
formatNumber(n) {
n = n.toString()
return n[1] ? n : '0' + n
},
arrayUnique(arr, name) {
    var hash = {};
    return arr.reduce(function (item, next) {
        hash[next[name]]
            ? ""
            : (hash[next[name]] = true && item.push(next));
        return item;
    }, []);
},
}
}
</script>
<style lang="scss" scoped>
.body{
width: 100%;
height: calc(100vh - 136px);
background-color: #06138e;
overflow: hidden;
.xh{
width: 8%;
}
.xm{
width: 400px;
white-space: nowrap;
}
.jls{
width: 10%;
}
.dyc{
width: 8%;
}
.dec{
width: 8%;
}
.dsc{
width: 8%;
}
.gb{
width: 8%;
}
.jcsj{
width: 8%;
}
.bjsj{
width: 8%;
}
.jl{
width: 10%;
padding-right: 30px;
box-sizing: border-box;
}
.a{
width: 100%;
height: 90px;
background-color: #0A59E5;
display: flex;
align-items: center;
font-weight: 400;
font-size: 30px;
color: #FFFFFF;
text-align: center;
justify-content: space-between;
}
.b{
overflow: hidden;
.item{
height: 60px;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 30px;
color: #FFFFFF;
text-align: center;
&:nth-child(2n){
background-color: #0833B5;
}
.xh{
display: flex;
align-items: center;
justify-content: center;
text{
display: block;
width: 48px;
line-height: 34px;
background: #DD1D2B;
border-radius: 5px;
}
}
.xm{
text-align: left;
}
.jl{
padding-right: 30px;
box-sizing: border-box;
font-size: 30px;
white-space: nowrap;
}
&-on{
.jl{
text{
display: block;
width: 170px;
line-height: 32px;
background: #DD1D2B;
color: #FFFF00;
border-radius: 5px;
}
}
.jl-on{
text{
display: block;
width: 170px;
line-height: 32px;
background: #FFFF00;
color: #DD1D2B;
border-radius: 5px;
}
}
color: #FFFF00;
}
}
}
}
@media screen and (min-width: 1200px) and (max-width: 1359px) {
.body{
.a{
white-space: nowrap;
height: 70px;
font-size: 20px;
}
.b{
.item{
font-size: 20px;
.jl{
font-size: 20px;
text{
width: 100%;
}
}
}
}
}
}
@media screen and (min-width: 1360px) and (max-width: 1500px) {
.body{
.a{
font-size: 25px;
white-space: nowrap;
height: 70px;
}
.b{
.item{
font-size: 25px;
.jl{
font-size: 20px;
text{
width: 100%;
}
}
}
}
}
}
</style>