|
|
@@ -27,8 +27,8 @@ Page({ |
|
|
|
onLoad() { |
|
|
|
this.socketLink() |
|
|
|
this.chatLimit() |
|
|
|
this.msgSec('习大大') |
|
|
|
this.msgSec('习大大') |
|
|
|
this.msgSec('共产党') |
|
|
|
this.msgSec('法轮功') |
|
|
|
}, |
|
|
|
|
|
|
|
// 敏感词检测 |
|
|
@@ -36,14 +36,13 @@ Page({ |
|
|
|
const AccessToken = wx.getStorageSync('AccessToken') |
|
|
|
const openId = wx.getStorageSync('openId') |
|
|
|
const data = { |
|
|
|
access_token: AccessToken, |
|
|
|
content, |
|
|
|
version: 2, |
|
|
|
scene: 4, |
|
|
|
openid: openId |
|
|
|
} |
|
|
|
wx.request({ |
|
|
|
url: 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token=ACCESS_TOKEN', |
|
|
|
url: `https://api.weixin.qq.com/wxa/msg_sec_check?access_token=${AccessToken}`, |
|
|
|
header: { |
|
|
|
"Content-Type": "application/json;charset=UTF-8", |
|
|
|
}, |
|
|
@@ -247,25 +246,26 @@ Page({ |
|
|
|
}).exec(); |
|
|
|
}, |
|
|
|
|
|
|
|
// 2023-4-28,由于给text标签添加了user-select属性,弃用自定义复制按钮,以下注释代码即为 |
|
|
|
// 点击开始,在触发messageTouchEnd之前即为长按 |
|
|
|
messageTouchStart(e) { |
|
|
|
const timer = this.data.timer |
|
|
|
const clearTimer = this.data.clearTimer |
|
|
|
clearTimeout(timer) |
|
|
|
clearTimeout(clearTimer) |
|
|
|
this.setData({ |
|
|
|
timer: null, |
|
|
|
clearTimer: null, |
|
|
|
}) |
|
|
|
// const timer = this.data.timer |
|
|
|
// const clearTimer = this.data.clearTimer |
|
|
|
// clearTimeout(timer) |
|
|
|
// clearTimeout(clearTimer) |
|
|
|
// this.setData({ |
|
|
|
// timer: null, |
|
|
|
// clearTimer: null, |
|
|
|
// }) |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
istouching: true, |
|
|
|
istouchingIndex: e.currentTarget.dataset.index, |
|
|
|
timer: setTimeout(() => { |
|
|
|
this.setData({ |
|
|
|
isHolding: true |
|
|
|
}) |
|
|
|
}, 200) |
|
|
|
// timer: setTimeout(() => { |
|
|
|
// this.setData({ |
|
|
|
// isHolding: true |
|
|
|
// }) |
|
|
|
// }, 200) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
@@ -274,28 +274,28 @@ Page({ |
|
|
|
this.setData({ |
|
|
|
istouching: false, |
|
|
|
istouchingIndex: e.currentTarget.dataset.index, |
|
|
|
clearTimer: setTimeout(() => { |
|
|
|
this.setData({ |
|
|
|
isHolding: false |
|
|
|
}) |
|
|
|
}, 4000) |
|
|
|
// clearTimer: setTimeout(() => { |
|
|
|
// this.setData({ |
|
|
|
// isHolding: false |
|
|
|
// }) |
|
|
|
// }, 4000) |
|
|
|
}) |
|
|
|
const timer = this.data.timer |
|
|
|
clearTimeout(timer) |
|
|
|
// const timer = this.data.timer |
|
|
|
// clearTimeout(timer) |
|
|
|
}, |
|
|
|
|
|
|
|
// 复制信息 |
|
|
|
copyMessage(e) { |
|
|
|
if (!this.data.isHolding) return |
|
|
|
const message = e.currentTarget.dataset.message |
|
|
|
this.setData({ |
|
|
|
isHolding: false |
|
|
|
}) |
|
|
|
const timer = this.data.timer |
|
|
|
clearTimeout(timer) |
|
|
|
|
|
|
|
this.setClipboardData(message) |
|
|
|
}, |
|
|
|
// copyMessage(e) { |
|
|
|
// if (!this.data.isHolding) return |
|
|
|
// const message = e.currentTarget.dataset.message |
|
|
|
// this.setData({ |
|
|
|
// isHolding: false |
|
|
|
// }) |
|
|
|
// const timer = this.data.timer |
|
|
|
// clearTimeout(timer) |
|
|
|
|
|
|
|
// this.setClipboardData(message) |
|
|
|
// }, |
|
|
|
|
|
|
|
// 监听聊天区域点击事件 |
|
|
|
contentWatch(e) { |
|
|
|