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

209 lines
4.2 KiB

5 months ago
<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>
</view>
<view class="body">
<view class="a">
<image mode="widthFix" src="@/static/1.png"></image>
</view>
<view class="b" :style="{'justify-content': slist.length==2?'flex-start':'center'}">
<template v-for="(a,i) in slist">
<view class="item item-02" :key="i" v-if="a.ranking == 2">
<image src="@/static/2.png"></image>
<view class="name">{{a.athlete_name}}</view>
<view class="desc">{{a.ranking}}</view>
</view>
<view class="item item-01" :key="i" v-if="a.ranking == 1">
<image src="@/static/4.png"></image>
<view class="name">{{a.athlete_name}}</view>
<view class="desc">{{a.ranking}}</view>
</view>
<view class="item item-03" :key="i" v-if="a.ranking == 3">
<image src="@/static/3.png"></image>
<view class="name">{{a.athlete_name}}</view>
<view class="desc">{{a.ranking}}</view>
</view>
</template>
</view>
</view>
</view>
</template>
<script>
const app = getApp()
export default {
data() {
return {
saiName: "",
slist: []
}
},
onLoad() {
this.saiName = uni.getStorageSync("saiName");
this.slist = uni.getStorageSync("slist")?uni.getStorageSync("slist").list:[];
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'){
uni.setStorageSync("slist",data)
uni.navigateTo({
url: '/pages/score/index'
})
}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') {//颁奖
this.slist = data.list
}else if(cmd == 'clear') {//清屏
uni.navigateTo({
url: '/pages/clear/index'
})
}
}
})
},
methods: {
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%;
min-height: calc(100vh - 136px);
background: url(@/static/bg.png) center center no-repeat;
background-size: cover;
.a{
width: 100%;
height: 108px;
text-align: center;
padding-top: 60px;
image{
width: 1390px;
height: 108px;
}
}
.b{
display: flex;
align-items: center;
padding: 0 10%;
justify-content: center;
margin-top: 20px;
.item{
flex:1;
max-width: 446px;
height: 662px;
margin: 0 5%;
background: url(@/static/bg.png) left top no-repeat;
background-size: contain;
text-align: center;
&-01{
order: 2;
}
&-02{
order: 1;
}
&-03{
order: 3;
}
image{
width: 300px;
height: 295px;
margin-top: 36px;
}
.name{
font-weight: bold;
font-size: 66px;
color: #FFFFFF;
margin-top: 76px;
}
.desc{
font-weight: bold;
font-size: 60px;
color: #FFFFFF;
margin-top: 36px;
}
}
}
}
@media screen and (min-width: 1200px) and (max-width: 1359px) {
.body{
.a{
image{
width: 1200px;
}
}
.b{
padding: 0 5%;
.item{
max-width: 300px;
.name{
font-size: 30px;
}
.desc{
font-size: 25px;
}
}
}
}
}
@media screen and (min-width: 1360px) and (max-width: 1500px) {
.body{
.a{
image{
width: 1360px;
}
}
.b{
padding: 0 5%;
.item{
max-width: 380px;
.name{
font-size: 40px;
}
.desc{
font-size: 30px;
}
}
}
}
}
</style>