浏览代码

9/10 报告数据echarts渲染问题

Foystor 3 年之前
父节点
当前提交
575230d419

+ 6 - 0
src/components/banner.vue

@@ -52,6 +52,12 @@ export default {
           url: "/pages/competition/main",
           button_text: "比赛详情",
         },
+        // {
+        //   id: 3,
+        //   src: "https://img.shuimuai.com/banner_joint.png",
+        //   url: "/pages/joint/main",
+        //   button_text: "我要联名",
+        // },
       ],
     };
   },

+ 1 - 1
src/pages/index/index.vue

@@ -197,7 +197,7 @@ export default {
   onHide() {},
   onLoad($option) {
     if (process.env.NODE_ENV == "development") {
-      wx.setStorageSync("token", "ZbNv-hpdpmxk895iqUrEwe4kCJjEWCJD");
+      // wx.setStorageSync("token", "ZbNv-hpdpmxk895iqUrEwe4kCJjEWCJD");
     }
 
     if (game_store.getters.getGameStatus() == 1) {

+ 224 - 0
src/pages/joint/index.vue

@@ -0,0 +1,224 @@
+<template>
+  <div
+    id="index_login_container"
+    @click="no_pop"
+  >
+    <div class="cover_whole">
+       <!-- 填写表框 -->
+       <div class="cover_input">
+          <span class="title">联名邀请,免费测评专注力</span>
+          <input 
+          placeholder='请输入学校名称'
+          v-model="school" 
+          placeholder-style="font-size: 28rpx;color: #B0784F;"/>
+
+          <input 
+          placeholder='请输入学生'
+          v-model="student" 
+          placeholder-style="font-size: 28rpx;color: #B0784F;"/>
+
+          <button class="cu-btn btn" @click="joint_test">免费测评</button>
+       </div>
+       
+       <!-- 滚动 -->
+       <div class="cover_scroll">
+         <swiper 
+         class="swiper"
+         easing-function="linear"
+         :current="currentTab" 
+         circular="true" 
+         :indicator-dots="indicatorDots"
+         :autoplay="autoplay"
+         :interval="interval"
+         :duration="duration"
+         :vertical="vertical"
+         >
+           <block v-for="(item,index) in scroll_list" :key="index">
+             <swiper-item class="swiper-item"><div class="item">{{ item.school }} {{item.name}} 已联名</div></swiper-item>
+           </block>
+         </swiper>
+       </div>
+
+       <!-- 弹窗 -->
+       <van-popup
+        :show="show"
+        @close="close_pop"
+        :close-on-click-overlay="false"
+        custom-class="pop"
+        overlay
+        z-index="99"
+       >
+         <div class="cover_pop"></div>
+      </van-popup>
+    </div>
+
+  </div>
+</template>
+<script>
+import { addJoint, getJoint } from "../../requests/competition"
+import Toast from "../../../static/vant/toast/toast";
+
+var $this;
+export default {
+  name: "scan_container",
+  data() {
+    return {
+       show: false,
+       school:'',
+       student: '',
+       scroll_list:[],
+       // 轮播配置
+       indicatorDots: false,
+       autoplay: true,
+       interval: 1800,
+       duration: 1800,
+       vertical:true
+    };
+  },
+  methods: {
+   joint_test(){
+       let $joint = {
+         phone: wx.getStorageSync("phone"),
+         school: $this.school,
+         name: $this.student
+       }
+       addJoint($joint).then((res) => {
+         console.log("联名",res)
+         let $res = res.data;
+         if ($res.code == 0) {
+           $this.show = true
+         }else{
+           wx.showToast({
+             title: $res.errmsg,
+             icon: "error"
+           })
+         }
+      }).catch((err)=>{
+        console.log("错误",err)
+      })
+   },
+
+    no_pop(){
+      $this.show = false
+    }
+  },
+  mounted() {
+    getJoint().then((res) => {
+         console.log("已联名",res)
+         let $res = res.data;
+         if ($res.code == 0) {
+           $this.scroll_list = $res.data
+         }else{
+           console.log("获取不到已联名",err)
+         }
+      }).catch((err)=>{
+        console.log("错误",err)
+      })
+  },
+  created() {
+    $this = this;
+  },
+};
+</script>
+<style scoped>
+#index_login_container {
+  background-color: #040312;
+}
+
+.cover_whole {
+  background: url("https://img.shuimuai.com/bg_joint_2.png");
+  width: 100%;
+  height: 4586px;
+  background-size: 100% 100%;
+  background-position: center;
+  display: flex;
+  align-items: center;
+  box-sizing: border-box;
+  flex-direction: column;
+  padding-top: 784rpx;
+  font-family: Alibaba PuHuiTi;
+  font-weight: 400;
+}
+
+.cover_input{
+  background: url("https://img.shuimuai.com/bg_input.png");
+  background-size: 100% 100%;
+  background-position: center;
+  width: 650rpx;
+  height: 517rpx;
+  margin-left: 7px;
+  display: flex;
+  align-items: center;
+  box-sizing: border-box;
+  flex-direction: column;
+  justify-content:space-around;
+  padding: 20px 0 28px
+}
+
+.cover_scroll{
+  background: url("https://img.shuimuai.com/bg_scroll.png");
+  background-size: 100% 100%;
+  background-position: center;
+  width: 634rpx;
+  height: 111rpx;
+  margin-top: 88rpx;
+  padding: 10rpx;
+}
+
+
+.item{
+  font-size: 24rpx;
+  color: #FFF1D7;
+  display: flex;
+  align-items: center;
+  box-sizing: border-box;
+  flex-direction: column;
+}
+
+.title{
+  font-size: 32rpx;
+  color: #FFAF74;
+  letter-spacing:5px
+}
+
+.btn{
+  width: 502rpx;
+  height: 80rpx;
+  background: linear-gradient(180deg, #FFE8C0 0%, #E19C6A 100%);
+  border-radius: 40rpx;
+  font-size: 30rpx;
+  font-weight: 500;
+  color: #9A4720;
+  letter-spacing:5px
+}
+
+input{
+  width: 502rpx;
+  height: 80rpx;
+  background: #4A3843;
+  border: 2px solid #FFAF74;
+  border-radius: 40rpx;
+  padding-left: 41rpx;
+  color: white
+}
+
+.cover_pop{
+  background: url("https://img.shuimuai.com/test.jpg");
+  background-size: 100% 100%;
+  background-position: center;
+  width: 493rpx;
+  height: 662rpx;
+}
+</style>
+
+<style>
+.pop {
+  background-color: rgba(255, 255, 255, 0) !important;
+}
+.swiper{
+  height:90rpx !important;
+}
+.swiper-item{
+  height:50rpx !important;
+}
+</style>

+ 12 - 0
src/pages/joint/main.js

@@ -0,0 +1,12 @@
+import Vue from 'vue'
+import App from './index'
+
+// add this to handle exception
+Vue.config.errorHandler = function (err) {
+  if (console && console.error) {
+    console.error(err)
+  }
+}
+
+const app = new Vue(App)
+app.$mount()

+ 8 - 0
src/pages/joint/main.json

@@ -0,0 +1,8 @@
+{
+    "usingComponents": {
+      "van-popup": "../../../static/vant/popup/index",
+      "van-overlay": "../../../static/vant/overlay/index",
+      "van-toast": "../../../../static/vant/toast/index"
+    }
+  }
+  

+ 1 - 1
src/pages/none/main.json

@@ -6,7 +6,7 @@
     "van-overlay": "../../../static/vant/overlay/index",
     "van-toast": "../../../static/vant/toast/index",
     "van-field": "../../../static/vant/field/index",
-        "van-count-down":"../../../static/vant/count-down/index"
+    "van-count-down":"../../../static/vant/count-down/index"
 
   }
 }

+ 123 - 69
src/pages/report/index.vue

@@ -16,6 +16,8 @@
 
       </view>
     </view>
+
+    <div :hidden="noShow">
     <div class="bran_wrap margin-bottom">
       <img
         src="http://img.shuimuai.com/report_ brain_coefficient.png"
@@ -364,9 +366,15 @@
         </van-tabs>
       </view>
     </view>
+    </div>
 
-    <van-toast id="van-toast"/>
+    <div v-if="noShow" class="boxVer margin-top-xl">
+      <img src="https://img.shuimuai.com/time_short.png" class="margin-bottom-xl" style="width: 73px;height: 83px;">
+      <view class="conclution margin-top-xl">数据传输异常,水母星球AI数据系统无法进行训练分析,艾米正在紧急联系星球指挥官。</view>
+    </div>
 
+    <van-toast id="van-toast"/>
+  
   </div>
 </template>
 
@@ -381,7 +389,7 @@ import util, {
   getRadarChartOption,
   timestampToTimeS,
 } from "../../utils/index";
-import {gameDetail} from "../../requests/game";
+import { gameDetail } from "../../requests/game";
 import game_store from "../../store/game";
 import Toast from "../../../static/vant/toast/toast";
 
@@ -507,7 +515,9 @@ export default {
       data_section: 4,
       //数据集合
       data_lines: [],
-
+      // 是否时间太短
+      show: true,   // 报告
+      noShow:false
     };
   },
   methods: {
@@ -524,19 +534,36 @@ export default {
           (res) => {
             Toast.clear();
             let $res = res.data;
+            console.log($res.data);
+
             $this.record = $res.data;
 
             // console.log("成绩记录数据", $res.data.interfereArr);
             // console.log("数据长度:", $res.data.line);
 
+            if ($res.data.line.length==0) {
+              $this.show = false
+              $this.noShow = true
+            } else {
+              $this.show = true
+              $this.noShow = false
+             
+            }
 
-            // 平均专注力大字
-            $this.record["att_average_big"] = parseInt($this.record["att_average"]);
+             // 平均专注力大字
+            $this.record["att_average_big"] = parseInt(
+              $this.record["att_average"]
+            );
             // 平均专注力小字
-            $this.record["att_average_string"] = $this.record["att_average"].toString();
-            $this.record["att_average_lil"] = $this.record["att_average_string"].substring($this.record["att_average_string"].indexOf("."));
+            $this.record["att_average_string"] = $this.record[
+              "att_average"
+            ].toString();
+            $this.record["att_average_lil"] = $this.record[
+              "att_average_string"
+            ].substring($this.record["att_average_string"].indexOf("."));
 
             let $play_time = $this.record.play_time;
+
             $this.record.play_time = formatSeconds($this.record.play_time);
             $this.record.start_time = timestampToTimeS($this.record.start_time);
             $this.record.height_absorbed = Math.ceil(
@@ -544,7 +571,7 @@ export default {
             );
             let $options = getHightPieChartOption(
               $this.record.height,
-              $this.record.total,
+              $this.record.total
             );
             hight_att_pie_charts.setOption($options);
 
@@ -568,51 +595,62 @@ export default {
             $this.record.level_time4 = formatSeconds($this.record.level[4]);
 
             // 时间总数
-            let all_time = 0
-            for(let i = 0;i < 5; i++){
-              all_time += $this.record.level[i]
+            let all_time = 0;
+            for (let i = 0; i < 5; i++) {
+              all_time += $this.record.level[i];
             }
 
             // 比例
-            $this.record.level_ratio0 = Math.round((($this.record.level[0] / all_time)*100)*100)/100;
-            $this.record.level_ratio1 = Math.round((($this.record.level[1] / all_time)*100)*100)/100;
-            $this.record.level_ratio2 = Math.round((($this.record.level[2] / all_time)*100)*100)/100;
-            $this.record.level_ratio3 = Math.round((($this.record.level[3] / all_time)*100)*100)/100;
-            $this.record.level_ratio4 = Math.round((($this.record.level[4] / all_time)*100)*100)/100;
-            
+            $this.record.level_ratio0 =
+              Math.round($this.record.level[0] / all_time * 100 * 100) / 100;
+            $this.record.level_ratio1 =
+              Math.round($this.record.level[1] / all_time * 100 * 100) / 100;
+            $this.record.level_ratio2 =
+              Math.round($this.record.level[2] / all_time * 100 * 100) / 100;
+            $this.record.level_ratio3 =
+              Math.round($this.record.level[3] / all_time * 100 * 100) / 100;
+            $this.record.level_ratio4 =
+              Math.round($this.record.level[4] / all_time * 100 * 100) / 100;
+
             let $pie_option = getPieChartsOption($pie_data);
             $pie_charts.setOption($pie_option);
 
-
             //5分钟阶段
             let $min = 2 * 60;
             $this.is_cut = $play_time > $min;
-            console.log($this.is_cut)
+            console.log($this.is_cut);
             if ($this.is_cut) {
               //截断得数量
-              $this.data_section = Math.ceil(
-                $play_time / $min
-              );
+              $this.data_section = Math.ceil($play_time / $min);
               let $e = {
                 mp: {
                   detail: {
-                    name: 0
-                  }
-                }
-              }
-              this.changeMin($e)
-              this.changeABMin($e)
-              this.changeDTMin($e)
+                    name: 0,
+                  },
+                },
+              };
+              this.changeMin($e);
+              this.changeABMin($e);
+              this.changeDTMin($e);
             } else {
               //处理 专注度 和  放松度的值
-              $this.get_game_line($this.record.line, $this.record.line_med, $this.record.amp)
+              $this.get_game_line(
+                $this.record.line,
+                $this.record.line_med,
+                $this.record.amp
+              );
               // 处理 alpha beta
-              $this.get_game_ab($this.record.low_alpha, $this.record.high_alpha, $this.record.low_beta, $this.record.high_beta)
+              $this.get_game_ab(
+                $this.record.low_alpha,
+                $this.record.high_alpha,
+                $this.record.low_beta,
+                $this.record.high_beta
+              );
               // // 处理 delta theta
-              $this.get_game_dt($this.record.delta, $this.record.theta)
+              $this.get_game_dt($this.record.delta, $this.record.theta);
             }
 
-
+            
           },
           (err) => {
             Toast.fail("错误代码:" + res.code + ",联系客服");
@@ -621,12 +659,21 @@ export default {
       }, 800);
     },
     get_game_line($line_data, $line_med_data, $line_amp_data) {
-      let $option = util.getLineOption($line_data, $line_med_data, $line_amp_data);
+      let $option = util.getLineOption(
+        $line_data,
+        $line_med_data,
+        $line_amp_data
+      );
       att_charts.setOption($option);
     },
     get_game_ab($line_alphaL, $line_alphaH, $line_betaL, $line_betaH) {
       let $option = {};
-      $option = util.getABOption($line_alphaL, $line_alphaH, $line_betaL, $line_betaH);
+      $option = util.getABOption(
+        $line_alphaL,
+        $line_alphaH,
+        $line_betaL,
+        $line_betaH
+      );
       alpha_beta_charts.setOption($option);
     },
     get_game_dt($line_delta, $line_theta) {
@@ -644,37 +691,37 @@ export default {
       let $index = $e.mp.detail.name;
       // 0-2  2-4  4-6
       // 0    1    2
-      let $start = $index * 120
-      let $end = ($index + 1) * 120
+      let $start = $index * 120;
+      let $end = ($index + 1) * 120;
       let $line_data = $this.record.line.slice($start, $end);
       let $med_data = $this.record.line_med.slice($start, $end);
       let $amp_data = $this.record.amp.slice($start, $end);
-      $this.get_game_line($line_data, $med_data, $amp_data)
+      $this.get_game_line($line_data, $med_data, $amp_data);
     },
     //  切换时间查看线 数据
     changeABMin($e) {
       let $index = $e.mp.detail.name;
       // 0-2  2-4  4-6
       // 0    1    2
-      let $start = $index * 120
-      let $end = ($index + 1) * 120
-      console.log($start, $end)
+      let $start = $index * 120;
+      let $end = ($index + 1) * 120;
+      console.log($start, $end);
       let low_alpha = $this.record.low_alpha.slice($start, $end);
       let high_alpha = $this.record.high_alpha.slice($start, $end);
       let low_beta = $this.record.low_beta.slice($start, $end);
       let high_beta = $this.record.high_beta.slice($start, $end);
-      $this.get_game_ab(low_alpha, high_alpha, low_beta, high_beta)
+      $this.get_game_ab(low_alpha, high_alpha, low_beta, high_beta);
     },
     //  切换时间查看线 数据
     changeDTMin($e) {
       let $index = $e.mp.detail.name;
       // 0-2  2-4  4-6
       // 0    1    2
-      let $start = $index * 120
-      let $end = ($index + 1) * 120
+      let $start = $index * 120;
+      let $end = ($index + 1) * 120;
       let delta = $this.record.delta.slice($start, $end);
       let theta = $this.record.theta.slice($start, $end);
-      $this.get_game_dt(delta, theta)
+      $this.get_game_dt(delta, theta);
     },
   },
   mounted() {
@@ -757,7 +804,7 @@ image.boy {
   display: flex;
   color: #222222;
   box-sizing: border-box;
-  justify-content: space-between
+  justify-content: space-between;
 }
 
 .user_info .box_wrap_left {
@@ -824,7 +871,7 @@ image.boy {
   overflow: hidden;
   display: flex;
   flex-direction: column;
-  margin-left: 3px
+  margin-left: 3px;
 }
 
 .margin-tb .margin_left .left_content {
@@ -836,13 +883,13 @@ image.boy {
   color: #676767;
   z-index: 999;
   margin-top: -100px;
-  margin-left: 5px
+  margin-left: 5px;
 }
 
 .margin-tb .margin_left .left_content .left_num {
   font-size: 18px;
   font-weight: 900;
-  margin-bottom: -3px
+  margin-bottom: -3px;
 }
 
 .margin-tb .margin_left .left_content .left_text {
@@ -860,7 +907,7 @@ image.boy {
 
 .margin-tb .textLil {
   font-size: 6px;
-  margin-left: 2px
+  margin-left: 2px;
 }
 
 .margin-tb .margin_right {
@@ -905,10 +952,9 @@ image.boy {
 .margin-tb .detail .detail_num {
   font-size: 15px;
   font-weight: 800;
-  margin-bottom: 1px
+  margin-bottom: 1px;
 }
 
-
 /* 小标题 */
 .bar {
   width: 100%;
@@ -934,7 +980,7 @@ image.boy {
   color: #6c6c6c;
   box-sizing: border-box;
   line-height: 25px;
-  margin-bottom: 28px
+  margin-bottom: 28px;
 }
 
 .conclution_title {
@@ -991,7 +1037,7 @@ image.boy {
   height: 95px;
   background: #f3f3f3;
   margin-top: 10px;
-  margin-left: -7px
+  margin-left: -7px;
   /*border-radius: 10px;*/
   /*box-shadow: 0px 6px 11px #dadada;*/
 }
@@ -1003,7 +1049,7 @@ image.boy {
   display: flex;
   padding: 0 16px;
   box-sizing: border-box;
-  margin-bottom: 30px
+  margin-bottom: 30px;
 }
 
 .sheet .left,
@@ -1027,8 +1073,8 @@ image.boy {
 .divide_line {
   width: 360px;
   height: 1px;
-  background: #E5E5E5;
-  margin: 0 auto
+  background: #e5e5e5;
+  margin: 0 auto;
 }
 
 /* 专注力干扰看板 */
@@ -1235,8 +1281,7 @@ image.boy {
   font-size: 10px;
   display: flex;
   flex-wrap: wrap;
-  width: 270px
-
+  width: 270px;
 }
 
 /*点图*/
@@ -1249,38 +1294,38 @@ image.boy {
 }
 
 .dot-Att {
-  background: #FAB615;
+  background: #fab615;
 }
 
 .dot-Med {
-  background: #40FF31;
+  background: #40ff31;
 }
 
 .dot-Amp {
-  background: #D4327A;
+  background: #d4327a;
 }
 
 /* .dot-Alpha {
   background: #FF9107;
 } */
 .dot-Theta {
-  background: #FFE838;
+  background: #ffe838;
 }
 
 .dot-Low-Alpha {
-  background: #38FF49;
+  background: #38ff49;
 }
 
 .dot-High-Alpha {
-  background: #00AD0E;
+  background: #00ad0e;
 }
 
 .dot-Low-Beta {
-  background: #0060F1;
+  background: #0060f1;
 }
 
 .dot-High-Beta {
-  background: #00CCFF;
+  background: #00ccff;
 }
 
 /* .dot-Beta {
@@ -1288,7 +1333,7 @@ image.boy {
 } */
 
 .dot-Delta {
-  background: #FF77B3;
+  background: #ff77b3;
 }
 
 /* 节标题  */
@@ -1325,6 +1370,16 @@ image.boy {
   align-items: flex-start;
 }
 
+.boxVer {
+  display: flex;
+  align-items: center;
+  box-sizing: border-box;
+  flex-direction: column;
+  height: 500px;
+  justify-content: center;
+  padding: 20px;
+}
+
 .flexBoxLand {
   display: flex;
   align-items: center;
@@ -1390,5 +1445,4 @@ image.boy {
 .left_text {
   font-size: 12px;
 }
-
 </style>

+ 1 - 1
src/pages/user_center/recharge/index.vue

@@ -15,7 +15,7 @@
         <text class="mine_min">{{ userinfo.play_time }}</text>
       </view>
     </div>
-
+  
     <!--    标题-->
     <div class="title flex padding-left align-center margin-top-xl margin-bottom-xs">
       <div class="line margin-right-xs "></div>

+ 19 - 0
src/requests/competition.js

@@ -78,3 +78,22 @@ export function getJsSDK($activity_id) {
   }
   return fly.post('activity/get-jsdk', $params)
 }
+
+// 添加联名
+export function addJoint($joint) {
+  let $params = {
+    phone: $joint.phone,
+    school: $joint.school,
+    name: $joint.name,
+  }
+  $params['access_token'] = wx.getStorageSync('token')
+  return fly.post('jointly/add', $params)
+}
+
+// 获取联名
+export function getJoint() {
+  let $params = {
+    "access_token": wx.getStorageSync('token'),
+  }
+  return fly.post('jointly/index', $params)
+}

+ 3 - 3
src/utils/bluetooth.js

@@ -310,9 +310,9 @@ export default {
             game_store.setters.setPlayedTime($this.played_time)
             $this.played_time_text = that.formatPlaySeconds($this.played_time);
             $this.do_datas($data);
-            if ($this.played_time_text.indexOf(":00") != -1 || $this.played_time_text.indexOf(":30") != -1) {
-              $this.post_data();
-            }
+            // if ($this.played_time_text.indexOf(":00") != -1 || $this.played_time_text.indexOf(":30") != -1) {
+            //   $this.post_data();
+            // }
           }
           if ($this.played_time == 0) {
             $this.post_data();

+ 2 - 0
src/utils/user.js

@@ -29,6 +29,8 @@ export function reload_userinfo($this) {
     //   do_logout($this)
     // }
     $this.userinfo = $data.data;
+    // 联名活动要用
+    wx.setStorageSync("phone", $this.userinfo.phone);
     $this.userinfo.birthday = formatBirthday($this.userinfo.birthday)
     $this.userinfo['validity_unformattedTime'] = $this.userinfo['validity_time']