feat:app版本管理
This commit is contained in:
1 parent
393c6b63a5
commit
aea52e482e
11 files changed
+240
-19
No files matched your search
@@ -1,16 +1,4 @@
|
||||
# pj_supermarket_cloud
|
||||
|
||||
A new Flutter project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
|
||||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
|
||||
|
||||
For help getting started with Flutter development, view the
|
||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
## 生成代码命令
|
||||
```
|
||||
flutter pub run build_runner build --delete-conflicting-outputs~
|
||||
```
|
||||
@@ -0,0 +1,15 @@
|
||||
import 'package:pj_supermarket_cloud/common/index.dart';
|
||||
|
||||
abstract class AppApi {
|
||||
/// 获取所有版本列表
|
||||
static Future<ServiceAppVersionPage?> openCardList(
|
||||
dynamic pa,
|
||||
) async {
|
||||
final res = await HttpManage().dio.get(
|
||||
"/integrated/app-version/ad/page",
|
||||
queryParameters: pa,
|
||||
);
|
||||
if (res.data == null) return null;
|
||||
return ServiceAppVersionPage.fromJson(res.data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:pj_supermarket_cloud/common/index.dart';
|
||||
|
||||
part 'app_api_models.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class ServiceAppVersion {
|
||||
/// 唯一标识符
|
||||
final String? id;
|
||||
|
||||
/// app唯一编码
|
||||
final String? appUniqueCode;
|
||||
|
||||
/// 平台
|
||||
final String? platform;
|
||||
|
||||
/// 内部版本号
|
||||
final int? versionCode;
|
||||
|
||||
/// 版本名称
|
||||
final String? versionName;
|
||||
|
||||
/// 更新内容/更新日志
|
||||
final String? updateContent;
|
||||
|
||||
/// 安装包下载地址(wgt、apk)
|
||||
final String? downloadUrl;
|
||||
|
||||
/// 是否强制更新
|
||||
@JsonKey(fromJson: JsonTool.stringToBoolean, toJson: JsonTool.booleanToString)
|
||||
final bool? isForce;
|
||||
|
||||
/// 是否静默更新(WGT用)
|
||||
@JsonKey(fromJson: JsonTool.stringToBoolean, toJson: JsonTool.booleanToString)
|
||||
final bool? isSilent;
|
||||
|
||||
/// 状态(已发布、未发布、已下架)
|
||||
final String? status;
|
||||
|
||||
ServiceAppVersion({
|
||||
this.id,
|
||||
this.appUniqueCode,
|
||||
this.platform,
|
||||
this.versionCode,
|
||||
this.versionName,
|
||||
this.updateContent,
|
||||
this.downloadUrl,
|
||||
this.isForce,
|
||||
this.isSilent,
|
||||
this.status,
|
||||
});
|
||||
|
||||
factory ServiceAppVersion.fromJson(Map<String, dynamic> json) =>
|
||||
_$ServiceAppVersionFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$ServiceAppVersionToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class ServiceAppVersionPage extends ServicePageBase {
|
||||
List<ServiceAppVersion>? records;
|
||||
|
||||
ServiceAppVersionPage({
|
||||
this.records,
|
||||
});
|
||||
|
||||
factory ServiceAppVersionPage.fromJson(Map<String, dynamic> json) =>
|
||||
_$ServiceAppVersionPageFromJson(
|
||||
json,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => _$ServiceAppVersionPageToJson(this);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'app_api_models.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
ServiceAppVersion _$ServiceAppVersionFromJson(Map<String, dynamic> json) =>
|
||||
ServiceAppVersion(
|
||||
id: json['id'] as String?,
|
||||
appUniqueCode: json['appUniqueCode'] as String?,
|
||||
platform: json['platform'] as String?,
|
||||
versionCode: (json['versionCode'] as num?)?.toInt(),
|
||||
versionName: json['versionName'] as String?,
|
||||
updateContent: json['updateContent'] as String?,
|
||||
downloadUrl: json['downloadUrl'] as String?,
|
||||
isForce: JsonTool.stringToBoolean(json['isForce'] as String),
|
||||
isSilent: JsonTool.stringToBoolean(json['isSilent'] as String),
|
||||
status: json['status'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ServiceAppVersionToJson(ServiceAppVersion instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'appUniqueCode': instance.appUniqueCode,
|
||||
'platform': instance.platform,
|
||||
'versionCode': instance.versionCode,
|
||||
'versionName': instance.versionName,
|
||||
'updateContent': instance.updateContent,
|
||||
'downloadUrl': instance.downloadUrl,
|
||||
'isForce': JsonTool.booleanToString(instance.isForce),
|
||||
'isSilent': JsonTool.booleanToString(instance.isSilent),
|
||||
'status': instance.status,
|
||||
};
|
||||
|
||||
ServiceAppVersionPage _$ServiceAppVersionPageFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
ServiceAppVersionPage(
|
||||
records: (json['records'] as List<dynamic>?)
|
||||
?.map((e) => ServiceAppVersion.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
)
|
||||
..current = (json['current'] as num).toInt()
|
||||
..pages = (json['pages'] as num).toInt()
|
||||
..size = (json['size'] as num).toInt()
|
||||
..total = (json['total'] as num).toInt();
|
||||
|
||||
Map<String, dynamic> _$ServiceAppVersionPageToJson(
|
||||
ServiceAppVersionPage instance) =>
|
||||
<String, dynamic>{
|
||||
'current': instance.current,
|
||||
'pages': instance.pages,
|
||||
'size': instance.size,
|
||||
'total': instance.total,
|
||||
'records': instance.records,
|
||||
};
|
||||
@@ -1,7 +1,8 @@
|
||||
library;
|
||||
|
||||
export './api/app_api_models.dart';
|
||||
export './api/base_api_models.dart';
|
||||
export 'api/product_api_models.dart';
|
||||
export './api/product_api_models.dart';
|
||||
export './api/hard_api_models.dart';
|
||||
export './api/user_api_models.dart';
|
||||
export './api/wallet_api_models.dart';
|
||||
|
||||
@@ -9,6 +9,7 @@ enum SettingMenuType implements BaseEnum {
|
||||
backup("40", "资源备份"),
|
||||
faceSetting("50", "支付设置"),
|
||||
productSetting("60", "资源备份"),
|
||||
versionSetting("70", "版本管理"),
|
||||
;
|
||||
|
||||
@override
|
||||
|
||||
@@ -10,9 +10,9 @@ class Constants {
|
||||
static const pwdEncKey = 'pigxpigxpigxpigx';
|
||||
|
||||
/// 服务 url 线上
|
||||
static const apiUrl = 'https://stgl.pj.gov.cn/api';
|
||||
// static const apiUrl = 'https://stgl.pj.gov.cn/api';
|
||||
|
||||
// static const apiUrl = 'http://192.168.101.196:9999';
|
||||
static const apiUrl = 'http://192.168.101.104:9999';
|
||||
|
||||
/// 静态资源 url
|
||||
static const ossUrl = apiUrl;
|
||||
|
||||
@@ -64,6 +64,11 @@ class SettingController extends GetxController {
|
||||
title: "商品管理",
|
||||
type: SettingMenuType.productSetting,
|
||||
),
|
||||
SettingMenu(
|
||||
prefixIcon: FAssets.icons.rocket,
|
||||
title: "版本管理",
|
||||
type: SettingMenuType.versionSetting,
|
||||
),
|
||||
].obs;
|
||||
|
||||
Rx<SettingMenuType> cuurentMenuType = SettingMenuType.baseInfo.obs;
|
||||
|
||||
@@ -118,6 +118,11 @@ class SettingPage extends GetView<SettingController> {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return settingProduct(context);
|
||||
case SettingMenuType.versionSetting:
|
||||
if (!isBand) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return settingVersionSetting(context);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@@ -6,3 +6,4 @@ export './setting_face.dart';
|
||||
export './setting_pay.dart';
|
||||
export './setting_product.dart';
|
||||
export './setting_sync.dart';
|
||||
export './setting-version-setting.dart';
|
||||
@@ -0,0 +1,75 @@
|
||||
import 'package:ducafe_ui_core/ducafe_ui_core.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pj_supermarket_cloud/common/index.dart';
|
||||
|
||||
class VersionManageController extends GetxController {
|
||||
static const String _tag = "版本管理 Controller";
|
||||
|
||||
final appC = Get.find<AppControl>();
|
||||
|
||||
RxInt currentPage = RxInt(1);
|
||||
|
||||
RxInt totalPage = RxInt(0);
|
||||
|
||||
RxInt pageSize = RxInt(15);
|
||||
|
||||
/// 搜索
|
||||
Future<void> doPage({int? page}) async {
|
||||
if (page != null) currentPage.value = page;
|
||||
await getVersionList(isLoading: true);
|
||||
}
|
||||
|
||||
/// 获取版本列表
|
||||
Future<void> getVersionList({bool isLoading = false}) async {
|
||||
if (isLoading) {
|
||||
EasyLoading.show(
|
||||
status: '查询中...',
|
||||
maskType: EasyLoadingMaskType.black,
|
||||
);
|
||||
}
|
||||
try {} finally {
|
||||
if (isLoading) {
|
||||
Future.delayed(const Duration(seconds: 1), () {
|
||||
EasyLoading.dismiss();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Widget settingVersionSetting(BuildContext context) {
|
||||
final versionC = Get.put<VersionManageController>(
|
||||
VersionManageController(),
|
||||
);
|
||||
return <Widget>[
|
||||
buildSettingVersionSettingSearch(context),
|
||||
buildSettingVersionSettingList(context).expanded(),
|
||||
Obx(
|
||||
() => appPage(
|
||||
context,
|
||||
pageNo: versionC.currentPage.value,
|
||||
pageSize: versionC.pageSize.value,
|
||||
total: versionC.totalPage.value,
|
||||
onPageChanged: (pageNo) => versionC.doPage(page: pageNo),
|
||||
),
|
||||
)
|
||||
].toColumn();
|
||||
}
|
||||
|
||||
// 版本更新搜索区域
|
||||
Widget buildSettingVersionSettingSearch(BuildContext context) {
|
||||
return Container();
|
||||
}
|
||||
|
||||
// 版本更新列表区域
|
||||
Widget buildSettingVersionSettingList(BuildContext context) {
|
||||
return Container();
|
||||
}
|
||||
|
||||
// 版本管理卡片
|
||||
Widget buildSettingVersionSettingCard(BuildContext context) {
|
||||
return Container();
|
||||
}
|
||||
Reference in new issue
Block a user