diff --git a/components/message/chat/chat-layout.vue b/components/message/chat/chat-layout.vue index 3fa524d..eba287b 100644 --- a/components/message/chat/chat-layout.vue +++ b/components/message/chat/chat-layout.vue @@ -43,7 +43,7 @@ - + @@ -142,12 +142,13 @@ const data = reactive({ content: "", simIndex: 1, scrollTop: 0, - keyboardHeight: 0 + keyboardHeight: 0, + lastClickTime: 0 }) -let { isSend, content, simIndex, scrollTop } = toRefs(data) +let { isSend, content, simIndex, scrollTop, lastClickTime } = toRefs(data) -const emit = defineEmits(['send']) +const emit = defineEmits(['send', 'dblclick-left', 'dblclick-right']) onMounted(() => { // 延迟极小时间确保 DOM 已更新循环并将滚动条拉到极限底端 @@ -220,6 +221,38 @@ const sendMessage = () => { }, 100); } +/** + * 处理 center-box 点击事件,检测双击并区分左右 + */ +const handleBoxClick = (e) => { + const now = Date.now(); + const clickInterval = now - data.lastClickTime; + + // 如果两次点击间隔在 300ms 以内,视为双击 + if (clickInterval > 0 && clickInterval < 300) { + // 获取点击位置的 X 坐标 + const clientX = e.detail.x || (e.touches && e.touches[0] ? e.touches[0].clientX : 0); + + // 获取屏幕宽度来区分左右 + const systemInfo = uni.getSystemInfoSync(); + const halfWidth = systemInfo.screenWidth / 2; + + if (clientX < halfWidth) { + console.log('双击左侧'); + emit('dblclick-left'); + } else { + console.log('双击右侧'); + emit('dblclick-right'); + } + + // 成功触发双击后重置时间,防止连续三次点击触发两次双击 + data.lastClickTime = 0; + } else { + data.lastClickTime = now; + } +} + + // 展示文字信息 const showInfo = computed(() => { let placeholder diff --git a/components/message/chat/chat-list.vue b/components/message/chat/chat-list.vue index 44170a4..0030550 100644 --- a/components/message/chat/chat-list.vue +++ b/components/message/chat/chat-list.vue @@ -18,7 +18,8 @@ - + 信息 · 短信 短信/彩信 {{ formatHuaweiTopTime(message.time) }} @@ -345,8 +346,8 @@ const formatMessageContent = (content, isMe) => { * @param index * @param message */ -const onMessageLongPress = (index, message) => { - emit('onLongPress', index, message) +const onMessageLongPress = (index, message, type = 'message') => { + emit('onLongPress', index, message, type) } // ===================== 拖拽排序逻辑 ===================== diff --git a/components/message/list/message-nav-bar.vue b/components/message/list/message-nav-bar.vue index dd4042d..d3af3c8 100644 --- a/components/message/list/message-nav-bar.vue +++ b/components/message/list/message-nav-bar.vue @@ -111,19 +111,9 @@ import { util } from '@/utils/common.js'; -const emit = defineEmits(['add']) +const emit = defineEmits(['add', 'setSim', 'setNoticeCount']) + -const buttonGroup = [{ - name: "添加短信", - click: () => { - emit('add') - } -}, { - name: "设置卡1卡2运营商", - click: () => { - emit('setSim') - } -}] const props = defineProps({ // 手机品牌 @@ -138,6 +128,31 @@ const props = defineProps({ } }) +const buttonGroup = computed(() => { + const groups = [{ + name: "添加短信", + click: () => { + emit('add') + } + }, { + name: "设置卡1卡2运营商", + click: () => { + emit('setSim') + } + }] + + if (props.phone == 'huawei') { + groups.push({ + name: "设置通知信息未读数", + click: () => { + emit('setNoticeCount') + } + }) + } + + return groups +}) + const data = reactive({ navBar: { @@ -538,15 +553,17 @@ page { padding: 0 10rpx; .icon { - width: 32rpx; - height: 32rpx; + width: 40rpx; + height: 40rpx; + flex-shrink: 0; } .input { + flex: 1; margin: 0 20rpx; ::v-deep .input-placeholder { - color: #646464; + color: #9A9A9A; font-size: 32rpx; } } diff --git a/pages/message/chat-page/chat-page.vue b/pages/message/chat-page/chat-page.vue index b2a3518..89251f6 100644 --- a/pages/message/chat-page/chat-page.vue +++ b/pages/message/chat-page/chat-page.vue @@ -8,7 +8,7 @@ + :number="data.number" @dblclick-left="onDblclickLeft" @dblclick-right="onDblclickRight"> @@ -194,10 +194,13 @@ const onEditorReady = () => { }).exec() } +let longpressType = ref('message') // 长按弹出弹出层 -const onMessageLongPress = (index, message) => { +const onMessageLongPress = (index, message, type) => { selectedMessage.value = message; - uni.createSelectorQuery().select('#msg-' + index).boundingClientRect(rect => { + longpressType.value = type + const selector = type === 'time' ? '#time-' + index : '#msg-' + index; + uni.createSelectorQuery().select(selector).boundingClientRect(rect => { if (rect) { // 将弹窗定位在元素正下方 (bottom边界 + 一点点边距) popupTop.value = rect.bottom + 10; @@ -443,6 +446,28 @@ const handleSend = (params) => { messageList.value.push(params) saveChatList() } + +/** + * 双击左侧 + */ +const onDblclickLeft = () => { + isMe.value = false + uni.showToast({ + title: "现在是对方发言", + icon: "none" + }) +} + +/** + * 双击右侧 + */ +const onDblclickRight = () => { + isMe.value = true + uni.showToast({ + title: "现在是自己发言", + icon: "none" + }) +} diff --git a/static/image/phone-message/huawei/notice.png b/static/image/phone-message/huawei/notice.png new file mode 100644 index 0000000..8dc7bd4 Binary files /dev/null and b/static/image/phone-message/huawei/notice.png differ diff --git a/static/image/phone-message/huawei/right.png b/static/image/phone-message/huawei/right.png new file mode 100644 index 0000000..9ad2a7a Binary files /dev/null and b/static/image/phone-message/huawei/right.png differ