mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 19:35:50 +00:00
Merge commit 'd12c0c42072452de4c99ef55c5915edb108dd2ef' into pro
This commit is contained in:
commit
34159caf22
@ -2175,12 +2175,12 @@ class DialogController extends AbstractController
|
||||
$dialog_id = intval(Request::input('dialog_id'));
|
||||
$uuid = trim(Request::input('uuid'));
|
||||
$text = trim(Request::input('text'));
|
||||
$list = Request::input('list');
|
||||
$list = Request::input('list') ?? [];
|
||||
//
|
||||
WebSocketDialog::checkDialog($dialog_id);
|
||||
$strlen = mb_strlen($text);
|
||||
$noimglen = mb_strlen(preg_replace("/<img[^>]*?>/i", "", $text));
|
||||
if ($strlen < 1) {
|
||||
if ($strlen < 1 || empty($list)) {
|
||||
return Base::retError('内容不能为空');
|
||||
}
|
||||
if ($noimglen > 200000) {
|
||||
@ -2195,17 +2195,28 @@ class DialogController extends AbstractController
|
||||
->orderByDesc('created_at')
|
||||
->where('msg', 'like', "%$uuid%")
|
||||
->value('msg');
|
||||
$list = array_reverse(array_merge($dialogMsg['list'] ?? [], $list));
|
||||
$list = array_reduce($list, function ($result, $item) {
|
||||
$fieldValue = $item['id']; // 指定字段名
|
||||
if (!isset($result[$fieldValue])) {
|
||||
$result[$fieldValue] = $item;
|
||||
// 新增
|
||||
$msgList = $dialogMsg['list'] ?? [];
|
||||
$addList = array_udiff($list, $msgList, function($a, $b) {
|
||||
return ($a['id'] ?? 0) - $b['id'];
|
||||
});
|
||||
foreach ($addList as $key => $item) {
|
||||
$item['id'] = intval(round(microtime(true) * 1000)) + $key;
|
||||
$msgList[] = $item;
|
||||
}
|
||||
// 编辑更新
|
||||
$lists = array_column($list,null,'id');
|
||||
foreach ($msgList as $key => $item) {
|
||||
if (isset($lists[$item['id']]) && $item['userid'] == $user->userid) {
|
||||
$msgList[$key] = $lists[$item['id']];
|
||||
}
|
||||
return $result;
|
||||
}, []);
|
||||
$list = array_reverse(array_values($list));
|
||||
}
|
||||
$list = $msgList;
|
||||
} else {
|
||||
$uuid = Base::generatePassword(36);
|
||||
foreach ($list as $key => $item) {
|
||||
$list[$key]['id'] = intval(round(microtime(true) * 1000)) + $key;
|
||||
}
|
||||
}
|
||||
//
|
||||
usort($list, function ($a, $b) {
|
||||
|
||||
@ -1552,3 +1552,7 @@ License Key
|
||||
月前
|
||||
请输入用户名
|
||||
是否拨打电话给(*)?
|
||||
|
||||
你确定要取消发送吗?
|
||||
消息已发送,不可取消
|
||||
取消发送失败
|
||||
|
||||
@ -76,12 +76,12 @@
|
||||
<!--接龙-->
|
||||
<div v-else-if="msgData.type === 'word-chain'" class="content-text content-word-chain no-dark-content">
|
||||
<pre v-html="$A.formatTextMsg(msgData.msg.text, userId)"></pre>
|
||||
<ul>
|
||||
<ul :class="{'expand': unfoldWordChainData.indexOf(msgData.id) !== -1 }">
|
||||
<li v-for="(item) in (msgData.msg.list || []).filter(h=>h.type == 'case')">
|
||||
{{ $L('例') }} {{ item.text }}
|
||||
</li>
|
||||
<li v-for="(item,index) in (msgData.msg.list || []).filter(h=>h.type != 'case')">
|
||||
<span class="expand" v-if="index == 2 && msgData.msg.list.length > 4" @click="unfoldWordChain">
|
||||
<span class="expand" v-if="index == 2 && msgData.msg.list.length > 4" @click="unfoldWordChain(msgData)">
|
||||
...{{$L('展开')}}...
|
||||
</span>
|
||||
<span :class="{'shrink': index >= 2 && msgData.msg.list.length > 4 } ">
|
||||
@ -325,7 +325,8 @@ export default {
|
||||
|
||||
emojiUsersNum: 5,
|
||||
|
||||
voteData: {}
|
||||
voteData: {},
|
||||
unfoldWordChainData: []
|
||||
}
|
||||
},
|
||||
|
||||
@ -334,6 +335,9 @@ export default {
|
||||
if (Object.keys(this.voteData).length === 0) {
|
||||
this.voteData = JSON.parse(window.localStorage.getItem(`__cache:vote__`)) || {};
|
||||
}
|
||||
if (this.unfoldWordChainData.length === 0) {
|
||||
this.unfoldWordChainData = JSON.parse(window.localStorage.getItem(`__cache:unfoldWordChain__`)) || [];
|
||||
}
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
@ -640,8 +644,13 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
unfoldWordChain(e) {
|
||||
e.target.parentNode?.parentNode?.classList.add('expand')
|
||||
unfoldWordChain(msg) {
|
||||
if (this.unfoldWordChainData.indexOf(msg.id) == -1) {
|
||||
const data = JSON.parse(window.localStorage.getItem('__cache:unfoldWordChain__')) || [];
|
||||
data.push(msg.id);
|
||||
window.localStorage.setItem('__cache:unfoldWordChain__', JSON.stringify(data));
|
||||
this.unfoldWordChainData.push(msg.id);
|
||||
}
|
||||
},
|
||||
|
||||
onVote(type, msgData) {
|
||||
|
||||
@ -1210,6 +1210,7 @@ export default {
|
||||
this.$store.dispatch('closeDialog', old_id)
|
||||
//
|
||||
window.localStorage.removeItem('__cache:vote__')
|
||||
window.localStorage.removeItem('__cache:unfoldWordChain__')
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
@ -2869,7 +2870,7 @@ export default {
|
||||
this.forgetTempMsg(this.operateItem.id)
|
||||
resolve();
|
||||
} else {
|
||||
reject("取消失败");
|
||||
reject("取消发送失败");
|
||||
}
|
||||
} else {
|
||||
// 取消消息发送
|
||||
@ -2877,7 +2878,7 @@ export default {
|
||||
this.forgetTempMsg(this.operateItem.id)
|
||||
resolve();
|
||||
}).catch(() => {
|
||||
reject("取消失败");
|
||||
reject("取消发送失败");
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user