index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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. </div>
  74. </template>
  75. <script>
  76. import mpvueEcharts from 'mpvue-echarts'
  77. import echarts from '../../../static/echarts.min';
  78. import util, {formatSeconds} 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. $this.record.play_time = formatSeconds($this.record.play_time)
  117. })
  118. },
  119. get_game_line($record_id) {
  120. let $params = {
  121. 'game_record_id': $record_id,
  122. }
  123. gameLineChart($params).then((res) => {
  124. let $res = res.data;
  125. setTimeout(() => {
  126. let $option = util.getLineOption($res.data.line, [0])
  127. att_charts.setOption($option)
  128. }, 1000)
  129. })
  130. },
  131. to_game_records() {
  132. mpvue.navigateTo({
  133. url: "/pages/game_record/main"
  134. })
  135. }
  136. }
  137. ,
  138. mounted() {
  139. $this.userinfo = wx.getStorageSync('userinfo')
  140. $this.get_report($this.record_id)
  141. $this.get_game_line($this.record_id)
  142. },
  143. created() {
  144. $this = this;
  145. },
  146. onLoad(options) {
  147. $this.record_id = options.id ? options.id : game_store.getters.getGameRecordId
  148. console.log($this.record_id)
  149. }
  150. }
  151. </script>
  152. <style scoped>
  153. /* 头部椭圆 */
  154. .head {
  155. width: 442px;
  156. height: 385px;
  157. background-color:#4b3ab0;
  158. border-radius: 50%;
  159. position: absolute;
  160. left: -34px;
  161. top: -252px;
  162. z-index: -1;
  163. }
  164. /* 头部个人信息 */
  165. image.boy {
  166. width: 110px;
  167. height: 111px;
  168. position: absolute;
  169. left: 225px;
  170. top: 45px;
  171. }
  172. .user {
  173. width: 100%;
  174. }
  175. .user .up {
  176. width: 100%;
  177. height: 40px;
  178. margin-top: 9px;
  179. display: flex;
  180. align-items: center;
  181. justify-content: space-between;
  182. color: #fff;
  183. }
  184. .user .up .left {
  185. height: 40px;
  186. display: flex;
  187. align-items: center;
  188. justify-content: start;
  189. }
  190. .user .up .left image {
  191. width: 40px;
  192. height: 40px;
  193. margin-left: 17px;
  194. margin-right: 8px;
  195. }
  196. .user .up .left view {
  197. height: 40px;
  198. display: flex;
  199. flex-direction: column;
  200. align-items: flex-start;
  201. justify-content: space-between;
  202. }
  203. .user .up .left view text:first-child{
  204. font-size: 15px;
  205. font-weight: bold;
  206. }
  207. .user .up .left view text:last-child{
  208. font-size: 13px;
  209. }
  210. .user .up .right {
  211. height: 40px;
  212. }
  213. .user .up .right image {
  214. width: 14px;
  215. height: 15px;
  216. vertical-align: middle;
  217. margin-right: 4px;
  218. }
  219. .user .up .right text {
  220. font-size: 12px;
  221. text-decoration: underline;
  222. margin-right: 10px;
  223. }
  224. .user .down {
  225. width: 100%;
  226. height: 82px;
  227. display: flex;
  228. flex-direction: column;
  229. align-items: center;
  230. justify-content: start;
  231. }
  232. .user .down view:first-child{
  233. font-size: 45px;
  234. color: #FFD800;
  235. font-weight: bold;
  236. }
  237. .user .down view:last-child{
  238. font-size: 10px;
  239. color: #C7C4D8;
  240. margin-top: -5px;
  241. }
  242. /* 详细数据 */
  243. .detail {
  244. width: 100%;
  245. height: 102px;
  246. display: flex;
  247. align-items: center;
  248. justify-content: space-around;
  249. }
  250. .detail view {
  251. display: flex;
  252. flex-direction: column;
  253. align-items: center;
  254. justify-content: space-around;
  255. color: #6C6C6C;
  256. font-size: 10px;
  257. }
  258. .detail view view:first-child {
  259. color: #000;
  260. font-size: 30px;
  261. }
  262. /* 小标题 */
  263. .bar {
  264. width: 100%;
  265. height: 10px;
  266. display: flex;
  267. align-items: center;
  268. justify-content: space-between;
  269. padding: 0 7px;
  270. box-sizing: border-box;
  271. margin: 11px 0;
  272. }
  273. .bar view {
  274. display: flex;
  275. align-items: center;
  276. justify-content: start;
  277. }
  278. .conclution {
  279. width: 100%;
  280. padding: 5px 19px 20px;
  281. font-size: 12px;
  282. color: #6C6C6C;
  283. box-sizing: border-box;
  284. }
  285. .bar .line {
  286. width: 4px;
  287. height: 15px;
  288. background-color: #5D4DB8;
  289. margin-right: 7px;
  290. }
  291. .bar .title {
  292. color: #010101;
  293. font-size: 15px;
  294. }
  295. /* 图表 */
  296. #mychart-dom-multi-line {
  297. width: 360px;
  298. height: 193px;
  299. }
  300. .chart {
  301. margin: 0 auto;
  302. width: 360px;
  303. height: 193px;
  304. background: #f3f3f3;
  305. opacity: 0.6;
  306. border-radius: 10px;
  307. box-shadow: 0px 6px 11px #dadada;
  308. }
  309. /* 核销详情 */
  310. .sheet {
  311. color: #6D6D6D;
  312. font-size: 12px;
  313. display: flex;
  314. padding: 0 16px;
  315. box-sizing: border-box;
  316. }
  317. .sheet .left,
  318. .sheet .right {
  319. height: 95px;
  320. display: flex;
  321. flex-direction: column;
  322. align-items: flex-start;
  323. justify-content: space-between;
  324. }
  325. .sheet .left {
  326. width: 195px;
  327. }
  328. </style>