Browse Source

Merge branch 'master' of gitee.com:sh_13808852820/program into master

智方网络_吖荣 4 years ago
parent
commit
dade4d93b0

+ 2 - 0
src/app.json

@@ -1,5 +1,6 @@
 {
   "pages": [
+
     "pages/index/main",
     "pages/start/main",
     "pages/none/main",
@@ -28,6 +29,7 @@
     "pages/test/main",
     "pages/competition/main",
     "pages/payment/main"
+
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 49 - 27
src/components/banner.vue

@@ -1,12 +1,29 @@
 <template>
   <div id="banner_container">
     <!--    <img src="https://img.shuimuai.com/mp/banners/banner1%402x.png" class="full_img main_banner" alt="">-->
-    <swiper class="screen-swiper round-dot full_img main_banner" :indicator-dots="true" :circular="true"
-            :autoplay="true" interval="5000" duration="500">
-      <swiper-item v-for="(item,index) in banners" :key="index" class="full_img main_banner">
-        <img :src="item.src" mode="aspectFill" class="full_img main_banner">
-        <button class="cu-btn bg-yellow text-white join_button" @click="to_none(item.url)">{{
-            item.button_text
+    <swiper
+      class="screen-swiper round-dot full_img main_banner"
+      :indicator-dots="true"
+      :circular="true"
+      :autoplay="true"
+      interval="5000"
+      duration="500"
+    >
+      <swiper-item
+        v-for="(item,index) in banners"
+        :key="index"
+        class="full_img main_banner"
+      >
+        <img
+          :src="item.src"
+          mode="aspectFill"
+          class="full_img main_banner"
+        >
+        <button
+          class="cu-btn bg-yellow text-white join_button"
+          @click="to_none(item.url)"
+        >{{
+          item.button_text
           }}
         </button>
       </swiper-item>
@@ -15,7 +32,7 @@
 </template>
 
 <script>
-import {getBannerList} from "../requests/user";
+import { getBannerList } from "../requests/user";
 
 var $this;
 export default {
@@ -26,42 +43,47 @@ export default {
         {
           id: 1,
           src: "https://img.shuimuai.com/mp/banners/banner1%402x.png",
-          url: '/pages/none/main',
-          button_text: '关于水母星球'
+          url: "/pages/none/main",
+          button_text: "关于水母星球",
         },
         {
           id: 2,
           src: "https://img.shuimuai.com/mp/banners/banner3%402x.png",
-          url: '/pages/competition/main',
-          button_text: '比赛详情'
-        }
-      ]
-    }
+          url: "/pages/competition/main",
+          button_text: "比赛详情",
+        },
+      ],
+    };
   },
   methods: {
     to_none($url) {
       mpvue.navigateTo({
-        url: $url
-      })
+        url: $url,
+      });
     },
     getBanners() {
       getBannerList().then((res) => {
-        let $res = res.data
-        let $activities = $res.data
-        let $new_act = $activities.pop()
-        console.log($new_act)
-        $this.banners[1].src = $new_act['img']?$new_act['img']:"https://img.shuimuai.com/mp/pkbanner4%402x.png"
-        $this.banners[1].url = '/pages/competition/main?activity_id=' + $new_act['activity_id']
-      })
-    }
+        let $res = res.data;
+        let $activities = $res.data;
+        let $new_act = $activities.pop();
+        // console.log("轮播图", $new_act);
+
+        $this.banners[1].src = $new_act["img"]
+          ? "https://img.shuimuai.com/" + $new_act["img"]
+          : "https://img.shuimuai.com/banner_activity_may_1.png";
+
+        $this.banners[1].url =
+          "/pages/competition/main?activity_id=" + $new_act["activity_id"];
+      });
+    },
   },
   mounted() {
-    $this.getBanners()
+    $this.getBanners();
   },
   created() {
     $this = this;
-  }
-}
+  },
+};
 </script>
 
 <style>

+ 28 - 1
src/components/device/device.vue

@@ -339,7 +339,12 @@ export default {
     },
     //打开蓝牙搜索
     onBluetoothDeviceFound() {
-      console.log("打开蓝牙搜索");
+      console.log(
+        "打开蓝牙搜索 device_status",
+        $this.device_status,
+        "是否有id _deviceId",
+        $this._deviceId
+      );
       try {
         // 5秒后判断 这5秒在搜索设备,搜索到就赋值给_deviceId
         setTimeout(() => {
@@ -347,6 +352,11 @@ export default {
             wx.stopBluetoothDevicesDiscovery();
             $this.change_device_status(0);
             Toast.fail("未连接到设备");
+          } else if ($this.device_status == 1) {
+            wx.stopBluetoothDevicesDiscovery();
+            $this.change_device_status(0);
+            Toast.fail("设备未连接到");
+            console.log('设备未连接到device_status的状态为:',$this.device_status)
           }
         }, 5000);
         wx.onBluetoothDeviceFound((res) => {
@@ -363,6 +373,8 @@ export default {
               game_store.setters.setDeviceId(device.deviceId);
               $this._deviceId = device.deviceId;
 
+              console.log("蓝牙搜索状态 device_status", $this.device_status);
+
               $this.createBLEConnection();
             }
           });
@@ -373,6 +385,12 @@ export default {
     },
     // 停止蓝牙搜索
     stopBluetoothDevicesDiscovery() {
+      console.log(
+        "脑环被占用的情况下我能获取到吗?",
+        $this.device_status,
+        "是否有id _deviceId",
+        $this._deviceId
+      );
       wx.stopBluetoothDevicesDiscovery();
     },
     //连接低功耗蓝牙设备。
@@ -430,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;
@@ -441,6 +460,14 @@ 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;
+      bluetooth.watch_bluetooth_status($this);
+     
+      // console.log('我是在游戏中断开,我触发了嘛~',$this.connect_toy, $this.connect_show,$this.device_status );
     }
   },
   onLoad(options) {

+ 25 - 14
src/components/device/unconnect.vue

@@ -1,42 +1,53 @@
 <template>
   <div>
     <van-row>
-      <van-col span="11" class="text-gray text-sm left" offset="1">
+      <van-col
+        span="11"
+        class="text-gray text-sm left"
+        offset="1"
+      >
         <view>1.打开手机蓝牙和位置信息</view>
         <view>2.长按头环侧面按钮启动头环</view>
         <view>3.点击扫码开始连接</view>
       </van-col>
 
-      <van-col span="8" offset="2">
-        <img src="https://img.shuimuai.com/lanyashuimu.png" class="connect_img"/>
+      <van-col
+        span="8"
+        offset="2"
+      >
+        <img
+          src="https://img.shuimuai.com/lanyashuimu.png"
+          class="connect_img"
+        />
       </van-col>
     </van-row>
-    <button class="cu-btn lg cu-btn-primary text-white text-center scan_button margin-tb" @click="open_scan">扫码连接智脑环
+    <button
+      class="cu-btn lg cu-btn-primary text-white text-center scan_button margin-tb"
+      @click="open_scan"
+    >扫码连接智脑环
     </button>
-    <van-toast id="van-toast"/>
+    <van-toast id="van-toast" />
 
   </div>
 </template>
 
 <script>
-
-var $this
+var $this;
 export default {
   name: "unconnect",
   data() {
-    return {}
+    return {};
   },
   methods: {
     open_scan() {
-      this.$emit('open_scan')
-    }
+      this.$emit("open_scan");
+    },
   },
   created() {
-    $this = this
+    $this = this;
   },
-  onShow() {
-  }
-}
+  onShow() {},
+};
 </script>
 
 <style scoped>

+ 32 - 9
src/components/index/regist.vue

@@ -61,13 +61,20 @@
     </div>
 
     <div class="text-center padding-lr padding-top">
-      <button
+      <!-- <button
         class="cu-btn lg cu-btn-primary text-white text-center"
         open-type="getUserInfo"
         @getuserinfo="get_Userinfo"
         :disabled="btn_disabled"
       >
         {{ title }}
+      </button> -->
+      <button
+        class="cu-btn lg cu-btn-primary text-white text-center"
+        @click='get_user_info'
+        :disabled="btn_disabled"
+      >
+        {{ title }}
       </button>
     </div>
     <view class="text-center text-xs protocol_text">
@@ -422,14 +429,30 @@ export default {
       $this.time_start = $this.time_show = false;
     },
     //  获取用户信息
-    get_Userinfo(e) {
-      console.log(e);
-      if (e.mp.detail.errMsg == "getUserInfo:fail auth deny") {
-        Toast.fail("请进行授权登录");
-      } else {
-        $this._userinfo = e.mp.detail.userInfo;
-        $this.wechat_login();
-      }
+    // get_Userinfo(e) {
+    //   console.log("获取到的用户信息为:", e);
+    //   if (e.mp.detail.errMsg == "getUserInfo:fail auth deny") {
+    //     Toast.fail("请进行授权登录");
+    //   } else {
+    //     $this._userinfo = e.mp.detail.userInfo;
+    //     $this.wechat_login();
+    //   }
+    // },
+    get_user_info() {
+      wx.getUserProfile({
+        desc: "获取你的昵称、头像、地区及性别",
+        success: (res) => {
+          let wxUserInfo = res.userInfo;
+          $this._userinfo = wxUserInfo;
+          $this.wechat_login();
+          console.log("我能获取到用户的信息吗??", $this._userinfo);
+        },
+        fail: (res) => {
+          //拒绝授权
+          Toast.fail("请进行授权登录");
+          return;
+        },
+      });
     },
   },
   mounted() {

+ 98 - 45
src/pages/agent/index/index.vue

@@ -6,12 +6,20 @@
       <van-row>
 
         <div class="userinfo padding-tb-sm">
-          <van-col span="3" offset="2">
-            <view class="cu-avatar lg"
-                  :style="'background-image:url('+userinfo.portrait+');'"></view>
+          <van-col
+            span="3"
+            offset="2"
+          >
+            <view
+              class="cu-avatar lg"
+              :style="'background-image:url('+userinfo.portrait+');'"
+            ></view>
           </van-col>
 
-          <van-col span="6" offset="1">
+          <van-col
+            span="6"
+            offset="1"
+          >
             <view class="label">
               <view class="text-bold">
                 <text class="text-white text-lg">{{ userinfo.user_name }}</text>
@@ -22,12 +30,14 @@
             </view>
           </van-col>
 
-
         </div>
       </van-row>
 
       <!--      收益模块-->
-      <div class="profit_container text-center" @click="to_income">
+      <div
+        class="profit_container text-center"
+        @click="to_income"
+      >
         <view>
           <text class="text-normal padding">累计收益(元)</text>
         </view>
@@ -42,11 +52,14 @@
         </view>
       </div>
 
-
       <!--      订单、客户、邀请卡粗图-->
       <div class="profit_detail_contaienr text-center padding-top-lg">
         <van-row gutter="40">
-          <van-col span="6" offset="3" @click="to_extend_order">
+          <van-col
+            span="6"
+            offset="3"
+            @click="to_extend_order"
+          >
             <view>
               <text class="text-xxl text-white">{{ agent_info.order_count }}</text>
             </view>
@@ -54,7 +67,10 @@
               <text class="text-normal text-sm">累计订单</text>
             </view>
           </van-col>
-          <van-col span="6" @click="to_customer">
+          <van-col
+            span="6"
+            @click="to_customer"
+          >
             <view>
               <text class="text-xxl text-white">{{ agent_info.user_count }}</text>
             </view>
@@ -62,7 +78,10 @@
               <text class="text-normal text-sm">累计客户</text>
             </view>
           </van-col>
-          <van-col span="6" @click="to_agent_invite_card">
+          <van-col
+            span="6"
+            @click="to_agent_invite_card"
+          >
             <view>
               <text class="text-xxl text-white">{{ agent_info.invite_count }}</text>
             </view>
@@ -75,39 +94,74 @@
       </div>
     </div>
 
-
     <!--      提现金额-->
-    <div class="withdraw_container flex justify-between align-center padding-lr" @click="to_agent_cal_center">
+    <div
+      class="withdraw_container flex justify-between align-center padding-lr"
+      @click="to_agent_cal_center"
+    >
       <text class="text-white">可提现金额(元)</text>
       <text class="text-white withdraw_money">{{ agent_info.user_balance }}</text>
     </div>
 
     <!--      菜单列表-->
     <div class="menu">
-      <van-cell title="今日收益(元)" :value="income_info.rebater" is-link url="/pages/agent/income_cal/main?tab=2">
-        <van-icon name="balance-o" slot="icon" color="#4B3AB0" class="margin-lr-sm" size="20px"></van-icon>
+      <van-cell
+        title="今日收益(元)"
+        :value="income_info.rebater"
+        is-link
+        url="/pages/agent/income_cal/main?tab=2"
+      >
+        <van-icon
+          name="balance-o"
+          slot="icon"
+          color="#4B3AB0"
+          class="margin-lr-sm"
+          size="20px"
+        ></van-icon>
       </van-cell>
 
-      <van-cell title="今日订单" :value="income_info.today_order" is-link url="/pages/agent/extend/orders/main?tab=2">
-        <van-icon name="notes-o" slot="icon" color="#4B3AB0" class="margin-lr-sm" size="20px"></van-icon>
+      <van-cell
+        title="今日订单"
+        :value="income_info.today_order"
+        is-link
+        url="/pages/agent/extend/orders/main?tab=2"
+      >
+        <van-icon
+          name="notes-o"
+          slot="icon"
+          color="#4B3AB0"
+          class="margin-lr-sm"
+          size="20px"
+        ></van-icon>
       </van-cell>
 
-      <van-cell title="今日新增客户" :value="income_info.today_user" is-link url="/pages/agent/customer/main?tab=2">
-        <van-icon name="contact" slot="icon" color="#4B3AB0" class="margin-lr-sm" size="20px"></van-icon>
+      <van-cell
+        title="今日新增客户"
+        :value="income_info.today_user"
+        is-link
+        url="/pages/agent/customer/main?tab=2"
+      >
+        <van-icon
+          name="contact"
+          slot="icon"
+          color="#4B3AB0"
+          class="margin-lr-sm"
+          size="20px"
+        ></van-icon>
       </van-cell>
 
     </div>
-    <van-toast id="van-toast"/>
+    <van-toast id="van-toast" />
 
   </div>
 </template>
 
 <script>
-import {agentDetail, agentIncomeDetail} from "../../../requests/agent";
-import utils from '@/utils/index'
-import Toast from '../../../../static/vant/toast/toast'
+import { agentDetail, agentIncomeDetail } from "../../../requests/agent";
+import utils from "@/utils/index";
+import Toast from "../../../../static/vant/toast/toast";
 
-var $this
+var $this;
 export default {
   name: "agent_index_container",
   filter: {},
@@ -119,31 +173,31 @@ export default {
       //代理商详情
       agent_info: {},
       //代理商收益详情
-      income_info: {}
-    }
+      income_info: {},
+    };
   },
   methods: {
     //跳转收益中心
     to_income() {
       mpvue.navigateTo({
-        url: "/pages/agent/income_cal/main?tab=1"
-      })
+        url: "/pages/agent/income_cal/main?tab=1",
+      });
     },
     //  跳转推广订单
     to_extend_order() {
       mpvue.navigateTo({
-        url: "/pages/agent/extend/orders/main?tab=1"
-      })
+        url: "/pages/agent/extend/orders/main?tab=1",
+      });
     },
     //  跳转推广客户
     to_customer() {
       mpvue.navigateTo({
-        url: "/pages/agent/customer/main?tab=1"
-      })
+        url: "/pages/agent/customer/main?tab=1",
+      });
     },
     //  跳转代理商结算中心
     to_agent_cal_center() {
-      Toast.fail('暂未开通,请联系客服')
+      Toast.fail("暂未开通,请联系客服");
       // mpvue.navigateTo({
       //   url: "/pages/agent/settlement_center/index/main"
       // })
@@ -151,32 +205,32 @@ export default {
     //  邀请卡库存
     to_agent_invite_card() {
       mpvue.navigateTo({
-        url: "/pages/agent/invite_card_inventory/main"
-      })
+        url: "/pages/agent/invite_card_inventory/main",
+      });
     },
     //获取代理商详情
     get_agent_detail() {
       agentDetail().then((res) => {
         let $data = res.data;
         $this.agent_info = $data.data;
-      })
+      });
       agentIncomeDetail().then((res) => {
         let $data = res.data;
         $this.income_info = $data.data;
-      })
-    }
+      });
+    },
   },
   mounted() {
-    $this.get_agent_detail()
-    $this.userinfo = wx.getStorageSync('userinfo')
+    $this.get_agent_detail();
+    $this.userinfo = wx.getStorageSync("userinfo");
   },
   onShow() {
-    $this.get_agent_detail()
+    $this.get_agent_detail();
   },
   created() {
-    $this = this
-  }
-}
+    $this = this;
+  },
+};
 </script>
 
 <style scoped>
@@ -189,13 +243,12 @@ export default {
 }
 
 .text-normal {
-  color: #97B2DE;
+  color: #97b2de;
 }
 
 .profit_detail_contaienr {
 }
 
-
 .withdraw_container {
   background-image: url("https://img.shuimuai.com/web/frame_dailishang_tixian.png");
   background-position: center;

+ 27 - 12
src/pages/competition/index.vue

@@ -74,6 +74,7 @@
         > -->
         <!--分享按钮-->
         <van-image
+          class="complete_btns_fixed_img"
           src="https://img.shuimuai.com/share_btn@2x.png"
           @click="show_share_window"
           width="160px"
@@ -86,6 +87,7 @@
         > -->
         <!--参与按钮-->
         <van-image
+          class="complete_btns_fixed_img"
           src="https://img.shuimuai.com/join_btn@2x.png"
           @click="to_info"
           width="160px"
@@ -93,6 +95,7 @@
           v-if="joined == false"
         ></van-image>
         <van-image
+          class="complete_btns_fixed_img"
           src="https://img.shuimuai.com/rank@2x.png"
           alt=""
           @click="to_rank"
@@ -150,7 +153,7 @@
             <van-row>
               <van-col span="8">
                 <img
-                  src="https://img.shuimuai.com/yu_sai_rank@2x.png"
+                  src="https://img.shuimuai.com/yu_sai_rank_may_1.png"
                   alt=""
                   class="rank_card"
                   @click="changeRankAction(1)"
@@ -164,7 +167,7 @@
               </van-col>
               <van-col span="8">
                 <img
-                  src="https://img.shuimuai.com/raise_rank@2x.png"
+                  src="https://img.shuimuai.com/raise_rank_may_1.png"
                   alt=""
                   class="rank_card"
                   @click="changeRankAction(2)"
@@ -178,7 +181,7 @@
               </van-col>
               <van-col span="8">
                 <img
-                  src="https://img.shuimuai.com/final_rank@2x.png"
+                  src="https://img.shuimuai.com/final_rank_may_1.png"
                   alt=""
                   class="rank_card"
                   @click="changeRankAction(3)"
@@ -696,7 +699,7 @@
       <!--   扫码关注我们模块   -->
       <div class="qrcode_container">
         <img
-          src="https://img.shuimuai.com/code@2x.png"
+          src="https://img.shuimuai.com/code_bottom.png"
           alt=""
           class="qrcode_container_img"
         >
@@ -760,10 +763,12 @@ export default {
       },
       icon_show: false,
       // 是否悬浮
-      is_fixed: false,
+      // is_fixed: false,
+      is_fixed: true,
       scroll_id: "",
     };
   },
+  // 监听
   watch: {
     rank_action($new, $old) {
       if ($new == 2) {
@@ -940,7 +945,7 @@ export default {
     //监听滚动
     onListenScroll(event) {
       let $scrollTop = event.mp.detail.scrollTop;
-      $this.is_fixed = $scrollTop > 400;
+      $this.is_fixed = $scrollTop > -1;
       $this.scroll_id = "";
     },
   },
@@ -994,10 +999,13 @@ page {
 }
 
 .index_container {
-  background: url("https://img.shuimuai.com//mp/pk/background_3%402x.png");
+  /* background: url("https://img.shuimuai.com//mp/pk/background_3%402x.png");  小乌龟 */
+  background: url("https://img.shuimuai.com/mppkbackground_May_7.png");
+
   background-size: 100% 100%;
   background-position: center;
-  height: 2487px;
+  /* height: 2487px; */
+  height: 2695px;
   width: 100%;
 }
 
@@ -1015,7 +1023,7 @@ page {
 
 .complete_btns {
   position: absolute;
-  top: 580px;
+  top: 650px;
   display: flex;
   width: 100%;
   justify-content: space-around;
@@ -1028,6 +1036,13 @@ page {
   display: flex;
   width: 100%;
   justify-content: space-around;
+  height: 80px;
+  align-items: center;
+  background: url(https://img.shuimuai.com/complete_bg.png);
+  background-size: 100% 100%;
+}
+.complete_btns_fixed_img {
+  margin-top: 7px;
 }
 
 .share_info {
@@ -1061,7 +1076,7 @@ page {
   width: 294px;
   height: 49px;
   position: absolute;
-  top: 323px;
+  top: 408px;
   left: 41px;
 }
 
@@ -1092,7 +1107,7 @@ page {
 }
 
 .count_down_container .count_down_time:nth-child(4) {
-  left: 135px;
+  left: 145px;
   top: 15px;
   bottom: 16px;
 }
@@ -1467,7 +1482,7 @@ page {
 
 .diy_container .qrcode_container_img {
   width: 352px;
-  height: 194px;
+  height: 228px;
 }
 
 .not_show {

+ 12 - 2
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";
@@ -191,7 +191,8 @@ export default {
   onHide() {},
   onLoad($option) {
     if (process.env.NODE_ENV == "development") {
-      wx.setStorageSync("token", "7MZYqpAWOdw8WDxsgUV5QkQnKfrU5L_7");
+      wx.setStorageSync("token", "05qCTeq-SxX2L-3Uscu1iUdCaeFZp54D");
+      // wx.setStorageSync("token", "aPaNBi1BXyic7P9o-NVPeGhkdCZUbWlx");
     }
 
     console.log(
@@ -226,6 +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",
+      // });
+      // 存在token时候录入  
+    setUserLogin().then(
+      
+      (res)=>{console.log('录入',res)}
+      
+      )
     }
   },
   created() {

+ 213 - 175
src/pages/report/index.vue

@@ -1,35 +1,33 @@
 <template>
   <div id="report_container">
-    <view class="head"></view>
-    <img
-      class="boy"
-      src="https://img.shuimuai.com/m_sign_chengji_boy%402x.png"
-    />
-    <view class="user">
-      <view class="up">
-        <view class="left">
-          <img :src="userinfo.portrait" />
-          <view>
-            <text>{{ record.user_name }}</text>
-            <text>{{ userinfo.level_name }}</text>
-          </view>
+
+    <!-- 头部信息 -->
+    <view class="user_info">
+      <img :src="userinfo.portrait" />
+      <view class="info_wrap">
+        <view class="box_wrap">
+          <text>{{ record.user_name }}</text>
+          <text>{{ record.phone }}</text>
         </view>
-        <view
-          class="right"
-          @click="to_game_records"
-        >
-          <img src="https://img.shuimuai.com/m_icon_chengji%402x.png" />
-          <text>成绩记录</text>
+        <view class="box_wrap info_right">
+          <text>{{ record.start_time }}</text>
+          <text>训练时间 : {{ record.play_time }}</text>
         </view>
-      </view>
-      <view class="down">
-        <view>{{ record.att_average }}</view>
-        <view>专注力得分</view>
+
       </view>
     </view>
-
-    <!--    训练时长和训练设备-->
-    <view class="po1 padding-lr margin-top-xl">
+    <div class="bran_wrap">
+      <img
+        src="http://img.shuimuai.com/report_ brain_coefficient.png"
+        alt=""
+      >
+      <div class="bran">
+        <p class="p_num">{{record.ratio}}</p>
+        <p class="p_text">智脑系数</p>
+      </div>
+    </div>
+    <!--    训练时长和训练设备  -->
+    <!-- <view class="po1 padding-lr margin-top-xl">
       <van-row>
         <van-col span="11">
           <view>
@@ -48,7 +46,7 @@
           </view>
         </van-col>
       </van-row>
-    </view>
+    </view> -->
     <view>
       <van-divider
         contentPosition="left"
@@ -65,66 +63,46 @@
 
     <!--    专注力维持区间、受干扰次数,专注力最大爆发值、专注力启动时长-->
     <view class="margin-tb">
-      <van-row>
-        <van-col span="16">
-          <van-row>
-            <van-col span="12">
-              <view class="detail">
-                <view>
-                  <view>{{ record.scope_diff }}</view>
-                  <view>专注力维持区间</view>
-                </view>
-              </view>
-            </van-col>
-            <van-col span="12">
-              <view class="detail">
-                <view>
-                  <view>{{ record.interfere }}</view>
-                  <view>受干扰次数</view>
-                </view>
-              </view>
-
-            </van-col>
-          </van-row>
-
-          <van-row>
-            <van-col span="12">
-              <view class="detail">
-                <view>
-                  <view>{{ record.burst }}</view>
-                  <view>专注力最大爆发值</view>
-                </view>
-              </view>
-
-            </van-col>
-            <van-col span="12">
-              <view class="detail">
-                <view>
-                  <view>{{ record.start }}</view>
-                  <view>专注力启动时长</view>
-                </view>
-              </view>
-            </van-col>
-          </van-row>
-        </van-col>
-        <van-col span="5">
-          <view class="text-center">
-            <view class="hight_pie_chart">
-              <mpvue-echarts
-                :echarts="echarts"
-                :onInit="hight_att_charts"
-                canvasId="demo-canvas1"
-              />
-            </view>
-            <view class="detail">
-              <view>
-                <view>{{ record.height_absorbed }}%</view>
-                <view>高专注力占比</view>
-              </view>
-            </view>
-          </view>
-        </van-col>
-      </van-row>
+      <!-- 高专注力占比 -->
+      <view class="margin_left">
+        <view class="hight_pie_chart">
+          <mpvue-echarts
+            :echarts="echarts"
+            :onInit="hight_att_charts"
+            canvasId="demo-canvas1"
+          />
+        </view>
+        <view class="left_content">
+          <view class="left_num">{{ record.height_absorbed }}%</view>
+          <view class="left_text">高专注力占比</view>
+        </view>
+      </view>
+      <!-- 数据详情 -->
+      <view class="margin_centent">
+        <view class="detail">
+          <te class="detail_num">{{ record.scope_diff }}</te>
+          <view>专注力维持区间</view>
+        </view>
+        <view class="detail">
+          <view class="detail_num">{{ record.interfere }}</view>
+          <view>受干扰次数</view>
+        </view>
+        <view class="detail">
+          <view class="detail_num">{{ record.burst }}</view>
+          <view>专注力最大爆发值</view>
+        </view>
+        <view class="detail">
+          <view class="detail_num">{{ record.start }}</view>
+          <view>专注力启动时长</view>
+        </view>
+      </view>
+
+      <!-- 平均专注力 -->
+      <view class="margin_right ">
+        <view class="right_num">{{ record.att_average }}</view>
+        <view class="right_text">平均专注力</view>
+      </view>
+
     </view>
 
     <view class="bar">
@@ -207,20 +185,24 @@
         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>-->
+    <!-- 核销详情 -->
+    <view class="bar">
+      <view>
+        <view class="line"></view>
+        <view class="title">核销详情</view>
+      </view>
+    </view>
+    <view class="sheet">
+      <view class="left">
+        <view>专注力训练设备: {{ record.name }}</view>
+      </view>
+      <view class="right">
+        <view>核销方式:
+          <text v-if="record.consumption_type==1">次卡</text>
+          <text v-if="record.consumption_type==2">时间卡</text>
+        </view>
+      </view>
+    </view>
     <van-toast id="van-toast" />
 
   </div>
@@ -235,6 +217,7 @@ import util, {
   getHightPieChartOption,
   getPieChartsOption,
   getRadarChartOption,
+  timestampToTimeS,
 } from "../../utils/index";
 import { gameDetail, gameLineChart } from "../../requests/game";
 import game_store from "../../store/game";
@@ -345,6 +328,8 @@ export default {
             $this.record = $res.data;
             console.log("成绩记录参数", $this.record);
             $this.record.play_time = formatSeconds($this.record.play_time);
+            $this.record.start_time = timestampToTimeS($this.record.start_time);
+            console.log("训练时间", $this.record.start_time);
             $this.record.height_absorbed = Math.ceil(
               $this.record.height / $this.record.total * 100
             );
@@ -357,11 +342,11 @@ export default {
             //设置雷达图
             $options = getRadarChartOption([
               $this.record.att_average, //平均
-              $this.record.att_scope,   //广度
-              $this.record.att_burst,   //爆发
+              $this.record.att_scope, //广度
+              $this.record.att_burst, //爆发
               $this.record.att_interfere, //抗干扰
-              $this.record.att_start,  //启动
-              $this.record.att_height,  // 高专注占比
+              $this.record.att_start, //启动
+              $this.record.att_height, // 高专注占比
             ]);
             radar_charts.setOption($options);
 
@@ -456,6 +441,11 @@ export default {
 </script>
 
 <style scoped>
+#report_container {
+  background: white;
+  padding-top: 10px;
+  padding-bottom: 10px;
+}
 /* 头部椭圆 */
 .head {
   width: 442px;
@@ -477,99 +467,146 @@ image.boy {
   top: 45px;
 }
 
-.user {
-  width: 100%;
-}
+.user_info {
+  width: 95%;
+  height: 51px;
+  display: flex;
+  margin: 0 auto;
+  margin-bottom: 10px;
+  align-items: center;
+  padding-right: 10px;
+  box-sizing: border-box;
+  box-shadow: 0px 0px 10px rgba(51, 56, 74, 0.11);
+  border-radius: 5px;
 
-.user .up {
-  width: 100%;
+  background: #fff;
+}
+.user_info img {
+  display: inline-block;
+  width: 40px;
   height: 40px;
-  margin-top: 9px;
+  margin-left: 10px;
+  margin-right: 8px;
+}
+.user_info .info_wrap {
   display: flex;
-  align-items: center;
   justify-content: space-between;
-  color: #fff;
+  flex: 1;
 }
 
-.user .up .left {
-  height: 40px;
+.user_info .box_wrap {
+  display: flex;
+  flex-direction: column;
+  color: #676767;
+}
+/* 智脑系数 */
+.bran_wrap {
+  width: 100%;
+  height: 101px;
+  background-color: #fff;
   display: flex;
+  justify-content: center;
   align-items: center;
-  justify-content: start;
 }
-
-.user .up .left image {
-  width: 40px;
-  height: 40px;
-  margin-left: 17px;
-  margin-right: 8px;
+.bran_wrap img {
+  display: inline-block;
+  width: 60px;
+  height: 68px;
+  margin-right: 20px;
 }
-
-.user .up .left view {
-  height: 40px;
+.bran_wrap .bran {
   display: flex;
   flex-direction: column;
-  align-items: flex-start;
+  justify-content: space-around;
+  align-items: center;
+}
+.bran_wrap .bran .p_num {
+  color: #ffb72d;
+  font-size: 40px;
+  font-weight: 900;
+}
+.bran_wrap .bran .p_text {
+  color: #333333;
+  font-size: 12px;
+  font-weight: 900;
+}
+/* 详细数据 */
+.margin-tb {
+  width: 95%;
+  height: 110px;
+  margin: 0 auto;
+  display: flex;
   justify-content: space-between;
+  background: #f3f3f3;
+  border-radius: 5px;
 }
-
-.user .up .left view text:first-child {
-  font-size: 15px;
-  font-weight: bold;
+.margin-tb .margin_left {
+  flex: 1;
+  overflow: hidden;
+  display: flex;
+  flex-direction: column;
 }
 
-.user .up .left view text:last-child {
-  font-size: 13px;
+.margin-tb .margin_left .left_content {
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+  color: #676767;
 }
-
-.user .up .right {
-  height: 40px;
+.margin-tb .margin_left .left_content .left_num {
+  font-size: 16px;
+  font-weight: 900;
 }
-
-.user .up .right image {
-  width: 14px;
-  height: 15px;
-  vertical-align: middle;
-  margin-right: 4px;
+.margin-tb .margin_left .left_content .left_text {
+  font-size: 8px;
 }
-
-.user .up .right text {
-  font-size: 12px;
-  text-decoration: underline;
-  margin-right: 10px;
+.margin-tb .margin_centent {
+  flex: 3;
+  display: flex;
+  flex-wrap: wrap;
+  justify-content: space-around;
 }
-
-.user .down {
-  width: 100%;
-  height: 82px;
+.margin-tb .margin_right {
+  flex: 1;
   display: flex;
   flex-direction: column;
+  justify-content: center;
   align-items: center;
-  justify-content: start;
+  color: #90df24;
+  box-sizing: border-box;
+  padding: 0 3px;
 }
-
-.user .down view:first-child {
-  font-size: 45px;
-  color: #ffd800;
-  font-weight: bold;
+.margin-tb .margin_right .right_num {
+  font-size: 25px;
+  font-weight: 900;
+  margin-bottom: 10px;
 }
-
-.user .down view:last-child {
+.margin-tb .margin_right .right_text {
+  width: 90%;
+  height: 20px;
+  background: #90df24;
+  color: #fff;
+  text-align: center;
+  line-height: 20px;
   font-size: 10px;
-  color: #c7c4d8;
-  margin-top: -5px;
+  border-radius: 1px;
 }
-
-/* 详细数据 */
-.detail {
-  width: 100%;
-  height: 102px;
-  /*display: flex;*/
-  /*align-items: center;*/
-  /*justify-content: space-around;*/
+.margin-tb .detail {
+  width: 48%;
+  height: 50%;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+  color: #676767;
+  font-size: 11px;
 }
-
-.detail view {
+.margin-tb .detail .detail_num {
+  font-size: 18px;
+  font-weight: 900;
+}
+/* .detail view {
   display: flex;
   flex-direction: column;
   align-items: center;
@@ -581,7 +618,7 @@ image.boy {
 .detail view view:first-child {
   color: #000;
   font-size: 30px;
-}
+}  */
 
 /* 小标题 */
 .bar {
@@ -654,10 +691,11 @@ image.boy {
 }
 
 .hight_pie_chart {
-  margin: 0 auto;
-  width: 100px;
-  height: 100px;
+  /* margin: 0 auto; */
+  width: 100%;
+  height: 50px;
   background: #f3f3f3;
+  margin-top: 15px;
   /*border-radius: 10px;*/
   /*box-shadow: 0px 6px 11px #dadada;*/
 }
@@ -673,7 +711,7 @@ image.boy {
 
 .sheet .left,
 .sheet .right {
-  height: 95px;
+  height: 15px;
   display: flex;
   flex-direction: column;
   align-items: flex-start;

+ 0 - 0
src/pages/report/index.vue.bak → src/pages/report/index.vue.back


+ 41 - 39
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>
+            <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,15 +61,15 @@
               <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>
           </div>
         </van-col>
-        <van-col span="2">
+        <!-- <van-col span="2">
           <div class="flex flex-direction align-center justify-center">
             <view>
               <text>-{{ rssi }}dbm</text>
@@ -90,14 +78,13 @@
               <text class="text-default">信号强度</text>
             </view>
           </div>
-        </van-col>
+        </van-col> -->
       </van-row>
     </div>
 
     <!--    图标模块-->
     <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");
       //删除游戏专注数据
@@ -282,7 +272,7 @@ export default {
       //删除隐藏时间
       game_store.remover.rmHideTime();
       //游戏结束重置游戏模式
-      game_store.setters.setMode(0);
+      // game_store.setters.setMode(0);
       //删除游戏得id
       game_store.setters.removeToyHex();
 
@@ -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,12 +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));
@@ -538,6 +529,12 @@ export default {
       //打开蓝牙监听
       bluetooth.watch_bluetooth_status($this);
     }
+    //  Notify({
+    //         type: 'danger',
+    //         message: '智脑环已断开连接,请重新扫码智脑环',
+    //         duration: 0,
+    //       });
+    
   },
   created() {
     $this = this;
@@ -814,4 +811,9 @@ export default {
   opacity: 0.6;
   border-radius: 10px;
 }
+
+/* 提高dialog提示的层级 */
+#van-dialog {
+  z-index: 10000001 !important;
+}
 </style>

+ 2 - 1
src/pages/start/main.json

@@ -4,6 +4,7 @@
     "van-col": "../../static/vant/col/index",
     "van-toast": "../../static/vant/toast/index",
     "van-popup": "../../static/vant/popup/index",
-    "van-dialog": "../../static/vant/dialog/index"
+    "van-dialog": "../../static/vant/dialog/index",
+    "van-notify": "../../static/vant/notify/index"
   }
 }

+ 113 - 51
src/pages/user_center/index.vue

@@ -1,11 +1,15 @@
 <template>
   <div class="uc_container">
     <view class="head"></view>
-    <img class="bianji" src="https://img.shuimuai.com/m_btn_bianji%402x.png" @click="to_edit"/>
+    <img
+      class="bianji"
+      src="https://img.shuimuai.com/m_btn_bianji%402x.png"
+      @click="to_edit"
+    />
     <view class="user">
       <view class="up">
         <view class="left">
-          <img :src="userinfo.portrait"/>
+          <img :src="userinfo.portrait" />
           <view>
             <text>
               <text>{{ userinfo.user_name }}</text>
@@ -20,95 +24,154 @@
         <!--        </view>-->
       </view>
       <view class="down">
-        <view>0</view>
+        <view class="down_num">{{userinfo.ratio}}</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>
 
     <van-row class="detail">
-      <van-col span="6" offset="1">
+      <van-col
+        span="6"
+        offset="1"
+      >
         <view>{{ userinfo.play_time }}</view>
         <view>可用时长(分钟)</view>
       </van-col>
-      <van-col span="6" offset="2" @click="to_coupons">
+      <van-col
+        span="6"
+        offset="2"
+        @click="to_coupons"
+      >
         <view>{{ userinfo.coupon }}</view>
         <view>已领券数量</view>
       </van-col>
-      <van-col span="6" offset="2">
+      <van-col
+        span="6"
+        offset="2"
+      >
         <view>{{ userinfo.experience }}</view>
         <view>次卡</view>
       </van-col>
     </van-row>
     <view class="detail flex justify-around">
       <!--      会员码-->
-      <img src="https://img.shuimuai.com/m_btn_huiyuanma%402x.png" @click="to_vip_code"/>
+      <img
+        src="https://img.shuimuai.com/m_btn_huiyuanma%402x.png"
+        @click="to_vip_code"
+      />
       <!--      会员权益-->
-      <img src="https://img.shuimuai.com/m_btn_huiyuanquanyi%402x.png" @click="to_vip"/>
+      <img
+        src="https://img.shuimuai.com/m_btn_huiyuanquanyi%402x.png"
+        @click="to_vip"
+      />
       <!--      加入家庭组-->
-      <img src="https://img.shuimuai.com/m_btn_jiatingzu%402x.png" @click="open_scan"/>
+      <img
+        src="https://img.shuimuai.com/m_btn_jiatingzu%402x.png"
+        @click="open_scan"
+      />
     </view>
 
     <!--    菜单模块-->
     <van-cell-group class="menu">
-      <van-cell title="我的订单" is-link url="/pages/user_center/orders/main">
-        <img src="https://img.shuimuai.com/web/icon/icon_dingdan.png" alt="" slot="icon" class="icon1">
+      <van-cell
+        title="我的订单"
+        is-link
+        url="/pages/user_center/orders/main"
+      >
+        <img
+          src="https://img.shuimuai.com/web/icon/icon_dingdan.png"
+          alt=""
+          slot="icon"
+          class="icon1"
+        >
       </van-cell>
-      <van-cell title="代理商中心" is-link @click="to_agent">
-        <img src="https://img.shuimuai.com/web/icon/icon_dailishang.png" alt="" slot="icon" class="icon2">
+      <van-cell
+        title="代理商中心"
+        is-link
+        @click="to_agent"
+      >
+        <img
+          src="https://img.shuimuai.com/web/icon/icon_dailishang.png"
+          alt=""
+          slot="icon"
+          class="icon2"
+        >
       </van-cell>
       <!--      <van-cell title="家庭组" icon="wap-home-o" is-link/>-->
-      <van-cell title="收货地址" is-link url="/pages/user_center/address/edit/main">
-        <img src="https://img.shuimuai.com/web/icon/sign_add.png" alt="" slot="icon" class="icon3">
+      <van-cell
+        title="收货地址"
+        is-link
+        url="/pages/user_center/address/edit/main"
+      >
+        <img
+          src="https://img.shuimuai.com/web/icon/sign_add.png"
+          alt=""
+          slot="icon"
+          class="icon3"
+        >
       </van-cell>
-      <van-cell title="联系客服" is-link>
-        <img src="https://img.shuimuai.com/web/icon/icon_kefu.png" alt="" slot="icon" class="icon4">
+      <van-cell
+        title="联系客服"
+        is-link
+      >
+        <img
+          src="https://img.shuimuai.com/web/icon/icon_kefu.png"
+          alt=""
+          slot="icon"
+          class="icon4"
+        >
       </van-cell>
-      <van-button open-type="contact" block custom-class="contact_button">
+      <van-button
+        open-type="contact"
+        block
+        custom-class="contact_button"
+      >
         <div>
           <view>
-            <van-icon name="service-o"/>&nbsp;联系客服
+            <van-icon name="service-o" />&nbsp;联系客服
           </view>
         </div>
 
       </van-button>
     </van-cell-group>
-    <van-toast id="van-toast"/>
+    <van-toast id="van-toast" />
 
   </div>
 </template>
 
 <script>
-import {reload_userinfo} from "../../utils/user";
+import { reload_userinfo } from "../../utils/user";
 
-import Toast from '../../../static/vant/toast/toast';
+import Toast from "../../../static/vant/toast/toast";
 
-var $this
+var $this;
 export default {
   name: "uc_container",
   components: {},
   data() {
     return {
       userinfo: {},
-    }
+    };
   },
   methods: {
     to_edit() {
       mpvue.navigateTo({
-        url: "/pages/user_center/edit/main"
-      })
+        url: "/pages/user_center/edit/main",
+      });
     },
     //跳转vip权益
     to_vip() {
       mpvue.navigateTo({
-        url: "/pages/user_center/vip/main"
-      })
+        url: "/pages/user_center/vip/main",
+      });
     },
     //打开扫一扫
     open_scan() {
-      Toast.fail("暂未开通")
+      Toast.fail("暂未开通");
       // mpvue.scanCode({
       //   onlyFromCamera: true
       // })
@@ -116,34 +179,32 @@ export default {
     //跳转会员码
     to_vip_code() {
       mpvue.navigateTo({
-        url: "/pages/user_center/vip_code/main"
-      })
+        url: "/pages/user_center/vip_code/main",
+      });
     },
     to_coupons() {
       mpvue.navigateTo({
-        url: "/pages/coupons/main"
-      })
+        url: "/pages/coupons/main",
+      });
     },
-    to_agent(){
+    to_agent() {
       if ($this.userinfo.level == 8 || $this.userinfo.level == 9) {
-        Toast.fail("店员、店长不可进")
-        return false
+        Toast.fail("店员、店长不可进");
+        return false;
       }
       mpvue.navigateTo({
-        url:"/pages/agent/index/main"
-      })
-    }
-  }
-  ,
-  mounted() {
+        url: "/pages/agent/index/main",
+      });
+    },
   },
+  mounted() {},
   created() {
     $this = this;
   },
   onLoad() {
-    reload_userinfo($this)
+    reload_userinfo($this);
   },
-}
+};
 </script>
 
 <style>
@@ -221,7 +282,6 @@ image.bianji {
 
 .user .up .right {
   height: 40px;
-
 }
 
 .user .up .right image {
@@ -245,7 +305,9 @@ image.bianji {
   align-items: center;
   justify-content: start;
 }
-
+.user .down .down_num {
+  margin: 5px 0;
+}
 .user .down image {
   width: 16px;
   height: 16px;
@@ -255,13 +317,13 @@ image.bianji {
 
 .user .down view:first-child {
   font-size: 36px;
-  color: #FFD800;
+  color: #ffd800;
   font-weight: bold;
 }
 
 .user .down view:last-child {
   font-size: 15px;
-  color: #C7C4D8;
+  color: #c7c4d8;
   margin-top: -2px;
 }
 
@@ -274,7 +336,7 @@ image.bianji {
 }
 
 .detail view {
-  color: #6C6C6C;
+  color: #6c6c6c;
   font-size: 10px;
 }
 

+ 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);
 }

+ 13 - 3
src/requests/user.js

@@ -105,15 +105,25 @@ export function userUpdateAddress($params) {
 export function userCheckUnionid($js_code) {
   let $params = {
     js_code: $js_code,
-    access_token:11
+    access_token:wx.getStorageSync('token')
   }
   return fly.post('user/check-unionid', $params)
 }
 
 //获取轮播图列表
-export function getBannerList(){
+export function getBannerList() {
+  
   let $params = {
-    access_token:11
+    access_token:wx.getStorageSync('token')
   }
   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)
+}

+ 16 - 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 {
   // 发送开启脑电数据包指令
@@ -229,8 +230,7 @@ export default {
   connect_toy(hexStr, deviceId, serviceId, Cid, Toast) {
     console.log("开始连接玩具");
     let $flag = "";
-    let $toys = [
-      {
+    let $toys = [{
         id: 1,
         hex: "aadd0a0000",
         msg: "无连接设备",
@@ -440,7 +440,16 @@ 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);
+
+
         }
       }
     });
@@ -663,7 +672,7 @@ export default {
           title: "脑环电量不足",
           icon: "none",
           success() {
-            $this.change_device_status(0);
+            // $this.change_device_status(0);
           },
         });
       }
@@ -674,12 +683,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,
@@ -699,7 +708,7 @@ export default {
   },
   // 游玩时间倒计时 
   formatPlaySeconds(value) {
-        console.log('剩余可游玩时间',value)
+    console.log('剩余可游玩时间', value)
     // 字符串转数字
     var secondTime = parseInt(value); // 秒
     var minuteTime = 0; // 分

+ 246 - 205
src/utils/index.js

@@ -1,85 +1,82 @@
 function formatNumber(n) {
-  const str = n.toString()
-  return str[1] ? str : `0${str}`
+  const str = n.toString();
+  return str[1] ? str : `0${str}`;
 }
 
 export function formatTime(date) {
   if (date.length <= 11) {
-    date = date * 1000
+    date = date * 1000;
   }
-  var date = new Date(date)
-  const year = date.getFullYear()
-  const month = date.getMonth() + 1
-  const day = date.getDate()
+  var date = new Date(date);
+  const year = date.getFullYear();
+  const month = date.getMonth() + 1;
+  const day = date.getDate();
 
-  const hour = date.getHours()
+  const hour = date.getHours();
 
-  return year + "/" + month + "/" + day
+  return year + "/" + month + "/" + day;
 }
 
-
 export function formatAllTime(date) {
   if (date.length <= 11) {
-    date = date * 1000
+    date = date * 1000;
   }
-  var date = new Date(date)
-  const year = date.getFullYear()
-  const month = date.getMonth() + 1
-  const day = date.getDate()
+  var date = new Date(date);
+  const year = date.getFullYear();
+  const month = date.getMonth() + 1;
+  const day = date.getDate();
 
-  const hour = date.getHours()
-  const minutes = date.getMinutes()
+  const hour = date.getHours();
+  const minutes = date.getMinutes();
 
-  return year + "/" + month + "/" + day + " " + hour + ":" + minutes
+  return year + "/" + month + "/" + day + " " + hour + ":" + minutes;
 }
 
-
 export function formatTimeForSeconds(date) {
   if (date.length <= 11) {
-    date = date * 1000
+    date = date * 1000;
   }
-  var date = new Date(date)
-  const year = date.getFullYear()
-  const month = date.getMonth() + 1
-  const day = date.getDate()
+  var date = new Date(date);
+  const year = date.getFullYear();
+  const month = date.getMonth() + 1;
+  const day = date.getDate();
 
-  const hour = date.getHours()
-  const minute = date.getMinutes()
+  const hour = date.getHours();
+  const minute = date.getMinutes();
 
-  return year + "/" + month + "/" + day + " " + hour + ":" + minute
+  return year + "/" + month + "/" + day + " " + hour + ":" + minute;
 }
 
-
 export function formatValidityTime(date) {
   if (date.toString().length <= 11) {
-    date = date * 1000
+    date = date * 1000;
   }
-  var date = new Date(date)
-  const year = date.getFullYear()
-  const month = date.getMonth() + 1
-  const day = date.getDate()
+  var date = new Date(date);
+  const year = date.getFullYear();
+  const month = date.getMonth() + 1;
+  const day = date.getDate();
 
-  const hour = date.getHours()
+  const hour = date.getHours();
 
-  return year + "/" + month + "/" + day + " " + hour + "时"
+  return year + "/" + month + "/" + day + " " + hour + "时";
 }
 
 export function formatBirthday(date) {
-  var date = new Date(date * 1000)
-  const year = date.getFullYear()
-  const month = date.getMonth() + 1
-  const day = date.getDate()
+  var date = new Date(date * 1000);
+  const year = date.getFullYear();
+  const month = date.getMonth() + 1;
+  const day = date.getDate();
 
-  const hour = date.getHours()
+  const hour = date.getHours();
 
-  const t1 = [year, month, day].map(formatNumber).join('-')
+  const t1 = [year, month, day].map(formatNumber).join("-");
 
-  return `${t1}`
+  return `${t1}`;
 }
 
 // 专注力与放松力图表
 function getLineOption(lineData_att, lineData_med) {
-  const that = this
+  const that = this;
   var option = {
     color: ["#FFB400", "#D4327A"],
     legend: {
@@ -95,10 +92,10 @@ function getLineOption(lineData_att, lineData_med) {
       textStyle: {
         // fontWeight: 'bold',
         fontSize: 10,
-        color: "#CFCFCF"
+        color: "#CFCFCF",
       },
       selectedMode: false,
-      show: false
+      show: false,
     },
     grid: {
       left: 20,
@@ -107,79 +104,80 @@ function getLineOption(lineData_att, lineData_med) {
       top: 16,
       // show:true,
       containLabel: true,
-      zlevel: 1
+      zlevel: 1,
     },
     tooltip: {
       show: true,
-      trigger: 'axis'
+      trigger: "axis",
     },
     yAxis: {
-      x: 'center',
-      type: 'value',
+      x: "center",
+      type: "value",
       splitLine: {
         lineStyle: {
-          type: 'dashed'
-        }
+          type: "dashed",
+        },
       },
       axisLine: {
         lineStyle: {
-          color: '#ccc'
+          color: "#ccc",
         },
-        show: false
+        show: false,
       },
       axisLabel: {
-        color: '#ccc'
+        color: "#ccc",
       },
       max: 100,
       // data: ["0", "20", "40", "60", "80", "100"]
       // show: false
     },
     xAxis: {
-      type: 'category',
+      type: "category",
       boundaryGap: false,
       splitLine: {
         lineStyle: {
-          type: 'dashed'
-        }
+          type: "dashed",
+        },
       },
       axisLine: {
         lineStyle: {
-          color: '#ccc'
-        }
+          color: "#ccc",
+        },
       },
       axisLabel: {
-        color: '#ccc'
+        color: "#ccc",
       },
-      show: false
-    },
-    series: [{
-      name: "Att(专注度)",
-      symbol: 'none', //取消折点圆圈
-      type: 'line',
-      smooth: true,
-      data: lineData_att
+      show: false,
     },
+    series: [
+      {
+        name: "Att(专注度)",
+        symbol: "none", //取消折点圆圈
+        type: "line",
+        smooth: true,
+        data: lineData_att,
+      },
       {
         name: "Med(放松度)",
-        symbol: 'none', //取消折点圆圈
-        type: 'line',
+        symbol: "none", //取消折点圆圈
+        type: "line",
         smooth: true,
-        data: lineData_med
+        data: lineData_med,
       },
     ],
-    animation: false
-  }
-  return option
+    animation: false,
+  };
+  return option;
 }
 
 // 基本脑波图
 function getBaseOption(delta, theta, alpha, beta) {
-  const that = this
+  const that = this;
   var option = {
     color: ["#4b8cb4", "#ed4b59", "#fdb64b", "#F6CB90"],
     legend: {
       data: ["Delta", "Theta", "Alpha", "Beta"],
-      left: 'center',
+      left: "center",
       bottom: 20,
       icon: "circle",
       itemWidth: 8,
@@ -190,7 +188,7 @@ function getBaseOption(delta, theta, alpha, beta) {
         fontSize: 10,
         color: "#CFCFCF",
       },
-      show: false
+      show: false,
     },
     grid: {
       left: 20,
@@ -198,90 +196,92 @@ function getBaseOption(delta, theta, alpha, beta) {
       bottom: 16,
       top: 16,
       // show:false,
-      containLabel: true
+      containLabel: true,
     },
     tooltip: {
       show: true,
-      trigger: 'axis'
+      trigger: "axis",
     },
     yAxis: {
-      x: 'center',
-      type: 'value',
+      x: "center",
+      type: "value",
       splitLine: {
         lineStyle: {
-          type: 'dashed'
-        }
+          type: "dashed",
+        },
       },
       axisLine: {
         lineStyle: {
-          color: '#ccc'
+          color: "#ccc",
         },
-        show: false
+        show: false,
       },
       axisLabel: {
-        color: '#ccc'
+        color: "#ccc",
       },
       // max: 100,
       // data: ["0", "20", "40", "60", "80", "100"]
       // show: false
     },
     xAxis: {
-      type: 'category',
+      type: "category",
       boundaryGap: false,
       splitLine: {
         lineStyle: {
-          type: 'dashed'
-        }
+          type: "dashed",
+        },
       },
       axisLine: {
         lineStyle: {
-          color: '#ccc'
-        }
+          color: "#ccc",
+        },
       },
       axisLabel: {
-        color: '#ccc'
+        color: "#ccc",
       },
-      show: false
-    },
-    series: [{
-      name: "Delta",
-      symbol: 'none', //取消折点圆圈
-      type: 'line',
-      smooth: true,
-      data: delta
+      show: false,
     },
+    series: [
+      {
+        name: "Delta",
+        symbol: "none", //取消折点圆圈
+        type: "line",
+        smooth: true,
+        data: delta,
+      },
       {
         name: "Theta",
-        symbol: 'none', //取消折点圆圈
-        type: 'line',
+        symbol: "none", //取消折点圆圈
+        type: "line",
         smooth: true,
-        data: theta
+        data: theta,
       },
       {
         name: "Alpha",
-        symbol: 'none', //取消折点圆圈
-        type: 'line',
+        symbol: "none", //取消折点圆圈
+        type: "line",
         smooth: true,
-        data: alpha
+        data: alpha,
       },
       {
         name: "Beta",
-        symbol: 'none', //取消折点圆圈
-        type: 'line',
+        symbol: "none", //取消折点圆圈
+        type: "line",
         smooth: true,
         data: beta,
       },
     ],
-    animation: false
-  }
-  return option
+    animation: false,
+  };
+  return option;
 }
 
 export function formatSeconds(value) {
-  var secondTime = parseInt(value);// 秒
-  var minuteTime = 0;// 分
-  var hourTime = 0;// 小时
-  if (secondTime > 60) {//如果秒数大于60,将秒数转换成整数
+  var secondTime = parseInt(value); // 秒
+  var minuteTime = 0; // 分
+  var hourTime = 0; // 小时
+  if (secondTime > 60) {
+    //如果秒数大于60,将秒数转换成整数
     //获取分钟,除以60取整数,得到整数分钟
     minuteTime = parseInt(secondTime / 60);
     //获取秒数,秒数取佘,得到整数秒数
@@ -305,153 +305,167 @@ export function formatSeconds(value) {
   return result;
 }
 
-
 //获取等级名称
 function get_level_name($level_id) {
-  let $level = ['普通用户', '体验会员', '黄金会员', '白金会员', '钻石会员', '创客代理', '区域代理', '合伙人', '店员', '店长', '老师']
-  return $level[$level_id]
+  let $level = [
+    "普通用户",
+    "体验会员",
+    "黄金会员",
+    "白金会员",
+    "钻石会员",
+    "创客代理",
+    "区域代理",
+    "合伙人",
+    "店员",
+    "店长",
+    "老师",
+  ];
+  return $level[$level_id];
 }
 
 export function cal_down_time($final_time) {
-  let $today = new Date().getTime()
-  let $differ = $final_time * 1000 - $today
+  let $today = new Date().getTime();
+  let $differ = $final_time * 1000 - $today;
   //计算出相差天数
-  var days = Math.floor($differ / (24 * 3600 * 1000))
+  var days = Math.floor($differ / (24 * 3600 * 1000));
   //计算出小时数
 
-  var leave1 = $differ % (24 * 3600 * 1000)    //计算天数后剩余的毫秒数
-  var hours = Math.floor(leave1 / (3600 * 1000))
+  var leave1 = $differ % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
+  var hours = Math.floor(leave1 / (3600 * 1000));
   //计算相差分钟数
-  var leave2 = leave1 % (3600 * 1000)        //计算小时数后剩余的毫秒数
-  var minutes = Math.floor(leave2 / (60 * 1000))
+  var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
+  var minutes = Math.floor(leave2 / (60 * 1000));
   //计算相差秒数
-  var leave3 = leave2 % (60 * 1000)      //计算分钟数后剩余的毫秒数
-  var seconds = Math.round(leave3 / 1000)
+  var leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数
+  var seconds = Math.round(leave3 / 1000);
   return {
-    differ: $differ, days, hours, minutes, seconds
-  }
+    differ: $differ,
+    days,
+    hours,
+    minutes,
+    seconds,
+  };
 }
 
 export function getHightPieChartOption($params, $total) {
-  console.log($params,$total);
   let $option = {
     tooltip: {
       // trigger: 'item'
-      show:false
+      show: false,
     },
     series: [
       {
-        name: '访问来源',
-        type: 'pie',
-        radius: '50%',
+        name: "访问来源",
+        type: "pie",
+        radius: "80%",
         labelLine: {
-          show: false
+          show: false,
         },
         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
+  return $option;
 }
 
-
 export function getRadarChartOption($params) {
-  console.log( '雷达图参数会打印什么呢?', $params)
+  console.log("雷达图参数会打印什么呢?", $params);
   let $option = {
     tooltip: {},
     radar: {
       // shape: 'circle',
-      radius: '55%',
+      radius: "55%",
       name: {
         textStyle: {
-          color: '#fff',
-          backgroundColor: '#999',
+          color: "#fff",
+          backgroundColor: "#999",
           borderRadius: 3,
-          padding: [3, 5]
-        }
+          padding: [3, 5],
+        },
       },
       indicator: [
-        {name: '专注力平均值指数', max: 100},
-        {name: '专注力广度指数', max: 100},
-        {name: '专注力爆发指数', max: 100},
-        {name: '专注力抗性指数', max: 100},
-        {name: '专注力启动指数', max: 100},
-        {name: '高专注力占比指数', max: 100}
-      ]
+        { name: "专注力平均值指数", max: 100 },
+        { name: "专注力广度指数", max: 100 },
+        { name: "专注力爆发指数", max: 100 },
+        { name: "专注力抗性指数", max: 100 },
+        { name: "专注力启动指数", max: 100 },
+        { name: "高专注力占比指数", max: 100 },
+      ],
     },
-    series: [{
-      name: '预算 vs 开销(Budget vs spending)',
-      type: 'radar',
-      // areaStyle: {normal: {}},
-      lineStyle: {
-        color: "#D28885"
+    series: [
+      {
+        name: "预算 vs 开销(Budget vs spending)",
+        type: "radar",
+        // areaStyle: {normal: {}},
+        lineStyle: {
+          color: "#D28885",
+        },
+        data: [
+          {
+            value: $params,
+            // name: '实际开销(Actual Spending)'
+            name: "专注力要素分析数据",
+          },
+        ],
       },
-      data: [
-        {
-          value: $params,
-          // name: '实际开销(Actual Spending)'
-          name: '专注力要素分析数据'
-        }
-      ]
-    }]
+    ],
   };
-  return $option
+  return $option;
 }
 
-
 //获取饼状图图属性
 export function getPieChartsOption($pie_datas) {
   if ($pie_datas) {
-    console.log($pie_datas)
+    console.log($pie_datas);
     let option = {
       tooltip: {
-        trigger: 'item',
-        formatter: '{a} \r\n {b}: {c} ({d}%)'
+        trigger: "item",
+        formatter: "{a} \r\n {b}: {c} ({d}%)",
       },
       legend: {
-        orient: 'vertical',
-        right: '10%',
-        top: '5%',
-        data: $pie_datas['legends']
+        orient: "vertical",
+        right: "10%",
+        top: "20%",
+        data: $pie_datas["legends"],
       },
       series: [
         {
-          name: '访问来源',
-          type: 'pie',
-          radius: ['40%', '70%'],
+          name: "访问来源",
+          type: "pie",
+          radius: ["40%", "70%"],
           avoidLabelOverlap: false,
           label: {
             show: false,
-            position: 'center'
+            position: "center",
           },
-          right: '40%',
+          right: "40%",
           emphasis: {
             label: {
               show: true,
-              fontSize: '30',
-              fontWeight: 'bold'
-            }
+              fontSize: "30",
+              fontWeight: "bold",
+            },
           },
           labelLine: {
-            show: true
+            show: true,
           },
-          data: $pie_datas['datas']
-        }
-      ]
+          data: $pie_datas["datas"],
+        },
+      ],
     };
-    return option
+    return option;
   }
 }
 
 //过滤饼状数据
 export function filterPieData(datas) {
-  let $this = this
-  let legends = []
+  let $this = this;
+  let legends = [];
   let $att_region = [
     // {
     //   min: 81,
@@ -475,34 +489,60 @@ export function filterPieData(datas) {
     // },
     {
       min: 0,
-      max: 20
+      max: 20,
     },
     {
       min: 21,
-      max: 40
+      max: 40,
     },
     {
       min: 41,
-      max: 60
+      max: 60,
     },
     {
       min: 61,
-      max: 80
+      max: 80,
     },
     {
       min: 81,
-      max: 100
+      max: 100,
     },
-  ]
+  ];
   datas.forEach(($val, $index) => {
-    legends.push($att_region[$index]['min'] + "-" + $att_region[$index]['max'] + ":" + formatSeconds($val))
+    legends.push(
+      $att_region[$index]["min"] +
+        "-" +
+        $att_region[$index]["max"] +
+        ":" +
+        formatSeconds($val)
+    );
     let _data = {
-      name: $att_region[$index]['min'] + "-" + $att_region[$index]['max'] + ":" + formatSeconds($val),
-      value: $val
-    }
-    datas[$index] = _data
-  })
-  return {datas, legends}
+      name:
+        $att_region[$index]["min"] +
+        "-" +
+        $att_region[$index]["max"] +
+        ":" +
+        formatSeconds($val),
+      value: $val,
+    };
+    datas[$index] = _data;
+  });
+  return { datas, legends };
+}
+
+// 时间戳转化成时间格式
+export function timestampToTimeS(timestamp) {
+  var date = new Date(timestamp * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
+  var Y = date.getFullYear() + "-";
+  var M =
+    (date.getMonth() + 1 < 10
+      ? "0" + (date.getMonth() + 1)
+      : date.getMonth() + 1) + "-";
+  var D = date.getDate() + " ";
+  var h = date.getHours() + ":";
+  var m = date.getMinutes() + ":";
+  var s = date.getSeconds();
+  return Y + M + D + h + m + s;
 }
 
 export default {
@@ -510,5 +550,6 @@ export default {
   formatTime,
   getLineOption,
   getBaseOption,
-  get_level_name
-}
+  get_level_name,
+  timestampToTimeS
+};