MatchEventAnalysis.vue 11.1 KB
<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-if="!loading">
			<view v-if="!info.status_analysis || !info.status_analysis.home_result">
				<view
					style="height: 50vh; width: 100%; display: flex; justify-items: center; align-items: center; align-content: center; justify-content: center; ">
					<text>暂无分析内容</text>
				</view>
			</view>
			<view v-else >
				<view class="content"
					style="display: flex; flex-direction: row; padding-left: 13px; padding-right: 13px; margin-top: 11px; ">
					<view style="display: flex;flex-direction: column; padding-right: 14px; padding-top: 7px">
						<view class="text2" style="text-align: right;">{{host.lose_avg_balls}}</view>
						<view class="text" style="text-align: right;">主队均失球</view>
					</view>
					<view style="display: flex; flex-direction: column; padding-left: 14px; 	padding-top: 7px">
						<view class="text2" style="text-align: left;">{{guest.lose_avg_balls}}</view>
						<view class="text" style="text-align: left;">客队均失球</view>
					</view>
				</view>

				<view style="display: flex; justify-content: center; margin: 32rpx;">
					<image style="width: 210rpx; height: 50rpx; " src="../../static/common/zonghenengli.png"></image>

				</view>

				<view style="display: flex;  margin-left: 30rpx; margin-right: 30rpx; margin-top: 16rpx;">
					<view class="left-bar" :style="'width:' + host.rate">{{host.rate}}</view>
					<view class="right-bar" :style="'width:' + guest.rate">{{guest.rate}}</view>
				</view>

				<view
					style="display: flex; justify-content: space-between; margin-left: 30rpx; margin-right: 30rpx; margin-top: 16rpx;">

					<text class="team_text">{{info.home_name}}</text>
					<text class="team_text">{{info.away_name}}</text>
				</view>

				<view class="text3">{{radar_chart_data.predict_value}}</view>

				<view style="display: flex; justify-content: center;">
					<image style="width: 210rpx; height: 50rpx;margin: 32rpx;" src="../../static/common/status_a.png">
					</image>
				</view>

				<view v-show="info.status_analysis" style="display: flex;  margin-left: 30rpx; margin-right: 30rpx;">
					<text class="team_text" style="margin-right: 30rpx;">{{info.home_name}}</text>
					<view style="display: flex; flex: 1;">
						<view class="left-bar" :style="'width:' + info.status_analysis.home_result.status_score + '%'">
							{{info.status_analysis.home_result.status_score + "%"}}
						</view>
					</view>

					<text
						style="color: #333333; font-size: 30rpx;">{{info.status_analysis.home_result.status_score + "分"}}</text>

					<text class="status_s_text">{{info.status_analysis.home_result.status_txt}} </text>
				</view>

				<view v-show="info.status_analysis" class="status_text_bg">
					<text
						style="color: #777777; font-size: 30rpx;">{{info.status_analysis.home_result.result_value}}</text>

					<text
						style="color: #04764E; font-size: 30rpx; margin-top: 16rpx;">{{info.status_analysis.pre_home_data}}</text>
				</view>

				<view v-show="info.status_analysis"
					style="display: flex;  margin-left: 30rpx; margin-right: 30rpx; margin-top: 30rpx;">
					<text class="team_text" style="margin-right: 30rpx;">{{info.away_name}}</text>
					<view style="display: flex; flex: 1;">
						<view class="left-bar" :style="'width:' + info.status_analysis.away_result.status_score + '%'">
							{{info.status_analysis.away_result.status_score + "%"}}
						</view>
					</view>

					<text
						style="color: #333333; font-size: 30rpx;">{{info.status_analysis.away_result.status_score + "分"}}</text>

					<text class="status_s_text">{{info.status_analysis.away_result.status_txt}} </text>
				</view>

				<view v-show="info.status_analysis" class="status_text_bg">
					<text
						style="color: #777777; font-size: 30rpx;">{{info.status_analysis.away_result.result_value}}</text>

					<text
						style="color: #04764E; font-size: 30rpx; margin-top: 16rpx;">{{info.status_analysis.pre_away_data}}</text>
				</view>

				<view class="content"
					style="display: flex; flex-direction: row; padding-left: 13px; padding-right: 13px; margin-top: 11px; ">
					<view style="display: flex;flex-direction: column; padding-right: 14px ; padding-bottom: 7px;">
						<view class="text2" style="text-align: right;">{{host.win_avg_balls}}</view>
						<view class="text" style="text-align: right;">主队均进球</view>
					</view>


					<image style="width: 50rpx; height: 90rpx;" src="../../static/VS@2x.png"></image>

					<view style="display: flex;  flex-direction: column; padding-left: 14px; padding-bottom: 7px; ">
						<view class="text2" style="text-align: left;">{{guest.win_avg_balls}}</view>
						<view class="text" style="text-align: left;">客队均进球</view>
					</view>
				</view>
				
				<view class="charts-box" v-if="chartData">
					<qiun-data-charts type="radar" :opts="opts" :chartData="chartData" :canvas2d="true" />
				</view>


			</view>
		</view>
	</view>


</template>

<script>
	import {
		default as http
	} from "@/utils/http.js";
	import common from '@/utils/common.js'
	import {
		setTimeout
	} from "timers";
	export default {
		props: {
			data_info: [Object]
		},
		data() {
			return {
				common,
				canvasId: "yiqiu_id" + this.data_info.YiqiuMatchId,
				loading: true,
				select_data: this.data_info,
				host: {},
				guest: {},
				radar_chart_data: {},
				info: {},
				chartData: {},
				//您可以通过修改 config-ucharts.js 文件中下标为 ['radar'] 的节点来配置全局默认参数,如都是默认参数,此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。
				opts: {
					color: ["#F02121", "#04764E", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
						"#ea7ccc"
					],
					padding: [0, 0, 0, 0],
					dataLabel: false,
					enableScroll: false,
					fontSize: 16,
					fontColor: "#333333",
					legend: {
						show: true,
						position: "bottom",
						lineHeight: 25
					},
					extra: {
						radar: {
							gridType: "radar",
							gridColor: "#D8DDDB",
							gridCount: 2,
							opacity: 0.2,
							max: 100,
							labelShow: true,
							border: true
						}
					}
				}
			};
		},
		mounted() {
			this.getServerData()
		},
		methods: {
			async getServerData() {
				console.log("getServerData:" + JSON.stringify(this.select_data))
				var yiqiu_id = this.select_data.YiqiuMatchId;
				// var yiqiu_id = 7065015
				this.canvasId = "yiqiu_id:" + yiqiu_id
				console.log(yiqiu_id)
				this.loading = true
				if (yiqiu_id) {
					let result = await http.gql({
						query: `query{
							get_soccer_game_base_surface_detail(yiqiu_id:${yiqiu_id})
						}`
					})

					//处理返回请求
					if (result && result.data && result.data.get_soccer_game_base_surface_detail) {
						if (result.data.get_soccer_game_base_surface_detail.error) {
							clearInterval(this.timer);
							this_.disabled = false;
							uni.showToast({
								icon: "none",
								title: result.data.get_soccer_game_base_surface_detail.error,
							});
						} else {
							this.radar_chart_data = result.data.get_soccer_game_base_surface_detail.result
								.radar_chart_data

							this.info = result.data.get_soccer_game_base_surface_detail.result;

							this.host = this.radar_chart_data.host_result;
							this.guest = this.radar_chart_data.guest_result;
							let res = {
								categories: ["身价", "技术", "排名", "状态", "防守", "进攻"],
								series: [{
										name: "主队",
										data: [this.host.team_worth, this.host.tech_score, this.host.team_rank,
											this.host
											.status_score, this.host.defend_total, this.host.attack_total
										]
									},
									{
										name: "客队",
										data: [this.guest.team_worth, this.guest.tech_score, this.guest
											.team_rank, this.guest
											.status_score, this.guest.defend_total, this.guest.attack_total
										]
									}
								]
							};
							console.log(JSON.stringify(result))
							var this_ = this;
							setTimeout(function() {
								this_.chartData = JSON.parse(JSON.stringify(res));
							}, 100)

						}
					}
				} else {
					uni.showToast({
						icon: "none",
						title: "暂无详情数据",
					});
				}
				this.loading = false

			},
			childmethods(item) {
				console.log("childMethods:" + JSON.stringify(item))
				this.select_data = item;
				this.getServerData()
			}
		}
	}
</script>

<style>
	.charts-box {
		margin-top: 30rpx;
		width: 100%;
		height: 300px;
	}

	.text {
		color: #D8D8D8;
		font-size: 28rpx;
		text-align: left;
		font-family: SourceHanSansSC-regular;

	}

	.text2 {
		color: #20262E;
		font-size: 30rpx;
		text-align: right;
		font-family: SourceHanSansSC-regular;
	}

	.content {
		display: flex;
		margin-left: 60rpx;
		margin-right: 60rpx;
		justify-content: space-between;
		justify-items: center;
		align-items: center;
	}

	.left-bar {
		color: #fff;
		font-size: 15px;
		text-align: center;
		font-weight: bold;
		background: #F02121;
		border-top-left-radius: 0.8rem;
		border-bottom-left-radius: 0.8rem;
	}

	.right-bar {
		color: #fff;
		font-size: 15px;
		text-align: center;
		background: #04764E;
		font-weight: bold;
		border-top-right-radius: 0.8rem;
		border-bottom-right-radius: 0.8rem;
	}

	.text3 {
		text-align: left;
		padding-left: 28rpx;
		padding-right: 28rpx;
		margin-top: 20rpx;
		margin-bottom: 40rpx;
		font-size: 30rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #777777;
	}

	.button {
		line-height: 40rpx;
		border-radius: 40rpx;
		background: linear-gradient(180deg, rgba(40, 120, 255, 1) 0%, rgba(40, 111, 234, 1) 100%);
		color: rgba(255, 255, 255, 1);
		font-size: 28rpx;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		margin-left: 26rpx;
		margin-right: 26rpx;
		text-align: center;
		font-family: Roboto;
	}

	.team_text {
		font-size: 30rpx;
		font-weight: 500;
		color: #333333;
	}

	.status_text_bg {
		background: #E3F0EC;
		border-radius: 16rpx;
		margin-left: 30rpx;
		margin-right: 30rpx;
		margin-bottom: 24rpx;
		margin-top: 24rpx;
		padding: 24rpx;
		display: flex;
		flex-direction: column;
	}

	.status_s_text {
		background: #FF9139;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		font-size: 28rpx;
		font-weight: 400;
		height: 40rpx;
		line-height: 40rpx;
		padding-left: 6rpx;
		padding-right: 6rpx;
		color: #FFFFFF;
		text-align: center;
		margin-left: 24rpx;
		margin-right: 24rpx;
	}
</style>