|
@@ -1,29 +1,67 @@
|
|
|
<template>
|
|
|
<div id="playing_container">
|
|
|
- <canvas type="2d" canvas-id="line_chart"></canvas>
|
|
|
+ <view><input type="number" v-model="game_record_id" placeholder="输入游戏编号">
|
|
|
+ <button class="cu-btn" @click="getGameLine">获取</button>
|
|
|
+ </view>
|
|
|
+ <view class="chart">
|
|
|
+ <mpvue-echarts :echarts="echarts" :onInit="attCharts"/>
|
|
|
+ </view>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import wxCharts from '../../../static/wxcharts'
|
|
|
+import mpvueEcharts from 'mpvue-echarts'
|
|
|
+import echarts from '../../../static/echarts.min';
|
|
|
+import {gameLineChart} from "../../requests/game";
|
|
|
+import util from '../../utils/index'
|
|
|
|
|
|
+var att_charts;
|
|
|
var $this;
|
|
|
+
|
|
|
+// 大脑图表初始化
|
|
|
+function initAttChart(canvas, width, height) {
|
|
|
+ att_charts = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height
|
|
|
+ });
|
|
|
+ canvas.setChart(att_charts);
|
|
|
+
|
|
|
+ let option = {}; // ECharts 配置项
|
|
|
+
|
|
|
+ att_charts.setOption(option);
|
|
|
+ return att_charts; // 返回 chart 后可以自动绑定触摸操作
|
|
|
+}
|
|
|
+
|
|
|
export default {
|
|
|
name: "index_container",
|
|
|
+ components: {
|
|
|
+ mpvueEcharts
|
|
|
+ },
|
|
|
data() {
|
|
|
- return {}
|
|
|
+ return {
|
|
|
+ // 折线图
|
|
|
+ echarts,
|
|
|
+ attCharts: initAttChart,
|
|
|
+ game_record_id: ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 获取游戏详情
|
|
|
+ getGameLine() {
|
|
|
+ let $params = {
|
|
|
+ // 'game_record_id': 1529,
|
|
|
+ 'game_record_id': $this.game_record_id,
|
|
|
+ }
|
|
|
+ gameLineChart($params).then((res) => {
|
|
|
+ let $res = res.data
|
|
|
+ let $options = util.getLineOption($res.data.line, [0])
|
|
|
+ att_charts.setOption($options)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
},
|
|
|
- methods: {}
|
|
|
- ,
|
|
|
onLoad() {
|
|
|
- let line = new wxCharts({
|
|
|
- canvasId: "line_chart",
|
|
|
- width: 360,
|
|
|
- height: 193,
|
|
|
- type: 'line',
|
|
|
- categories: [16, 10],
|
|
|
- series: [{data: [10], color: '#fad355'}, {data: [7], color: '#4e83fd'}]
|
|
|
- })
|
|
|
},
|
|
|
created() {
|
|
|
$this = this;
|
|
@@ -41,25 +79,12 @@ export default {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-.text-default {
|
|
|
- color: #9A95B7;
|
|
|
- font-size: 10px;
|
|
|
-}
|
|
|
-
|
|
|
-/*电量显示*/
|
|
|
-.elc_power_container {
|
|
|
- width: 28px;
|
|
|
- border: #9A95B7 3px solid;
|
|
|
- border-radius: 5px;
|
|
|
- height: 22px;
|
|
|
+.chart {
|
|
|
+ width: 360px;
|
|
|
+ height: 193px;
|
|
|
+ background: #302D43;
|
|
|
+ opacity: 0.6;
|
|
|
+ border-radius: 10px;
|
|
|
}
|
|
|
|
|
|
-.device_elc {
|
|
|
- height: 16px;
|
|
|
-}
|
|
|
-
|
|
|
-.pop_title {
|
|
|
- height: 50px;
|
|
|
-}
|
|
|
</style>
|