index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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">{{ record.content }}</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. <van-toast id="van-toast"/>
  74. </div>
  75. </template>
  76. <script>
  77. import mpvueEcharts from 'mpvue-echarts'
  78. import echarts from '../../../static/echarts.min';
  79. import util, {formatSeconds} from '../../utils/index'
  80. import {gameDetail, gameLineChart} from "../../requests/game";
  81. import game_store from "../../store/game";
  82. import Toast from '../../../static/vant/toast/toast';
  83. var att_charts,
  84. $this
  85. // 大脑图表初始化
  86. function initAttChart(canvas, width, height) {
  87. att_charts = echarts.init(canvas, null, {
  88. width: width,
  89. height: height
  90. });
  91. canvas.setChart(att_charts);
  92. var option = util.getLineOption([0], [0]); // ECharts 配置项
  93. att_charts.setOption(option);
  94. return att_charts; // 返回 chart 后可以自动绑定触摸操作
  95. }
  96. export default {
  97. name: "index_container",
  98. components: {
  99. mpvueEcharts
  100. },
  101. data() {
  102. return {
  103. // 0:未选择 1:时间 2:次数
  104. // 折线图
  105. attCharts: initAttChart,
  106. echarts,
  107. record: {},
  108. userinfo: {},
  109. record_id: 0
  110. }
  111. },
  112. methods: {
  113. // 获取游戏报告
  114. get_report($record_id) {
  115. $this.record = {}
  116. Toast.loading({
  117. forbidClick:true,
  118. message:"加载中",
  119. duration:0
  120. })
  121. gameDetail($record_id).then((res) => {
  122. Toast.clear()
  123. let $res = res.data;
  124. $this.record = $res.data
  125. $this.record.play_time = formatSeconds($this.record.play_time)
  126. })
  127. },
  128. get_game_line($record_id) {
  129. let $params = {
  130. 'game_record_id': $record_id,
  131. }
  132. gameLineChart($params).then((res) => {
  133. let $res = res.data;
  134. setTimeout(() => {
  135. let $option = util.getLineOption($res.data.line, [0])
  136. att_charts.setOption($option)
  137. }, 1000)
  138. })
  139. },
  140. to_game_records() {
  141. mpvue.navigateTo({
  142. url: "/pages/game_record/main"
  143. })
  144. }
  145. }
  146. ,
  147. mounted() {
  148. $this.userinfo = wx.getStorageSync('userinfo')
  149. $this.get_report($this.record_id)
  150. $this.get_game_line($this.record_id)
  151. },
  152. created() {
  153. $this = this;
  154. },
  155. onLoad(options) {
  156. $this.record_id = options.id ? options.id : game_store.getters.getGameRecordId()
  157. console.log($this.record_id)
  158. }
  159. }
  160. </script>
  161. <style scoped>
  162. /* 头部椭圆 */
  163. .head {
  164. width: 442px;
  165. height: 385px;
  166. background-color:#4b3ab0;
  167. border-radius: 50%;
  168. position: absolute;
  169. left: -34px;
  170. top: -252px;
  171. z-index: -1;
  172. }
  173. /* 头部个人信息 */
  174. image.boy {
  175. width: 110px;
  176. height: 111px;
  177. position: absolute;
  178. left: 225px;
  179. top: 45px;
  180. }
  181. .user {
  182. width: 100%;
  183. }
  184. .user .up {
  185. width: 100%;
  186. height: 40px;
  187. margin-top: 9px;
  188. display: flex;
  189. align-items: center;
  190. justify-content: space-between;
  191. color: #fff;
  192. }
  193. .user .up .left {
  194. height: 40px;
  195. display: flex;
  196. align-items: center;
  197. justify-content: start;
  198. }
  199. .user .up .left image {
  200. width: 40px;
  201. height: 40px;
  202. margin-left: 17px;
  203. margin-right: 8px;
  204. }
  205. .user .up .left view {
  206. height: 40px;
  207. display: flex;
  208. flex-direction: column;
  209. align-items: flex-start;
  210. justify-content: space-between;
  211. }
  212. .user .up .left view text:first-child{
  213. font-size: 15px;
  214. font-weight: bold;
  215. }
  216. .user .up .left view text:last-child{
  217. font-size: 13px;
  218. }
  219. .user .up .right {
  220. height: 40px;
  221. }
  222. .user .up .right image {
  223. width: 14px;
  224. height: 15px;
  225. vertical-align: middle;
  226. margin-right: 4px;
  227. }
  228. .user .up .right text {
  229. font-size: 12px;
  230. text-decoration: underline;
  231. margin-right: 10px;
  232. }
  233. .user .down {
  234. width: 100%;
  235. height: 82px;
  236. display: flex;
  237. flex-direction: column;
  238. align-items: center;
  239. justify-content: start;
  240. }
  241. .user .down view:first-child{
  242. font-size: 45px;
  243. color: #FFD800;
  244. font-weight: bold;
  245. }
  246. .user .down view:last-child{
  247. font-size: 10px;
  248. color: #C7C4D8;
  249. margin-top: -5px;
  250. }
  251. /* 详细数据 */
  252. .detail {
  253. width: 100%;
  254. height: 102px;
  255. display: flex;
  256. align-items: center;
  257. justify-content: space-around;
  258. }
  259. .detail view {
  260. display: flex;
  261. flex-direction: column;
  262. align-items: center;
  263. justify-content: space-around;
  264. color: #6C6C6C;
  265. font-size: 10px;
  266. }
  267. .detail view view:first-child {
  268. color: #000;
  269. font-size: 30px;
  270. }
  271. /* 小标题 */
  272. .bar {
  273. width: 100%;
  274. height: 10px;
  275. display: flex;
  276. align-items: center;
  277. justify-content: space-between;
  278. padding: 0 7px;
  279. box-sizing: border-box;
  280. margin: 11px 0;
  281. }
  282. .bar view {
  283. display: flex;
  284. align-items: center;
  285. justify-content: start;
  286. }
  287. .conclution {
  288. width: 100%;
  289. padding: 5px 19px 20px;
  290. font-size: 12px;
  291. color: #6C6C6C;
  292. box-sizing: border-box;
  293. }
  294. .bar .line {
  295. width: 4px;
  296. height: 15px;
  297. background-color: #5D4DB8;
  298. margin-right: 7px;
  299. }
  300. .bar .title {
  301. color: #010101;
  302. font-size: 15px;
  303. }
  304. /* 图表 */
  305. #mychart-dom-multi-line {
  306. width: 360px;
  307. height: 193px;
  308. }
  309. .chart {
  310. margin: 0 auto;
  311. width: 360px;
  312. height: 193px;
  313. background: #f3f3f3;
  314. opacity: 0.6;
  315. border-radius: 10px;
  316. box-shadow: 0px 6px 11px #dadada;
  317. }
  318. /* 核销详情 */
  319. .sheet {
  320. color: #6D6D6D;
  321. font-size: 12px;
  322. display: flex;
  323. padding: 0 16px;
  324. box-sizing: border-box;
  325. }
  326. .sheet .left,
  327. .sheet .right {
  328. height: 95px;
  329. display: flex;
  330. flex-direction: column;
  331. align-items: flex-start;
  332. justify-content: space-between;
  333. }
  334. .sheet .left {
  335. width: 195px;
  336. }
  337. </style>