index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <div id="report_container">
  3. <view class="head"></view>
  4. <img class="boy" src="https://img.shuimuai.com/m_sign_chengji_boy%402x.png"/>
  5. <view class="user">
  6. <view class="up">
  7. <view class="left">
  8. <img :src="userinfo.portrait"/>
  9. <view>
  10. <text>{{ record.user_name }}</text>
  11. <text>{{ userinfo.level_name }}</text>
  12. </view>
  13. </view>
  14. <view class="right" @click="to_game_records">
  15. <img src="https://img.shuimuai.com/m_icon_chengji%402x.png"/>
  16. <text>成绩记录</text>
  17. </view>
  18. </view>
  19. <view class="down">
  20. <view>{{ record.att_average }}</view>
  21. <view>专注力得分</view>
  22. </view>
  23. </view>
  24. <view class="bar">
  25. <view>
  26. <view class="line"></view>
  27. <view class="title">数据详情</view>
  28. </view>
  29. </view>
  30. <view class="detail">
  31. <view>
  32. <view>{{ record.att_max }}</view>
  33. <view>专注力最高分</view>
  34. </view>
  35. <view>
  36. <view>{{ record.med_max }}</view>
  37. <view>放松度最高值</view>
  38. </view>
  39. <view>
  40. <view>{{ record.med_average }}</view>
  41. <view>放松度均值</view>
  42. </view>
  43. </view>
  44. <view class="bar">
  45. <view>
  46. <view class="line"></view>
  47. <view class="title">基本脑波</view>
  48. </view>
  49. </view>
  50. <view class="chart">
  51. <mpvue-echarts :echarts="echarts" :onInit="attCharts" canvasId="demo-canvas"/>
  52. </view>
  53. <view class="conclution">专注力良好,你的表现比一般人好。专注力波动较大,比较容易被外界干扰。你大多数时候不能很好地集中注意力,请继续加油。</view>
  54. <view class="bar">
  55. <view>
  56. <view class="line"></view>
  57. <view class="title">核销详情</view>
  58. </view>
  59. </view>
  60. <view class="sheet">
  61. <view class="left">
  62. <view>专注力训练设备: {{ record.name }}</view>
  63. <view>核销方式:
  64. <text v-if="record.consumption_type==1">次卡</text>
  65. <text v-if="record.consumption_type==2">时间卡</text>
  66. </view>
  67. <view>会员游玩时间: {{ record.play_time }}秒</view>
  68. </view>
  69. <view class="right">
  70. <view>专注力训练时长: {{ record.play_time }}秒</view>
  71. </view>
  72. </view>
  73. </div>
  74. </template>
  75. <script>
  76. import mpvueEcharts from 'mpvue-echarts'
  77. import echarts from '../../../static/echarts.min';
  78. import util from '../../utils/index'
  79. import {gameDetail, gameLineChart} from "../../requests/game";
  80. import game_store from "../../store/game";
  81. var att_charts,
  82. $this
  83. // 大脑图表初始化
  84. function initAttChart(canvas, width, height) {
  85. att_charts = echarts.init(canvas, null, {
  86. width: width,
  87. height: height
  88. });
  89. canvas.setChart(att_charts);
  90. var option = util.getLineOption([0], [0]); // ECharts 配置项
  91. att_charts.setOption(option);
  92. return att_charts; // 返回 chart 后可以自动绑定触摸操作
  93. }
  94. export default {
  95. name: "index_container",
  96. components: {
  97. mpvueEcharts
  98. },
  99. data() {
  100. return {
  101. // 0:未选择 1:时间 2:次数
  102. // 折线图
  103. attCharts: initAttChart,
  104. echarts,
  105. record: {},
  106. userinfo: {},
  107. record_id: 0
  108. }
  109. },
  110. methods: {
  111. // 获取游戏报告
  112. get_report($record_id) {
  113. gameDetail($record_id).then((res) => {
  114. let $res = res.data;
  115. $this.record = $res.data
  116. })
  117. },
  118. get_game_line($record_id) {
  119. let $params = {
  120. 'game_record_id': $record_id,
  121. }
  122. gameLineChart($params).then((res) => {
  123. let $res = res.data;
  124. setTimeout(() => {
  125. let $option = util.getLineOption($res.data.line, [0])
  126. att_charts.setOption($option)
  127. }, 1000)
  128. })
  129. },
  130. to_game_records() {
  131. mpvue.navigateTo({
  132. url: "/pages/game_record/main"
  133. })
  134. }
  135. }
  136. ,
  137. mounted() {
  138. $this.userinfo = wx.getStorageSync('userinfo')
  139. $this.get_report($this.record_id)
  140. $this.get_game_line($this.record_id)
  141. },
  142. created() {
  143. $this = this;
  144. },
  145. onLoad(options) {
  146. $this.record_id = options.id ? options.id : game_store.getters.getGameRecordId
  147. console.log($this.record_id)
  148. }
  149. }
  150. </script>
  151. <style scoped>
  152. @import "index.css";
  153. </style>