Selaa lähdekoodia

合并前的上传

Luhan1997 4 vuotta sitten
vanhempi
commit
3c3d0ef629
2 muutettua tiedostoa jossa 348 lisäystä ja 263 poistoa
  1. 107 76
      src/pages/index/index.vue
  2. 241 187
      src/pages/start/index.vue

+ 107 - 76
src/pages/index/index.vue

@@ -3,27 +3,38 @@
     <!--    banner模块-->
     <banner></banner>
     <!--    未登录 登录窗口模块-->
-    <div class="login_card" v-if="!is_login">
+    <div
+      class="login_card"
+      v-if="!is_login"
+    >
       <!--      登录窗口-->
-      <login_container v-if="login_status == 'login'"
-                       @changeStatus="change_status"
-                       @changeTitle="change_title"
+      <login_container
+        v-if="login_status == 'login'"
+        @changeStatus="change_status"
+        @changeTitle="change_title"
       ></login_container>
       <!--      注册窗口-->
-      <regist_container v-if="login_status == 'regist'"
-                        @changeStatus='change_status'
-                        @change_login_status="change_login_status"
-                        :title="regist_title"
+      <regist_container
+        v-if="login_status == 'regist'"
+        @changeStatus='change_status'
+        @change_login_status="change_login_status"
+        :title="regist_title"
       ></regist_container>
 
     </div>
     <!--    登陆后 的个人首页-->
-    <div class="personal_card" v-if="is_login">
+    <div
+      class="personal_card"
+      v-if="is_login"
+    >
       <personal_container @change_login_status="change_login_status"></personal_container>
 
       <device_container></device_container>
     </div>
-    <div class="service" :class="{'service_login_page':is_login==false}">
+    <div
+      class="service"
+      :class="{'service_login_page':is_login==false}"
+    >
       <view class="padding-tb">
         <text class="cuIcon-titles text-primary"></text>
         <text class="">功能服务</text>
@@ -31,50 +42,64 @@
       <div class="content">
         <van-row>
           <van-col span="12">
-            <img src="https://img.shuimuai.com/index_btn_chongzhizhongxin.png"
-                 @click="to_page('user_center/recharge')"></img>
+            <img
+              src="https://img.shuimuai.com/index_btn_chongzhizhongxin.png"
+              @click="to_page('user_center/recharge')"
+            ></img>
           </van-col>
           <van-col span="12">
-            <img src="https://img.shuimuai.com/web/index_btn_gerenzhongxin.png" @click="to_page('user_center')"></img>
+            <img
+              src="https://img.shuimuai.com/web/index_btn_gerenzhongxin.png"
+              @click="to_page('user_center')"
+            ></img>
           </van-col>
         </van-row>
 
         <van-row>
           <van-col span="12">
-            <img src="https://img.shuimuai.com/web/index_btn_chengjijilu.png" @click="to_page('game_record')"></img>
+            <img
+              src="https://img.shuimuai.com/web/index_btn_chengjijilu.png"
+              @click="to_page('game_record')"
+            ></img>
           </van-col>
           <van-col span="12">
-            <img src="https://img.shuimuai.com/index_btn_dailishang.png" @click="to_page('agent/index')"></img>
+            <img
+              src="https://img.shuimuai.com/index_btn_dailishang.png"
+              @click="to_page('agent/index')"
+            ></img>
           </van-col>
         </van-row>
       </div>
     </div>
-    <van-toast id="van-toast"/>
-    <van-dialog id="van-dialog"/>
+    <van-toast id="van-toast" />
+    <van-dialog id="van-dialog" />
     <!--     <button class="cu-btn lg cu-btn-primary text-white text-center margin-tb" @click="auth_msg">获取消息授权-->
     <!--    </button>-->
   </div>
 </template>
 
 <script>
-import banner from '@/components/banner'
-import login_container from '@/components/index/login'
-import regist_container from '@/components/index/regist'
+import banner from "@/components/banner";
+import login_container from "@/components/index/login";
+import regist_container from "@/components/index/regist";
 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 user_store from "../../store/index"
-import game_store from "../../store/game"
-import game_util, {post_data} from '../../utils/game'
+import Toast from "../../../static/vant/toast/toast";
+import Dialog from "../../../static/vant/dialog/dialog";
+import { userDetail } from "../../requests/user";
+import user_store from "../../store/index";
+import game_store from "../../store/game";
+import game_util, { post_data } from "../../utils/game";
 
-
-var $this
+var $this;
 export default {
   name: "index_container",
   components: {
-    banner, login_container, regist_container, personal_container, device_container
+    banner,
+    login_container,
+    regist_container,
+    personal_container,
+    device_container,
   },
   data() {
     return {
@@ -82,90 +107,91 @@ export default {
       login_status: "login",
       // is_login: false,
       is_login: false,
-      regist_title: ""
-    }
+      regist_title: "",
+    };
   },
   methods: {
-    get_init_data() {
-    },
+    get_init_data() {},
     //切换到扫码
     change_status($status) {
-      this.login_status = $status
+      this.login_status = $status;
     },
     //跳转充值中心
     to_recharge() {
       mpvue.navigateTo({
-        url: "/pages/user_center/recharge/main"
-      })
+        url: "/pages/user_center/recharge/main",
+      });
     },
     //修改登录状态
     change_login_status() {
-      this.is_login = user_store.getters.get_login_status()
+      this.is_login = user_store.getters.get_login_status();
     },
     // 修改界面的文字
     change_title($status) {
       if ($status == 0) {
-        this.regist_title = "注册"
+        this.regist_title = "注册";
       } else if ($status == 1) {
-        this.regist_title = "登录"
+        this.regist_title = "登录";
       }
     },
     //跳转页面
     to_page($page) {
-      if ($page == 'agent/index') {
+      if ($page == "agent/index") {
         //店员店长不可进
         if ($this.userinfo.level == 8 || $this.userinfo.level == 9) {
-          Toast.fail("店员、店长不可进")
-          return false
+          Toast.fail("店员、店长不可进");
+          return false;
         }
       }
       if (!this.is_login) {
-        Toast.fail("请先登录")
-        return false
+        Toast.fail("请先登录");
+        return false;
       }
       mpvue.navigateTo({
-        url: "/pages/" + $page + "/main"
-      })
+        url: "/pages/" + $page + "/main",
+      });
     },
     auth_msg() {
       wx.requestSubscribeMessage({
-        tmplIds: ['NV-xb_oOPutXLVge0ZnBxct_nNxS1j1XNCMtfp2c8zw', '70xngszQ62NWHbbCjbggbz5-pvOu3Z8ttLbjfplJXLg'],
+        tmplIds: [
+          "NV-xb_oOPutXLVge0ZnBxct_nNxS1j1XNCMtfp2c8zw",
+          "70xngszQ62NWHbbCjbggbz5-pvOu3Z8ttLbjfplJXLg",
+        ],
         success(res) {
-          console.log(res)
-          Toast.success("授权成功")
-        }
-      })
-    }
+          console.log(res);
+          Toast.success("授权成功");
+        },
+      });
+    },
   },
   mounted() {
     wx.login({
       success(res) {
         console.log(res);
-      }
-    })
+      },
+    });
   },
   onShow() {
     userDetail().then((res) => {
-      let $data = res.data
+      let $data = res.data;
       //判断如果是第一次登录就 弹出领取体验卡
-      $this.userinfo = $data.data
-      user_store.setters.set_userinfo($this.userinfo)
-    })
-  },
-  onHide() {
+      $this.userinfo = $data.data;
+      user_store.setters.set_userinfo($this.userinfo);
+    });
   },
+  onHide() {},
   onLoad($option) {
-    if (process.env.NODE_ENV == 'development') {
-      wx.setStorageSync('token', '7MZYqpAWOdw8WDxsgUV5QkQnKfrU5L_7')
+    if (process.env.NODE_ENV == "development") {
+      wx.setStorageSync("token", "7MZYqpAWOdw8WDxsgUV5QkQnKfrU5L_7");
     }
 
-    console.log(game_store.getters.getGameAttMedDatas())
-    console.log(game_store.getters.getPlayedTime())
+    console.log(game_store.getters.getGameAttMedDatas());
+    console.log(game_store.getters.getPlayedTime());
     console.log(
       "游戏状态:" + game_store.getters.getGameStatus(),
 
       "游戏记录id:" + game_store.getters.getGameRecordId()
-    )
+    );
     if (game_store.getters.getGameStatus() == 1) {
       // Dialog.confirm({
       //   title: '系统提示',
@@ -180,25 +206,31 @@ export default {
       //     post_data(game_store.getters.getGameAttMedDatas())
       //   });
       Dialog.alert({
-        title: '系统提示',
-        message: '正在结束上一个游戏',
+        title: "系统提示",
+        message: "正在结束上一个游戏",
       }).then(() => {
-        post_data(game_store.getters.getGameAttMedDatas())
+        post_data(game_store.getters.getGameAttMedDatas());
       });
     }
 
     //  判断存储是否登录
-    let $token = wx.getStorageSync('token')
+    let $token = wx.getStorageSync("token");
     if ($token) {
-      user_store.setters.set_token($token)
-      user_store.setters.set_login(true)
-      this.is_login = user_store.getters.get_login_status()
+      user_store.setters.set_token($token);
+      user_store.setters.set_login(true);
+      this.is_login = user_store.getters.get_login_status();
     }
   },
   created() {
-    $this = this
-  }
-}
+    $this = this;
+  },
+  onShareAppMessage() {
+    return {
+      title: "欢迎进入水母星球",
+      imageUrl: "http://img.shuimuai.com/textwx5_4img.png",
+    };
+  },
+};
 </script>
 
 <style scoped>
@@ -255,5 +287,4 @@ export default {
   position: relative;
   z-index: 5;
 }
-
 </style>

+ 241 - 187
src/pages/start/index.vue

@@ -3,7 +3,10 @@
     <!--    计费面板模块-->
     <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>
@@ -11,13 +14,23 @@
             <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>
           </view>
-          <button class="cu-btn bg-red text-white margin-top-sm" @click="game_finished">
-            <img src="https://img.shuimuai.com/m_duankainaohuan.png" class="cut_brain_icon" alt="">
+          <button
+            class="cu-btn bg-red text-white margin-top-sm"
+            @click="game_finished"
+          >
+            <img
+              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>
@@ -27,21 +40,42 @@
     <!--    设备状态-->
     <div class="game_status padding-tb">
       <van-row>
-        <van-col span="10" offset="2">
-          <div class="flex flex-direction align-center justify-center" v-if="device_bg">
-            <img src="https://img.shuimuai.com/web/touhuanzhuangtai_2.png" alt="" class="device_img">
+        <van-col
+          span="10"
+          offset="2"
+        >
+          <div
+            class="flex flex-direction align-center justify-center"
+            v-if="device_bg"
+          >
+            <img
+              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>
-            <img src="https://img.shuimuai.com/web/touhuanzhuangtai_3.png" alt="" class="device_img">
+          <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>
         <van-col span="10">
           <div class="flex flex-direction align-center justify-center">
             <view class="elc_power_container">
-              <img src="https://img.shuimuai.com/web/dianchi_3.png" alt="" :style="{width:device_power+'%'}"
-                   class="device_elc">
+              <img
+                src="https://img.shuimuai.com/web/dianchi_3.png"
+                alt=""
+                :style="{width:device_power+'%'}"
+                class="device_elc"
+              >
             </view>
             <text class="text-default">{{ device_power }}%</text>
             <text class="text-default">设备电量</text>
@@ -60,7 +94,6 @@
       </van-row>
     </div>
 
-
     <!--    图标模块-->
     <div class="ec_container">
       <view class="chart_view_first margin-tb-xl">
@@ -82,7 +115,11 @@
           </view>
         </view>
         <view class="chart">
-          <mpvue-echarts :echarts="echarts" :onInit="attCharts" canvasId="canvasId-demo1"/>
+          <mpvue-echarts
+            :echarts="echarts"
+            :onInit="attCharts"
+            canvasId="canvasId-demo1"
+          />
         </view>
       </view>
 
@@ -113,36 +150,38 @@
           </view>
         </view>
         <view class="chart">
-          <mpvue-echarts :echarts="echarts" :onInit="medCharts" canvasId="canvasId-demo2"/>
+          <mpvue-echarts
+            :echarts="echarts"
+            :onInit="medCharts"
+            canvasId="canvasId-demo2"
+          />
         </view>
       </view>
 
     </div>
 
-    <van-toast id="van-toast"/>
-    <van-dialog id="van-dialog"/>
+    <van-toast id="van-toast" />
+    <van-dialog id="van-dialog" />
   </div>
 </template>
 
 <script>
-import util, {formatSeconds} from '../../utils/index'
+import util, { formatSeconds } from "../../utils/index";
 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 {gameAddLine, gameEnd} from "../../requests/game";
-import mpvueEcharts from 'mpvue-echarts'
-import echarts from '../../../static/echarts.min';
+import Toast from "../../../static/vant/toast/toast";
+import Dialog from "../../../static/vant/dialog/dialog";
+import { gameAddLine, gameEnd } from "../../requests/game";
+import mpvueEcharts from "mpvue-echarts";
+import echarts from "../../../static/echarts.min";
 
-var att_charts,
-  med_charts,
-  $this
+var att_charts, med_charts, $this;
 
 // 大脑图表初始化
 function initAttChart(canvas, width, height) {
   att_charts = echarts.init(canvas, null, {
     width: width,
-    height: height
+    height: height,
   });
   canvas.setChart(att_charts);
 
@@ -156,7 +195,7 @@ function initAttChart(canvas, width, height) {
 function initMedChart(canvas, width, height) {
   med_charts = echarts.init(canvas, null, {
     width: width,
-    height: height
+    height: height,
   });
   canvas.setChart(med_charts);
 
@@ -169,11 +208,11 @@ function initMedChart(canvas, width, height) {
 export default {
   name: "index_container",
   components: {
-    mpvueEcharts
+    mpvueEcharts,
   },
   data() {
     return {
-       // 折线图
+      // 折线图
       echarts,
       attCharts: initAttChart,
       medCharts: initMedChart,
@@ -218,29 +257,33 @@ export default {
 
       //  蓝牙信号强度
       rssi: 0,
-      game_status: 0
-    }
+      game_status: 0,
+    };
   },
   methods: {
     //游戏结束方法
     game_finished() {
-      bluetooth.sendEnd($this._deviceId, $this._serviceId, $this._characteristicId)
-      $this.$emit('closePop', true)
+      bluetooth.sendEnd(
+        $this._deviceId,
+        $this._serviceId,
+        $this._characteristicId
+      );
+      $this.$emit("closePop", true);
       //取消监听低功耗蓝牙设备
-      wx.offBLECharacteristicValueChange()
+      wx.offBLECharacteristicValueChange();
       //设置游戏状态为 停止游戏
-      game_store.setters.setGameStatus(3)
+      game_store.setters.setGameStatus(3);
       //游戏结束重置游戏时间
-      wx.removeStorageSync('play_time')
+      wx.removeStorageSync("play_time");
       //删除游戏专注数据
-      game_store.remover.rmGameAttMedDatas()
+      game_store.remover.rmGameAttMedDatas();
       //游戏结束重置游戏模式
-      game_store.setters.setMode(0)
+      game_store.setters.setMode(0);
       //删除游戏得id
-      game_store.setters.removeToyHex()
+      game_store.setters.removeToyHex();
 
       // 结束游戏在提交报告函数里
-      $this.post_data()
+      $this.post_data();
 
       Toast.loading({
         forbidClick: true,
@@ -248,24 +291,28 @@ export default {
         message: "正在生成报告...",
         duration: 0,
         onClose() {
-          bluetooth.shutdownSendControl($this._deviceId, $this._serviceId, $this._characteristicId)
-        }
-      })
+          bluetooth.shutdownSendControl(
+            $this._deviceId,
+            $this._serviceId,
+            $this._characteristicId
+          );
+        },
+      });
     },
     to_report() {
       mpvue.redirectTo({
         url: "/pages/report/main",
         success() {
-          $this.timeData = {}
-          $this.attList = []
-          $this.medList = []
-        }
-      })
+          $this.timeData = {};
+          $this.attList = [];
+          $this.medList = [];
+        },
+      });
     },
     start_game() {
       wx.setKeepScreenOn({
-        keepScreenOn: true
-      })
+        keepScreenOn: true,
+      });
       //打开内存警告
       // wx.onMemoryWarning(() => {
       //   console.log('内存告急警告')
@@ -286,76 +333,79 @@ export default {
       // $this.theta_list = []
       // $this.beta_list = []
 
-      bluetooth.watchingDevice($this)
-      bluetooth.sendControl($this._deviceId, $this._serviceId, $this._characteristicId)
+      bluetooth.watchingDevice($this);
+      bluetooth.sendControl(
+        $this._deviceId,
+        $this._serviceId,
+        $this._characteristicId
+      );
     },
 
     // ArrayBuffer转16进度字符串示例
     ab2hex(buffer) {
-      var hexArr = Array.prototype.map.call(
-        new Uint8Array(buffer),
-        function (bit) {
-          return ('00' + bit.toString(16)).slice(-2)
-        }
-      )
-      return hexArr.join('');
+      var hexArr = Array.prototype.map.call(new Uint8Array(buffer), function(
+        bit
+      ) {
+        return ("00" + bit.toString(16)).slice(-2);
+      });
+      return hexArr.join("");
     },
     // 往后端推送一次定时数据
     post_data() {
       //判断数据长度大于理想状态 需要对数组进行切割 逐个提交数据
-      let $len = 300
-      console.log($this.attList.length, '结束游戏提交的数据量')
+      let $len = 300;
+      console.log($this.attList.length, "结束游戏提交的数据量");
       if ($this.attList.length > $len) {
-        let $count = Math.ceil($this.attList.length / $len)
+        let $count = Math.ceil($this.attList.length / $len);
 
-        let index = 0
+        let index = 0;
         let inter = setInterval(() => {
           if (index < $count) {
             let $params = {
               game_record_id: game_store.getters.getGameRecordId(),
               //数据段长度大于65 多个提交
               line: $this.attList.slice(index * $len, (index + 1) * $len),
-              line_med: $this.medList.slice(index * $len, (index + 1) * $len)
-            }
+              line_med: $this.medList.slice(index * $len, (index + 1) * $len),
+            };
             gameAddLine($params).then((res) => {
-              let $data = res.data
+              let $data = res.data;
               if ($data.code == 0) {
-                console.log('ok', $params['line'])
+                console.log("ok", $params["line"]);
               }
-            })
+            });
           }
-          index++
+          index++;
           if (index == $count) {
-            clearInterval(inter)
-            $this.game_over()
-            $this.to_report()
+            clearInterval(inter);
+            $this.game_over();
+            $this.to_report();
           }
-        }, 200)
-        return $count * 500
+        }, 200);
+        return $count * 500;
       } else {
         let $params = {
           game_record_id: game_store.getters.getGameRecordId(),
           //数据段长度小于65 单个提交
           line: $this.attList,
-          line_med: $this.medList
-        }
+          line_med: $this.medList,
+        };
 
         if (!$params.line) {
-          return false
+          return false;
         }
         gameAddLine($params).then((res) => {
-          let $data = res.data
+          let $data = res.data;
           if ($data.code == 0) {
-            $this.attList = []
-            $this.medList = []
+            $this.attList = [];
+            $this.medList = [];
           }
           setTimeout(() => {
-            $this.game_over()
-            $this.to_report()
-          }, 800)
-        })
+            $this.game_over();
+            $this.to_report();
+          }, 800);
+        });
 
-        return 800
+        return 800;
       }
     },
     //  结束游戏
@@ -363,64 +413,69 @@ export default {
       let $params = {
         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 - Math.abs($this.played_time),
+      };
       //
       gameEnd($params).then((res) => {
-        let $data = res.data
-        $this.played_time = null
+        let $data = res.data;
+        $this.played_time = null;
         //设置未结束游戏
-        $this.is_end = false
-        $this.att_list = []
-        $this.med_list = []
-        $this.delta_list = []
-        $this.alpha_list = []
-        $this.theta_list = []
-        $this.beta_list = []
-      })
+        $this.is_end = false;
+        $this.att_list = [];
+        $this.med_list = [];
+        $this.delta_list = [];
+        $this.alpha_list = [];
+        $this.theta_list = [];
+        $this.beta_list = [];
+      });
     },
     //  处理游戏中数据的方法
-    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))
-      $this.alpha_list.push(Math.round($data['alpha'] / 1000000))
-      $this.theta_list.push(Math.round($data['theta'] / 10000))
-      $this.beta_list.push(Math.round($data['beta']) / 1000000)
+    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));
+      $this.alpha_list.push(Math.round($data["alpha"] / 1000000));
+      $this.theta_list.push(Math.round($data["theta"] / 10000));
+      $this.beta_list.push(Math.round($data["beta"]) / 1000000);
 
       if ($this.att_list.length > 50) {
-        $this.att_list.shift()
-        $this.med_list.shift()
-        $this.delta_list.shift()
-        $this.alpha_list.shift()
-        $this.theta_list.shift()
-        $this.beta_list.shift()
+        $this.att_list.shift();
+        $this.med_list.shift();
+        $this.delta_list.shift();
+        $this.alpha_list.shift();
+        $this.theta_list.shift();
+        $this.beta_list.shift();
       }
 
-      $this.attList.push($data['att'])
-      $this.medList.push($data['med'])
+      $this.attList.push($data["att"]);
+      $this.medList.push($data["med"]);
 
       game_store.setters.setGameAttMedDatas({
         attList: $this.attList,
-        medList: $this.medList
-      })
+        medList: $this.medList,
+      });
 
       //判断是否隐藏 隐藏则不绘画
-      let $hide_status = game_store.getters.getHideStatus()
+      let $hide_status = game_store.getters.getHideStatus();
       if (!$hide_status) {
         //通过专注放松度 画图
-        let $option = util.getLineOption($this.att_list, $this.med_list)
-        att_charts.setOption($option)
+        let $option = util.getLineOption($this.att_list, $this.med_list);
+        att_charts.setOption($option);
 
         //通过基本脑波发送数据
-        let $base_option = util.getBaseOption($this.delta_list, $this.theta_list, $this.alpha_list, $this.beta_list)
-        med_charts.setOption($base_option)
+        let $base_option = util.getBaseOption(
+          $this.delta_list,
+          $this.theta_list,
+          $this.alpha_list,
+          $this.beta_list
+        );
+        med_charts.setOption($base_option);
       }
     },
     //计算游玩时间
     calThePlayedTime() {
       //筛选模式
-      $this.mode = game_store.getters.getMode()
+      $this.mode = game_store.getters.getMode();
 
       let mode_list = [
         {
@@ -430,119 +485,123 @@ export default {
         {
           id: 2,
           name: "会员时间消费",
-        }
-
-      ]
+        },
+      ];
 
       //可玩时间
-      $this.play_time = game_store.getters.getPlayTime()
+      $this.play_time = game_store.getters.getPlayTime();
 
       //已经完了多长时间
-      $this.played_time = game_store.getters.getPlayedTime() ? game_store.getters.getPlayedTime() : game_store.getters.getPlayTime()
+      $this.played_time = game_store.getters.getPlayedTime()
+        ? game_store.getters.getPlayedTime()
+        : game_store.getters.getPlayTime();
 
-      $this.mode_item = {}
-      $this.mode_item = mode_list[$this.mode - 1]
-    }
-  }
-  ,
+      $this.mode_item = {};
+      $this.mode_item = mode_list[$this.mode - 1];
+    },
+  },
   mounted() {
-    $this._deviceId = game_store.getters.getDeviceId()
-    $this._serviceId = game_store.getters.getServiceId()
-    $this._characteristicId = game_store.getters.getCharacterId()
+    $this._deviceId = game_store.getters.getDeviceId();
+    $this._serviceId = game_store.getters.getServiceId();
+    $this._characteristicId = game_store.getters.getCharacterId();
     // setTimeout(() => {
-    $this.game_status = game_store.getters.getGameStatus()
+    $this.game_status = game_store.getters.getGameStatus();
     // }, 1000)
     //判断是否结束游戏
     if ($this.is_end == true) {
-      $this.game_finished()
+      $this.game_finished();
     } else {
-      $this.calThePlayedTime()
-      $this.start_game()
+      $this.calThePlayedTime();
+      $this.start_game();
 
       //打开蓝牙监听
-      bluetooth.watch_bluetooth_status($this)
-
+      bluetooth.watch_bluetooth_status($this);
     }
-
   },
   created() {
     $this = this;
   },
   onShow() {
-    game_store.setters.setHideStatus(false)
+    game_store.setters.setHideStatus(false);
     if ($this.played_time == 0) {
-      $this.game_finished()
+      $this.game_finished();
     } else {
       wx.getSystemInfoAsync({
         success(res) {
-          if (res.platform != 'android') {
+          if (res.platform != "android") {
             //获取 拉到后台得时间
-            let $hide_time = game_store.getters.getHideTime()
+            let $hide_time = game_store.getters.getHideTime();
             if ($hide_time) {
               //获取当前时间
-              let $now = Math.round(new Date() / 1000)
+              let $now = Math.round(new Date() / 1000);
               //获得后台到当前时间差
-              let $residue = $now - $hide_time
+              let $residue = $now - $hide_time;
               //将原来的游玩时间+上 时间差
-              let $played_time = $this.played_time * 1 - $residue * 1
+              let $played_time = $this.played_time * 1 - $residue * 1;
               //重新设置游玩时间
-              game_store.setters.setPlayedTime($played_time)
-              $this.calThePlayedTime()
+              game_store.setters.setPlayedTime($played_time);
+              $this.calThePlayedTime();
             }
           }
-        }
-      })
+        },
+      });
     }
   },
   onLoad(options) {
     if (options.end == 1) {
-      $this.is_end = true
+      $this.is_end = true;
     }
   },
   onHide() {
-    game_store.setters.setHideStatus(true)
-    game_store.setters.setHideTime(Math.round(new Date() / 1000))
-
+    game_store.setters.setHideStatus(true);
+    game_store.setters.setHideTime(Math.round(new Date() / 1000));
   },
   onUnload() {
-    console.log('小程序被销毁')
+    console.log("小程序被销毁");
     if (!$this.is_end) {
       //停止传输数据
-      bluetooth.sendEnd($this._deviceId, $this._serviceId, $this._characteristicId)
-      wx.offBLECharacteristicValueChange()
+      bluetooth.sendEnd(
+        $this._deviceId,
+        $this._serviceId,
+        $this._characteristicId
+      );
+      wx.offBLECharacteristicValueChange();
       //存储时间
-      game_store.setters.setPlayedTime($this.played_time)
+      game_store.setters.setPlayedTime($this.played_time);
       //设置未结束游戏
-      $this.is_end = false
+      $this.is_end = false;
     }
-  }
-}
+  },
+};
 </script>
 <style scoped>
 #playing_container {
   width: 100%;
-  background: linear-gradient(0deg, rgba(40, 157, 206, 0.51), rgba(135, 145, 226, 0.26));
-  background-color: #46425E;
+  background: linear-gradient(
+    0deg,
+    rgba(40, 157, 206, 0.51),
+    rgba(135, 145, 226, 0.26)
+  );
+  background-color: #46425e;
   padding: 5px;
   height: 750px;
-
 }
 
 .game_panel {
   width: 100%;
   height: 76px;
-  background: #46425E;
-  box-shadow: 0px 3px 4px 0px #302D43;
+  background: #46425e;
+  box-shadow: 0px 3px 4px 0px #302d43;
   border-radius: 11px;
   margin: 0px auto;
 }
 
 .game_panel .title {
-  color: #9A96B7;
+  color: #9a96b7;
 }
 
 .game_panel .type {
-  color: #FFFFFF;
+  color: #ffffff;
 }
 
 .cut_brain_icon {
@@ -556,14 +615,14 @@ export default {
 }
 
 .text-default {
-  color: #9A95B7;
+  color: #9a95b7;
   font-size: 10px;
 }
 
 /*电量显示*/
 .elc_power_container {
   width: 28px;
-  border: #9A95B7 3px solid;
+  border: #9a95b7 3px solid;
   border-radius: 5px;
   height: 22px;
 }
@@ -593,7 +652,7 @@ export default {
 .bar .line {
   width: 4px;
   height: 15px;
-  background-color: #FFB400;
+  background-color: #ffb400;
   margin-right: 7px;
 }
 
@@ -603,7 +662,7 @@ export default {
 }
 
 .label {
-  color: #9A95B7;
+  color: #9a95b7;
   font-size: 10px;
 }
 
@@ -617,32 +676,27 @@ export default {
 }
 
 .dot-orange {
-  background: #FFB400;
+  background: #ffb400;
 }
 
 .dot-pink {
-
-  background: #D4327A;
+  background: #d4327a;
 }
 
 .dot-blue {
-
-  background: #00CCFF;
+  background: #00ccff;
 }
 
 .dot-green {
-
-  background: #0CDA2E;
+  background: #0cda2e;
 }
 
 .dot-yellow {
-
-  background: #D1D310;
+  background: #d1d310;
 }
 
 .dot-orange-yellow {
-
-  background: #F8A117;
+  background: #f8a117;
 }
 
 /* 图表 */
@@ -667,7 +721,7 @@ export default {
 .err_container .title {
   font-size: 20px;
   font-weight: bold;
-  color: #4C4C4C;
+  color: #4c4c4c;
   line-height: 24px;
 }
 
@@ -676,7 +730,7 @@ export default {
   font-size: 12px;
   font-family: Microsoft YaHei;
   font-weight: 400;
-  color: #4B4B4B;
+  color: #4b4b4b;
   line-height: 24px;
 }
 
@@ -707,7 +761,7 @@ export default {
 .chart {
   width: 360px;
   height: 193px;
-  background: #302D43;
+  background: #302d43;
   opacity: 0.6;
   border-radius: 10px;
 }