no message

This commit is contained in:
kuaifan 2021-06-06 16:15:45 +08:00
parent dd9dbd7b87
commit c9bcf6ac83
6 changed files with 39 additions and 6 deletions

View File

@ -4,8 +4,10 @@ namespace App\Models;
/** /**
* App\Models\WebSocket * Class WebSocket
* *
* @package App\Models
* @property int $id
* @property string $key * @property string $key
* @property string|null $fd * @property string|null $fd
* @property int|null $userid * @property int|null $userid
@ -16,6 +18,7 @@ namespace App\Models;
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket query() * @method static \Illuminate\Database\Eloquent\Builder|WebSocket query()
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereCreatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereFd($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereFd($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereKey($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereKey($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereUserid($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocket whereUserid($value)

View File

@ -151,9 +151,8 @@ class WebSocketService implements WebSocketHandlerInterface
*/ */
public function onClose(Server $server, $fd, $reactorId) public function onClose(Server $server, $fd, $reactorId)
{ {
Task::deliver(new LineTask($this->getUserid($fd), false)); // 通知离线
$this->deleteUser($fd); $this->deleteUser($fd);
// 通知离线
Task::deliver(new LineTask($this->getUserid($fd), false));
} }
/** ****************************************************************************** */ /** ****************************************************************************** */

View File

@ -78,7 +78,7 @@
}, },
userOnline(data) { userOnline(data) {
if (this.user && data[this.user.userid]) { if (this.user && typeof data[this.user.userid] !== "undefined") {
this.$set(this.user, 'online', data[this.user.userid]); this.$set(this.user, 'online', data[this.user.userid]);
} }
} }

View File

@ -37,6 +37,10 @@
<div class="messenger-msg"> <div class="messenger-msg">
<DialogWrapper v-if="dialogId > 0"/> <DialogWrapper v-if="dialogId > 0"/>
<div v-else class="dialog-no">
<div class="dialog-no-icon"><Icon type="ios-chatbubbles" /></div>
<div class="dialog-no-text">{{$L('选择一个会话开始聊天')}}</div>
</div>
</div> </div>
</div> </div>

View File

@ -69,7 +69,7 @@ export default {
/** /**
* 更新会员在线 * 更新会员在线
* @param state * @param state
* @param info * @param info {userid,online}
*/ */
setUserOnlineStatus(state, info) { setUserOnlineStatus(state, info) {
const {userid, online} = info; const {userid, online} = info;
@ -353,6 +353,10 @@ export default {
delete state.wsCall[msgId]; delete state.wsCall[msgId];
break break
case "line":
this.commit('setUserOnlineStatus', msgDetail.data);
break
default: default:
msgId && this.commit('wsSend', {type: 'receipt', msgId}); msgId && this.commit('wsSend', {type: 'receipt', msgId});
state.wsMsg = msgDetail; state.wsMsg = msgDetail;

View File

@ -1160,8 +1160,31 @@ body {
width: 0; width: 0;
height: 100%; height: 100%;
display: flex; display: flex;
.dialog-wrapper { .dialog-wrapper,
.dialog-no {
flex: 1; flex: 1;
} }
.dialog-no {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.dialog-no-icon {
background-color: #f4f5f7;
padding: 20px;
border-radius: 50%;
.ivu-icon {
color: #d1d8dd;
font-size: 46px;
}
}
.dialog-no-text {
margin-top: 16px;
color: #bec6cc;
background-color: #f4f5f7;
padding: 4px 15px;
border-radius: 14px;
}
}
} }
} }