Compare commits
2 Commits
f7772a9c5a
...
8d952578de
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d952578de | |||
| cf8be0bff5 |
@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("IMTest")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+feed24f378d1e3d6f4eca7b49b01cbef3ffdcc85")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f7772a9c5a6c1a00fd55a667dd7644fe3debe9d7")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("IMTest")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("IMTest")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@ -1 +1 @@
|
||||
6f30046e587a1bf70b948bab6bfef3eb4d2a9b1095912b0ebe81c7bfad90e72f
|
||||
c6e01bb72d85599aa024524b725bc3ddb7e3c1cc42c37b8b46561df20748cbf5
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net8.0
|
||||
build_property.TargetFrameworkIdentifier = .NETCoreApp
|
||||
build_property.TargetFrameworkVersion = v8.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
@ -10,7 +8,7 @@ build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = IMTest
|
||||
build_property.ProjectDir = /home/nanxun/Documents/Project/IM/backend/IMTest/
|
||||
build_property.ProjectDir = C:\Users\nanxun\Documents\IM\backend\IMTest\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
build_property.EffectiveAnalysisLevelStyle = 8.0
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
// <auto-generated/>
|
||||
global using System;
|
||||
global using System.Collections.Generic;
|
||||
global using System.IO;
|
||||
global using System.Linq;
|
||||
global using System.Net.Http;
|
||||
global using System.Threading;
|
||||
global using System.Threading.Tasks;
|
||||
global using Xunit;
|
||||
global using global::System;
|
||||
global using global::System.Collections.Generic;
|
||||
global using global::System.IO;
|
||||
global using global::System.Linq;
|
||||
global using global::System.Net.Http;
|
||||
global using global::System.Threading;
|
||||
global using global::System.Threading.Tasks;
|
||||
global using global::Xunit;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -15,7 +15,7 @@ namespace IM_API.Application.EventHandlers.GroupInviteActionUpdateHandler
|
||||
public async Task Consume(ConsumeContext<GroupInviteActionUpdateEvent> context)
|
||||
{
|
||||
var @event = context.Message;
|
||||
if(@event.Action == Models.GroupRequestState.Passed)
|
||||
if(@event.Action == Models.GroupRequestState.TargetPassed)
|
||||
{
|
||||
await _groupService.MakeGroupRequestAsync(@event.UserId, @event.InviteUserId,@event.GroupId);
|
||||
}
|
||||
|
||||
@ -21,6 +21,10 @@
|
||||
/// <summary>
|
||||
/// 对方拒绝
|
||||
/// </summary>
|
||||
TargetDeclined = 4
|
||||
TargetDeclined = 4,
|
||||
/// <summary>
|
||||
/// 对方同意
|
||||
/// </summary>
|
||||
TargetPassed = 5
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ namespace IM_API.Services
|
||||
var inviteInfo = await _context.GroupRequests
|
||||
.FirstOrDefaultAsync(x => x.UserId == userid && x.StateEnum == GroupRequestState.TargetPending)
|
||||
?? throw new BaseException(CodeDefine.INVALID_ACTION);
|
||||
if (!(dto.Action == GroupRequestState.TargetPending ||
|
||||
if (!(dto.Action == GroupRequestState.TargetPassed ||
|
||||
dto.Action == GroupRequestState.TargetDeclined))
|
||||
return;
|
||||
inviteInfo.StateEnum = dto.Action;
|
||||
|
||||
@ -10,6 +10,9 @@ pluginManagement {
|
||||
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
||||
|
||||
repositories {
|
||||
// 👇 添加这一行,用于下载 Flutter 插件相关的依赖
|
||||
maven { url = uri("https://storage.flutter-io.cn/download.flutter.io") }
|
||||
|
||||
maven { url = uri("https://maven.aliyun.com/repository/google") }
|
||||
maven { url = uri("https://maven.aliyun.com/repository/public") }
|
||||
gradlePluginPortal()
|
||||
@ -21,6 +24,9 @@ pluginManagement {
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
||||
repositories {
|
||||
// 👇 添加这一行,这是解决你报错的核心!强制项目从这里下载 Flutter 引擎
|
||||
maven { url = uri("https://storage.flutter-io.cn/download.flutter.io") }
|
||||
|
||||
maven { url = uri("https://maven.aliyun.com/repository/google") }
|
||||
maven { url = uri("https://maven.aliyun.com/repository/public") }
|
||||
gradlePluginPortal()
|
||||
@ -31,8 +37,10 @@ dependencyResolutionManagement {
|
||||
|
||||
plugins {
|
||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||
id("com.android.application") version "8.1.1" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.8.22" apply false
|
||||
// 👇 升级到 8.2.1 修复 Java 21 兼容性 bug
|
||||
id("com.android.application") version "8.2.1" apply false
|
||||
// 👇 顺便把 Kotlin 版本也稍微升一下,避免后续出现旧版本警告
|
||||
id("org.jetbrains.kotlin.android") version "1.9.22" apply false
|
||||
}
|
||||
|
||||
include(":app")
|
||||
9
frontend/app/lib/core/network/auth_interceptor.dart
Normal file
9
frontend/app/lib/core/network/auth_interceptor.dart
Normal file
@ -0,0 +1,9 @@
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
class AuthInterceptor extends Interceptor{
|
||||
@override
|
||||
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
|
||||
// TODO: implement onRequest
|
||||
super.onRequest(options, handler);
|
||||
}
|
||||
}
|
||||
21
frontend/app/lib/core/network/request.dart
Normal file
21
frontend/app/lib/core/network/request.dart
Normal file
@ -0,0 +1,21 @@
|
||||
import 'package:app/core/network/auth_interceptor.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
class Request {
|
||||
static final Request _instance = Request._internal();
|
||||
factory Request() => _instance;
|
||||
|
||||
late Dio dio;
|
||||
|
||||
Request._internal(){
|
||||
BaseOptions options = BaseOptions(
|
||||
baseUrl: "",
|
||||
responseType: ResponseType.json,
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
);
|
||||
dio = Dio(options);
|
||||
dio.interceptors.addAll([
|
||||
AuthInterceptor()
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
|
||||
|
||||
import 'package:app/features/auth/pages/login_page.dart';
|
||||
import 'package:app/features/auth/pages/register_page.dart';
|
||||
import 'package:app/features/home/pages/index_page.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
@ -10,6 +11,7 @@ final appRouter = GoRouter(
|
||||
initialLocation: '/auth/login',
|
||||
routes: [
|
||||
GoRoute(path: '/auth/login', builder: (context, state) => const LoginPage()),
|
||||
GoRoute(path: '/auth/register', builder: (context, state) => const RegisterPage()),
|
||||
ShellRoute(
|
||||
builder: (context, state, child) {
|
||||
return MainPage(child: child);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:app/core/constants/app_colors.dart';
|
||||
import 'package:app/features/auth/pages/login_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:app/core/router/app_router.dart';
|
||||
|
||||
class LoginPageState extends State<LoginPage> {
|
||||
@override
|
||||
@ -11,10 +12,10 @@ class LoginPageState extends State<LoginPage> {
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text("找回密码", style: TextStyle(color: Colors.grey)),
|
||||
),
|
||||
// TextButton(
|
||||
// onPressed: () {},
|
||||
// child: const Text("找回密码", style: TextStyle(color: Colors.grey)),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
@ -24,23 +25,9 @@ class LoginPageState extends State<LoginPage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
// 1. 品牌Logo/头像区域
|
||||
Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primaryColor.withOpacity(0.1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.person_rounded,
|
||||
size: 60,
|
||||
color: AppColors.primaryColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const Text(
|
||||
"登录您的聊天账号",
|
||||
"登陆账号",
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
@ -109,7 +96,9 @@ class LoginPageState extends State<LoginPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
appRouter.push("/auth/register");
|
||||
},
|
||||
child: const Text(
|
||||
"注册账号",
|
||||
style: TextStyle(color: Color(0xFF576B95)),
|
||||
@ -126,6 +115,13 @@ class LoginPageState extends State<LoginPage> {
|
||||
style: TextStyle(color: Color(0xFF576B95)),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text(
|
||||
"找回密码",
|
||||
style: TextStyle(color: Color(0xFF576B95)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
156
frontend/app/lib/features/auth/bloc/register_page_state.dart
Normal file
156
frontend/app/lib/features/auth/bloc/register_page_state.dart
Normal file
@ -0,0 +1,156 @@
|
||||
import 'package:app/features/auth/pages/register_page.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/constants/app_colors.dart';
|
||||
|
||||
class RegisterPageState extends State<RegisterPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: implement build
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
actions: [
|
||||
// TextButton(
|
||||
// onPressed: () {},
|
||||
// child: const Text("找回密码", style: TextStyle(color: Colors.grey)),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
const SizedBox(height: 24),
|
||||
const Text(
|
||||
"注册账号",
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 60),
|
||||
|
||||
// 2. 账号输入框 (极简下划线风格)
|
||||
TextField(
|
||||
decoration: InputDecoration(
|
||||
labelText: "用户名",
|
||||
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14),
|
||||
floatingLabelStyle: const TextStyle(color: AppColors.primaryColor),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey.shade300),
|
||||
),
|
||||
focusedBorder: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: AppColors.primaryColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
|
||||
// 3. 密码输入框
|
||||
TextField(
|
||||
obscureText: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: "请输入密码",
|
||||
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14),
|
||||
floatingLabelStyle: const TextStyle(color: AppColors.primaryColor),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey.shade300),
|
||||
),
|
||||
focusedBorder: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: AppColors.primaryColor, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 60),
|
||||
|
||||
// 4. 登录按钮 (圆润大按钮)
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 50,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primaryColor,
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
"注 册",
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// 5. 注册/切换登录方式
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text(
|
||||
"已有账号?点我登录",
|
||||
style: TextStyle(color: Color(0xFF576B95)),
|
||||
), // 经典的链接蓝
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
child: VerticalDivider(color: Colors.grey),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text(
|
||||
"找回密码",
|
||||
style: TextStyle(color: Color(0xFF576B95)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 80),
|
||||
// 6. 底部协议 (社交App必有)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Checkbox(
|
||||
value: true,
|
||||
activeColor: AppColors.primaryColor,
|
||||
onChanged: (v) {},
|
||||
),
|
||||
const Text(
|
||||
"我已阅读并同意",
|
||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||
),
|
||||
const Text(
|
||||
"《用户协议》",
|
||||
style: TextStyle(color: Color(0xFF576B95), fontSize: 12),
|
||||
),
|
||||
const Text(
|
||||
"与",
|
||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||
),
|
||||
const Text(
|
||||
"《隐私政策》",
|
||||
style: TextStyle(color: Color(0xFF576B95), fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
12
frontend/app/lib/features/auth/pages/register_page.dart
Normal file
12
frontend/app/lib/features/auth/pages/register_page.dart
Normal file
@ -0,0 +1,12 @@
|
||||
import 'package:app/features/auth/bloc/register_page_state.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class RegisterPage extends StatefulWidget {
|
||||
const RegisterPage({super.key});
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
// TODO: implement createState
|
||||
return RegisterPageState();
|
||||
}
|
||||
|
||||
}
|
||||
@ -5,16 +5,16 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
|
||||
url: "https://pub.dev"
|
||||
sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.13.0"
|
||||
version: "2.13.1"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: boolean_selector
|
||||
sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
characters:
|
||||
@ -22,7 +22,7 @@ packages:
|
||||
description:
|
||||
name: characters
|
||||
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.4.1"
|
||||
clock:
|
||||
@ -30,7 +30,7 @@ packages:
|
||||
description:
|
||||
name: clock
|
||||
sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
collection:
|
||||
@ -38,23 +38,39 @@ packages:
|
||||
description:
|
||||
name: collection
|
||||
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.19.1"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: cupertino_icons
|
||||
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
|
||||
url: "https://pub.dev"
|
||||
sha256: "41e005c33bd814be4d3096aff55b1908d419fde52ca656c8c47719ec745873cd"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.0.8"
|
||||
version: "1.0.9"
|
||||
dio:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: dio
|
||||
sha256: aff32c08f92787a557dd5c0145ac91536481831a01b4648136373cddb0e64f8c
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "5.9.2"
|
||||
dio_web_adapter:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dio_web_adapter
|
||||
sha256: "2f9e64323a7c3c7ef69567d5c800424a11f8337b8b228bad02524c9fb3c1f340"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.3.3"
|
||||
flutter:
|
||||
@ -67,7 +83,7 @@ packages:
|
||||
description:
|
||||
name: flutter_lints
|
||||
sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "6.0.0"
|
||||
flutter_test:
|
||||
@ -85,15 +101,23 @@ packages:
|
||||
description:
|
||||
name: go_router
|
||||
sha256: "7974313e217a7771557add6ff2238acb63f635317c35fa590d348fb238f00896"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "17.1.0"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_parser
|
||||
sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "4.1.2"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker
|
||||
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "11.0.2"
|
||||
leak_tracker_flutter_testing:
|
||||
@ -101,7 +125,7 @@ packages:
|
||||
description:
|
||||
name: leak_tracker_flutter_testing
|
||||
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.10"
|
||||
leak_tracker_testing:
|
||||
@ -109,7 +133,7 @@ packages:
|
||||
description:
|
||||
name: leak_tracker_testing
|
||||
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
lints:
|
||||
@ -117,7 +141,7 @@ packages:
|
||||
description:
|
||||
name: lints
|
||||
sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "6.1.0"
|
||||
logging:
|
||||
@ -125,7 +149,7 @@ packages:
|
||||
description:
|
||||
name: logging
|
||||
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
matcher:
|
||||
@ -133,7 +157,7 @@ packages:
|
||||
description:
|
||||
name: matcher
|
||||
sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.12.18"
|
||||
material_color_utilities:
|
||||
@ -141,7 +165,7 @@ packages:
|
||||
description:
|
||||
name: material_color_utilities
|
||||
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.13.0"
|
||||
meta:
|
||||
@ -149,15 +173,23 @@ packages:
|
||||
description:
|
||||
name: meta
|
||||
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.17.0"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: mime
|
||||
sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
sky_engine:
|
||||
@ -170,7 +202,7 @@ packages:
|
||||
description:
|
||||
name: source_span
|
||||
sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.10.2"
|
||||
stack_trace:
|
||||
@ -178,7 +210,7 @@ packages:
|
||||
description:
|
||||
name: stack_trace
|
||||
sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.12.1"
|
||||
stream_channel:
|
||||
@ -186,7 +218,7 @@ packages:
|
||||
description:
|
||||
name: stream_channel
|
||||
sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
string_scanner:
|
||||
@ -194,7 +226,7 @@ packages:
|
||||
description:
|
||||
name: string_scanner
|
||||
sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.4.1"
|
||||
term_glyph:
|
||||
@ -202,7 +234,7 @@ packages:
|
||||
description:
|
||||
name: term_glyph
|
||||
sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.2.2"
|
||||
test_api:
|
||||
@ -210,15 +242,23 @@ packages:
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "19a78f63e83d3a61f00826d09bc2f60e191bf3504183c001262be6ac75589fb8"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.7.8"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
vm_service:
|
||||
@ -226,9 +266,17 @@ packages:
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
|
||||
url: "https://pub.dev"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "15.0.2"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web
|
||||
sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
sdks:
|
||||
dart: ">=3.10.4 <4.0.0"
|
||||
flutter: ">=3.35.0"
|
||||
|
||||
@ -38,6 +38,7 @@ dependencies:
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.8
|
||||
go_router: ^17.0.1
|
||||
dio: ^5.9.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
252
frontend/pc/IM/src/renderer/src/components/Dropdown.vue
Normal file
252
frontend/pc/IM/src/renderer/src/components/Dropdown.vue
Normal file
@ -0,0 +1,252 @@
|
||||
<template>
|
||||
<div class="v-ui-dropdown" ref="dropdownRef">
|
||||
<button
|
||||
type="button"
|
||||
class="v-ui-dropdown-toggle"
|
||||
:class="{ 'is-open': isOpen }"
|
||||
@click.stop="toggleDropdown"
|
||||
role="button"
|
||||
aria-haspopup="listbox"
|
||||
:aria-expanded="isOpen"
|
||||
:disabled="disable"
|
||||
>
|
||||
<span class="v-ui-selected-text">{{ selectedLabel }}</span>
|
||||
<span class="v-ui-arrow-icon" :class="{ 'v-ui-arrow-up': isOpen }">
|
||||
<svg viewBox="0 0 1024 1024" width="1em" height="1em">
|
||||
<path d="M831.872 340.864L512 652.672 192.128 340.864a31.936 31.936 0 0 0-45.248 0 32 32 0 0 0 0 45.248l342.144 333.76a31.936 31.936 0 0 0 45.248 0l342.144-333.76a32 32 0 0 0-45.248-45.248z" fill="currentColor"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<transition name="v-ui-dropdown-grow">
|
||||
<ul
|
||||
v-show="isOpen"
|
||||
class="v-ui-dropdown-menu"
|
||||
role="listbox"
|
||||
:aria-activedescendant="modelValue"
|
||||
>
|
||||
<li
|
||||
v-for="option in options"
|
||||
:key="option.value"
|
||||
class="v-ui-dropdown-item"
|
||||
:class="{ 'is-selected': option.value === modelValue }"
|
||||
@click.stop="selectOption(option)"
|
||||
role="option"
|
||||
:aria-selected="option.value === modelValue"
|
||||
>
|
||||
<span class="v-ui-item-label">{{ option.label }}</span>
|
||||
<span v-if="option.value === modelValue" class="v-ui-check-icon">
|
||||
<svg viewBox="0 0 1024 1024" width="1em" height="1em">
|
||||
<path d="M358.4 716.8l-204.8-204.8-51.2 51.2 256 256 512-512-51.2-51.2-460.8 460.8z" fill="currentColor"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||
|
||||
// 定义 Props (逻辑未变)
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
options: {
|
||||
type: Array,
|
||||
required: true,
|
||||
// 期望格式: [{ label: '选项一', value: 1 }, { label: '选项二', value: 2 }]
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '请选择...'
|
||||
},
|
||||
disable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
// 定义 Emits (支持 v-model, 逻辑未变)
|
||||
const emit = defineEmits(['update:modelValue', 'change'])
|
||||
|
||||
const isOpen = ref(false)
|
||||
const dropdownRef = ref(null)
|
||||
|
||||
// 计算当前选中的文本 (逻辑未变)
|
||||
const selectedLabel = computed(() => {
|
||||
const selected = props.options.find(opt => opt.value === props.modelValue)
|
||||
return selected ? selected.label : props.placeholder
|
||||
})
|
||||
|
||||
// 切换下拉菜单状态 (逻辑未变)
|
||||
const toggleDropdown = () => {
|
||||
isOpen.value = !isOpen.value
|
||||
}
|
||||
|
||||
// 选中选项 (逻辑未变)
|
||||
const selectOption = (option) => {
|
||||
emit('update:modelValue', option.value)
|
||||
emit('change', option)
|
||||
isOpen.value = false
|
||||
}
|
||||
|
||||
// 点击组件外部区域关闭菜单 (逻辑未变)
|
||||
const handleClickOutside = (event) => {
|
||||
if (dropdownRef.value && !dropdownRef.value.contains(event.target)) {
|
||||
isOpen.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 挂载和卸载全局点击事件监听 (逻辑未变)
|
||||
onMounted(() => {
|
||||
document.addEventListener('click', handleClickOutside)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
document.removeEventListener('click', handleClickOutside)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 使用加强型前缀和特异性选择器防止污染 */
|
||||
.v-ui-dropdown {
|
||||
position: relative; /* 强制相对定位 */
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
display: inline-block; /* 防止父容器布局冲突 */
|
||||
}
|
||||
|
||||
/* 针对 ul 和 li 进行强制 reset,防止全局样式干扰 */
|
||||
.v-ui-dropdown ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.v-ui-dropdown li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
/* 触发按钮:白底、靛蓝色边框的现代 Filled 风格 */
|
||||
.v-ui-dropdown-toggle {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding: 10px 16px;
|
||||
background-color: #007aff; /* 强制微灰底色,与纯白背景区分 */
|
||||
border: 1px solid #e4e4e7; /* 浅灰边框,避免融合 */
|
||||
border-radius: 12px;
|
||||
color: #000000; /* 极深灰 */
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.v-ui-dropdown-toggle:hover {
|
||||
background-color: #cacaff;
|
||||
border-color: #d1d5db;
|
||||
}
|
||||
|
||||
/* 展开状态下 */
|
||||
.v-ui-dropdown-toggle.is-open {
|
||||
background-color: #cacaff;
|
||||
border-color: #4f46e5; /* 靛蓝色主色 */
|
||||
box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); /* Focus 环 */
|
||||
}
|
||||
|
||||
.v-ui-selected-text {
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
margin-right: 10px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.v-ui-arrow-icon {
|
||||
display: flex;
|
||||
font-size: 12px;
|
||||
color: #000000;
|
||||
transition: transform 0.3s ease, color 0.2s ease;
|
||||
}
|
||||
|
||||
.v-ui-arrow-up {
|
||||
transform: rotate(180deg);
|
||||
color: #4f46e5;
|
||||
}
|
||||
|
||||
/* 下拉菜单:纯白底色,强化悬浮阴影 */
|
||||
.v-ui-dropdown .v-ui-dropdown-menu {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
margin-top: 8px;
|
||||
padding: 6px;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #e4e4e7;
|
||||
border-radius: 12px;
|
||||
/* 强阴影是白色背景上脱颖而出的秘诀 */
|
||||
box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.12), 0 4px 12px -4px rgba(0, 0, 0, 0.08);
|
||||
z-index: 1000; /* 确保在最上层 */
|
||||
max-height: 240px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
/* 菜单项样式 */
|
||||
.v-ui-dropdown-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 12px;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
color: #18181b;
|
||||
transition: all 0.2s ease;
|
||||
margin-bottom: 2px; /* Item 呼吸感 */
|
||||
}
|
||||
|
||||
.v-ui-dropdown-item:hover {
|
||||
background-color: #f4f4f5;
|
||||
}
|
||||
|
||||
/* 选中项的样式 */
|
||||
.v-ui-dropdown-item.is-selected {
|
||||
background-color: #eef2ff; /* 极淡的靛蓝色 */
|
||||
color: #4f46e5;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.v-ui-item-label {
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.v-ui-check-icon {
|
||||
display: flex;
|
||||
font-size: 14px;
|
||||
color: #4f46e5;
|
||||
}
|
||||
|
||||
/* 过渡动画 */
|
||||
.v-ui-dropdown-grow-enter-active,
|
||||
.v-ui-dropdown-grow-leave-active {
|
||||
transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.2, 0, 0, 1);
|
||||
transform-origin: top center;
|
||||
}
|
||||
|
||||
.v-ui-dropdown-grow-enter-from,
|
||||
.v-ui-dropdown-grow-leave-to {
|
||||
opacity: 0;
|
||||
transform: scaleY(0.95) translateY(-8px);
|
||||
}
|
||||
</style>
|
||||
@ -4,6 +4,7 @@ import { friendService } from '../../services/friend';
|
||||
import { groupService } from '@/services/group';
|
||||
import { SYSTEM_BASE_STATUS } from '@/constants/systemBaseStatus';
|
||||
import { useMessage } from '../messages/useAlert';
|
||||
import AsyncImage from '../AsyncImage.vue';
|
||||
|
||||
const message = useMessage();
|
||||
|
||||
@ -62,7 +63,7 @@ onMounted(async () =>{
|
||||
|
||||
<div class="list">
|
||||
<div v-for="f in friends" :key="f.friendId" @click="toggle(f.friendId)" class="item">
|
||||
<img :src="f.userInfo.avatar" class="avatar" />
|
||||
<AsyncImage :raw-url="f.userInfo.avatar" class="avatar" />
|
||||
<span class="name">{{ f.remarkName }}</span>
|
||||
<input type="checkbox" :checked="selected.has(f.friendId)" />
|
||||
</div>
|
||||
@ -111,7 +112,7 @@ main { padding: 12px; }
|
||||
}
|
||||
.item:hover { background: #f5f5f5; }
|
||||
|
||||
.avatar { width: 32px; height: 32px; border-radius: 4px; margin-right: 10px; }
|
||||
:deep(.avatar) { width: 32px; height: 32px; border-radius: 4px; margin-right: 10px; }
|
||||
.name { flex: 1; font-size: 14px; }
|
||||
|
||||
footer { padding: 12px; }
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
class="member-item"
|
||||
>
|
||||
<div class="member-avatar-box">
|
||||
<img :src="member.avatar" class="member-img" />
|
||||
<async-image :raw-url="member.avatar" class="member-img"/>
|
||||
<span v-if="member.role === GROUP_MEMBER_ROLE.ADMIN || member.role === GROUP_MEMBER_ROLE.MASTER" class="role-badge"></span>
|
||||
</div>
|
||||
<span class="member-nick">{{ member.nickname }}</span>
|
||||
@ -85,6 +85,7 @@ import { SYSTEM_BASE_STATUS } from '../../constants/systemBaseStatus';
|
||||
import { useMessage } from './useAlert';
|
||||
import { getFileHash } from '../../utils/uploadTools';
|
||||
import CreateGroup from '../groups/CreateGroup.vue';
|
||||
import AsyncImage from '../AsyncImage.vue';
|
||||
|
||||
const props = defineProps({
|
||||
chatType: {
|
||||
@ -339,7 +340,7 @@ onMounted(async () => {
|
||||
height: 48px;
|
||||
}
|
||||
|
||||
.member-img {
|
||||
:deep(.member-img) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 12px;
|
||||
|
||||
@ -18,7 +18,12 @@ export const GROUP_REQUEST_STATUS = Object.freeze({
|
||||
TARGET_PENDING: 'TargetPending',
|
||||
/** 对方拒绝 */
|
||||
TARGET_DECLINED: 'TargetDeclined'
|
||||
});
|
||||
})
|
||||
|
||||
export const GROUP_REQUEST_ACTION = Object.freeze({
|
||||
ACCEPT: 'Accept',
|
||||
REJECT: 'Reject'
|
||||
})
|
||||
|
||||
|
||||
export const getGroupRequestStatusTxt = (status) => {
|
||||
@ -36,4 +41,5 @@ export const getGroupRequestStatusTxt = (status) => {
|
||||
default:
|
||||
return '未知状态';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -42,5 +42,21 @@ export const groupService = {
|
||||
* 获取群聊通知
|
||||
* @returns
|
||||
*/
|
||||
getGroupNotification: () => request.get('/Group/GetGroupNotification')
|
||||
getGroupNotification: () => request.get('/Group/GetGroupNotification'),
|
||||
/**
|
||||
* 处理入群邀请
|
||||
* @param {*} inviteId
|
||||
* @param {*} action
|
||||
* @returns
|
||||
*/
|
||||
handleGroupInvite: (inviteId, action) =>
|
||||
request.post('/Group/HandleGroupInvite', { inviteId: inviteId, action: action }),
|
||||
/**
|
||||
* 处理入群请求
|
||||
* @param {*} requestId
|
||||
* @param {*} action
|
||||
* @returns
|
||||
*/
|
||||
handleGroupRequest: (requestId, action) =>
|
||||
request.post('/Group/HandleGroupRequest', { requestId: requestId, action: action })
|
||||
}
|
||||
|
||||
@ -50,7 +50,6 @@ export const useChatStore = defineStore('chat', {
|
||||
this.isEnded = false;
|
||||
//先从浏览器缓存加载一部分消息列表
|
||||
const localHistory = await messagesDb.getLatestMessages(sessionId, this.pageSize);
|
||||
console.log(localHistory)
|
||||
if (localHistory.length > 0) {
|
||||
this.messages = localHistory;
|
||||
this.maxSequenceId = this.messages.reduce((max, m) =>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<template>
|
||||
|
||||
<AsyncImage raw-url="http://192.168.5.116:7070/uploads/files/IM/2026/03/2/e6c407f60c68.jpg" :type="FILE_TYPE.Image"/>
|
||||
<!-- <AsyncImage raw-url="http://192.168.5.116:7070/uploads/files/IM/2026/03/2/e6c407f60c68.jpg" :type="FILE_TYPE.Image"/> -->
|
||||
<Dropdown :options="[{label:'测试1',value:'测试1'},{label:'测试2',value:'测试2'}]" placeholder="测试下拉框"/>
|
||||
<button @click="test">click</button>
|
||||
</template>
|
||||
|
||||
@ -9,6 +10,7 @@ import { ref } from 'vue';
|
||||
import { useCacheStore } from '../stores/cache';
|
||||
import { FILE_TYPE } from '../constants/fileTypeDefine';
|
||||
import AsyncImage from '../components/AsyncImage.vue';
|
||||
import Dropdown from '../components/Dropdown.vue';
|
||||
|
||||
|
||||
const url = ref('')
|
||||
|
||||
@ -9,30 +9,25 @@
|
||||
<div v-for="item in groupRequest" :key="item.requestId" class="minimal-item">
|
||||
|
||||
<div class="avatar-wrapper">
|
||||
<img
|
||||
:src="avatarHandle(item)"
|
||||
:class="[
|
||||
'avatar',
|
||||
item.type === GROUP_REQUEST_STATUS.IS_GROUP ||
|
||||
<img :src="avatarHandle(item)" :class="[
|
||||
'avatar',
|
||||
item.type === GROUP_REQUEST_STATUS.IS_GROUP ||
|
||||
item.type === GROUP_REQUEST_STATUS.IS_USER
|
||||
? 'is-group'
|
||||
: 'is-user'
|
||||
]"
|
||||
/>
|
||||
? 'is-group'
|
||||
: 'is-user'
|
||||
]" />
|
||||
</div>
|
||||
|
||||
<div class="info">
|
||||
<div class="title-row">
|
||||
<span class="name">{{ item.name }}</span>
|
||||
<span
|
||||
:class="[
|
||||
'type-tag',
|
||||
item.type === GROUP_REQUEST_TYPE.INVITE ||
|
||||
<span :class="[
|
||||
'type-tag',
|
||||
item.type === GROUP_REQUEST_TYPE.INVITE ||
|
||||
item.type === GROUP_REQUEST_TYPE.IS_USER
|
||||
? 'tag-orange'
|
||||
: 'tag-green'
|
||||
]"
|
||||
>
|
||||
? 'tag-orange'
|
||||
: 'tag-green'
|
||||
]">
|
||||
{{ getTypeText(item.type) }}
|
||||
</span>
|
||||
<span class="date">14:20</span>
|
||||
@ -42,25 +37,23 @@
|
||||
<span class="label">目标群聊:</span>
|
||||
<span class="group-name">{{ item.groupName }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="[GROUP_REQUEST_TYPE.INVITE, GROUP_REQUEST_TYPE.INVITED].includes(item.type)"
|
||||
class="group-info"
|
||||
>
|
||||
<div v-if="[GROUP_REQUEST_TYPE.INVITE, GROUP_REQUEST_TYPE.INVITED].includes(item.type)"
|
||||
class="group-info">
|
||||
<span class="label">目标用户:</span>
|
||||
<span class="group-name">{{
|
||||
myInfo.id === item.userId ? item.inviteUserNickname : item.nickName
|
||||
}}</span>
|
||||
}}</span>
|
||||
</div>
|
||||
|
||||
<p class="sub-text">入群描述:{{ item.description }}</p>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="![GROUP_REQUEST_TYPE.INVITE, GROUP_REQUEST_TYPE.IS_USER].includes(item.type)"
|
||||
class="actions"
|
||||
>
|
||||
<div v-if="[GROUP_REQUEST_TYPE.INVITED, GROUP_REQUEST_TYPE.IS_GROUP].includes(item.type)" class="actions">
|
||||
<button class="btn-text btn-reject">忽略</button>
|
||||
<button class="btn-text btn-accept">去处理</button>
|
||||
<Dropdown :disable="handleDropDownDisable" class="handleDropDown" v-model="handleValue" :options="[
|
||||
{ label: '同意', value: GROUP_REQUEST_ACTION.ACCEPT },
|
||||
{ label: '拒绝', value: GROUP_REQUEST_ACTION.REJECT }
|
||||
]" placeholder="处理" @change="groupRequestHandler(item, handleValue)" />
|
||||
</div>
|
||||
|
||||
<div class="actions" v-else>
|
||||
@ -78,18 +71,26 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, computed } from 'vue';
|
||||
import { onMounted, computed, ref, watch } from 'vue';
|
||||
import WindowControls from '../../components/WindowControls.vue';
|
||||
import { useGroupRequestStore } from '../../stores/groupRequest';
|
||||
import { useAuthStore } from '../../stores/auth';
|
||||
import { GROUP_REQUEST_TYPE, getTypeText } from '../../constants/groupRequestTypeDefine';
|
||||
import { GROUP_REQUEST_STATUS, getGroupRequestStatusTxt } from '../../constants/GroupDefine';
|
||||
import { GROUP_REQUEST_ACTION, GROUP_REQUEST_STATUS, getGroupRequestStatusTxt } from '../../constants/GroupDefine';
|
||||
import Dropdown from '../../components/Dropdown.vue';
|
||||
import { groupService } from '../../services/group';
|
||||
import { useMessage } from '../../components/messages/useAlert';
|
||||
import { SYSTEM_BASE_STATUS } from '../../constants/systemBaseStatus';
|
||||
|
||||
const groupRequestStore = useGroupRequestStore()
|
||||
const myInfo = useAuthStore().userInfo
|
||||
const handleValue = ref(null)
|
||||
const handleDropDownDisable = ref(false)
|
||||
const message = useMessage()
|
||||
|
||||
|
||||
const groupRequest = computed(() => {
|
||||
if(!groupRequestStore.groupRequest){
|
||||
if (!groupRequestStore.groupRequest) {
|
||||
return [];
|
||||
}
|
||||
return groupRequestStore.groupRequest.map((item) => {
|
||||
@ -109,7 +110,7 @@ const getGroupRequestStatusClass = (status) => {
|
||||
};
|
||||
|
||||
const avatarHandle = (request) => {
|
||||
switch(request.type){
|
||||
switch (request.type) {
|
||||
case GROUP_REQUEST_STATUS.IS_GROUP:
|
||||
case GROUP_REQUEST_STATUS.IS_USER:
|
||||
return request.groupAvatar;
|
||||
@ -154,6 +155,31 @@ const getRequestType = (request) => {
|
||||
}
|
||||
}
|
||||
|
||||
//入群请求处理
|
||||
const groupRequestHandler = async (request, action) => {
|
||||
if (!request || !request.type) return
|
||||
let requestAction = GROUP_REQUEST_STATUS.PASSED
|
||||
let result = null
|
||||
switch (request.type) {
|
||||
case GROUP_REQUEST_TYPE.INVITED:
|
||||
requestAction = action == GROUP_REQUEST_ACTION.ACCEPT ? GROUP_REQUEST_STATUS.TARGET_PENDING : GROUP_REQUEST_STATUS.TARGET_DECLINED;
|
||||
result = await groupService.handleGroupInvite(request.id ,requestAction)
|
||||
break
|
||||
case GROUP_REQUEST_TYPE.IS_GROUP:
|
||||
requestAction = action == GROUP_REQUEST_ACTION.ACCEPT ? GROUP_REQUEST_STATUS.PASSED : GROUP_REQUEST_STATUS.DECLINED;
|
||||
result = await groupService.handleGroupRequest(request.id, requestAction)
|
||||
break
|
||||
default:
|
||||
return
|
||||
}
|
||||
if(result.code == SYSTEM_BASE_STATUS.SUCCESS){
|
||||
message.success('操作成功')
|
||||
}else{
|
||||
message.error(result.message)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await groupRequestStore.loadGroupRequest()
|
||||
console.log(groupRequestStore.groupRequest)
|
||||
@ -390,4 +416,6 @@ onMounted(async () => {
|
||||
opacity: 0.8;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.handleDropDown {}
|
||||
</style>
|
||||
|
||||
@ -68,13 +68,12 @@ const currentContact = ref(null)
|
||||
function handleGoToChat() {
|
||||
if (currentContact.value) {
|
||||
const cid = conversationStore.conversations.find(x => x.targetId == currentContact.value.userInfo.id).id;
|
||||
console.log(cid)
|
||||
router.push(`/messages/chat/${cid}`);
|
||||
}
|
||||
}
|
||||
|
||||
onBeforeRouteUpdate(() => {
|
||||
currentContact.value = contactStore.contacts.find(x => x.id == props.id);
|
||||
onBeforeRouteUpdate((to, from) => {
|
||||
currentContact.value = contactStore.contacts.find(x => x.id == to.params.id);
|
||||
})
|
||||
onMounted(() => {
|
||||
currentContact.value = contactStore.contacts.find(x => x.id == props.id);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user