Przeglądaj źródła

修改游戏状态提示

unknown 4 lat temu
rodzic
commit
d48f641492

+ 11 - 0
src/components/device/device.vue

@@ -356,6 +356,7 @@ export default {
             wx.stopBluetoothDevicesDiscovery();
             $this.change_device_status(0);
             Toast.fail("设备未连接到");
+            console.log('设备未连接到device_status的状态为:',$this.device_status)
           }
         }, 5000);
         wx.onBluetoothDeviceFound((res) => {
@@ -447,6 +448,7 @@ export default {
   onShow() {
     //判断是否游戏中
     let $game_status = game_store.getters.getGameStatus();
+    console.log("游戏中:"+$game_status);
     if ($game_status == 3) {
       //不在游戏状态
       $this.connect_toy = 0;
@@ -458,6 +460,15 @@ export default {
       //   //断开蓝牙连接
       //   $this.change_device_status(0);
       // }
+      // 状态为0的时候重置为0 小乌龟
+    }else if ($game_status == 0){
+      $this.connect_toy = 0 ;
+      $this.connect_show = false;
+      $this.device_status = 0;
+      // $this.change_device_status(0)
+      console.log('我是在游戏中断开,我触发了嘛~',$this.connect_toy, $this.connect_show,$this.device_status );
+
+
     }
   },
   onLoad(options) {

+ 11 - 5
src/pages/index/index.vue

@@ -86,7 +86,7 @@ import personal_container from "@/components/index/personal";
 import device_container from "@/components/device/device";
 import Toast from "../../../static/vant/toast/toast";
 import Dialog from "../../../static/vant/dialog/dialog";
-import { userDetail } from "../../requests/user";
+import { userDetail , setUserLogin } from "../../requests/user";
 import user_store from "../../store/index";
 import game_store from "../../store/game";
 import game_util, { post_data } from "../../utils/game";
@@ -192,7 +192,7 @@ export default {
   onLoad($option) {
     if (process.env.NODE_ENV == "development") {
       // wx.setStorageSync("token", "7MZYqpAWOdw8WDxsgUV5QkQnKfrU5L_7");
-      wx.setStorageSync("token", "hbVDHNVpJqZsWn_MpFlQYIJI5QcoCk4v");
+      wx.setStorageSync("token", "05qCTeq-SxX2L-3Uscu1iUdCaeFZp54D");
     }
 
     console.log(
@@ -227,9 +227,15 @@ export default {
       user_store.setters.set_token($token);
       user_store.setters.set_login(true);
       this.is_login = user_store.getters.get_login_status();
-      wx.navigateTo({
-        url: "/pages/payment/main",
-      });
+      // wx.navigateTo({
+      //   url: "/pages/payment/main",
+      // });
+      // 存在token时候录入  
+    setUserLogin().then(
+      
+      (res)=>{console.log('录入',res)}
+      
+      )
     }
   },
   created() {

+ 258 - 40
src/pages/report/index.vue

@@ -24,33 +24,134 @@
       </view>
       <view class="down">
         <view>{{ record.att_average }}</view>
-        <view>专注力均值</view>
+        <view>专注力得分</view>
       </view>
     </view>
+
+    <!--    训练时长和训练设备  -->
+    <view class="po1 padding-lr margin-top-xl">
+      <van-row>
+        <van-col span="11">
+          <view>
+            <text>训练时长</text>
+            <text class="text-bold text-xl"> &nbsp; {{ record.play_time }}</text>
+          </view>
+        </van-col>
+
+        <van-col
+          span="11"
+          offset="2"
+        >
+          <view>
+            <text>训练设备</text>
+            <text class="text-bold text-xl">&nbsp; {{ record.name }}</text>
+          </view>
+        </van-col>
+      </van-row>
+    </view>
+    <view>
+      <van-divider
+        contentPosition="left"
+        borderColor="#E98F36"
+      >
+        <van-image
+          src="https://img.shuimuai.com/line.png"
+          alt=""
+          width="40"
+          height="40"
+        ></van-image>
+      </van-divider>
+    </view>
+
+    <!--    专注力维持区间、受干扰次数,专注力最大爆发值、专注力启动时长-->
+    <view class="margin-tb">
+
+      <view class="detail">
+        <view>
+          <view>{{ record.scope_diff }}</view>
+          <view>专注力维持区间</view>
+        </view>
+      </view>
+
+      <view class="detail">
+        <view>
+          <view>{{ record.interfere }}</view>
+          <view>受干扰次数</view>
+        </view>
+      </view>
+
+      <view class="hight_pie_chart">
+        <mpvue-echarts
+          :echarts="echarts"
+          :onInit="hight_att_charts"
+          canvasId="demo-canvas1"
+        />
+      </view>
+
+      <view class="detail">
+        <view>
+          <view>{{ record.burst }}</view>
+          <view>专注力最大爆发值</view>
+        </view>
+      </view>
+
+      <view class="detail">
+        <view>
+          <view>{{ record.start }}</view>
+          <view>专注力启动时长</view>
+        </view>
+      </view>
+
+      <view class="detail">
+        <view>
+          <view>{{ record.height_absorbed }}%</view>
+          <view>高专注力占比</view>
+        </view>
+      </view>
+
+    </view>
+
     <view class="bar">
       <view>
         <view class="line"></view>
-        <view class="title">数据详情</view>
+        <view class="title">专注力要素分析</view>
       </view>
     </view>
-    <view class="detail">
-      <view>
-        <view>{{ record.att_max }}</view>
-        <view>专注力最高分</view>
-        <!-- <view>{{ record.interfere }} </view>
-        <view>被干扰次数</view> -->
+
+    <view class="radar_chart">
+      <mpvue-echarts
+        :echarts="echarts"
+        :onInit="radar_charts"
+        canvasId="demo-canvas2"
+      />
+    </view>
+
+    <view class="">
+      <view class="bar">
+        <view>
+          <view class="line"></view>
+          <view class="title">报告分析</view>
+        </view>
       </view>
-      <view>
-        <view>{{ record.scope_diff }}</view>
-        <view>专注力广度</view>
+      <view class="conclution">{{ record.content }}</view>
+      <!-- <view class="conclution">{{ record.content2 }}</view> -->
+
+      <view class="bar">
+        <view>
+          <view class="line"></view>
+          <view class="title">训练建议</view>
+        </view>
       </view>
+      <view class="conclution">{{ record.advise }}</view>
     </view>
+
     <view class="bar">
       <view>
         <view class="line"></view>
-        <view class="title">基本脑波</view>
+        <view class="title">专注力数值曲线</view>
       </view>
     </view>
+
     <view class="chart">
       <mpvue-echarts
         :echarts="echarts"
@@ -76,27 +177,34 @@
         ></van-tab>
       </van-tabs>
     </view>
-    <view class="conclution"> <text class="conclution_title">分析</text>: {{ record.content }}</view>
-    <view class="conclution"> <text class="conclution_title">建议</text>: {{ record.advise }}</view>
-    <view class="bar">
-      <view>
-        <view class="line"></view>
-        <view class="title">核销详情</view>
+
+    <view class="cu-bar bg-white">
+      <view class="action">
+        <text class="cuIcon-titles text-primary"></text>
+        <text class="">专注力数值累计比例</text>
       </view>
     </view>
-    <view class="sheet">
-      <view class="left">
-        <view>专注力训练设备: {{ record.name }}</view>
-        <view>核销方式:
-          <text v-if="record.consumption_type==1">次卡</text>
-          <text v-if="record.consumption_type==2">时间卡</text>
-        </view>
-        <view>会员游玩时间: {{ record.play_time }}</view>
-      </view>
-      <view class="right">
-        <view>专注力训练时长: {{ record.play_time }}</view>
-      </view>
+    <view class="chart">
+      <mpvue-echarts
+        :echarts="echarts"
+        :onInit="pie_charts"
+        canvasId="demo-canvas-1"
+      />
     </view>
+
+    <!--    <view class="sheet">-->
+    <!--      <view class="left">-->
+    <!--        <view>专注力训练设备: {{ record.name }}</view>-->
+    <!--        <view>核销方式:-->
+    <!--          <text v-if="record.consumption_type==1">次卡</text>-->
+    <!--          <text v-if="record.consumption_type==2">时间卡</text>-->
+    <!--        </view>-->
+    <!--        <view>会员游玩时间: {{ record.play_time }}</view>-->
+    <!--      </view>-->
+    <!--      <view class="right">-->
+    <!--        <view>专注力训练时长: {{ record.play_time }}</view>-->
+    <!--      </view>-->
+    <!--    </view>-->
     <van-toast id="van-toast" />
 
   </div>
@@ -105,12 +213,18 @@
 <script>
 import mpvueEcharts from "mpvue-echarts";
 import echarts from "../../../static/echarts.min";
-import util, { formatSeconds } from "../../utils/index";
+import util, {
+  filterPieData,
+  formatSeconds,
+  getHightPieChartOption,
+  getPieChartsOption,
+  getRadarChartOption,
+} from "../../utils/index";
 import { gameDetail, gameLineChart } from "../../requests/game";
 import game_store from "../../store/game";
 import Toast from "../../../static/vant/toast/toast";
 
-var att_charts, $this;
+var att_charts, hight_att_pie_charts, radar_charts, $pie_charts, $this;
 
 // 大脑图表初始化
 function initAttChart(canvas, width, height) {
@@ -127,6 +241,50 @@ function initAttChart(canvas, width, height) {
   return att_charts; // 返回 chart 后可以自动绑定触摸操作
 }
 
+// 大脑图表初始化
+function initHightPieChart(canvas, width, height) {
+  hight_att_pie_charts = echarts.init(canvas, null, {
+    width: width,
+    height: height,
+  });
+  canvas.setChart(hight_att_pie_charts);
+
+  var option = getHightPieChartOption(0, 0); // ECharts 配置项
+
+  hight_att_pie_charts.setOption(option);
+
+  return hight_att_pie_charts; // 返回 chart 后可以自动绑定触摸操作
+}
+
+// 大脑图表初始化
+function initRadarChart(canvas, width, height) {
+  radar_charts = echarts.init(canvas, null, {
+    width: width,
+    height: height,
+  });
+  canvas.setChart(radar_charts);
+
+  var option = getRadarChartOption(0); // ECharts 配置项
+
+  radar_charts.setOption(option);
+
+  return radar_charts; // 返回 chart 后可以自动绑定触摸操作
+}
+
+function initPieChart(canvas, width, height) {
+  $pie_charts = echarts.init(canvas, null, {
+    width: width,
+    height: height,
+  });
+  canvas.setChart($pie_charts);
+
+  var option = getPieChartsOption(); // ECharts 配置项
+
+  $pie_charts.setOption(option);
+
+  return $pie_charts; // 返回 chart 后可以自动绑定触摸操作
+}
+
 export default {
   name: "index_container",
   components: {
@@ -137,6 +295,10 @@ export default {
       // 0:未选择 1:时间 2:次数
       // 折线图
       attCharts: initAttChart,
+      hight_att_charts: initHightPieChart,
+      radar_charts: initRadarChart,
+      pie_charts: initPieChart,
+
       echarts,
       record: {},
       userinfo: {},
@@ -162,10 +324,35 @@ export default {
       setTimeout(() => {
         gameDetail($record_id).then(
           (res) => {
-            console.log("get_game_detail", res);
             Toast.clear();
             let $res = res.data;
             $this.record = $res.data;
+            console.log("成绩记录参数", $this.record);
+            $this.record.play_time = formatSeconds($this.record.play_time);
+            $this.record.height_absorbed = Math.ceil(
+              $this.record.height / $this.record.total * 100
+            );
+            let $options = getHightPieChartOption(
+              $this.record.height,
+              $this.record.total
+            );
+            hight_att_pie_charts.setOption($options);
+
+            //设置雷达图
+            $options = getRadarChartOption([
+              $this.record.att_average, //平均
+              $this.record.att_scope, //广度
+              $this.record.att_burst, //爆发
+              $this.record.att_interfere, //抗干扰
+              $this.record.att_start, //启动
+              $this.record.att_height, // 高专注占比
+            ]);
+            radar_charts.setOption($options);
+
+            let $pie_data = filterPieData($this.record.level);
+            let $pie_option = getPieChartsOption($pie_data);
+            $pie_charts.setOption($pie_option);
+
             //5分钟阶段
             let $five_min = 5 * 60;
             $this.is_cut = $this.record.play_time > $five_min;
@@ -175,7 +362,6 @@ export default {
                 $this.record.play_time / $five_min
               );
             }
-            $this.record.play_time = formatSeconds($this.record.play_time);
           },
           (err) => {
             Toast.fail("错误代码:" + res.code + ",联系客服");
@@ -216,7 +402,7 @@ export default {
               $option = util.getLineOption($line_data, [0]);
             }
             att_charts.setOption($option);
-          }, 1000);
+          }, 800);
         },
         (err) => {
           Toast.fail("错误代码:" + res.code + ",联系客服");
@@ -241,7 +427,6 @@ export default {
     wx.removeStorageSync("played_time");
     $this.get_report($this.record_id);
     $this.get_game_line($this.record_id);
-    console.log("进来时候获取到的信息", $this.record);
   },
   created() {
     $this = this;
@@ -360,12 +545,18 @@ image.boy {
 }
 
 /* 详细数据 */
-.detail {
-  width: 100%;
-  height: 102px;
+.margin-tb {
   display: flex;
-  align-items: center;
   justify-content: space-around;
+  flex-wrap: wrap;
+}
+
+.detail {
+  width: 30%;
+  height: 102px;
+  /*display: flex;*/
+  /*align-items: center;*/
+  /*justify-content: space-around;*/
 }
 
 .detail view {
@@ -407,6 +598,7 @@ image.boy {
   color: #6c6c6c;
   box-sizing: border-box;
 }
+
 .conclution_title {
   font-weight: 600;
   color: #000;
@@ -440,6 +632,27 @@ image.boy {
   box-shadow: 0px 6px 11px #dadada;
 }
 
+/*雷达图*/
+.radar_chart {
+  margin: 0 auto;
+  width: 360px;
+  height: 293px;
+  background: #f3f3f3;
+  opacity: 0.6;
+  border-radius: 10px;
+  box-shadow: 0px 6px 11px #dadada;
+}
+
+.hight_pie_chart {
+  /* margin: 0 auto; */
+  width: 30%;
+  height: 102px;
+  background: #f3f3f3;
+  margin-top: 5px;
+  /*border-radius: 10px;*/
+  /*box-shadow: 0px 6px 11px #dadada;*/
+}
+
 /* 核销详情 */
 .sheet {
   color: #6d6d6d;
@@ -461,4 +674,9 @@ image.boy {
 .sheet .left {
   width: 195px;
 }
+
+.content_card {
+  border-radius: 10px;
+  box-shadow: 0px 6px 11px #dadada;
+}
 </style>

+ 40 - 258
src/pages/report/index.vue.bakk → src/pages/report/index.vue.back

@@ -24,134 +24,33 @@
       </view>
       <view class="down">
         <view>{{ record.att_average }}</view>
-        <view>专注力得分</view>
+        <view>专注力均值</view>
       </view>
     </view>
-
-    <!--    训练时长和训练设备  -->
-    <view class="po1 padding-lr margin-top-xl">
-      <van-row>
-        <van-col span="11">
-          <view>
-            <text>训练时长</text>
-            <text class="text-bold text-xl"> &nbsp; {{ record.play_time }}</text>
-          </view>
-        </van-col>
-
-        <van-col
-          span="11"
-          offset="2"
-        >
-          <view>
-            <text>训练设备</text>
-            <text class="text-bold text-xl">&nbsp; {{ record.name }}</text>
-          </view>
-        </van-col>
-      </van-row>
-    </view>
-    <view>
-      <van-divider
-        contentPosition="left"
-        borderColor="#E98F36"
-      >
-        <van-image
-          src="https://img.shuimuai.com/line.png"
-          alt=""
-          width="40"
-          height="40"
-        ></van-image>
-      </van-divider>
-    </view>
-
-    <!--    专注力维持区间、受干扰次数,专注力最大爆发值、专注力启动时长-->
-    <view class="margin-tb">
-
-      <view class="detail">
-        <view>
-          <view>{{ record.scope_diff }}</view>
-          <view>专注力维持区间</view>
-        </view>
-      </view>
-
-      <view class="detail">
-        <view>
-          <view>{{ record.interfere }}</view>
-          <view>受干扰次数</view>
-        </view>
-      </view>
-
-      <view class="hight_pie_chart">
-        <mpvue-echarts
-          :echarts="echarts"
-          :onInit="hight_att_charts"
-          canvasId="demo-canvas1"
-        />
-      </view>
-
-      <view class="detail">
-        <view>
-          <view>{{ record.burst }}</view>
-          <view>专注力最大爆发值</view>
-        </view>
-      </view>
-
-      <view class="detail">
-        <view>
-          <view>{{ record.start }}</view>
-          <view>专注力启动时长</view>
-        </view>
-      </view>
-
-      <view class="detail">
-        <view>
-          <view>{{ record.height_absorbed }}%</view>
-          <view>高专注力占比</view>
-        </view>
-      </view>
-
-    </view>
-
     <view class="bar">
       <view>
         <view class="line"></view>
-        <view class="title">专注力要素分析</view>
+        <view class="title">数据详情</view>
       </view>
     </view>
-
-    <view class="radar_chart">
-      <mpvue-echarts
-        :echarts="echarts"
-        :onInit="radar_charts"
-        canvasId="demo-canvas2"
-      />
-    </view>
-
-    <view class="">
-      <view class="bar">
-        <view>
-          <view class="line"></view>
-          <view class="title">报告分析</view>
-        </view>
+    <view class="detail">
+      <view>
+        <view>{{ record.att_max }}</view>
+        <view>专注力最高分</view>
+        <!-- <view>{{ record.interfere }} </view>
+        <view>被干扰次数</view> -->
       </view>
-      <view class="conclution">{{ record.content }}</view>
-      <!-- <view class="conclution">{{ record.content2 }}</view> -->
-
-      <view class="bar">
-        <view>
-          <view class="line"></view>
-          <view class="title">训练建议</view>
-        </view>
+      <view>
+        <view>{{ record.scope_diff }}</view>
+        <view>专注力广度</view>
       </view>
-      <view class="conclution">{{ record.advise }}</view>
     </view>
-
     <view class="bar">
       <view>
         <view class="line"></view>
-        <view class="title">专注力数值曲线</view>
+        <view class="title">基本脑波</view>
       </view>
     </view>
-
     <view class="chart">
       <mpvue-echarts
         :echarts="echarts"
@@ -177,34 +76,27 @@
         ></van-tab>
       </van-tabs>
     </view>
-
-    <view class="cu-bar bg-white">
-      <view class="action">
-        <text class="cuIcon-titles text-primary"></text>
-        <text class="">专注力数值累计比例</text>
+    <view class="conclution"> <text class="conclution_title">分析</text>: {{ record.content }}</view>
+    <view class="conclution"> <text class="conclution_title">建议</text>: {{ record.advise }}</view>
+    <view class="bar">
+      <view>
+        <view class="line"></view>
+        <view class="title">核销详情</view>
       </view>
     </view>
-    <view class="chart">
-      <mpvue-echarts
-        :echarts="echarts"
-        :onInit="pie_charts"
-        canvasId="demo-canvas-1"
-      />
+    <view class="sheet">
+      <view class="left">
+        <view>专注力训练设备: {{ record.name }}</view>
+        <view>核销方式:
+          <text v-if="record.consumption_type==1">次卡</text>
+          <text v-if="record.consumption_type==2">时间卡</text>
+        </view>
+        <view>会员游玩时间: {{ record.play_time }}</view>
+      </view>
+      <view class="right">
+        <view>专注力训练时长: {{ record.play_time }}</view>
+      </view>
     </view>
-
-    <!--    <view class="sheet">-->
-    <!--      <view class="left">-->
-    <!--        <view>专注力训练设备: {{ record.name }}</view>-->
-    <!--        <view>核销方式:-->
-    <!--          <text v-if="record.consumption_type==1">次卡</text>-->
-    <!--          <text v-if="record.consumption_type==2">时间卡</text>-->
-    <!--        </view>-->
-    <!--        <view>会员游玩时间: {{ record.play_time }}</view>-->
-    <!--      </view>-->
-    <!--      <view class="right">-->
-    <!--        <view>专注力训练时长: {{ record.play_time }}</view>-->
-    <!--      </view>-->
-    <!--    </view>-->
     <van-toast id="van-toast" />
 
   </div>
@@ -213,18 +105,12 @@
 <script>
 import mpvueEcharts from "mpvue-echarts";
 import echarts from "../../../static/echarts.min";
-import util, {
-  filterPieData,
-  formatSeconds,
-  getHightPieChartOption,
-  getPieChartsOption,
-  getRadarChartOption,
-} from "../../utils/index";
+import util, { formatSeconds } from "../../utils/index";
 import { gameDetail, gameLineChart } from "../../requests/game";
 import game_store from "../../store/game";
 import Toast from "../../../static/vant/toast/toast";
 
-var att_charts, hight_att_pie_charts, radar_charts, $pie_charts, $this;
+var att_charts, $this;
 
 // 大脑图表初始化
 function initAttChart(canvas, width, height) {
@@ -241,50 +127,6 @@ function initAttChart(canvas, width, height) {
   return att_charts; // 返回 chart 后可以自动绑定触摸操作
 }
 
-// 大脑图表初始化
-function initHightPieChart(canvas, width, height) {
-  hight_att_pie_charts = echarts.init(canvas, null, {
-    width: width,
-    height: height,
-  });
-  canvas.setChart(hight_att_pie_charts);
-
-  var option = getHightPieChartOption(0, 0); // ECharts 配置项
-
-  hight_att_pie_charts.setOption(option);
-
-  return hight_att_pie_charts; // 返回 chart 后可以自动绑定触摸操作
-}
-
-// 大脑图表初始化
-function initRadarChart(canvas, width, height) {
-  radar_charts = echarts.init(canvas, null, {
-    width: width,
-    height: height,
-  });
-  canvas.setChart(radar_charts);
-
-  var option = getRadarChartOption(0); // ECharts 配置项
-
-  radar_charts.setOption(option);
-
-  return radar_charts; // 返回 chart 后可以自动绑定触摸操作
-}
-
-function initPieChart(canvas, width, height) {
-  $pie_charts = echarts.init(canvas, null, {
-    width: width,
-    height: height,
-  });
-  canvas.setChart($pie_charts);
-
-  var option = getPieChartsOption(); // ECharts 配置项
-
-  $pie_charts.setOption(option);
-
-  return $pie_charts; // 返回 chart 后可以自动绑定触摸操作
-}
-
 export default {
   name: "index_container",
   components: {
@@ -295,10 +137,6 @@ export default {
       // 0:未选择 1:时间 2:次数
       // 折线图
       attCharts: initAttChart,
-      hight_att_charts: initHightPieChart,
-      radar_charts: initRadarChart,
-      pie_charts: initPieChart,
-
       echarts,
       record: {},
       userinfo: {},
@@ -324,35 +162,10 @@ export default {
       setTimeout(() => {
         gameDetail($record_id).then(
           (res) => {
+            console.log("get_game_detail", res);
             Toast.clear();
             let $res = res.data;
             $this.record = $res.data;
-            console.log("成绩记录参数", $this.record);
-            $this.record.play_time = formatSeconds($this.record.play_time);
-            $this.record.height_absorbed = Math.ceil(
-              $this.record.height / $this.record.total * 100
-            );
-            let $options = getHightPieChartOption(
-              $this.record.height,
-              $this.record.total
-            );
-            hight_att_pie_charts.setOption($options);
-
-            //设置雷达图
-            $options = getRadarChartOption([
-              $this.record.att_average, //平均
-              $this.record.att_scope, //广度
-              $this.record.att_burst, //爆发
-              $this.record.att_interfere, //抗干扰
-              $this.record.att_start, //启动
-              $this.record.att_height, // 高专注占比
-            ]);
-            radar_charts.setOption($options);
-
-            let $pie_data = filterPieData($this.record.level);
-            let $pie_option = getPieChartsOption($pie_data);
-            $pie_charts.setOption($pie_option);
-
             //5分钟阶段
             let $five_min = 5 * 60;
             $this.is_cut = $this.record.play_time > $five_min;
@@ -362,6 +175,7 @@ export default {
                 $this.record.play_time / $five_min
               );
             }
+            $this.record.play_time = formatSeconds($this.record.play_time);
           },
           (err) => {
             Toast.fail("错误代码:" + res.code + ",联系客服");
@@ -402,7 +216,7 @@ export default {
               $option = util.getLineOption($line_data, [0]);
             }
             att_charts.setOption($option);
-          }, 800);
+          }, 1000);
         },
         (err) => {
           Toast.fail("错误代码:" + res.code + ",联系客服");
@@ -427,6 +241,7 @@ export default {
     wx.removeStorageSync("played_time");
     $this.get_report($this.record_id);
     $this.get_game_line($this.record_id);
+    console.log("进来时候获取到的信息", $this.record);
   },
   created() {
     $this = this;
@@ -545,18 +360,12 @@ image.boy {
 }
 
 /* 详细数据 */
-.margin-tb {
-  display: flex;
-  justify-content: space-around;
-  flex-wrap: wrap;
-}
-
 .detail {
-  width: 30%;
+  width: 100%;
   height: 102px;
-  /*display: flex;*/
-  /*align-items: center;*/
-  /*justify-content: space-around;*/
+  display: flex;
+  align-items: center;
+  justify-content: space-around;
 }
 
 .detail view {
@@ -598,7 +407,6 @@ image.boy {
   color: #6c6c6c;
   box-sizing: border-box;
 }
-
 .conclution_title {
   font-weight: 600;
   color: #000;
@@ -632,27 +440,6 @@ image.boy {
   box-shadow: 0px 6px 11px #dadada;
 }
 
-/*雷达图*/
-.radar_chart {
-  margin: 0 auto;
-  width: 360px;
-  height: 293px;
-  background: #f3f3f3;
-  opacity: 0.6;
-  border-radius: 10px;
-  box-shadow: 0px 6px 11px #dadada;
-}
-
-.hight_pie_chart {
-  /* margin: 0 auto; */
-  width: 30%;
-  height: 102px;
-  background: #f3f3f3;
-  margin-top: 5px;
-  /*border-radius: 10px;*/
-  /*box-shadow: 0px 6px 11px #dadada;*/
-}
-
 /* 核销详情 */
 .sheet {
   color: #6d6d6d;
@@ -674,9 +461,4 @@ image.boy {
 .sheet .left {
   width: 195px;
 }
-
-.content_card {
-  border-radius: 10px;
-  box-shadow: 0px 6px 11px #dadada;
-}
 </style>

+ 30 - 35
src/pages/start/index.vue

@@ -3,21 +3,15 @@
     <!--    计费面板模块-->
     <div class="game_panel padding-top-sm">
       <van-row gutter="16">
-        <van-col
-          span="8"
-          offset="2"
-        >
+        <van-col span="8" offset="2">
           <view class="text-sm">
             <text class="title">本次游玩时间</text>
           </view>
-          <view class="text-lg   padding-top">
+          <view class="text-lg padding-top">
             <text class="count_down_text">{{ played_time_text }}</text>
           </view>
         </van-col>
-        <van-col
-          span="10"
-          offset="4"
-        >
+        <van-col span="10" offset="4">
           <view class="text-sm">
             <text class="title">计费模式</text>
             <text class="type padding-left-sm">{{ mode_item.name }}</text>
@@ -30,7 +24,7 @@
               src="https://img.shuimuai.com/m_duankainaohuan.png"
               class="cut_brain_icon"
               alt=""
-            >
+            />
             <text class="padding-lr cut_text text-sm">结束游戏</text>
           </button>
         </van-col>
@@ -40,10 +34,7 @@
     <!--    设备状态-->
     <div class="game_status padding-tb">
       <van-row>
-        <van-col
-          span="10"
-          offset="2"
-        >
+        <van-col span="10" offset="2">
           <div
             class="flex flex-direction align-center justify-center"
             v-if="device_bg"
@@ -52,18 +43,15 @@
               src="https://img.shuimuai.com/web/touhuanzhuangtai_2.png"
               alt=""
               class="device_img"
-            >
+            />
             <text class="text-default">已经正确佩戴</text>
           </div>
-          <div
-            class="flex flex-direction align-center justify-center"
-            v-else
-          >
+          <div class="flex flex-direction align-center justify-center" v-else>
             <img
               src="https://img.shuimuai.com/web/touhuanzhuangtai_3.png"
               alt=""
               class="device_img"
-            >
+            />
             <text class="text-default">未正确佩戴</text>
           </div>
         </van-col>
@@ -73,9 +61,9 @@
               <img
                 src="https://img.shuimuai.com/web/dianchi_3.png"
                 alt=""
-                :style="{width:device_power+'%'}"
+                :style="{ width: device_power + '%' }"
                 class="device_elc"
-              >
+              />
             </view>
             <text class="text-default">{{ device_power }}%</text>
             <text class="text-default">设备电量</text>
@@ -97,7 +85,6 @@
     <!--    图标模块-->
     <div class="ec_container">
       <view class="chart_view_first margin-tb-xl">
-
         <view class="bar">
           <view>
             <view class="line"></view>
@@ -124,7 +111,6 @@
       </view>
 
       <view class="chart_view_second margin-tb-xl">
-
         <view class="bar">
           <view>
             <view class="line"></view>
@@ -157,11 +143,12 @@
           />
         </view>
       </view>
-
     </div>
 
-    <van-toast id="van-toast" />
     <van-dialog id="van-dialog" />
+    <van-toast id="van-toast" />
+    <van-notify id="van-notify" />
+    
   </div>
 </template>
 
@@ -171,6 +158,7 @@ import bluetooth from "../../utils/bluetooth";
 import game_store from "@/store/game";
 import Toast from "../../../static/vant/toast/toast";
 import Dialog from "../../../static/vant/dialog/dialog";
+import Notify from "../../../static/vant/notify/notify";
 import { gameAddLine, gameEnd } from "../../requests/game";
 import mpvueEcharts from "mpvue-echarts";
 import echarts from "../../../static/echarts.min";
@@ -274,7 +262,9 @@ export default {
       //取消监听低功耗蓝牙设备
       wx.offBLECharacteristicValueChange();
       //设置游戏状态为 停止游戏
-      game_store.setters.setGameStatus(3);
+      game_store.getters.getGameStatus() == 0
+        ? game_store.setters.setGameStatus(0)
+        : game_store.setters.setGameStatus(3);
       //游戏结束重置游戏时间
       wx.removeStorageSync("play_time");
       //删除游戏专注数据
@@ -348,11 +338,12 @@ export default {
 
     // ArrayBuffer转16进度字符串示例
     ab2hex(buffer) {
-      var hexArr = Array.prototype.map.call(new Uint8Array(buffer), function(
-        bit
-      ) {
-        return ("00" + bit.toString(16)).slice(-2);
-      });
+      var hexArr = Array.prototype.map.call(
+        new Uint8Array(buffer),
+        function (bit) {
+          return ("00" + bit.toString(16)).slice(-2);
+        }
+      );
       return hexArr.join("");
     },
     // 往后端推送一次定时数据
@@ -430,7 +421,6 @@ export default {
         game_record_id: game_store.getters.getGameRecordId(),
         type: $this.mode,
         // play_time: $this.play_time - Math.abs($this.played_time),
-        // play_time: $this.play_time - $this.played_time,
         play_time: $this.over_play_time - $this.played_time,
       };
       //
@@ -445,13 +435,13 @@ export default {
         $this.alpha_list = [];
         $this.theta_list = [];
         $this.beta_list = [];
-        //游戏结束重置游戏时间
+        //游戏结束重置游戏卡卷类型时间和卡卷类型
         wx.removeStorageSync("over_play_time");
         game_store.setters.setMode(0);
       });
     },
     //  处理游戏中数据的方法
-    do_datas: function($data) {
+    do_datas: function ($data) {
       $this.att_list.push($data["att"]);
       $this.med_list.push($data["med"]);
       $this.delta_list.push(Math.round($data["delta"] / 10000));
@@ -815,4 +805,9 @@ export default {
   opacity: 0.6;
   border-radius: 10px;
 }
+
+/* 提高dialog提示的层级 */
+#van-dialog {
+  z-index: 10000001 !important;
+}
 </style>

+ 7 - 4
src/pages/user_center/index.vue

@@ -20,10 +20,11 @@
         <!--        </view>-->
       </view>
       <view class="down">
-        <view>0</view>
+        <view class="down_num">0</view>
         <view>
-          <img src="https://img.shuimuai.com/m_icon_jifen%402x.png"/>
-          <text>积分</text>
+          <!-- <img src="https://img.shuimuai.com/m_icon_jifen%402x.png"/>
+          <text>积分</text> -->
+            <text>智脑成长系数</text>
         </view>
       </view>
     </view>
@@ -245,7 +246,9 @@ image.bianji {
   align-items: center;
   justify-content: start;
 }
-
+.user .down .down_num{
+  margin:5px 0;
+}
 .user .down image {
   width: 16px;
   height: 16px;

+ 16 - 17
src/requests/game.js

@@ -2,45 +2,44 @@ import fly from "./main";
 
 // 设备列表
 export function game_devices($params = {}) {
-  $params['access_token'] = wx.getStorageSync('token')
-  return fly.post('game/device-list', $params)
+  $params["access_token"] = wx.getStorageSync("token");
+  return fly.post("game/device-list", $params);
 }
 
-
 // 开始游戏
 export function gameStart($params) {
-  return fly.post('game/game-start', $params)
+  return fly.post("game/game-start", $params);
 }
 
 //结束游戏
 export function gameEnd($params) {
-  $params['access_token'] = wx.getStorageSync('token')
-  return fly.post('game/game-over', $params)
+  $params["access_token"] = wx.getStorageSync("token");
+  return fly.post("game/game-over", $params);
 }
 
 //游戏记录详情
 export function gameDetail($record_id) {
-  let $params = {}
-  $params['game_record_id'] = $record_id
-  $params['access_token'] = wx.getStorageSync('token')
-  return fly.post('game/game-detail', $params)
+  let $params = {};
+  $params["game_record_id"] = $record_id;
+  //   $params["game_record_id"] = "9270";
+  $params["access_token"] = wx.getStorageSync("token");
+  return fly.post("game/game-detail", $params);
 }
 
 //折线图图表
 export function gameLineChart($params) {
-  $params['access_token'] = wx.getStorageSync('token')
-  return fly.post('game/line', $params)
+  $params["access_token"] = wx.getStorageSync("token");
+  return fly.post("game/line", $params);
 }
 
-
 // 添加折线图的点
 export function gameAddLine($params) {
-  $params['access_token'] = wx.getStorageSync('token')
-  return fly.post('game/add-line', $params)
+  $params["access_token"] = wx.getStorageSync("token");
+  return fly.post("game/add-line", $params);
 }
 
 //获取游戏记录
 export function gameList($params = {}) {
-  $params['access_token'] = wx.getStorageSync('token')
-  return fly.post('game/game-list', $params)
+  $params["access_token"] = wx.getStorageSync("token");
+  return fly.post("game/game-list", $params);
 }

+ 9 - 0
src/requests/user.js

@@ -117,3 +117,12 @@ export function getBannerList(){
   }
   return fly.post('activity/activity-list', $params)
 }
+
+//小程序登录一次就录入一次数据
+export function setUserLogin() {
+  console.log('录入调用成功了嘛')
+  let $params = {
+    access_token:wx.getStorageSync('token')
+  }
+  return fly.post('user/user-login', $params)
+}

+ 15 - 7
src/utils/bluetooth.js

@@ -1,6 +1,7 @@
 import game_store from "../store/game";
 import ble_store from "../store/bluetooth";
 import bluetooth from "../store/bluetooth";
+import Notify from "../../static/vant/notify/notify";
 
 export default {
   // 发送开启脑电数据包指令
@@ -227,8 +228,7 @@ export default {
   connect_toy(hexStr, deviceId, serviceId, Cid, Toast) {
     console.log("开始连接玩具");
     let $flag = "";
-    let $toys = [
-      {
+    let $toys = [{
         id: 1,
         hex: "aadd0a0000",
         msg: "无连接设备",
@@ -438,7 +438,15 @@ export default {
         //判断游戏是否游戏中
         let $game_status = game_store.getters.getGameStatus();
         if ($game_status == 1) {
-          $that.game_finished();
+          // $that.game_finished();
+          //清除状态 设置为默认初始状态 0 小乌龟
+          Notify({
+            type: 'danger',
+            duration: 0,
+            message: '智脑环已断开连接,请重新扫码智脑环'
+          });
+          game_store.setters.setGameStatus(0);
+
         }
       }
     });
@@ -661,7 +669,7 @@ export default {
           title: "脑环电量不足",
           icon: "none",
           success() {
-            $this.change_device_status(0);
+            // $this.change_device_status(0);
           },
         });
       }
@@ -672,12 +680,12 @@ export default {
           if ($this.played_time > 0) {
             //自定义定时器
             $this.played_time -= 1;
-            console.log('时间自定义每秒减少1~~~ played_time',$this.played_time )
+            console.log('时间自定义每秒减少1~~~ played_time', $this.played_time)
             game_store.setters.setPlayedTime($this.played_time)
             $this.played_time_text = that.formatPlaySeconds($this.played_time);
             $this.do_datas($data);
           }
-          if ($this.played_time == 0) {   
+          if ($this.played_time == 0) {
             //判断是否隐藏 隐藏则不绘画
             that.shutdownSendControl(
               characteristic.deviceId,
@@ -697,7 +705,7 @@ export default {
   },
   // 游玩时间倒计时 
   formatPlaySeconds(value) {
-        console.log('剩余可游玩时间',value)
+    console.log('剩余可游玩时间', value)
     // 字符串转数字
     var secondTime = parseInt(value); // 秒
     var minuteTime = 0; // 分

+ 5 - 5
src/utils/index.js

@@ -364,11 +364,11 @@ export function getHightPieChartOption($params, $total) {
         data: [
           // {value: $params, name: '高专注占比'},
           // {value: Math.abs(100-$params), name: '直接访问'},
-          { value: $params, name: "高专注占比" },
-          { value: Math.abs($total - $params), name: "直接访问" },
-        ],
-      },
-    ],
+          {value: $params, name: ''},
+          {value: Math.abs($total - $params), name: ''},
+        ]
+      }
+    ]
   };
   return $option;
 }