|
@@ -124,6 +124,7 @@
|
|
|
import mpvueEcharts from 'mpvue-echarts'
|
|
|
import echarts from '../../../static/echarts.min';
|
|
|
import util, {formatSeconds} from '../../utils/index'
|
|
|
+import userjs from '../../utils/user'
|
|
|
import bluetooth from "../../utils/bluetooth";
|
|
|
import game_store from "@/store/game";
|
|
|
import Toast from '../../../static/vant/toast/toast';
|
|
@@ -341,7 +342,7 @@ export default {
|
|
|
}
|
|
|
$this.timeData = $datetime
|
|
|
$this.played_time += 1
|
|
|
- if ($this.played_time % 60 == 0){
|
|
|
+ if ($this.played_time % 60 == 0) {
|
|
|
$this.post_data()
|
|
|
}
|
|
|
},
|
|
@@ -361,6 +362,27 @@ export default {
|
|
|
$this.attList = []
|
|
|
$this.medList = []
|
|
|
} else {
|
|
|
+ bluetooth.shutdownSendControl($this._deviceId, $this._serviceId, $this._characteristicId)
|
|
|
+ //停止控制游戏
|
|
|
+ const countDown = $this.$mp.page.selectComponent('.control-count-down');
|
|
|
+ countDown.pause();
|
|
|
+ //取消监听低功耗蓝牙设备
|
|
|
+ wx.offBLECharacteristicValueChange()
|
|
|
+ Toast.success('已成功断开')
|
|
|
+ //设置游戏状态为 停止游戏
|
|
|
+ game_store.setters.setGameStatus(3)
|
|
|
+ //游戏结束重置游戏时间
|
|
|
+ wx.removeStorageSync('play_time')
|
|
|
+ wx.removeStorageSync('hide_time')
|
|
|
+ //游戏结束重置游戏模式
|
|
|
+ game_store.setters.setMode(0)
|
|
|
+ //删除游戏得id
|
|
|
+ game_store.setters.removeToyHex()
|
|
|
+ //关闭游戏常亮
|
|
|
+ wx.setKeepScreenOn({
|
|
|
+ keepScreenOn: false
|
|
|
+ })
|
|
|
+ userjs.do_logout($this)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -436,7 +458,7 @@ export default {
|
|
|
let $played_time = $this.played_time = game_store.getters.getPlayedTime() ? game_store.getters.getPlayedTime() : 0
|
|
|
|
|
|
//判断可玩时长超出了时间 就直接结束游戏
|
|
|
- if ($played_time>=($play_time * 1000)) {
|
|
|
+ if ($played_time >= ($play_time * 1000)) {
|
|
|
$this.game_finished()
|
|
|
}
|
|
|
|