study.vue
6.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<template>
<view>
<view v-if="loading" style="height: 100vh; width: 100vw; display: flex; justify-items: center; align-items: center;">
<view
style="height: 100%; width: 100%; display: flex; justify-items: center; align-items: center; align-content: center; justify-content: center; ">
<image style="width: 400rpx; height: 400rpx;" src="../../static/loading_icon.gif"></image>
</view>
</view>
<view v-else-if="match_list && match_list.length > 0">
<z-swiper ref="zSwiper" v-model="match_list" @slideChange="onSwiperChange" :options="options">
<z-swiper-item v-for="(item, index) in match_list" :key="item.Id" :custom-style="{width:'48%'}">
<view :class="select_index === index ? 'match-info' : 'match-info-unselect'"
@click="change_match(item, index)">
<view style="display: flex; justify-content: space-between; width: 100%;">
<text class="title-text-one" :style="{'color': (select_index === index)
? '#ffffff' : '#777777'}" @click="change_match(item, index)">{{deal_match_time(item)}}</text>
<text class="title-text-one" :style="{'color': (select_index === index)
? '#ffffff' : '#777777'}" @click="change_match(item, index)">{{item.MatchState}}</text>
</view>
<view class="team-h-g">
<image class="team-logo" :src="item.HostTeam.LogoFullPath" />
<text class="title-text-two" :style="{'color': (select_index === index)
? '#ffffff' : '#333333'}">{{item.HostName}}</text>
</view>
<view class="team-h-g">
<image class="team-logo" :src="item.GuestTeam.LogoFullPath" />
<text class="title-text-two" :style="{'color': (select_index === index)
? '#ffffff' : '#333333'}">{{item.GuestName}}</text>
</view>
</view>
</z-swiper-item>
</z-swiper>
<z-swiper ref="zSwiperInfo" v-model="match_list" @slideChange="onSwiperInfoChange" :options="info_options">
<z-swiper-item v-for="(info_item, index) in match_list" :key="info_item.Id">
<MatchEventAnalysis ref="child" :data_info="info_item" />
</z-swiper-item>
</z-swiper>
</view>
<view v-else style="align-items: center; display: flex; flex-direction: column; height: 80vh;">
<image style="height: 400rpx; width: 400rpx;" src="../../static/pic_zanwushuju@2x.png"></image>
<text>暂无内容</text>
</view>
</view>
</template>
<script>
import http from "@/utils/http";
import MatchEventStatistics from "@/components/match-list/MatchEventStatistics.vue";
import MatchEventAnalysis from "@/components/match-list/MatchEventAnalysis.vue";
import common from '../../utils/common';
export default {
components: {
MatchEventStatistics,
MatchEventAnalysis
},
data() {
return {
options: {
slidesPerView: 'auto'
},
info_options: {
centeredSlides: true,
centeredSlidesBounds: true
},
load_status: 0,
match_list: [],
view_point: null,
select_index: 0,
loading: false
}
},
methods: {
onSwiperChange(swiper) {
console.log(swiper)
this.select_index = this.$refs.zSwiper.swiper.activeIndex
this.$refs.child[this.select_index].childmethods(this.match_list[this.select_index]) //子组件$on中的名字
this.$refs.zSwiperInfo.swiper.slideTo(this.select_index); //切换到第一个slide,速度为1秒
},
onSwiperInfoChange(swiper) {
this.select_index = this.$refs.zSwiperInfo.swiper.activeIndex
this.$refs.child[this.select_index].childmethods(this.match_list[this.select_index]) //子组件$on中的名字
this.$refs.zSwiper.swiper.slideTo(this.select_index); //切换到第一个slide,速度为1秒
},
deal_match_time(match) {
let temp_data = new Date(match.MatchTime).toJSON()
let bj_time = new Date(+new Date(temp_data) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(
/\.[\d]{3}Z/, '')
return match.GameName + ' ' + bj_time.substring(5, 16)
},
change_match(item, index) {
this.$refs.zSwiperInfo.swiper.slideTo(index); //切换到第一个slide,速度为1秒
}
},
async onLoad() {
this.loading = true
let infoRes = await http.gql({
"query": `{
liveScore(lotId: 72, matchState: "未") {
count
matchs {
Id
InfoId
YiqiuMatchId
LotteryId
IssueName
MatchTime
MatchNumber
HostName
GuestName
GameName
HostTeam {
LogoFullPath
}
GuestTeam {
LogoFullPath
}
MatchState
MatchRound
PreTotalScore
Temperature
SportsInjury
SportsInfoCount
Sportsdt {
SportsdtMatchId
}
}
}
} `
})
let matchs = infoRes.data.liveScore.matchs
if (this.match_list.length > 0) {
this.match_list.length = 0
}
for (let m of matchs) {
if (m.YiqiuMatchId) {
this.match_list.push(m)
}
}
if (this.match_list.length > 0) {
this.select_index = 0
}
console.log("==========>>>", JSON.stringify(this.match_list))
this.loading = false;
}
}
</script>
<style>
.match-info {
display: flex;
flex-direction: column;
min-width: 400;
margin-top: 32rpx;
margin-left: 32rpx;
padding: 24rpx;
background: linear-gradient(135deg, #34C592 0%, #287E60 100%);
border-radius: 16rpx;
}
.match-info-unselect {
display: flex;
flex-direction: column;
margin-top: 32rpx;
min-width: 400;
margin-left: 32rpx;
padding: 24rpx;
border-radius: 16rpx;
border: 2rpx solid #04764E;
}
.team-logo {
width: 40rpx;
height: 40rpx;
border-radius: 10px;
}
.team-h-g {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 3px;
color: white;
font-size: 25rpx;
}
.text-index {
width: 56rpx;
height: 56rpx;
margin: 11px;
background-color: #F5F5F5;
color: #888888;
font-size: 14px;
border-radius: 56rpx;
line-height: 56rpx;
text-align: center;
}
.text-item {
color: #333333;
font-size: 16px;
text-align: justify;
border-radius: 20px;
line-height: 20px;
}
.title-text-one {
font-size: 28rpx;
color: white;
white-space: nowrap;
font-weight: 400;
}
.title-text-two {
font-size: 36rpx;
margin-left: 6px;
color: white;
white-space: nowrap;
font-weight: 500;
}
</style>