Skip to content

Commit

Permalink
戳戳戳戳戳
Browse files Browse the repository at this point in the history
✨ 支持 Napcat 3.0 戳一戳功能
➕ 更新依赖:vue3-bcui
  • Loading branch information
Stapxs committed Oct 23, 2024
1 parent 1c417a8 commit 7aeb089
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stapxs-qq-lite",
"version": "2.9.1",
"version": "2.9.2",
"private": false,
"author": "Stapx Steve [林槐]",
"description": "一个兼容 OneBot 的非官方网页版 QQ 客户端,使用 Vue 重制的全新版本。",
Expand Down Expand Up @@ -47,7 +47,7 @@
"vue-clipboard2": "^0.3.3",
"vue-i18n": "^9.2.2",
"vue-prism-editor": "^2.0.0-alpha.2",
"vue3-bcui": "^0.2.3",
"vue3-bcui": "^0.2.6",
"vue3-danmaku": "^1.6.0",
"vue3-infinite-scroll-better": "^2.2.0",
"xss": "^1.0.14"
Expand Down
6 changes: 5 additions & 1 deletion src/assets/pathMap/NapCat.Onebot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,8 @@ recent_contact:
user_id: /peerUin
time: /msgTime
chat_type: /chatType
name: /peerName
name: /peerName
# 戳一戳
poke:
name: group_poke
private_name: friend_poke
7 changes: 6 additions & 1 deletion src/components/MsgBody.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div :class="'message' + (type ? ' ' + type : '') + (data.revoke ? ' revoke' : '') + (isMe ? ' me': '') + (selected ? ' selected' : '')" :data-raw="getMsgRawTxt(data)"
:id="'chat-' + data.message_id" :data-sender="data.sender.user_id" :data-time="data.time"
@mouseleave="hiddenUserInfo">
<img name="avatar" :src="'https://q1.qlogo.cn/g?b=qq&s=0&nk=' + data.sender.user_id" v-show="!isMe || type == 'merge'">
<img @dblclick="sendPoke" name="avatar" :src="'https://q1.qlogo.cn/g?b=qq&s=0&nk=' + data.sender.user_id" v-show="!isMe || type == 'merge'">
<div class="message-space" v-if="isMe && type != 'merge'"></div>
<div :class="isMe ? (type == 'merge' ? 'message-body' : 'message-body me') : 'message-body'">
<template v-if="runtimeData.chatInfo.show.type == 'group' && !isMe && senderInfo?.title && senderInfo?.title != ''">
Expand Down Expand Up @@ -531,6 +531,11 @@ export default defineComponent({
hasCard = true
}})
return hasCard
},

sendPoke() {
// 调用上级组件的 poke 方法
this.$emit('sendPoke', this.data.sender.user_id)
}
},
mounted () {
Expand Down
8 changes: 6 additions & 2 deletions src/function/utils/msgUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,10 @@ export function updateLastestHistory(item: UserFriendElem & UserGroupElem) {
}

export function sendMsgAppendInfo(msg: any) {
msg
// TODO
if(msg.message) {
msg.message.forEach(() => {
// TODO
}
)
}
}
19 changes: 14 additions & 5 deletions src/pages/Chat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
@contextmenu.prevent="showMsgMeun($event, msg)"
@touchstart="msgStartMove($event, msg)"
@touchmove="msgOnMove"
@touchend="msgMoveEnd($event, msg)">
@touchend="msgMoveEnd($event, msg)"
@sendPoke="sendPoke">
</MsgBody>
<!-- 其他通知消息 -->
<NoticeBody :id="uuid()" v-if="msg.post_type === 'notice'" :key="'notice-' + index" :data="msg"></NoticeBody>
Expand Down Expand Up @@ -216,7 +217,7 @@
@click="details[1].open = !details[1].open, tags.showMoreDetail = false">
<font-awesome-icon :icon="['fas', 'face-laugh']" />
</div>
<div :title="$t('戳一戳')" v-if="chat.show.type === 'user'" @click="sendPoke">
<div :title="$t('戳一戳')" v-if="chat.show.type === 'user'" @click="sendPoke(chat.show.id)">
<font-awesome-icon :icon="['fas', 'fa-hand-point-up']" /></div>
<div :title="$t('精华消息')" v-if="chat.show.type === 'group'" @click="showJin">
<font-awesome-icon :icon="['fas', 'star']" /></div>
Expand Down Expand Up @@ -365,6 +366,10 @@
<div><font-awesome-icon :icon="['fas', 'at']" /></div>
<a>{{ $t('提及') }}</a>
</div>
<div @click="sendPoke(selectedMsg ? selectedMsg.sender.user_id : undefined)" v-show="tags.menuDisplay.poke">
<div><font-awesome-icon :icon="['fas', 'fa-hand-point-up']" /></div>
<a>{{ $t('戳一戳') }}</a>
</div>
<div @click="removeUser" v-show="tags.menuDisplay.remove">
<div><font-awesome-icon :icon="['fas', 'trash-can']" /></div>
<a>{{ $t('移出群聊') }}</a>
Expand Down Expand Up @@ -490,6 +495,7 @@ export default defineComponent({
downloadImg: false as string | false,
revoke: false,
at: true,
poke: false,
remove: false,
respond: false,
showRespond: true
Expand Down Expand Up @@ -786,6 +792,7 @@ export default defineComponent({
})
this.tags.menuDisplay.showRespond = false
this.tags.menuDisplay.at = true
this.tags.menuDisplay.poke = true
this.tags.menuDisplay.remove = true
if(runtimeData.chatInfo.show.type != 'group' ||
data.sender.user_id === runtimeData.loginInfo.uin ||
Expand Down Expand Up @@ -907,6 +914,7 @@ export default defineComponent({
downloadImg: false,
revoke: false,
at: false,
poke: false,
remove: false,
respond: false,
showRespond: true
Expand Down Expand Up @@ -1816,18 +1824,19 @@ export default defineComponent({
/**
* 发送戳一戳
*/
sendPoke() {
sendPoke(user_id: number) {
if(runtimeData.jsonMap.poke) {
let name = runtimeData.jsonMap.poke.name
if(this.chat.show.type == 'user' && runtimeData.jsonMap.poke.private_name) {
name = runtimeData.jsonMap.poke.private_name
}
Connector.send(name, {
user_id: this.chat.show.id,
user_id: user_id,
group_id: this.chat.show.id
}, 'sendPoke')
}
this.tags.showMoreDetail = !this.tags.showMoreDetail
this.tags.showMoreDetail = false
this.tags.menuDisplay.poke = false
},
/**
Expand Down

0 comments on commit 7aeb089

Please sign in to comment.