Merge branch 'feature-nxdev' of https://gitea.nxsir.cn/code/IM into feature-nxdev
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
VITE_API_BASE_URL = http://localhost:5202/api
|
||||
VITE_API_BASE_URL = http://192.168.5.116:7070/api
|
||||
@@ -11,12 +11,19 @@ const routes = [
|
||||
{
|
||||
path: '/',
|
||||
component: MainView,
|
||||
|
||||
children: [
|
||||
{
|
||||
path: '/messages',
|
||||
name: 'userMessages',
|
||||
component: () => import('@/views/messages/MessageList.vue'),
|
||||
redirect: '/messages/index',
|
||||
children: [
|
||||
{
|
||||
path: '/messages/index',
|
||||
name: 'msgDefault',
|
||||
component: () => import('@/views/messages/MessageDefault.vue')
|
||||
},
|
||||
{
|
||||
path: '/messages/chat/:id',
|
||||
name: '/msgChat',
|
||||
|
||||
@@ -47,8 +47,12 @@ api.interceptors.response.use(
|
||||
message.error('请求错误,请检查网络。');
|
||||
break;
|
||||
}
|
||||
return Promise.reject(err);
|
||||
} else {
|
||||
message.error('请求错误,请检查网络。');
|
||||
return Promise.reject(err);
|
||||
}
|
||||
return Promise.reject(err);
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { request } from "./api";
|
||||
|
||||
export const messageService = {
|
||||
/**
|
||||
* 获取当前用户会话
|
||||
* @returns
|
||||
*/
|
||||
getConversations: () => request.get('/conversation/list'),
|
||||
|
||||
/**
|
||||
* 清空所有会话消息
|
||||
* @returns
|
||||
*/
|
||||
clearConversation: () => request.post('')
|
||||
}
|
||||
@@ -96,7 +96,7 @@ const handleLogin = async () => {
|
||||
if(res.code === 0){ // Assuming 0 is success
|
||||
message.success('登录成功')
|
||||
authStore.setLoginInfo(res.data.token, res.data.refreshToken, res.data.userInfo);
|
||||
router.push('/')
|
||||
router.push('/messages')
|
||||
}else{
|
||||
message.error(res.message || '登录失败')
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<div class="empty-container">
|
||||
<div class="empty-content">
|
||||
<div class="empty-icon">
|
||||
<svg viewBox="0 0 100 100" width="100" height="100">
|
||||
<circle cx="50" cy="50" r="48" fill="none" stroke="#e2e2e2" stroke-width="2" />
|
||||
<path d="M30 40 Q30 30 45 30 L65 30 Q75 30 75 40 L75 55 Q75 65 60 65 L45 80 L45 65 L35 65 Q30 65 30 55 Z"
|
||||
fill="#f0f0f0" stroke="#dcdcdc" stroke-width="2" />
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="empty-title">未选中会话</h2>
|
||||
<p class="empty-tips">请从左侧列表中选择一个联系人开始聊天</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.empty-container {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
background-color: #f5f5f5; /* 与聊天列表右侧背景保持一致 */
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.empty-content {
|
||||
text-align: center;
|
||||
/* 稍微上移一点,视觉中心更平衡 */
|
||||
margin-top: -40px;
|
||||
}
|
||||
|
||||
.empty-icon {
|
||||
margin-bottom: 20px;
|
||||
opacity: 0.8;
|
||||
animation: fadeIn 0.8s ease-out;
|
||||
}
|
||||
|
||||
.empty-title {
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
font-weight: 400;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.empty-tips {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 入场动画,增加平滑感 */
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(10px); }
|
||||
to { opacity: 0.8; transform: translateY(0); }
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user