mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 19:23:26 +00:00
no message
This commit is contained in:
parent
7c885cad5b
commit
573a5c03e4
@ -742,7 +742,7 @@ class DialogController extends AbstractController
|
|||||||
* @apiName msg__forward
|
* @apiName msg__forward
|
||||||
*
|
*
|
||||||
* @apiParam {Number} msg_id 消息ID
|
* @apiParam {Number} msg_id 消息ID
|
||||||
* @apiParam {String} emoji 回复或取消的emoji表情
|
* @apiParam {String} symbol 回复或取消的emoji表情
|
||||||
*
|
*
|
||||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||||
@ -753,9 +753,9 @@ class DialogController extends AbstractController
|
|||||||
$user = User::auth();
|
$user = User::auth();
|
||||||
//
|
//
|
||||||
$msg_id = intval(Request::input("msg_id"));
|
$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("参数错误");
|
return Base::retError("参数错误");
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -765,7 +765,7 @@ class DialogController extends AbstractController
|
|||||||
}
|
}
|
||||||
WebSocketDialog::checkDialog($msg->dialog_id);
|
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回复
|
* emoji回复
|
||||||
* @param $emoji
|
* @param $symbol
|
||||||
* @param int $sender 发送的会员ID
|
* @param int $sender 发送的会员ID
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function emojiMsg($emoji, $sender)
|
public function emojiMsg($symbol, $sender)
|
||||||
{
|
{
|
||||||
$exist = false;
|
$exist = false;
|
||||||
$array = $this->emoji;
|
$array = $this->emoji;
|
||||||
foreach ($array as $index => &$item) {
|
foreach ($array as $index => &$item) {
|
||||||
if ($item['symbol'] === $emoji) {
|
if ($item['symbol'] === $symbol) {
|
||||||
if (in_array($sender, $item['userids'])) {
|
if (in_array($sender, $item['userids'])) {
|
||||||
// 已存在 去除
|
// 已存在 去除
|
||||||
$item['userids'] = array_values(array_diff($item['userids'], [$sender]));
|
$item['userids'] = array_values(array_diff($item['userids'], [$sender]));
|
||||||
@ -224,7 +224,7 @@ class WebSocketDialogMsg extends AbstractModel
|
|||||||
}
|
}
|
||||||
if (!$exist) {
|
if (!$exist) {
|
||||||
array_unshift($array, [
|
array_unshift($array, [
|
||||||
'symbol' => $emoji,
|
'symbol' => $symbol,
|
||||||
'userids' => [$sender]
|
'userids' => [$sender]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,8 +87,8 @@ export default {
|
|||||||
this.dispatch("on-view-file", e)
|
this.dispatch("on-view-file", e)
|
||||||
},
|
},
|
||||||
|
|
||||||
onEmoji(e) {
|
onEmoji(data) {
|
||||||
this.dispatch("on-emoji", e)
|
this.dispatch("on-emoji", data)
|
||||||
},
|
},
|
||||||
|
|
||||||
dispatch(event, arg) {
|
dispatch(event, arg) {
|
||||||
|
|||||||
@ -386,8 +386,11 @@ export default {
|
|||||||
this.$emit("on-view-file", e)
|
this.$emit("on-view-file", e)
|
||||||
},
|
},
|
||||||
|
|
||||||
onEmoji(emoji) {
|
onEmoji(symbol) {
|
||||||
this.$emit("on-emoji", emoji)
|
this.$emit("on-emoji", {
|
||||||
|
msg_id: this.msgData.id,
|
||||||
|
symbol
|
||||||
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1262,24 +1262,26 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onEmoji(emoji) {
|
onEmoji(data) {
|
||||||
const msg_id = this.operateItem.id;
|
if (!$A.isJson(data)) {
|
||||||
|
data = {
|
||||||
|
msg_id: this.operateItem.id,
|
||||||
|
symbol: data,
|
||||||
|
}
|
||||||
|
}
|
||||||
this.$store.dispatch("setLoad", {
|
this.$store.dispatch("setLoad", {
|
||||||
key: `msg-${msg_id}`,
|
key: `msg-${data.msg_id}`,
|
||||||
delay: 600
|
delay: 600
|
||||||
})
|
})
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'dialog/msg/emoji',
|
url: 'dialog/msg/emoji',
|
||||||
data: {
|
data,
|
||||||
msg_id,
|
|
||||||
emoji,
|
|
||||||
},
|
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
this.$store.dispatch("saveDialogMsg", data);
|
this.$store.dispatch("saveDialogMsg", data);
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.messageError(msg);
|
$A.messageError(msg);
|
||||||
}).finally(_ => {
|
}).finally(_ => {
|
||||||
this.$store.dispatch("cancelLoad", `msg-${msg_id}`)
|
this.$store.dispatch("cancelLoad", `msg-${data.msg_id}`)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,7 +79,7 @@
|
|||||||
:class="{
|
:class="{
|
||||||
shear: shearIds.includes(item.id),
|
shear: shearIds.includes(item.id),
|
||||||
highlight: selectIds.includes(item.id),
|
highlight: selectIds.includes(item.id),
|
||||||
operation: contextMenuVisible && item.id === contextMenuItem.id,
|
operate: contextMenuVisible && item.id === contextMenuItem.id,
|
||||||
}"
|
}"
|
||||||
:data-id="item.id"
|
:data-id="item.id"
|
||||||
v-longpress="handleLongpress"
|
v-longpress="handleLongpress"
|
||||||
|
|||||||
@ -44,7 +44,7 @@
|
|||||||
:class="{
|
:class="{
|
||||||
top: dialog.top_at,
|
top: dialog.top_at,
|
||||||
active: dialog.id == dialogId,
|
active: dialog.id == dialogId,
|
||||||
operate: dialog.id == operateItem.id && operateVisible,
|
operate: operateVisible && dialog.id == operateItem.id,
|
||||||
completed: $A.dialogCompleted(dialog)
|
completed: $A.dialogCompleted(dialog)
|
||||||
}"
|
}"
|
||||||
:data-id="dialog.id"
|
:data-id="dialog.id"
|
||||||
@ -72,7 +72,10 @@
|
|||||||
<div v-if="dialog.last_msg.userid == userId" class="last-self">{{$L('你')}}</div>
|
<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/>
|
<UserAvatar v-else :userid="dialog.last_msg.userid" :show-name="true" :show-icon="false" tooltip-disabled/>
|
||||||
</template>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
<Badge class="dialog-num" :count="$A.getDialogUnread(dialog)"/>
|
<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) {
|
formatMsgDesc(data) {
|
||||||
return msgSimpleDesc(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)) {
|
} else if ($A.isJson(data)) {
|
||||||
const index = state.dialogMsgs.findIndex(({id}) => id == data.id);
|
const index = state.dialogMsgs.findIndex(({id}) => id == data.id);
|
||||||
|
data = Object.assign({}, state.dialogMsgs[index], data)
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
state.dialogMsgs.splice(index, 1, Object.assign({}, state.dialogMsgs[index], data));
|
state.dialogMsgs.splice(index, 1, data);
|
||||||
} else {
|
} else {
|
||||||
state.dialogMsgs.push(data);
|
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;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 48px;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
z-index: 4;
|
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 {
|
&.highlight {
|
||||||
background-color: #f4f5f7;
|
background-color: #f4f5f7;
|
||||||
}
|
}
|
||||||
&.operation,
|
&.operate,
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: #f4f5f7;
|
background-color: #f4f5f7;
|
||||||
.file-menu,
|
.file-menu,
|
||||||
@ -697,7 +697,7 @@
|
|||||||
&:hover {
|
&:hover {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
&.operation {
|
&.operate {
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: #f4f5f7;
|
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 {
|
.last-text {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
white-space: nowrap;
|
display: flex;
|
||||||
overflow: hidden;
|
align-items: center;
|
||||||
text-overflow: ellipsis;
|
> 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