|
@@ -231,27 +231,20 @@ export default {
|
|
game_store.setters.setGameStatus(3)
|
|
game_store.setters.setGameStatus(3)
|
|
//游戏结束重置游戏时间
|
|
//游戏结束重置游戏时间
|
|
wx.removeStorageSync('play_time')
|
|
wx.removeStorageSync('play_time')
|
|
- wx.removeStorageSync('hide_time')
|
|
|
|
//游戏结束重置游戏模式
|
|
//游戏结束重置游戏模式
|
|
game_store.setters.setMode(0)
|
|
game_store.setters.setMode(0)
|
|
//删除游戏得id
|
|
//删除游戏得id
|
|
game_store.setters.removeToyHex()
|
|
game_store.setters.removeToyHex()
|
|
|
|
|
|
|
|
+ // 结束游戏在提交报告函数里
|
|
|
|
+ $this.post_data()
|
|
|
|
+
|
|
Toast.loading({
|
|
Toast.loading({
|
|
forbidClick: true,
|
|
forbidClick: true,
|
|
mask: true,
|
|
mask: true,
|
|
message: "正在生成报告...",
|
|
message: "正在生成报告...",
|
|
duration: 0,
|
|
duration: 0,
|
|
})
|
|
})
|
|
- // 结束游戏在提交报告函数里
|
|
|
|
- $this.post_data()
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- // 时间到
|
|
|
|
- time_out() {
|
|
|
|
- console.log('游戏结束')
|
|
|
|
- //游戏结束
|
|
|
|
- $this.game_finished()
|
|
|
|
},
|
|
},
|
|
to_report() {
|
|
to_report() {
|
|
mpvue.redirectTo({
|
|
mpvue.redirectTo({
|
|
@@ -282,6 +275,7 @@ export default {
|
|
post_data() {
|
|
post_data() {
|
|
//判断数据长度大于理想状态 需要对数组进行切割 逐个提交数据
|
|
//判断数据长度大于理想状态 需要对数组进行切割 逐个提交数据
|
|
let $len = 300
|
|
let $len = 300
|
|
|
|
+ console.log($this.attList.length, '结束游戏提交的数据量')
|
|
if ($this.attList.length > $len) {
|
|
if ($this.attList.length > $len) {
|
|
let $count = Math.ceil($this.attList.length / $len)
|
|
let $count = Math.ceil($this.attList.length / $len)
|
|
|
|
|
|
@@ -294,9 +288,6 @@ export default {
|
|
line: $this.attList.slice(index * $len, (index + 1) * $len),
|
|
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)
|
|
}
|
|
}
|
|
- console.log($this.attList)
|
|
|
|
- console.log(index * $len, (index + 1) * $len)
|
|
|
|
- console.log($this.attList.slice(index * $len, (index + 1) * $len))
|
|
|
|
gameAddLine($params).then((res) => {
|
|
gameAddLine($params).then((res) => {
|
|
let $data = res.data
|
|
let $data = res.data
|
|
if ($data.code == 0) {
|
|
if ($data.code == 0) {
|
|
@@ -329,11 +320,12 @@ export default {
|
|
$this.attList = []
|
|
$this.attList = []
|
|
$this.medList = []
|
|
$this.medList = []
|
|
}
|
|
}
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ $this.game_over()
|
|
|
|
+ $this.to_report()
|
|
|
|
+ }, 800)
|
|
})
|
|
})
|
|
- setTimeout(() => {
|
|
|
|
- $this.game_over()
|
|
|
|
- $this.to_report()
|
|
|
|
- }, 800)
|
|
|
|
|
|
+
|
|
return 800
|
|
return 800
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -380,13 +372,17 @@ export default {
|
|
$this.attList.push($data['att'])
|
|
$this.attList.push($data['att'])
|
|
$this.medList.push($data['med'])
|
|
$this.medList.push($data['med'])
|
|
|
|
|
|
- //通过专注放松度 画图
|
|
|
|
- let $option = util.getLineOption($this.att_list, $this.med_list)
|
|
|
|
- att_charts.setOption($option)
|
|
|
|
|
|
+ //判断是否隐藏 隐藏则不绘画
|
|
|
|
+ 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 $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() {
|
|
calThePlayedTime() {
|
|
@@ -419,9 +415,9 @@ export default {
|
|
}
|
|
}
|
|
,
|
|
,
|
|
mounted() {
|
|
mounted() {
|
|
- let $deviceId = $this._deviceId = game_store.getters.getDeviceId()
|
|
|
|
- let $serviceId = $this._serviceId = game_store.getters.getServiceId()
|
|
|
|
- let $cId = $this._characteristicId = game_store.getters.getCharacterId()
|
|
|
|
|
|
+ $this._deviceId = game_store.getters.getDeviceId()
|
|
|
|
+ $this._serviceId = game_store.getters.getServiceId()
|
|
|
|
+ $this._characteristicId = game_store.getters.getCharacterId()
|
|
|
|
|
|
//判断是否结束游戏
|
|
//判断是否结束游戏
|
|
if ($this.is_end == true) {
|
|
if ($this.is_end == true) {
|
|
@@ -441,14 +437,18 @@ export default {
|
|
$this = this;
|
|
$this = this;
|
|
},
|
|
},
|
|
onShow() {
|
|
onShow() {
|
|
|
|
+ game_store.setters.setHideStatus(false)
|
|
if ($this.played_time == 0) {
|
|
if ($this.played_time == 0) {
|
|
- $this.time_out()
|
|
|
|
|
|
+ $this.game_finished()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
if (options.end == 1) {
|
|
if (options.end == 1) {
|
|
$this.is_end = true
|
|
$this.is_end = true
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ onHide() {
|
|
|
|
+ game_store.setters.setHideStatus(true)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|