feat: 增加邀请二维码
This commit is contained in:
parent
0659c46874
commit
abe49031ac
@ -8,4 +8,5 @@ class ApiPath {
|
|||||||
static const String changeTeam = "/v1/team/changeTeam";
|
static const String changeTeam = "/v1/team/changeTeam";
|
||||||
static const String bindTeamStarCloudAccount = "/v1/team/bindStarCloudAccount";
|
static const String bindTeamStarCloudAccount = "/v1/team/bindStarCloudAccount";
|
||||||
static const String updateTeamInfo = "/v1/team/updateTeam";
|
static const String updateTeamInfo = "/v1/team/updateTeam";
|
||||||
|
static const String getInviteInfo = "/v1/team/getInviteInfo";
|
||||||
}
|
}
|
||||||
|
|||||||
24
lib/api/model/team/request/invite_info_request.dart
Normal file
24
lib/api/model/team/request/invite_info_request.dart
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
class InviteInfoRequest {
|
||||||
|
String departNo;
|
||||||
|
|
||||||
|
InviteInfoRequest({
|
||||||
|
required this.departNo,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory InviteInfoRequest.fromJson(Map<String, dynamic> json) {
|
||||||
|
return InviteInfoRequest(
|
||||||
|
departNo: json['departNo'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'departNo': departNo,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'InviteInfoRequest{departNo: $departNo}';
|
||||||
|
}
|
||||||
|
}
|
||||||
44
lib/api/model/team/response/invite_info_response.dart
Normal file
44
lib/api/model/team/response/invite_info_response.dart
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
class InviteInfoResponse {
|
||||||
|
String? teamName;
|
||||||
|
String? teamNo;
|
||||||
|
String? teamCode;
|
||||||
|
int? inviteId;
|
||||||
|
String? inviteInfo;
|
||||||
|
String? qrCode;
|
||||||
|
|
||||||
|
InviteInfoResponse({
|
||||||
|
this.teamName,
|
||||||
|
this.teamNo,
|
||||||
|
this.teamCode,
|
||||||
|
this.inviteId,
|
||||||
|
this.inviteInfo,
|
||||||
|
this.qrCode,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory InviteInfoResponse.fromJson(Map<String, dynamic> json) {
|
||||||
|
return InviteInfoResponse(
|
||||||
|
teamName: json['teamName'] as String?,
|
||||||
|
teamNo: json['teamNo'] as String?,
|
||||||
|
teamCode: json['teamCode'] as String?,
|
||||||
|
inviteId: json['inviteId'] as int?,
|
||||||
|
inviteInfo: json['inviteInfo'] as String?,
|
||||||
|
qrCode: json['qrCode'] as String?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'teamName': teamName,
|
||||||
|
'teamNo': teamNo,
|
||||||
|
'teamCode': teamCode,
|
||||||
|
'inviteId': inviteId,
|
||||||
|
'inviteInfo': inviteInfo,
|
||||||
|
'qrCode': qrCode,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'InviteInfoResponse{teamName: $teamName, teamNo: $teamNo, teamCode: $teamCode, inviteId: $inviteId, inviteInfo: $inviteInfo, qrCode: $qrCode}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,9 +5,11 @@ import 'package:starwork_flutter/api/base_api_service.dart';
|
|||||||
import 'package:starwork_flutter/api/model/team/request/bind_team_star_cloud_account_request.dart';
|
import 'package:starwork_flutter/api/model/team/request/bind_team_star_cloud_account_request.dart';
|
||||||
import 'package:starwork_flutter/api/model/team/request/change_current_team_request.dart';
|
import 'package:starwork_flutter/api/model/team/request/change_current_team_request.dart';
|
||||||
import 'package:starwork_flutter/api/model/team/request/create_team_request.dart';
|
import 'package:starwork_flutter/api/model/team/request/create_team_request.dart';
|
||||||
|
import 'package:starwork_flutter/api/model/team/request/invite_info_request.dart';
|
||||||
import 'package:starwork_flutter/api/model/team/request/update_team_info_request.dart';
|
import 'package:starwork_flutter/api/model/team/request/update_team_info_request.dart';
|
||||||
import 'package:starwork_flutter/api/model/team/response/all_team_list_response.dart';
|
import 'package:starwork_flutter/api/model/team/response/all_team_list_response.dart';
|
||||||
import 'package:starwork_flutter/api/model/team/response/create_team_response.dart';
|
import 'package:starwork_flutter/api/model/team/response/create_team_response.dart';
|
||||||
|
import 'package:starwork_flutter/api/model/team/response/invite_info_response.dart';
|
||||||
import 'package:starwork_flutter/api/model/team/response/scene_info_response.dart';
|
import 'package:starwork_flutter/api/model/team/response/scene_info_response.dart';
|
||||||
import 'package:starwork_flutter/api/model/user/request/validation_code_login.dart';
|
import 'package:starwork_flutter/api/model/user/request/validation_code_login.dart';
|
||||||
import 'package:starwork_flutter/api/model/user/response/token_response.dart';
|
import 'package:starwork_flutter/api/model/user/response/token_response.dart';
|
||||||
@ -73,7 +75,7 @@ class TeamApiService {
|
|||||||
path: ApiPath.bindTeamStarCloudAccount,
|
path: ApiPath.bindTeamStarCloudAccount,
|
||||||
method: HttpConstant.post,
|
method: HttpConstant.post,
|
||||||
data: request.toJson(),
|
data: request.toJson(),
|
||||||
fromJson: (data){},
|
fromJson: (data) {},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,4 +91,17 @@ class TeamApiService {
|
|||||||
fromJson: (data) {},
|
fromJson: (data) {},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 获取邀请信息
|
||||||
|
Future<ApiResponse<InviteInfoResponse>> requestInviteInfo({
|
||||||
|
required InviteInfoRequest request,
|
||||||
|
}) {
|
||||||
|
return _api.makeRequest(
|
||||||
|
// 通过实例调用
|
||||||
|
path: ApiPath.getInviteInfo,
|
||||||
|
method: HttpConstant.post,
|
||||||
|
data: request.toJson(),
|
||||||
|
fromJson: (data) => InviteInfoResponse.fromJson(data),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class F {
|
|||||||
// Release环境的API地址
|
// Release环境的API地址
|
||||||
switch (appFlavor) {
|
switch (appFlavor) {
|
||||||
case Flavor.sky:
|
case Flavor.sky:
|
||||||
return 'https://192.168.1.139:8112/api'; // 生产环境API
|
return 'https://192.168.1.138:8112/api'; // 生产环境API
|
||||||
case Flavor.xhj:
|
case Flavor.xhj:
|
||||||
return 'https://api.xhjcn.ltd/api'; // 生产环境API
|
return 'https://api.xhjcn.ltd/api'; // 生产环境API
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ class F {
|
|||||||
// Debug/Profile环境的API地址(开发环境)
|
// Debug/Profile环境的API地址(开发环境)
|
||||||
switch (appFlavor) {
|
switch (appFlavor) {
|
||||||
case Flavor.sky:
|
case Flavor.sky:
|
||||||
return 'http://192.168.1.139:8112/api';
|
return 'http://192.168.1.138:8112/api';
|
||||||
case Flavor.xhj:
|
case Flavor.xhj:
|
||||||
return 'https://loacl.work.star-lock.cn/api';
|
return 'https://loacl.work.star-lock.cn/api';
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ class F {
|
|||||||
// Debug/Profile环境的StarCloud地址(开发环境)
|
// Debug/Profile环境的StarCloud地址(开发环境)
|
||||||
switch (appFlavor) {
|
switch (appFlavor) {
|
||||||
case Flavor.sky:
|
case Flavor.sky:
|
||||||
return 'http://192.168.1.139:8111/sdk';
|
return 'http://192.168.1.138:8111/sdk';
|
||||||
case Flavor.xhj:
|
case Flavor.xhj:
|
||||||
return 'http://local.cloud.star-lock.cn';
|
return 'http://local.cloud.star-lock.cn';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,17 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:starwork_flutter/api/model/team/request/invite_info_request.dart';
|
||||||
|
import 'package:starwork_flutter/api/model/team/response/invite_info_response.dart';
|
||||||
import 'package:starwork_flutter/api/model/team/response/team_info_response.dart';
|
import 'package:starwork_flutter/api/model/team/response/team_info_response.dart';
|
||||||
|
import 'package:starwork_flutter/api/service/team_api_service.dart';
|
||||||
import 'package:starwork_flutter/base/base_controller.dart';
|
import 'package:starwork_flutter/base/base_controller.dart';
|
||||||
import 'package:starwork_flutter/common/constant/app_view_parameter_keys.dart';
|
import 'package:starwork_flutter/common/constant/app_view_parameter_keys.dart';
|
||||||
|
|
||||||
class InviteTeamMemberController extends BaseController {
|
class InviteTeamMemberController extends BaseController {
|
||||||
// 定义一个可观察的 Map
|
// 定义一个可观察的 Map
|
||||||
var selectedTeam = TeamInfoResponse().obs;
|
var selectedTeam = TeamInfoResponse().obs;
|
||||||
|
final teamApi = Get.find<TeamApiService>();
|
||||||
|
|
||||||
|
var inviteInfo = InviteInfoResponse().obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
@ -16,5 +22,19 @@ class InviteTeamMemberController extends BaseController {
|
|||||||
final json = args[AppViewParameterKeys.teamInfo];
|
final json = args[AppViewParameterKeys.teamInfo];
|
||||||
selectedTeam.value = TeamInfoResponse.fromJson(json);
|
selectedTeam.value = TeamInfoResponse.fromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selectedTeam.value.teamCloudInfo != null) {
|
||||||
|
requestInviteInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 请求邀请信息
|
||||||
|
requestInviteInfo() async {
|
||||||
|
var response = await teamApi.requestInviteInfo(
|
||||||
|
request: InviteInfoRequest(departNo: selectedTeam.value.teamNo!),
|
||||||
|
);
|
||||||
|
if (response.isSuccess) {
|
||||||
|
inviteInfo.value = response.data!;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,12 +82,24 @@ class InviteTeamMemberView extends GetView<InviteTeamMemberController> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
ClipRRect(
|
Container(
|
||||||
borderRadius: BorderRadius.circular(8.r),
|
padding: EdgeInsets.all(10.r), // 添加边距
|
||||||
child: Image(
|
decoration: BoxDecoration(
|
||||||
width: 220.w,
|
borderRadius: BorderRadius.circular(8.r), // 为 Container 添加圆角
|
||||||
image: const AssetImage(AppImages.mockErCode),
|
color: Colors.white, // 添加背景色以突出圆角效果
|
||||||
fit: BoxFit.cover, // 保持图片比例并填满容器
|
),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(8.r),
|
||||||
|
child: Obx(
|
||||||
|
() => Image(
|
||||||
|
width: 200.w, // 调整为 200 以适应 padding
|
||||||
|
height: 200.w,
|
||||||
|
image: NetworkImage(
|
||||||
|
controller.inviteInfo.value.inviteInfo ?? '',
|
||||||
|
),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
|
|||||||
@ -12,7 +12,12 @@ class TeamNoticeView extends GetView<TeamNoticeController> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: CustomAppBarWidget(title: '公告'.tr),
|
backgroundColor: AppColors.scaffoldBackgroundColor,
|
||||||
|
appBar: CustomAppBarWidget(
|
||||||
|
title: '公告'.tr,
|
||||||
|
showBackButton: false,
|
||||||
|
backgroundColor: AppColors.scaffoldBackgroundColor,
|
||||||
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
TabBar(
|
TabBar(
|
||||||
@ -76,7 +81,6 @@ class TeamNoticeView extends GetView<TeamNoticeController> {
|
|||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
// 模拟下拉刷新
|
// 模拟下拉刷新
|
||||||
await Future.delayed(const Duration(seconds: 2));
|
await Future.delayed(const Duration(seconds: 2));
|
||||||
Get.snackbar('提示', '刷新成功');
|
|
||||||
},
|
},
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
displacement: 60.0,
|
displacement: 60.0,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user