mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-05 00:47:05 +00:00
no message
This commit is contained in:
parent
7c885cad5b
commit
573a5c03e4
@ -742,7 +742,7 @@ class DialogController extends AbstractController
|
||||
* @apiName msg__forward
|
||||
*
|
||||
* @apiParam {Number} msg_id 消息ID
|
||||
* @apiParam {String} emoji 回复或取消的emoji表情
|
||||
* @apiParam {String} symbol 回复或取消的emoji表情
|
||||
*
|
||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||
@ -753,9 +753,9 @@ class DialogController extends AbstractController
|
||||
$user = User::auth();
|
||||
//
|
||||
$msg_id = intval(Request::input("msg_id"));
|
||||
$emoji = Request::input("emoji");
|
||||
$symbol = Request::input("symbol");
|
||||
//
|
||||
if (!preg_match("/^[\u{d800}-\u{dbff}]|[\u{dc00}-\u{dfff}]$/", $emoji)) {
|
||||
if (!preg_match("/^[\u{d800}-\u{dbff}]|[\u{dc00}-\u{dfff}]$/", $symbol)) {
|
||||
return Base::retError("参数错误");
|
||||
}
|
||||
//
|
||||
@ -765,7 +765,7 @@ class DialogController extends AbstractController
|
||||
}
|
||||
WebSocketDialog::checkDialog($msg->dialog_id);
|
||||
//
|
||||
return $msg->emojiMsg($emoji, $user->userid);
|
||||
return $msg->emojiMsg($symbol, $user->userid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -197,16 +197,16 @@ class WebSocketDialogMsg extends AbstractModel
|
||||
|
||||
/**
|
||||
* emoji回复
|
||||
* @param $emoji
|
||||
* @param $symbol
|
||||
* @param int $sender 发送的会员ID
|
||||
* @return mixed
|
||||
*/
|
||||
public function emojiMsg($emoji, $sender)
|
||||
public function emojiMsg($symbol, $sender)
|
||||
{
|
||||
$exist = false;
|
||||
$array = $this->emoji;
|
||||
foreach ($array as $index => &$item) {
|
||||
if ($item['symbol'] === $emoji) {
|
||||
if ($item['symbol'] === $symbol) {
|
||||
if (in_array($sender, $item['userids'])) {
|
||||
// 已存在 去除
|
||||
$item['userids'] = array_values(array_diff($item['userids'], [$sender]));
|
||||
@ -224,7 +224,7 @@ class WebSocketDialogMsg extends AbstractModel
|
||||
}
|
||||
if (!$exist) {
|
||||
array_unshift($array, [
|
||||
'symbol' => $emoji,
|
||||
'symbol' => $symbol,
|
||||
'userids' => [$sender]
|
||||
]);
|
||||
}
|
||||
|
||||
@ -87,8 +87,8 @@ export default {
|
||||
this.dispatch("on-view-file", e)
|
||||
},
|
||||
|
||||
onEmoji(e) {
|
||||
this.dispatch("on-emoji", e)
|
||||
onEmoji(data) {
|
||||
this.dispatch("on-emoji", data)
|
||||
},
|
||||
|
||||
dispatch(event, arg) {
|
||||
|
||||
@ -386,8 +386,11 @@ export default {
|
||||
this.$emit("on-view-file", e)
|
||||
},
|
||||
|
||||
onEmoji(emoji) {
|
||||
this.$emit("on-emoji", emoji)
|
||||
onEmoji(symbol) {
|
||||
this.$emit("on-emoji", {
|
||||
msg_id: this.msgData.id,
|
||||
symbol
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -1262,24 +1262,26 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
onEmoji(emoji) {
|
||||
const msg_id = this.operateItem.id;
|
||||
onEmoji(data) {
|
||||
if (!$A.isJson(data)) {
|
||||
data = {
|
||||
msg_id: this.operateItem.id,
|
||||
symbol: data,
|
||||
}
|
||||
}
|
||||
this.$store.dispatch("setLoad", {
|
||||
key: `msg-${msg_id}`,
|
||||
key: `msg-${data.msg_id}`,
|
||||
delay: 600
|
||||
})
|
||||
this.$store.dispatch("call", {
|
||||
url: 'dialog/msg/emoji',
|
||||
data: {
|
||||
msg_id,
|
||||
emoji,
|
||||
},
|
||||
data,
|
||||
}).then(({data}) => {
|
||||
this.$store.dispatch("saveDialogMsg", data);
|
||||
}).catch(({msg}) => {
|
||||
$A.messageError(msg);
|
||||
}).finally(_ => {
|
||||
this.$store.dispatch("cancelLoad", `msg-${msg_id}`)
|
||||
this.$store.dispatch("cancelLoad", `msg-${data.msg_id}`)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@
|
||||
:class="{
|
||||
shear: shearIds.includes(item.id),
|
||||
highlight: selectIds.includes(item.id),
|
||||
operation: contextMenuVisible && item.id === contextMenuItem.id,
|
||||
operate: contextMenuVisible && item.id === contextMenuItem.id,
|
||||
}"
|
||||
:data-id="item.id"
|
||||
v-longpress="handleLongpress"
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
:class="{
|
||||
top: dialog.top_at,
|
||||
active: dialog.id == dialogId,
|
||||
operate: dialog.id == operateItem.id && operateVisible,
|
||||
operate: operateVisible && dialog.id == operateItem.id,
|
||||
completed: $A.dialogCompleted(dialog)
|
||||
}"
|
||||
:data-id="dialog.id"
|
||||
@ -72,7 +72,10 @@
|
||||
<div v-if="dialog.last_msg.userid == userId" class="last-self">{{$L('你')}}</div>
|
||||
<UserAvatar v-else :userid="dialog.last_msg.userid" :show-name="true" :show-icon="false" tooltip-disabled/>
|
||||
</template>
|
||||
<div class="last-text">{{formatMsgDesc(dialog.last_msg)}}</div>
|
||||
<div class="last-text">
|
||||
<em v-if="formatMsgEmojiDesc(dialog.last_msg)">{{formatMsgEmojiDesc(dialog.last_msg)}}</em>
|
||||
<span>{{formatMsgDesc(dialog.last_msg)}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Badge class="dialog-num" :count="$A.getDialogUnread(dialog)"/>
|
||||
@ -528,6 +531,13 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
formatMsgEmojiDesc(data) {
|
||||
if ($A.isJson(data) && $A.arrayLength(data.emoji) > 0) {
|
||||
return data.emoji[0].symbol;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
formatMsgDesc(data) {
|
||||
return msgSimpleDesc(data);
|
||||
},
|
||||
|
||||
11
resources/assets/js/store/actions.js
vendored
11
resources/assets/js/store/actions.js
vendored
@ -2128,11 +2128,20 @@ export default {
|
||||
});
|
||||
} else if ($A.isJson(data)) {
|
||||
const index = state.dialogMsgs.findIndex(({id}) => id == data.id);
|
||||
data = Object.assign({}, state.dialogMsgs[index], data)
|
||||
if (index > -1) {
|
||||
state.dialogMsgs.splice(index, 1, Object.assign({}, state.dialogMsgs[index], data));
|
||||
state.dialogMsgs.splice(index, 1, data);
|
||||
} else {
|
||||
state.dialogMsgs.push(data);
|
||||
}
|
||||
//
|
||||
const dialog = state.cacheDialogs.find(({id, last_msg}) => id == data.dialog_id && last_msg && last_msg.id === data.id);
|
||||
if (dialog) {
|
||||
dispatch("saveDialog", {
|
||||
id: data.dialog_id,
|
||||
last_msg: Object.assign({}, dialog.last_msg, data),
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -269,7 +269,7 @@
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
right: 48px;
|
||||
bottom: 0;
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
4
resources/assets/sass/pages/page-file.scss
vendored
4
resources/assets/sass/pages/page-file.scss
vendored
@ -446,7 +446,7 @@
|
||||
&.highlight {
|
||||
background-color: #f4f5f7;
|
||||
}
|
||||
&.operation,
|
||||
&.operate,
|
||||
&:hover {
|
||||
background-color: #f4f5f7;
|
||||
.file-menu,
|
||||
@ -697,7 +697,7 @@
|
||||
&:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
&.operation {
|
||||
&.operate {
|
||||
&:hover {
|
||||
background-color: #f4f5f7;
|
||||
}
|
||||
|
||||
24
resources/assets/sass/pages/page-messenger.scss
vendored
24
resources/assets/sass/pages/page-messenger.scss
vendored
@ -204,9 +204,27 @@
|
||||
}
|
||||
.last-text {
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
> em {
|
||||
flex-shrink: 0;
|
||||
background-color: rgba($primary-desc-color, 0.3);
|
||||
height: 18px;
|
||||
width: 24px;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
border-radius: 9px;
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
margin-right: 4px;
|
||||
}
|
||||
> span {
|
||||
flex: 1;
|
||||
width: 0;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user