提交 84cd181c authored 作者: 岳维路's avatar 岳维路

合并分支 'test' 到 'sim'

Test 查看合并请求 kiwitap/zijing-app!6
......@@ -9,6 +9,7 @@ abstract class AccountAPI {
required String type,
String? password,
String? code,
String? uuid,
}) async {
// assert((password != null && code == null) ||
// (password == null && code != null),
......@@ -26,6 +27,7 @@ abstract class AccountAPI {
// 验证码登录
if(type == '2'){
params['code'] = code;
params['uuid'] = uuid;
}
final result = await HttpService.to.post(
'/v1/members/login/login',
......@@ -70,11 +72,26 @@ abstract class AccountAPI {
required String phone,
required String type,
}) async {
String uuid = '';
final DeviceInfoPlugin device = DeviceInfoPlugin();
if(Platform.isIOS){
final IosDeviceInfo iosInfo = await device.iosInfo;
uuid = iosInfo.identifierForVendor??'';
}
else if(Platform.isAndroid){
const androidIdPlugin = AndroidId();
final AndroidDeviceInfo androidInfo = await device.androidInfo;
uuid = await androidIdPlugin.getId()??'';
uuid = '$uuid${androidInfo.fingerprint}';
}
final result = await HttpService.to.post(
'/v1/members/login/sendCode',
params: {
'phone': phone,
'types': type
'types': type,
'uuid':uuid
},
excludeToken: true,
showLoading: true,
......
library apis;
import 'dart:io';
import 'package:android_id/android_id.dart';
import 'package:device_info_plus/device_info_plus.dart';
import '../models/index.dart';
import '../services/index.dart';
part 'account.dart';
part 'mine.dart';
part 'course.dart';
......
......@@ -223,6 +223,8 @@ class BookDetailModel {
this.chapterName,
this.readChapterId,
this.introduction,
/// 笔记
this.commentNum,
});
BookDetailModel.fromJson(dynamic json) {
......@@ -251,6 +253,7 @@ class BookDetailModel {
chapterName = json['chapter_name'];
readChapterId = json['read_chapter_id'];
introduction = json['introduction'];
commentNum = json['comment_num'];
}
num? bookId;
String? bookName;
......@@ -277,6 +280,7 @@ class BookDetailModel {
String? chapterName;
num? readChapterId;
String? introduction;
num? commentNum;
BookDetailModel copyWith({ num? bookId,
String? bookName,
String? img,
......@@ -302,6 +306,7 @@ class BookDetailModel {
String? chapterName,
num? readChapterId,
String? introduction,
num? commentNum,
}) => BookDetailModel( bookId: bookId ?? this.bookId,
bookName: bookName ?? this.bookName,
img: img ?? this.img,
......@@ -326,7 +331,8 @@ class BookDetailModel {
chapterId: chapterId ?? this.chapterId,
chapterName: chapterName ?? this.chapterName,
readChapterId: readChapterId?? this.readChapterId,
introduction: introduction ?? this.introduction
introduction: introduction ?? this.introduction,
commentNum: commentNum ?? this.commentNum,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
......@@ -355,6 +361,7 @@ class BookDetailModel {
map['chapter_name'] = chapterName;
map['read_chapter_id'] = readChapterId;
map['introduction'] = introduction;
map['comment_num'] = commentNum;
return map;
}
......
......@@ -2,9 +2,11 @@ part of change_pwd;
class ChangePwdPage extends StatefulWidget {
final UserInfoModel userInfo;
final String type;
const ChangePwdPage({
Key? key ,
required this.userInfo,
required this.type
}) : super(key: key);
// const ResetPwdPage({Key? key}) : super(key: key);
......@@ -123,7 +125,7 @@ class _ChangePwdPageState extends State<ChangePwdPage> {
Tools.unfocus();
final result = await controller.changePwd();
if (result){
if(widget.userInfo.password.toString().isNotEmpty){
if(widget.type == '1'){
await UserStore.to.logout();
Toast.show('修改成功,请重新登录');
if (context.mounted) {
......
......@@ -51,9 +51,6 @@ class DiscussController extends GetxController {
void setShow() {
showReply = !showReply;
if (showReply == false) {
replyInput.text = '';
}
update();
}
......
......@@ -107,22 +107,30 @@ class MsgPage extends StatelessWidget {
///TODO:
}else if (model.type == 2){
// 2 购买完成三天未评价(跳转订单列表--已完成)
// final orderInfo = await controller.getOrderInfo(model.urlId?.orderNum??'');
//
// final result = await context.pushNamed(Routes.orderEvaluate,extra:orderInfo,
// queryParameters: {'orderNum':orderInfo.ordersnum});
//
final result = await context.pushNamed(Routes.order);
if (result == true){
// controller.onRefresh();
}
final orderInfo = await controller.getOrderInfo(model.urlId?.orderNum??'');
final result = await context.pushNamed(Routes.orderEvaluate,extra:orderInfo,
queryParameters: {'orderNum':orderInfo.ordersnum});
// final result = await context.pushNamed(Routes.order);
// if (result == true){
// // controller.onRefresh();
// }
///TODO:
}else if (model.type == 3){
// 3 讨论有人回复的时候 (跳转对应书籍的讨论页面)
final result = await context.pushNamed(Routes.bookDetail,queryParameters: {'book_id':model.urlId?.bookId.toString()});
if (result == true){
// controller.onRefresh();
}
// 3 讨论有人回复的时候 (跳转我的讨论详情也)
String bookId = model.urlId?.bookId.toString()??'';
BookDetailModel bookDetails = await LibraryAPI.details(bookId:bookId);
CourseModel courseModel = CourseModel(
img: bookDetails.img,
bookId: bookDetails.bookId,
bookName: bookDetails.bookName,
commentNum: bookDetails.commentNum
);
context.pushNamed(Routes.discussDes,extra: courseModel);
}
else if (model.type == 4){
// 4 订单完成后有新的积分增加(跳转用户积分记录页)
......
......@@ -128,7 +128,8 @@ class BuiltAwaiting extends StatelessWidget {
child: Align(
alignment: Alignment.center,
child: Text(
'${31 - (DateTime.now().difference(DateTime.parse(model.createTime.toString()))).inMinutes}分钟',
'${(30 - (DateTime.now().difference(DateTime.parse(model.createTime.toString()))).inMinutes)==0?
1:30 - (DateTime.now().difference(DateTime.parse(model.createTime.toString()))).inMinutes}分钟',
style: TextStyle(
color: Colours.cC31F4C,
fontSize: 10.w,
......@@ -273,7 +274,8 @@ class BuiltAwaiting extends StatelessWidget {
child: Align(
alignment: Alignment.center,
child: Text(
'29分钟',
'${(30 - (DateTime.now().difference(DateTime.parse(model.createTime.toString()))).inMinutes)==0?
1:30 - (DateTime.now().difference(DateTime.parse(model.createTime.toString()))).inMinutes}分钟',
style: TextStyle(
color: Colours.cC31F4C,
fontSize: 10.w,
......
......@@ -69,6 +69,7 @@ class BuiltCoin extends StatelessWidget {
),
Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
......@@ -82,7 +83,7 @@ class BuiltCoin extends StatelessWidget {
style: TextStyle(fontSize: 12.w, color: Colours.c9),
),
SizedBox(
height: 4.w,
height: 10.w,
),
Text(
'充值紫荆币',
......@@ -94,21 +95,83 @@ class BuiltCoin extends StatelessWidget {
],
),
Container(
margin: EdgeInsets.only(right: 15.w),
margin: EdgeInsets.only(right: 1.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SizedBox(
height: 6.5.w,
height: 4.5.w,
),
Text(status, style: TextStyle(fontSize: 13.w, color: Colours.c9),),
model.status == 1?Align(
alignment: Alignment.topRight,
child: Container(
margin: EdgeInsets.only( right: 4.w),
width: 110,
height: 20,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// 左半部分的文字
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(180.w),
bottomLeft: Radius.circular(180.w)),
color: Colours.cC31F4C,
),
height: double.infinity,
width: 55,
child: Align(
alignment: Alignment.center,
child: Text(
'等待付款',
style: TextStyle(
color: Colors.white,
fontSize: 10.w,
fontWeight: Fonts.medium,
),
),
),
),
// 右半部分的文字
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topRight: Radius.circular(180.w),
bottomRight: Radius.circular(180.w)),
color: Colours.cC31F4C2,
),
height: double.infinity,
width: 55,
child: Align(
alignment: Alignment.center,
child: Text(
'${(30 - (DateTime.now().difference(DateTime.parse(model.createTime.toString()))).inMinutes)==0?
1:30 - (DateTime.now().difference(DateTime.parse(model.createTime.toString()))).inMinutes}分钟',
style: TextStyle(
color: Colours.cC31F4C,
fontSize: 10.w,
fontWeight: Fonts.medium),
),
),
),
],
),
),
):Container(
margin: EdgeInsets.only(right: 10.w,top: 10.w),
child: Text(status, style: TextStyle(fontSize: 13.w, color: Colours.c9),)),
SizedBox(height: 6.5.w,),
Text(
${model.finalTotalPrice}',
style: TextStyle(
fontSize: 14.w,
color: Colours.cAB1941,
fontWeight: Fonts.medium),
Container(
margin: EdgeInsets.only(right: 10.w),
child: Text(
${model.finalTotalPrice}',
style: TextStyle(
fontSize: 14.w,
color: Colours.cAB1941,
fontWeight: Fonts.medium),
),
)
],
),
......
......@@ -53,7 +53,11 @@ class _UserSecurityPageState extends State<UserSecurityPage> {
),
GestureDetector(
onTap: () {
context.pushNamed(Routes.changePwd, extra: widget.model);
String type = '1';
if (widget.model.password.toString().isEmpty){
type = '0';
}
context.pushNamed(Routes.changePwd, extra: widget.model,queryParameters: {'type':type});
},
child: _buildItem(
title: '修改密码',
......
......@@ -9,8 +9,8 @@ class UserSetPage extends StatefulWidget {
class _UserSetPageState extends State<UserSetPage> {
late UModel _getModel;
String url =
"https://imtt.dd.qq.com/16891/apk/FA48766BA12A41A1D619CB4B152889C6.apk?fsname=com.estrongs.android.pop_4.2.3.3_10089.apk&csr=1bbd";
// String url =
// "https://imtt.dd.qq.com/16891/apk/FA48766BA12A41A1D619CB4B152889C6.apk?fsname=com.estrongs.android.pop_4.2.3.3_10089.apk&csr=1bbd";
@override
Widget build(BuildContext context) {
......@@ -236,13 +236,30 @@ class _UserSetPageState extends State<UserSetPage> {
UModel model = await MineAPI.update();
_getModel = model;
final packageInfo = await PackageInfo.fromPlatform();
int getVersion = int.parse(model.version!.replaceAll('.', ''));
int localVersion = int.parse(packageInfo.version.replaceAll('.', ''));
if (localVersion < getVersion) {
int update = verifyVersion(model.version!,packageInfo.version);
if (update == 1) {
_showUpdateDialog(false);
}
}
int verifyVersion(String newVersion, String oldVersion) {
List<String> newVersionArr = newVersion.split('.');
List<String> oldVersionArr = oldVersion.split('.');
for (int i = 0; i < 3; i++) {
int newVersionNumber = int.parse(newVersionArr[i]);
int oldVersionNumber = int.parse(oldVersionArr[i]);
if (newVersionNumber < oldVersionNumber) {
return -1; // 新版本小于旧版本
} else if (newVersionNumber > oldVersionNumber) {
return 1; // 新版本大于旧版本
}
}
return 0; // 两个版本号相等
}
///Flutter侧处理升级对话框
///[forcedUpgrade] 是否强制升级
/*_showUpdateDialog(bool forcedUpgrade) {
......
......@@ -478,7 +478,10 @@ abstract class Routes {
pageBuilder: (context, state) =>CupertinoPage(
name: state.uri.toString(),
key: state.pageKey,
child: ChangePwdPage(userInfo: state.extra as UserInfoModel)
child: ChangePwdPage(
userInfo: state.extra as UserInfoModel,
type: state.uri.queryParameters['type'].toString(),
)
)
),
GoRoute(
......
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
android_id:
dependency: "direct main"
description:
name: android_id
sha256: "5c2d3a259afcd173dbe367ba452817bd530c4df75d251d652c69b8d3c8ac0d36"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.6"
archive:
dependency: "direct main"
description:
......@@ -161,6 +169,22 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.3"
device_info_plus:
dependency: "direct main"
description:
name: device_info_plus
sha256: "77f757b789ff68e4eaf9c56d1752309bd9f7ad557cb105b938a7f8eb89e59110"
url: "https://pub.flutter-io.cn"
source: hosted
version: "9.1.2"
device_info_plus_platform_interface:
dependency: transitive
description:
name: device_info_plus_platform_interface
sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64
url: "https://pub.flutter-io.cn"
source: hosted
version: "7.0.0"
dio:
dependency: "direct main"
description:
......@@ -1018,6 +1042,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.0.9"
win32_registry:
dependency: transitive
description:
name: win32_registry
sha256: e4506d60b7244251bc59df15656a3093501c37fb5af02105a944d73eb95be4c9
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
xdg_directories:
dependency: transitive
description:
......
......@@ -115,6 +115,10 @@ dependencies:
connectivity_plus: ^5.0.2
# 数据库
sqflite: ^2.3.2
# 设备信息
device_info_plus: ^9.1.2
# 安卓
android_id: ^0.3.6
dev_dependencies:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论