diff --git a/backend/IM_API/Dtos/HandleFriendRequestDto.cs b/backend/IM_API/Dtos/HandleFriendRequestDto.cs new file mode 100644 index 0000000..637871d --- /dev/null +++ b/backend/IM_API/Dtos/HandleFriendRequestDto.cs @@ -0,0 +1,25 @@ +namespace IM_API.Dtos +{ + public class HandleFriendRequestDto + { + /// + /// 好友请求Id + /// + public int RequestId { get; set; } + /// + /// 处理操作 + /// + public HandleFriendRequestAction Action { get; set; } + } + public enum HandleFriendRequestAction + { + /// + /// 同意 + /// + Accept = 0, + /// + /// 拒绝 + /// + Reject = 1 + } +} diff --git a/backend/IM_API/Interface/Services/IFriendSerivce.cs b/backend/IM_API/Interface/Services/IFriendSerivce.cs index 2b5fc3a..4f0bfa2 100644 --- a/backend/IM_API/Interface/Services/IFriendSerivce.cs +++ b/backend/IM_API/Interface/Services/IFriendSerivce.cs @@ -28,5 +28,37 @@ namespace IM_API.Interface.Services /// /// Task GetFriendRequestListAsync(int userId,bool isReceived,int page,int limit); + /// + /// 处理好友请求 + /// + /// + /// + Task HandleFriendRequestAsync(HandleFriendRequestDto requestDto); + /// + /// 通过用户Id删除好友关系 + /// + /// 操作用户Id + /// 被删除用户ID + /// + Task DeleteFriendByUserIdAsync(int userId,int toUserId); + /// + /// 通过好友关系Id删除好友关系 + /// + /// 好友关系id + /// + Task DeleteFriendAsync(int friendId); + /// + /// 通过用户Id拉黑好友关系 + /// + /// 操作用户Id + /// 被拉黑用户ID + /// + Task BlockFriendByUserIdAsync(int userId, int toUserId); + /// + /// 通过好友关系Id拉黑好友关系 + /// + /// 好友关系id + /// + Task BlockeFriendAsync(int friendId); } } diff --git a/frontend/web/index.html b/frontend/web/index.html index b19040a..4c929da 100644 --- a/frontend/web/index.html +++ b/frontend/web/index.html @@ -3,6 +3,7 @@ + Vite App diff --git a/frontend/web/src/App.vue b/frontend/web/src/App.vue index af331b0..59f2b39 100644 --- a/frontend/web/src/App.vue +++ b/frontend/web/src/App.vue @@ -11,7 +11,7 @@ diff --git a/frontend/web/src/components/Layout.vue b/frontend/web/src/components/Layout.vue deleted file mode 100644 index c00ea60..0000000 --- a/frontend/web/src/components/Layout.vue +++ /dev/null @@ -1,262 +0,0 @@ - - - - - \ No newline at end of file diff --git a/frontend/web/src/components/Window.vue b/frontend/web/src/components/Window.vue new file mode 100644 index 0000000..874c1aa --- /dev/null +++ b/frontend/web/src/components/Window.vue @@ -0,0 +1,136 @@ + + + + + diff --git a/frontend/web/src/router/index.js b/frontend/web/src/router/index.js index 29e07eb..7fef57a 100644 --- a/frontend/web/src/router/index.js +++ b/frontend/web/src/router/index.js @@ -1,6 +1,11 @@ import { createRouter, createWebHistory } from 'vue-router' +import MainView from '@/views/Main.vue' -const routes = [{ path: '/auth/login', component: () => import('@/views/auth/Login.vue') }] +const routes = [ + { path: '/auth/login', component: () => import('@/views/auth/Login.vue') }, + { path: '/', component: MainView }, + { path: '/index', component: MainView }, +] const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), diff --git a/frontend/web/src/views/Main.vue b/frontend/web/src/views/Main.vue new file mode 100644 index 0000000..265a33b --- /dev/null +++ b/frontend/web/src/views/Main.vue @@ -0,0 +1,829 @@ + + + + + \ No newline at end of file diff --git a/frontend/web/src/views/auth/Login.vue b/frontend/web/src/views/auth/Login.vue index 7bd501e..f5667df 100644 --- a/frontend/web/src/views/auth/Login.vue +++ b/frontend/web/src/views/auth/Login.vue @@ -1,58 +1,76 @@ @@ -62,325 +80,185 @@ import { ref } from 'vue' const username = ref('') const password = ref('') +const remember = ref(false) const errorMsg = ref('') +const loading = ref(false) + +const usernameFocused = ref(false) +const passwordFocused = ref(false) const handleLogin = () => { - if (!username.value || !password.value) { + errorMsg.value = '' + if (!username.value.trim() || !password.value) { errorMsg.value = '用户名或密码不能为空' return } - - if (username.value === 'admin' && password.value === '123456') { - alert('登录成功!') - errorMsg.value = '' - // TODO: 跳转到IM主界面 - } else { - errorMsg.value = '用户名或密码错误' - } + loading.value = true + // 模拟登录延迟(客户端示例),生产中替换为 API 调用 + setTimeout(() => { + loading.value = false + if (username.value === 'admin' && password.value === '123456') { + errorMsg.value = '' + alert('登录成功!') + // TODO: 跳转到 IM 主界面 + } else { + errorMsg.value = '用户名或密码错误' + } + }, 700) } \ No newline at end of file +