GameInfo.vue
8.6 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
234
235
236
237
238
239
240
241
242
243
244
245
246
<!-- 情报 -->
<template>
<div>
<div class="content-slide" v-if="game_info?.sports_info">
<!-- 主客队选择-->
<div class="tab-sel">
<div class="around">
<p :class="tab_name == game_info.host_team?.short_name ? 'around-p active-p' : 'around-p'" @click="tab_name = game_info.host_team?.short_name,is_show.host=true,is_show.away=false,is_show.zhong=false">{{ game_info.host_team?.short_name }}</p>
<p :class="tab_name == '中立' ? 'around-p active-p' : 'around-p'" @click="tab_name = '中立',is_show.host=false,is_show.away=false,is_show.zhong=true">中立</p>
<p :class="tab_name == game_info.away_team?.short_name ? 'around-p active-p' : 'around-p'" @click="tab_name = game_info.away_team?.short_name,is_show.host=false,is_show.away=true,is_show.zhong=false">{{game_info.away_team?.short_name}}</p>
</div>
</div>
<div class="info-list qb-space" v-if="game_info.dfcp_img_url && common_data.switchState" @click="look_img()">
<h6>牛牛指数截图</h6>
<img :src="game_info.dfcp_img_url" alt="牛牛指数截图">
<div style="font-size:12px; color:#999;">仅供大家参考</div>
</div>
<template v-if="is_show.host">
<!--主队 有利情报-->
<div class="info-list" v-if="game_info.sports_info?.HostGood && game_info.sports_info?.HostGood.length">
<h6><span class="t-bg"></span><span>{{ game_info.host_team?.short_name }}有利情报</span></h6>
<div class="info">
<p v-for="(item, index) in game_info.sports_info?.HostGood" :key="index"><span>{{ item }}</span></p>
</div>
</div>
<!--主队 不利情报-->
<div class="info-list" v-if="game_info.sports_info?.HostBad && game_info.sports_info?.HostBad.length">
<h6><span class="t-bg"></span><span>{{ game_info.host_team?.short_name }}不利情报</span></h6>
<div class="info">
<p v-for="(item, index) in game_info.sports_info?.HostBad" :key="index"><span>{{ item }}</span></p>
</div>
</div>
</template>
<template v-if="is_show.away">
<!--客队 有利情报-->
<div class="info-list" v-if="game_info.sports_info?.GuestGood && game_info.sports_info?.GuestGood.length">
<h6><span class="t-bg"></span><span>{{ game_info.away_team?.short_name }}有利情报</span></h6>
<div class="info">
<p v-for="(item, index) in game_info.sports_info?.GuestGood" :key="index"><span>{{ item }}</span></p>
</div>
</div>
<!--客队 不利情报-->
<div class="info-list" v-if="game_info.sports_info?.GuestBad && game_info.sports_info?.GuestBad.length">
<h6><span class="t-bg"></span><span>{{ game_info.away_team?.short_name }}不利情报</span></h6>
<div class="info">
<p v-for="(item, index) in game_info.sports_info?.GuestBad" :key="index"><span>{{ item }}</span></p>
</div>
</div>
</template>
<template v-if="is_show.zhong">
<!--中立场-->
<div class="info-list" v-if="game_info.sports_info?.PredictionDesc && game_info.sports_info?.PredictionDesc.length">
<h6><span class="t-bg"></span><span>中立情报</span></h6>
<div class="info">
<p v-for="(item, index) in game_info.sports_info?.PredictionDesc" :key="index"><span>{{ item }}</span></p>
</div>
</div>
</template>
</div>
<noData v-if="no_data" :nodata_message="'暂无情报数据!'"></noData>
</div>
</template>
<script lang="ts">
import { ref,defineComponent,onMounted,watch, computed } from "vue";
import {showImagePreview } from "vant";
import { useStore } from 'vuex';
import { useRoute } from 'vue-router';
import * as game_api from "@/api/game_api";
import noData from '@/components/NoData.vue';
export default defineComponent({
name: "GameInfo",
components: {noData},
props: {
gameInfo: {
type: Object,
default: () => { return {}; }
}
},
setup(props) {
const store:any = useStore();
const route = useRoute();
const gameInfo:any = ref({});
const game_info:any = computed(() =>{
if(props.gameInfo?.sports_info){
return props.gameInfo
}else{
return gameInfo.value
}
});
const tab_name = ref('');
const is_show = ref({
host:true,
zhong:false,
away:false,
})
const no_data = ref(false);
const init_data = async() => {
gameInfo.value = await get_game_info();
if(!game_info.value?.sports_info ||
(!game_info.value.sports_info?.HostGood && !game_info.value.sports_info?.HostBad &&
!game_info.value.sports_info?.GuestGood && !game_info.value.sports_info?.GuestBad)){
no_data.value = true;
}else{
tab_name.value = game_info.value.host_team?.short_name
}
return;
}
onMounted(init_data);
watch(() => route.query.yiqiuid || route.params.yiqiuid, (newVal: any) => {
if (newVal && game_info.value && newVal != game_info.value.id) {
console.info('info',newVal,game_info.value.id)
init_data();
}
});
const get_game_info = (async() => {
try {
if (!game_info.value?.sports_info) {
// alert(1)
const yiqiuid = route.query.yiqiuid || route.params.yiqiuid;
const gameid = route.query.gameid;
const infoid = route.query.infoid;
let temp = await game_api.get_soccer_game_info({ yiqiu_id: yiqiuid, game_id: gameid, info_id: infoid });
return temp;
}
} catch (error) {
console.info("get_soccer_game_info",error)
return {};
}
})
const look_img = () => {
showImagePreview([game_info.value.dfcp_img_url]);
}
return {
no_data,
game_info,
tab_name,
is_show,
common_data:store.state.common_data,
look_img
};
}
});
</script>
<style lang="scss" scoped>
@use '@/common/style/common' as *;
.content-slide{
background-color: #fff;
@include border-radius(5px);
margin:10px;
text-align: left;
.tab-sel {
color: var(--color-999999);
text-align: center;
justify-content: center;
.around {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
align-items: center;
justify-content: space-around;
box-sizing: border-box;
}
.around-p {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
color: #777777;
border:solid 1px #E7EEF7;
line-height: 30px;
@include border-radius(15px);
width: 100px;
margin: 2px 3px;
}
.active-p {
background: #E7EEF7;
color: #227AFF;
box-shadow: 0px 1 4px 0px rgba(34, 122, 255, 0.3);
@include border-radius(15px);
overflow: hidden;
}
}
}
.info-list {
padding: 5px 10px;
position: relative;
h6{
@include sc(16px,#333333);
font-weight: 500;
line-height: 40px;
.t-bg{
width: 25px;
height: 12px;
background-repeat: no-repeat;
background-size: contain;
background-image: url(https://img2.ydniu.com/app/images/sports_ydniu/model/ic_xiaoxi.png);
margin-right: 10px;
}
}
.info{
background: #F6F7F8;
color:#574B4B;
padding:10px;
@include border-radius(5px);
p{
font-size: 15px;
padding-left: 15px;
padding-bottom: 10px;
position: relative;
}
p:after{
content: "";
position: absolute;
width: 8px;
left: 0;
top: 6px;
height: 8px;
border-radius: 8px;
background: #227aff;
animation: activeScaleX .4s both;
-webkit-animation: activeScaleX .4s both;
z-index: 0;
}
}
}
</style>