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

327 lines
6.6 KiB

<template>
<view class="home">
<view class="header">
<view class="logo">
<image src="@/static/logo2.png"></image>
</view>
<view class="info">
<view class="a">弹射者|{{saiName}}</view>
<view class="b">{{subName}}
<view class="fs"><text>{{mr}}</text>{{fs}}</view>
</view>
</view>
</view>
<view class="body">
<view class="a">
<view class="xh"><text>名次</text></view>
<view class="xm"><text>号码</text></view>
<view class="jls"><text>姓名</text></view>
<view class="dyc"><text>单位</text></view>
<view class="dec"><text>成绩</text></view>
<view class="dsc"><text>备注</text></view>
</view>
<view class="b">
<view class="list">
<view class="item" v-for="(a,i) in slist" :key="i">
<view class="xh"><text>{{a.passage}}</text></view>
<view class="xm"><text>{{a.athlete_number}}</text></view>
<view class="jls">{{a.athlete_name}}</view>
<view class="dyc">{{a.club_name}}</view>
<view class="dec">{{a.score}}<text v-if="a.score_remake">{{a.score_remake}}</text></view>
<view class="dsc">{{a.remake}}</view>
</view>
</view>
<view class="items">
<view class="timer">公告时间{{this.timer}}</view>
<image src="@/static/bottom.png"></image>
</view>
</view>
</view>
</view>
</template>
<script>
const app = getApp();
let timer = null;
export default {
data() {
return {
slist: [],
saiName: "",
subName: "",
mr: "",
type: 1,
fs: "",
timer: ""
}
},
onLoad() {
this.saiName = uni.getStorageSync("saiName")
var obj = uni.getStorageSync("slist")?uni.getStorageSync("slist"):{};
console.log(obj.list)
this.slist = obj.list
this.subName = obj.name+obj.group_name;
this.mr = obj.mr;
this.type = obj.type;
this.fs = obj.fs;
this.initTime();
if(app.globalData.socketWBObj){
app.globalData.socketWBObj.closeSocket();
}
app.globalData.socketWBObj = new this.$websocketUtils(1);
//监听获取消息
uni.$on('socketMessage', res=>{
if(res){
var { cmd, data } = res.data !='链接成功'?JSON.parse(res.data):{};
//成绩
if(cmd == 'score'){
this.slist = data.list
}else if(cmd == 'declare') {//宣告
uni.setStorageSync("slist",data)
uni.navigateTo({
url: '/pages/declare/index'
})
}else if(cmd == 'schedule') {//日程
uni.setStorageSync("slist",data)
uni.navigateTo({
url: '/pages/schedule/index'
})
}else if(cmd == 'check_in') {//检录
uni.navigateTo({
url: '/pages/check/index'
})
}else if(cmd == 'award') {//颁奖
uni.setStorageSync("slist",data)
uni.navigateTo({
url: '/pages/award/index'
})
}else if(cmd == 'clear') {//清屏
uni.navigateTo({
url: '/pages/clear/index'
})
}
}
})
},
destroyed() {
clearInterval(timer)
},
methods: {
arrayUnique(arr, name) {
    var hash = {};
    return arr.reduce(function (item, next) {
        hash[next[name]]
            ? ""
            : (hash[next[name]] = true && item.push(next));
        return item;
    }, []);
},
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.timer = [year, month, day].map(this.formatNumber).join('-') + ' ' + [hour, minute, second].map(this.formatNumber).join(':')
},
/**
* 数字补位
*/
formatNumber(n) {
n = n.toString()
return n[1] ? n : '0' + n
}
}
}
</script>
<style lang="scss" scoped>
.body{
width: 100%;
min-height: calc(100vh - 184px);
background: url(@/static/bg3.png) center center no-repeat;
background-size: cover;
.xh{
width: 10%;
}
.xm{
width: 15%;
text-align: left;
}
.jls{
width: 20%;
text-align: left;
}
.dyc{
width: 20%;
text-align: left;
}
.dec{
width: 20%;
text-align: left;
}
.dsc{
width: 15%;
text-align: left;
}
.a{
width: 100%;
height: 66px;
background-color: #FFFFFF;
display: flex;
align-items: center;
font-weight: 400;
font-size: 50px;
color: #DD1D2B;
text-align: center;
justify-content: space-between;
}
.b{
.items{
height: 88px;
display: flex;
align-items: center;
justify-content: space-between;
border-top: 1px solid #6286d7;
image{
width: 415px;
height: 45px;
margin-right: 45rpx;
}
.timer{
font-weight: 500;
font-size: 36px;
color: #FFFFFF;
margin-left: 24px;
}
}
.list{
height: calc(100vh - 184px - 88px);
}
.item{
height: 82px;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 40px;
color: #FFFFFF;
text-align: center;
border-top: 1px solid #6286d7;
&:first-child{
border-top-color: transparent;
}
.xh{
display: flex;
align-items: center;
justify-content: center;
text{
display: block;
width: 94px;
line-height: 60px;
background: #DD1D2B;
border-radius: 5px;
}
}
.dec{
display: flex;
align-items: center;
text{
padding: 0 10px;
display: block;
font-weight: bold;
border-radius: 10px;
font-size: 38px;
color: #000000;
line-height: 50px;
margin-left: 20px;
background: linear-gradient(to bottom, #d3b580, #d67a69);
}
}
.xm{
text-align: center;
display: flex;
align-items: center;
justify-content: flex-start;
text{
display: block;
width: 140px;
line-height: 60px;
background: #f36337;
border-radius: 10px;
}
}
}
}
}
@media screen and (min-width: 1200px) and (max-width: 1359px) {
.body{
.a{
font-size: 26px;
}
.b{
.item{
font-size: 26px;
.xh{
text{
width: 60px;
}
}
.dec{
text{
font-size: 26px;
}
}
}
.items{
.timer{
font-size: 26px;
}
}
}
.c .e{
width: 360px;
}
.dyc{
white-space: nowrap;
}
}
}
@media screen and (min-width: 1360px) and (max-width: 1500px) {
.body{
.a{
font-size: 36px;
}
.b{
.item{
font-size: 36px;
.xh{
text{
width: 60px;
}
}
}
}
.c .e{
width: 360px;
}
.dyc{
white-space: nowrap;
}
}
}
</style>