click.js
2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 11:28:48
* @LastEditors: limin
* @LastEditTime: 2024-12-06 14:46:47
* @FilePath: \gl_tape\utils\recordManager\click.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import utils from '@/utils/utils.js'
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js'
const timer = Object.freeze({
duration: 40 * 60 * 1000,
interval: 30 * 1000,
timeout: duration / interval
})
let counter = 0
let timer_interval = null
export default {
data() {
return {
reaction: 1
}
},
async mounted() {
this.versionCheck() // 检查更新
},
methods: {
versionCheck() {
const { textList, tempFileURL, version } = uni.$storage.get('mock_data')
const res = utils.compareVersions(plus?.runtime?.version, version)
if (res > -1) {
return
}
const e = {
result: {
is_silently: false,
is_mandatory: true,
name: '',
title: '',
contents: textList.join('\n'),
version: version,
url: tempFileURL,
stable_publish: true
}
}
checkUpdate(e)
},
// //关闭提示
tipCancel() {
this.audioManager.stop()
this.saveRecord()
this.setReceptionStatus(0)
this.setAudioInfo({ endReasonType: 1 })
if (this.$refs.tipBox) {
this.$refs.tipBox.close()
let { sceneType } = uni.$storage.get('userInfo')
uni.reLaunch({
url: sceneType == 0 ? '/pages/equity/index' : '/pages/boutique/index'
})
}
},
async saveRecord() {
const preRecord = this.record.preRecord
return this.record.save(preRecord)
},
//结束提示
tipConfirm() {
counter = 0
this.$refs.tipBox?.close()
},
closeAudio() {
this.endWatchClick()
this.audioManager.stop()
this.setReceptionStatus(0)
this.setAudioInfo({ endReasonType: 1 })
},
//监听点击事件
initTime() {
this.endWatchClick()
timer_interval = setInterval(() => {
if (counter >= timer.timeout) {
//关闭录音
this.closeAudio()
}
counter++
}, timer.interval)
},
endWatchClick() {
if (timer_interval) clearInterval(timer_interval)
timer_interval = null
counter = 0
},
handleTouchStart() {
counter = 0
}
}
}