diff --git a/lib/constants/market_api.dart b/lib/constants/market_api.dart index 87f85e86..a479c038 100644 --- a/lib/constants/market_api.dart +++ b/lib/constants/market_api.dart @@ -8,6 +8,7 @@ class _MarketApi { _Rotation rotation = _Rotation(); _ShopCart shopCart = _ShopCart(); _Address address = _Address(); + _Order order = _Order(); } class _ShopCart { @@ -83,3 +84,20 @@ class _Rotation { ///查询app商城首页轮播图 String get rotation => '/app/user/shop/rotation/list'; } + +class _Order { + ///查询订单物流 + String get findLogistics => '/app/user/shop/order/findLogistics'; + + ///app确认收货 + String get confirm => '/app/user/shop/order/confirm'; + + ///app删除订单 + String get delete => '/app/user/shop/order/appDelete'; + + ///app取消订单 + String get cancel => '/app/user/shop/order/cancel'; + + ///我的订单 + String get myOrder => '/app/user/shop/order/myOrder'; +} diff --git a/lib/constants/sars_api.dart b/lib/constants/sars_api.dart index ba7a4ebb..cc7558e2 100644 --- a/lib/constants/sars_api.dart +++ b/lib/constants/sars_api.dart @@ -21,6 +21,8 @@ class SARSAPI { static _Login login = _Login(); static _User user = _User(); static _House house = _House(); + static _File uploadFile = _File(); + static _Message message = _Message(); ///二级分类 static _ProfileApi profile = _ProfileApi(); @@ -53,6 +55,9 @@ class _User { ///实名认证 String get certification => '/app/user/verified'; + + ///修改用户头像 + String get updateAvatar => '/app/user/updateAvatarImg'; } class _Login { @@ -73,3 +78,57 @@ class _House { ///查询所有的房屋(级联) String get allHouses => '/app/estate/findEstateCascade'; } + +class _File { + ///上传app照片 + String get uploadImg => '/app/user/upload/uploadImg'; +} + +class _Message { + ///全部已读 + String get allRead => '/app/user/message/allRead'; + + ///已读 + String get read => '/app/user/message/read'; + + ///所有点赞消息 + String get allLikes => '/app/user/message/likesMessage'; + + ///所有评论消息 + String get allComment => '/app/user/message/commentMessage'; +} + +class _Community { + ///动态信息详情 + String get dynamicDetail => '/app/user/community/dynamic/details'; + + ///点赞动态 + String get dynamicLike => '/app/user/community/dynamic/likes'; + + ///点赞评论 + String get commentLike => '/app/user/community/comment/likes'; + + ///发送评论 + String get commentInsert => '/app/user/community/comment/insert'; + + ///查询动态下的评论信息列表 + String get commentList => '/app/user/community/comment/list'; + + ///发布动态 + String get dynamicInsert => '/app/user/community/dynamic/insert'; + + ///我的动态资料部分(头部) + String get dynamicMyListH => '/app/user/community/dynamic/myListH'; + + ///我的动态信息部分(底部) + String get dynamicMyListL => '/app/user/community/dynamic/myListL'; + + ///所有动态信息 + String get dynamicList => '/app/user/community/dynamic/list'; + + ///所有话题 + String get topicList => '/app/user/community/topic/list'; + + ///新鲜话题 + String get topNewList => '/app/user/community/topic/newList'; +} diff --git a/lib/model/order/order_list_model.dart b/lib/model/order/order_list_model.dart index f0e9333a..11693f39 100644 --- a/lib/model/order/order_list_model.dart +++ b/lib/model/order/order_list_model.dart @@ -5,13 +5,14 @@ class OrderListModel { int? payType; double? payPrice; double? freightFee; - int? jcookAddressId; + int? appGoodsAddressId; String? receiverName; String? receiverTel; String? locationName; String? addressDetail; String? createDate; - List? myOrderListVoList; + String? remake; + List? orderList; OrderListModel( {this.id, @@ -25,8 +26,9 @@ class OrderListModel { this.locationName, this.addressDetail, this.createDate, - this.myOrderListVoList, - this.jcookAddressId}); + this.remake, + this.appGoodsAddressId, + this.orderList}); OrderListModel.fromJson(Map json) { id = json['id']; @@ -40,14 +42,15 @@ class OrderListModel { locationName = json['locationName']; addressDetail = json['addressDetail']; createDate = json['createDate']; - jcookAddressId = json['jcookAddressId']; - if (json['myOrderListVoList'] != null) { - myOrderListVoList = []; - json['myOrderListVoList'].forEach((v) { - myOrderListVoList!.add(new MyOrderListVoList.fromJson(v)); + remake = json['remake']; + appGoodsAddressId = json['appGoodsAddressId']; + if (json['orderList'] != null) { + orderList = []; + json['orderList'].forEach((v) { + orderList!.add(new MyOrderListVoList.fromJson(v)); }); } else { - myOrderListVoList = []; + orderList = []; } } @@ -64,10 +67,11 @@ class OrderListModel { data['locationName'] = this.locationName; data['addressDetail'] = this.addressDetail; data['createDate'] = this.createDate; - data['jcookAddressId'] = this.jcookAddressId; - if (this.myOrderListVoList != null) { + data['jcookAddressId'] = this.appGoodsAddressId; + data['remake'] = this.remake; + if (this.orderList != null) { data['myOrderListVoList'] = - this.myOrderListVoList!.map((v) => v.toJson()).toList(); + this.orderList!.map((v) => v.toJson()).toList(); } return data; } @@ -75,7 +79,8 @@ class OrderListModel { class MyOrderListVoList { int? id; - int? jcookGoodsId; + int? goodsPushId; + int? appSkuId; String? skuName; String? mainPhoto; double? sellPrice; @@ -87,7 +92,8 @@ class MyOrderListVoList { MyOrderListVoList( {this.id, - this.jcookGoodsId, + this.appSkuId, + this.goodsPushId, this.skuName, this.mainPhoto, this.sellPrice, @@ -99,7 +105,8 @@ class MyOrderListVoList { MyOrderListVoList.fromJson(Map json) { id = json['id']; - jcookGoodsId = json['jcookGoodsId']; + goodsPushId = json['goodsPushId']; + appSkuId = json['appSkuId']; skuName = json['skuName']; mainPhoto = json['mainPhoto']; sellPrice = json['sellPrice']; @@ -113,7 +120,8 @@ class MyOrderListVoList { Map toJson() { final Map data = new Map(); data['id'] = this.id; - data['jcookGoodsId'] = this.jcookGoodsId; + data['appSkuId'] = this.appSkuId; + data['goodsPushId'] = this.goodsPushId; data['skuName'] = this.skuName; data['mainPhoto'] = this.mainPhoto; data['sellPrice'] = this.sellPrice; diff --git a/lib/models/login/china_region_model.dart b/lib/models/login/china_region_model.dart index f92b56eb..35324f20 100644 --- a/lib/models/login/china_region_model.dart +++ b/lib/models/login/china_region_model.dart @@ -11,18 +11,21 @@ class ChinaRegionModel { @HiveField(1) final String name; @HiveField(2) - final List cityList; + final int parentId; + @HiveField(3) + final List? cityList; factory ChinaRegionModel.fromJson(Map json) => _$ChinaRegionModelFromJson(json); + static ChinaRegionModel empty(int parentId) { + return ChinaRegionModel(id: 0, name: '', cityList: [], parentId: 0); + } + const ChinaRegionModel({ required this.id, required this.name, - required this.cityList, + required this.parentId, + this.cityList, }); - - static ChinaRegionModel empty(int parentId) { - return ChinaRegionModel(id: 0, name: '', cityList: []); - } } diff --git a/lib/models/login/china_region_model.g.dart b/lib/models/login/china_region_model.g.dart index 08dac6d6..d43bc361 100644 --- a/lib/models/login/china_region_model.g.dart +++ b/lib/models/login/china_region_model.g.dart @@ -19,19 +19,22 @@ class ChinaRegionModelAdapter extends TypeAdapter { return ChinaRegionModel( id: fields[0] as int, name: fields[1] as String, - cityList: (fields[2] as List).cast(), + parentId: fields[2] as int, + cityList: (fields[3] as List?)?.cast(), ); } @override void write(BinaryWriter writer, ChinaRegionModel obj) { writer - ..writeByte(3) + ..writeByte(4) ..writeByte(0) ..write(obj.id) ..writeByte(1) ..write(obj.name) ..writeByte(2) + ..write(obj.parentId) + ..writeByte(3) ..write(obj.cityList); } @@ -54,7 +57,8 @@ ChinaRegionModel _$ChinaRegionModelFromJson(Map json) => ChinaRegionModel( id: json['id'] as int, name: json['name'] as String, - cityList: (json['cityList'] as List) - .map((e) => ChinaRegionModel.fromJson(e as Map)) + parentId: json['parentId'] as int, + cityList: (json['cityList'] as List?) + ?.map((e) => ChinaRegionModel.fromJson(e as Map)) .toList(), ); diff --git a/lib/models/market/good_detail_model.g.dart b/lib/models/market/good_detail_model.g.dart index 1a4c2b39..95416279 100644 --- a/lib/models/market/good_detail_model.g.dart +++ b/lib/models/market/good_detail_model.g.dart @@ -9,16 +9,16 @@ part of 'good_detail_model.dart'; GoodDetailModel _$GoodDetailModelFromJson(Map json) => GoodDetailModel( id: json['id'] as int, - jcookImageVoList: (json['jcookImageVoList'] as List) - .map((e) => JcookImageVoList.fromJson(e as Map)) + jcookImageVoList: (json['jcookImageVoList'] as List?) + ?.map((e) => JcookImageVoList.fromJson(e as Map)) .toList(), sellPrice: json['sellPrice'] as num, discountPrice: json['discountPrice'] as num, - skuName: json['skuName'] as String, + skuName: json['skuName'] as String?, status: json['status'] as int, shopStatus: json['shopStatus'] as int, - sellNum: json['sellNum'] as int, - kind: json['kind'] as int, + sellNum: json['sellNum'] as int?, + kind: json['kind'] as int?, defaultLocation: json['defaultLocation'] as String, defaultAddressDetail: json['defaultAddressDetail'] as String, stockStatus: json['stockStatus'] as int, @@ -51,6 +51,6 @@ JcookSpecificationVoList _$JcookSpecificationVoListFromJson( ); Attribute _$AttributeFromJson(Map json) => Attribute( - name: json['name'] as String, - value: json['value'] as String, + name: json['name'] as String?, + value: json['value'] as String?, ); diff --git a/lib/models/market/market_all_category_model.g.dart b/lib/models/market/market_all_category_model.g.dart index 5a32a690..d3f4e456 100644 --- a/lib/models/market/market_all_category_model.g.dart +++ b/lib/models/market/market_all_category_model.g.dart @@ -10,7 +10,7 @@ MarketAllCategoryModel _$MarketAllCategoryModelFromJson( Map json) => MarketAllCategoryModel( id: json['id'] as int, - name: json['name'] as String, + name: json['name'] as String?, imgUrls: (json['imgUrls'] as List).map((e) => e as String).toList(), categoryList: (json['categoryList'] as List) diff --git a/lib/models/market/market_category_model.g.dart b/lib/models/market/market_category_model.g.dart index 0fa01c69..b637f74f 100644 --- a/lib/models/market/market_category_model.g.dart +++ b/lib/models/market/market_category_model.g.dart @@ -9,7 +9,7 @@ part of 'market_category_model.dart'; MarketCategoryModel _$MarketCategoryModelFromJson(Map json) => MarketCategoryModel( id: json['id'] as int, - name: json['name'] as String, + name: json['name'] as String?, imgUrls: (json['imgUrls'] as List).map((e) => e as String).toList(), ); diff --git a/lib/models/message/reply_list_model.dart b/lib/models/message/reply_list_model.dart index a54b89da..48727ebc 100644 --- a/lib/models/message/reply_list_model.dart +++ b/lib/models/message/reply_list_model.dart @@ -6,22 +6,30 @@ part 'reply_list_model.g.dart'; @JsonSerializable() class ReplyListModel { final int id; - final String name; - final String date; + final int status; final String content; - final ImgModel img; - final String title; - final ImgModel pic; + final int sendId; + final String sendName; + final String sendDate; + final List avatarImgList; + final List dynamicImgList; + factory ReplyListModel.fromJson(Map json) => _$ReplyListModelFromJson(json); + String get avatar => + avatarImgList.isEmpty ? '' : avatarImgList.first.url ?? ''; + String get pic => + dynamicImgList.isEmpty ? '' : dynamicImgList.first.url ?? ''; + const ReplyListModel({ required this.id, - required this.name, - required this.date, + required this.status, required this.content, - required this.img, - required this.title, - required this.pic, + required this.sendId, + required this.sendName, + required this.sendDate, + required this.avatarImgList, + required this.dynamicImgList, }); } diff --git a/lib/models/message/reply_list_model.g.dart b/lib/models/message/reply_list_model.g.dart index 882ccfee..b1c57659 100644 --- a/lib/models/message/reply_list_model.g.dart +++ b/lib/models/message/reply_list_model.g.dart @@ -9,10 +9,15 @@ part of 'reply_list_model.dart'; ReplyListModel _$ReplyListModelFromJson(Map json) => ReplyListModel( id: json['id'] as int, - name: json['name'] as String, - date: json['date'] as String, + status: json['status'] as int, content: json['content'] as String, - img: ImgModel.fromJson(json['img'] as Map), - title: json['title'] as String, - pic: ImgModel.fromJson(json['pic'] as Map), + sendId: json['sendId'] as int, + sendName: json['sendName'] as String, + sendDate: json['sendDate'] as String, + avatarImgList: (json['avatarImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + dynamicImgList: (json['dynamicImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), ); diff --git a/lib/models/user/user_info_model.dart b/lib/models/user/user_info_model.dart index f86038dd..0ee743bd 100644 --- a/lib/models/user/user_info_model.dart +++ b/lib/models/user/user_info_model.dart @@ -1,3 +1,4 @@ +import 'package:aku_new_community/model/common/img_model.dart'; import 'package:json_annotation/json_annotation.dart'; part 'user_info_model.g.dart'; @@ -6,6 +7,7 @@ part 'user_info_model.g.dart'; class UserInfoModel { final int id; final int communityId; + final String communityCode; final String? name; final String? idCard; final String tel; @@ -17,6 +19,7 @@ class UserInfoModel { final bool isPointsSignSetting; final bool isSign; final int? points; + final List imgList; String get sexValue { if (sex == 1) return '男'; @@ -40,6 +43,7 @@ class UserInfoModel { const UserInfoModel({ required this.id, required this.communityId, + required this.communityCode, this.name, this.idCard, required this.tel, @@ -49,5 +53,6 @@ class UserInfoModel { required this.isPointsSignSetting, required this.isSign, this.points, + required this.imgList, }); } diff --git a/lib/models/user/user_info_model.g.dart b/lib/models/user/user_info_model.g.dart index 3b98b9df..dc460248 100644 --- a/lib/models/user/user_info_model.g.dart +++ b/lib/models/user/user_info_model.g.dart @@ -10,6 +10,7 @@ UserInfoModel _$UserInfoModelFromJson(Map json) => UserInfoModel( id: json['id'] as int, communityId: json['communityId'] as int, + communityCode: json['communityCode'] as String, name: json['name'] as String?, idCard: json['idCard'] as String?, tel: json['tel'] as String, @@ -19,4 +20,7 @@ UserInfoModel _$UserInfoModelFromJson(Map json) => isPointsSignSetting: json['isPointsSignSetting'] as bool, isSign: json['isSign'] as bool, points: json['points'] as int?, + imgList: (json['imgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), ); diff --git a/lib/pages/message_center_page/message_center_page.dart b/lib/pages/message_center_page/message_center_page.dart index 03580724..d8881514 100644 --- a/lib/pages/message_center_page/message_center_page.dart +++ b/lib/pages/message_center_page/message_center_page.dart @@ -1,11 +1,15 @@ +import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/pages/message_center_page/announce/announce_view.dart'; import 'package:aku_new_community/pages/message_center_page/reply/replay_view.dart'; import 'package:aku_new_community/pages/message_center_page/thumbs_up/thumbs_up_view.dart'; +import 'package:aku_new_community/utils/network/net_util.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart'; -import 'package:aku_new_community/widget/buttons/all_select_button.dart'; import 'package:aku_new_community/widget/tab_bar/bee_tab_bar.dart'; +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/src/extensions/string_ext.dart'; class MessageCenterPage extends StatefulWidget { MessageCenterPage({Key? key}) : super(key: key); @@ -16,10 +20,10 @@ class MessageCenterPage extends StatefulWidget { class _MessageCenterPageState extends State with TickerProviderStateMixin { - EasyRefreshController _refreshController = EasyRefreshController(); + List _controllers = + List.generate(2, (index) => EasyRefreshController()); List _tabs = ['回复我的', '收到的赞', '通知公告']; late final TabController _tabController; - bool inEdit = false; @override void initState() { @@ -34,7 +38,9 @@ class _MessageCenterPageState extends State @override void dispose() { - _refreshController.dispose(); + for (var item in _controllers) { + item.dispose(); + } super.dispose(); } @@ -43,13 +49,21 @@ class _MessageCenterPageState extends State return BeeScaffold( title: '消息', actions: [ - // MaterialButton( - // onPressed: () async { - // setState(() {}); - // }, - // child: '${inEdit ? '取消' : '编辑'}'.text.size(28.sp).black.make(), - // padding: EdgeInsets.symmetric(horizontal: 32.w), - // ), + MaterialButton( + onPressed: () async { + var res = await NetUtil().get(SARSAPI.message.allRead, params: { + 'type': _tabController.index + 1, + }); + if (res.success) { + _controllers[_tabController.index].callRefresh(); + setState(() {}); + } else { + BotToast.showText(text: res.msg); + } + }, + child: '全部已读'.text.size(28.sp).black.make(), + padding: EdgeInsets.symmetric(horizontal: 32.w), + ), ], appBarBottom: BeeTabBar( controller: _tabController, @@ -57,18 +71,16 @@ class _MessageCenterPageState extends State ), body: TabBarView( children: [ - ReplayView(), - ThumbsUpView(), + ReplayView( + controller: _controllers[0], + ), + ThumbsUpView( + controller: _controllers[1], + ), AnnounceView(), ], controller: _tabController, ), - bottomNavi: Offstage( - offstage: !inEdit, - child: AllSelectButton( - onPressed: () {}, - selected: true, - )), ); } } diff --git a/lib/pages/message_center_page/message_func.dart b/lib/pages/message_center_page/message_func.dart index 310c5b71..cd973897 100644 --- a/lib/pages/message_center_page/message_func.dart +++ b/lib/pages/message_center_page/message_func.dart @@ -1,7 +1,9 @@ import 'package:aku_new_community/constants/api.dart'; +import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/model/message/system_message_detail_model.dart'; import 'package:aku_new_community/utils/network/base_model.dart'; import 'package:aku_new_community/utils/network/net_util.dart'; +import 'package:bot_toast/bot_toast.dart'; class MessageFunc { static Future getSystemMessageDetial( @@ -12,4 +14,16 @@ class MessageFunc { }); return SystemMessageDetailModel.fromJson(baseModel.data); } + + static Future readMessage(int? id) async { + BaseModel baseModel = await NetUtil().get(SARSAPI.message.read, params: { + 'messageId': id, + }); + if (baseModel.success) { + return true; + } else { + BotToast.showText(text: baseModel.msg); + return false; + } + } } diff --git a/lib/pages/message_center_page/reply/replay_view.dart b/lib/pages/message_center_page/reply/replay_view.dart index 6586333d..3fd66e94 100644 --- a/lib/pages/message_center_page/reply/replay_view.dart +++ b/lib/pages/message_center_page/reply/replay_view.dart @@ -1,4 +1,6 @@ -import 'package:aku_new_community/constants/api.dart'; +import 'package:aku_new_community/constants/sars_api.dart'; +import 'package:aku_new_community/models/message/reply_list_model.dart'; +import 'package:aku_new_community/pages/message_center_page/reply/reply_card.dart'; import 'package:aku_new_community/pages/things_page/widget/bee_list_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; @@ -6,15 +8,14 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; class ReplayView extends StatefulWidget { - const ReplayView({Key? key}) : super(key: key); + final EasyRefreshController controller; + const ReplayView({Key? key, required this.controller}) : super(key: key); @override _ReplayViewState createState() => _ReplayViewState(); } class _ReplayViewState extends State { - EasyRefreshController _refreshController = EasyRefreshController(); - @override void initState() { super.initState(); @@ -22,22 +23,20 @@ class _ReplayViewState extends State { @override void dispose() { - _refreshController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return BeeListView( - path: API.host, - controller: _refreshController, - convert: (json) { - return []; - }, + path: SARSAPI.message.allComment, + controller: widget.controller, + convert: (models) => + models.tableList!.map((e) => ReplyListModel.fromJson(e)).toList(), builder: (items) { return ListView.separated( itemBuilder: (context, index) { - return Container(); + return ReplyCard(model: items[index]); }, separatorBuilder: (_, __) => 20.w.heightBox, itemCount: items.length); diff --git a/lib/pages/message_center_page/reply/reply_card.dart b/lib/pages/message_center_page/reply/reply_card.dart index 3b58d42e..dbeab8e6 100644 --- a/lib/pages/message_center_page/reply/reply_card.dart +++ b/lib/pages/message_center_page/reply/reply_card.dart @@ -1,6 +1,7 @@ import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/models/message/reply_list_model.dart'; +import 'package:aku_new_community/pages/message_center_page/message_func.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; @@ -12,42 +13,47 @@ class ReplyCard extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( - padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 48.w), - child: Row( - children: [ - ClipOval( - child: Image.network( - API.image(model.img.url), - width: 100.w, - height: 100.w, + return GestureDetector( + onTap: () async { + await MessageFunc.readMessage(model.id); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 48.w), + child: Row( + children: [ + ClipOval( + child: Image.network( + API.image(model.avatar), + width: 100.w, + height: 100.w, + ), ), - ), - 24.w.widthBox, - SizedBox( - width: 350.w, - child: Column( - children: [ - model.title.text.size(26.sp).black.bold.make(), - model.content.text - .size(24.sp) - .color(ktextSubColor) - .maxLines(1) - .ellipsis - .make(), - model.date.text.size(24.sp).color(ktextSubColor).make(), - ], + 24.w.widthBox, + SizedBox( + width: 350.w, + child: Column( + children: [ + model.sendName.text.size(26.sp).black.bold.make(), + model.content.text + .size(24.sp) + .color(ktextSubColor) + .maxLines(1) + .ellipsis + .make(), + model.sendDate.text.size(24.sp).color(ktextSubColor).make(), + ], + ), ), - ), - ClipRRect( - borderRadius: BorderRadius.circular(9.w), - child: Image.network( - API.image(model.pic.url), - width: 128.w, - height: 128.w, + ClipRRect( + borderRadius: BorderRadius.circular(9.w), + child: Image.network( + API.image(model.pic), + width: 128.w, + height: 128.w, + ), ), - ), - ], + ], + ), ), ); } diff --git a/lib/pages/message_center_page/thumbs_up/thumbs_up_card.dart b/lib/pages/message_center_page/thumbs_up/thumbs_up_card.dart index 199d9251..8b4d54da 100644 --- a/lib/pages/message_center_page/thumbs_up/thumbs_up_card.dart +++ b/lib/pages/message_center_page/thumbs_up/thumbs_up_card.dart @@ -2,49 +2,55 @@ import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/models/message/reply_list_model.dart'; +import 'package:aku_new_community/pages/message_center_page/message_func.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; -class thumbs_up_card extends StatelessWidget { +class ThumbsUpCard extends StatelessWidget { final ReplyListModel model; - const thumbs_up_card({Key? key, required this.model}) : super(key: key); + const ThumbsUpCard({Key? key, required this.model}) : super(key: key); @override Widget build(BuildContext context) { - return Container( - padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 48.w), - child: Row( - children: [ - ClipOval( - child: Image.network( - API.image(model.img.url), - width: 100.w, - height: 100.w, + return GestureDetector( + onTap: () async { + await MessageFunc.readMessage(model.id); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 48.w), + child: Row( + children: [ + ClipOval( + child: Image.network( + API.image(model.avatar), + width: 100.w, + height: 100.w, + ), ), - ), - 24.w.widthBox, - SizedBox( - width: 350.w, - child: Column( - children: [ - model.name.text.size(26.sp).black.bold.make(), - Assets.icons.communityLikeIs - .image(width: 28.w, height: 28.w, fit: BoxFit.contain), - model.date.text.size(24.sp).color(ktextSubColor).make(), - ], + 24.w.widthBox, + SizedBox( + width: 350.w, + child: Column( + children: [ + model.sendName.text.size(26.sp).black.bold.make(), + Assets.icons.communityLikeIs + .image(width: 28.w, height: 28.w, fit: BoxFit.contain), + model.sendDate.text.size(24.sp).color(ktextSubColor).make(), + ], + ), ), - ), - ClipRRect( - borderRadius: BorderRadius.circular(9.w), - child: Image.network( - API.image(model.pic.url), - width: 128.w, - height: 128.w, + ClipRRect( + borderRadius: BorderRadius.circular(9.w), + child: Image.network( + API.image(model.pic), + width: 128.w, + height: 128.w, + ), ), - ), - ], + ], + ), ), ); } diff --git a/lib/pages/message_center_page/thumbs_up/thumbs_up_view.dart b/lib/pages/message_center_page/thumbs_up/thumbs_up_view.dart index c4239900..7b9780fb 100644 --- a/lib/pages/message_center_page/thumbs_up/thumbs_up_view.dart +++ b/lib/pages/message_center_page/thumbs_up/thumbs_up_view.dart @@ -1,4 +1,6 @@ -import 'package:aku_new_community/constants/api.dart'; +import 'package:aku_new_community/constants/sars_api.dart'; +import 'package:aku_new_community/models/message/reply_list_model.dart'; +import 'package:aku_new_community/pages/message_center_page/thumbs_up/thumbs_up_card.dart'; import 'package:aku_new_community/pages/things_page/widget/bee_list_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; @@ -6,31 +8,30 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; class ThumbsUpView extends StatefulWidget { - const ThumbsUpView({Key? key}) : super(key: key); + final EasyRefreshController controller; + const ThumbsUpView({Key? key, required this.controller}) : super(key: key); @override _ThumbsUpViewState createState() => _ThumbsUpViewState(); } class _ThumbsUpViewState extends State { - EasyRefreshController _refreshController = EasyRefreshController(); - @override void dispose() { - _refreshController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return BeeListView( - path: API.host, - controller: _refreshController, - convert: (json) => [], + path: SARSAPI.message.allLikes, + controller: widget.controller, + convert: (models) => + models.tableList!.map((e) => ReplyListModel.fromJson(e)).toList(), builder: (items) { return ListView.separated( itemBuilder: (context, index) { - return Container(); + return ThumbsUpCard(model: items[index]); }, separatorBuilder: (_, __) => 20.w.heightBox, itemCount: items.length); diff --git a/lib/pages/personal/user_profile_page.dart b/lib/pages/personal/user_profile_page.dart index 58bb9eee..19400352 100644 --- a/lib/pages/personal/user_profile_page.dart +++ b/lib/pages/personal/user_profile_page.dart @@ -1,7 +1,7 @@ import 'dart:io'; import 'package:aku_new_community/base/base_style.dart'; -import 'package:aku_new_community/constants/api.dart'; +import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/pages/personal/change_nick_name_page.dart'; import 'package:aku_new_community/pages/personal/update_tel_page.dart'; import 'package:aku_new_community/provider/user_provider.dart'; @@ -69,7 +69,7 @@ class _UserProfilePageState extends State { //Upload Avatar Function cancel = BotToast.showLoading(); BaseFileModel model = - await NetUtil().upload(API.upload.uploadAvatar, file); + await NetUtil().upload(SARSAPI.uploadFile.uploadImg, file); if (model.status ?? false) userProvider.updateAvatar(model.url); else diff --git a/lib/pages/sign/login/code_message_page.dart b/lib/pages/sign/login/code_message_page.dart index 689ce75b..09355843 100644 --- a/lib/pages/sign/login/code_message_page.dart +++ b/lib/pages/sign/login/code_message_page.dart @@ -5,9 +5,12 @@ import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; import 'package:sms_autofill/sms_autofill.dart'; import 'package:velocity_x/velocity_x.dart'; +import '../../tab_navigator.dart'; + class CodeMessagePage extends StatefulWidget { final String tel; @@ -85,6 +88,7 @@ class _CodeMessagePageState extends State { await UserTool.userProvider .setLogin(re.data['data'] as int); await UserTool.dataProvider.addHistories(); + Get.offAll(() => TabNavigator()); } else { _errorMessage = re.data['msg']; BotToast.showText(text: re.data['msg']); diff --git a/lib/pages/sign/login/other_login_page.dart b/lib/pages/sign/login/other_login_page.dart index 206dfbe4..755e17b0 100644 --- a/lib/pages/sign/login/other_login_page.dart +++ b/lib/pages/sign/login/other_login_page.dart @@ -16,6 +16,8 @@ import 'package:get/get.dart'; import 'package:provider/provider.dart'; import 'package:velocity_x/velocity_x.dart'; +import '../../tab_navigator.dart'; + class OtherLoginPage extends StatefulWidget { const OtherLoginPage({Key? key}) : super(key: key); @@ -106,6 +108,7 @@ class _OtherLoginPageState extends State { if (response.data['success']) { await UserTool.userProvider.setLogin(response.data['data']); await UserTool.dataProvider.addHistories(); + Get.offAll(() => TabNavigator()); } else { BotToast.showText(text: response.data['message']); } @@ -131,6 +134,10 @@ class _OtherLoginPageState extends State { BotToast.showText(text: '请先选择小区!'); return false; } + if (_currentIndex == 0 && _psd.text.isEmpty) { + BotToast.showText(text: '密码不能为空'); + return false; + } return true; } diff --git a/lib/pages/sign/sign_func.dart b/lib/pages/sign/sign_func.dart index da7cba1e..34a54871 100644 --- a/lib/pages/sign/sign_func.dart +++ b/lib/pages/sign/sign_func.dart @@ -15,8 +15,6 @@ import 'package:dio/dio.dart'; import 'package:get/get.dart' hide Response; import 'package:provider/provider.dart'; -import '../tab_navigator.dart'; - class SignFunc { //发送手机号验证码 static Future sendMessageCode( @@ -169,8 +167,6 @@ class SignFunc { await Get.to(() => SetPsdPage()); } else if (UserTool.userProvider.userInfoModel!.nickName == null) { await Get.to(() => SetNickNamePage()); - } else { - Get.offAll(() => TabNavigator()); } } diff --git a/lib/pages/splash/splash_page.dart b/lib/pages/splash/splash_page.dart index 911e28ef..5fc7e550 100644 --- a/lib/pages/splash/splash_page.dart +++ b/lib/pages/splash/splash_page.dart @@ -20,6 +20,8 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:power_logger/power_logger.dart'; import 'package:provider/provider.dart'; +import '../tab_navigator.dart'; + class SplashPage extends StatefulWidget { SplashPage({Key? key}) : super(key: key); @@ -136,6 +138,7 @@ class _SplashPageState extends State { MainInitialize.initTheme(); MainInitialize.initWechat(); MainInitialize.initWebSocket(); + Get.offAll(() => TabNavigator()); }); } diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index 57df1030..bb6fe7ab 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:aku_new_community/constants/api.dart'; +import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/models/user/my_house_model.dart'; import 'package:aku_new_community/models/user/user_config_model.dart'; import 'package:aku_new_community/models/user/user_info_model.dart'; @@ -161,7 +162,7 @@ class UserProvider extends ChangeNotifier { ///修改头像 Future updateAvatar(String? path) async { BaseModel model = await NetUtil().post( - API.user.udpdateAvatar, + SARSAPI.user.updateAvatar, params: { 'fileUrls': [path] }, diff --git a/lib/ui/market/order/order_card.dart b/lib/ui/market/order/order_card.dart index e19354ec..aaff17c0 100644 --- a/lib/ui/market/order/order_card.dart +++ b/lib/ui/market/order/order_card.dart @@ -1,5 +1,6 @@ import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/constants/api.dart'; +import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/model/order/order_list_model.dart'; import 'package:aku_new_community/pages/life_pay/pay_finish_page.dart'; import 'package:aku_new_community/pages/life_pay/pay_util.dart'; @@ -60,9 +61,9 @@ class _OrderCardState extends State { @override void initState() { super.initState(); - widget.model.myOrderListVoList!.forEach((element) { + widget.model.orderList!.forEach((element) { _goodsList.add(SettlementGoodsDTO( - appGoodsPushId: element.jcookGoodsId, num: element.num)); + appGoodsPushId: element.goodsPushId, num: element.num)); }); } @@ -70,7 +71,7 @@ class _OrderCardState extends State { Function cancel = BotToast.showLoading(); BaseModel baseModel = await NetUtil().post(API.pay.jcookOrderCreateOrder, params: { - "addressId": widget.model.jcookAddressId, + "addressId": widget.model.appGoodsAddressId, "settlementGoodsDTOList": _goodsList.map((v) => v.toJson()).toList(), "payType": 1, //暂时写死 等待后续补充 "payPrice": widget.model.payPrice @@ -105,7 +106,7 @@ class _OrderCardState extends State { if (result == true) { Function cancel = BotToast.showLoading(); BaseModel baseModel = - await NetUtil().get(API.market.deleteOrder, params: { + await NetUtil().get(SARSAPI.market.order.delete, params: { "orderId": widget.model.id, }); if (baseModel.success) { @@ -135,7 +136,7 @@ class _OrderCardState extends State { ); if (result == true) { Function cancel = BotToast.showLoading(); - BaseModel baseModel = await NetUtil().get(API.market.cancelOrder, + BaseModel baseModel = await NetUtil().get(SARSAPI.market.order.cancel, params: {"orderId": widget.model.id, 'cancelReasonCode': 4}); if (baseModel.success) { BotToast.showText(text: '取消成功'); @@ -165,7 +166,7 @@ class _OrderCardState extends State { if (result == true) { Function cancel = BotToast.showLoading(); BaseModel baseModel = - await NetUtil().get(API.market.confirmOrder, params: { + await NetUtil().get(SARSAPI.market.order.confirm, params: { "orderId": widget.model.id, }); if (baseModel.success) { @@ -211,7 +212,7 @@ class _OrderCardState extends State { color: Color(0xFFD9D9D9), ), 16.hb, - ...widget.model.myOrderListVoList!.map((e) => _goodCard(e)), + ...widget.model.orderList!.map((e) => _goodCard(e)), 20.hb, _priceView(), 20.hb, @@ -265,7 +266,7 @@ class _OrderCardState extends State { color: Color(0xFFD9D9D9), ), 16.hb, - ...widget.model.myOrderListVoList!.map((e) => _goodCard(e)), + ...widget.model.orderList!.map((e) => _goodCard(e)), 20.hb, _priceView(), 20.hb, @@ -319,7 +320,7 @@ class _OrderCardState extends State { color: Color(0xFFD9D9D9), ), 16.hb, - ...widget.model.myOrderListVoList!.map((e) => _goodCard(e)), + ...widget.model.orderList!.map((e) => _goodCard(e)), 20.hb, _priceView(), 20.hb, @@ -379,7 +380,7 @@ class _OrderCardState extends State { color: Color(0xFFD9D9D9), ), 16.hb, - ...widget.model.myOrderListVoList!.map((e) => _goodCard(e)), + ...widget.model.orderList!.map((e) => _goodCard(e)), 20.hb, _priceView(), 20.hb, @@ -433,7 +434,7 @@ class _OrderCardState extends State { color: Color(0xFFD9D9D9), ), 16.hb, - ...widget.model.myOrderListVoList!.map((e) => _goodCard(e)), + ...widget.model.orderList!.map((e) => _goodCard(e)), 20.hb, _priceView(), 20.hb, @@ -487,7 +488,7 @@ class _OrderCardState extends State { color: Color(0xFFD9D9D9), ), 16.hb, - ...widget.model.myOrderListVoList!.map((e) => _goodCard(e)), + ...widget.model.orderList!.map((e) => _goodCard(e)), 20.hb, _priceView(), 20.hb, diff --git a/lib/ui/market/order/order_detail_page.dart b/lib/ui/market/order/order_detail_page.dart index da550dc6..986d82d9 100644 --- a/lib/ui/market/order/order_detail_page.dart +++ b/lib/ui/market/order/order_detail_page.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/const/resource.dart'; import 'package:aku_new_community/constants/api.dart'; +import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/model/order/logistics_model.dart'; import 'package:aku_new_community/model/order/order_list_model.dart'; import 'package:aku_new_community/pages/life_pay/pay_util.dart'; @@ -56,7 +57,7 @@ class _OrderDetailPageState extends State { Function cancel = BotToast.showLoading(); BaseModel baseModel = await NetUtil().post(API.pay.jcookOrderCreateOrder, params: { - "addressId": widget.orderModel.jcookAddressId, + "addressId": widget.orderModel.appGoodsAddressId, "settlementGoodsDTOList": _goodsList.map((v) => v.toJson()).toList(), "payType": 1, //暂时写死 等待后续补充 "payPrice": widget.orderModel.payPrice @@ -93,7 +94,7 @@ class _OrderDetailPageState extends State { if (result == true) { Function cancel = BotToast.showLoading(); BaseModel baseModel = - await NetUtil().get(API.market.deleteOrder, params: { + await NetUtil().get(SARSAPI.market.order.delete, params: { "orderId": widget.orderModel.id, }); if (baseModel.success) { @@ -124,7 +125,7 @@ class _OrderDetailPageState extends State { ); if (result == true) { Function cancel = BotToast.showLoading(); - BaseModel baseModel = await NetUtil().get(API.market.cancelOrder, + BaseModel baseModel = await NetUtil().get(SARSAPI.market.order.cancel, params: {"orderId": widget.orderModel.id, 'cancelReasonCode': 4}); if (baseModel.success) { BotToast.showText(text: '取消成功'); @@ -155,7 +156,7 @@ class _OrderDetailPageState extends State { if (result == true) { Function cancel = BotToast.showLoading(); BaseModel baseModel = - await NetUtil().get(API.market.confirmOrder, params: { + await NetUtil().get(SARSAPI.market.order.confirm, params: { "orderId": widget.orderModel.id, }); if (baseModel.success) { @@ -170,9 +171,9 @@ class _OrderDetailPageState extends State { @override void initState() { super.initState(); - widget.orderModel.myOrderListVoList!.forEach((element) { + widget.orderModel.orderList!.forEach((element) { _goodsList.add(SettlementGoodsDTO( - appGoodsPushId: element.jcookGoodsId, num: element.num)); + appGoodsPushId: element.goodsPushId, num: element.num)); }); if (widget.orderModel.tradeStatus == 0) { timer = Timer.periodic(Duration(seconds: 1), (Timer t) => _checkTime()); @@ -294,7 +295,7 @@ class _OrderDetailPageState extends State { ), child: Column( children: [ - ...widget.orderModel.myOrderListVoList!.map((e) => _goodCard(e)), + ...widget.orderModel.orderList!.map((e) => _goodCard(e)), _priceView(), ], ), @@ -544,8 +545,8 @@ class _OrderDetailPageState extends State { Spacer(), LineButton( onPressed: () async { - BaseModel baseModel = - await NetUtil().get(API.market.findLogistics, params: { + BaseModel baseModel = await NetUtil() + .get(SARSAPI.market.order.findLogistics, params: { "orderId": widget.orderModel.id, }); if (baseModel.success == true && baseModel.data != null) { @@ -555,7 +556,7 @@ class _OrderDetailPageState extends State { if (logisticsModels.isNotEmpty) { Get.to(() => LogisticsPage( models: logisticsModels, - goods: widget.orderModel.myOrderListVoList!.first, + goods: widget.orderModel.orderList!.first, orderModel: widget.orderModel)); } else { BotToast.showText(text: '未获取到物流信息'); diff --git a/lib/ui/market/order/order_view.dart b/lib/ui/market/order/order_view.dart index 3632fad3..42139a49 100644 --- a/lib/ui/market/order/order_view.dart +++ b/lib/ui/market/order/order_view.dart @@ -1,4 +1,4 @@ -import 'package:aku_new_community/constants/api.dart'; +import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/model/order/order_list_model.dart'; import 'package:aku_new_community/pages/things_page/widget/bee_list_view.dart'; import 'package:flutter/material.dart'; @@ -34,7 +34,7 @@ class _OrderViewState extends State { @override Widget build(BuildContext context) { return BeeListView( - path: API.market.myOrder, + path: SARSAPI.market.order.myOrder, controller: _refreshController, extraParams: {"tradeStatus": widget.index, 'orderCode': null}, convert: (models) { diff --git a/lib/widget/picker/bee_city_picker.dart b/lib/widget/picker/bee_city_picker.dart index 30a39b45..645c1262 100644 --- a/lib/widget/picker/bee_city_picker.dart +++ b/lib/widget/picker/bee_city_picker.dart @@ -39,9 +39,9 @@ class _BeeCityPickerState extends State { ? ChinaRegionModel.empty(_pickedCity.id) : districts[_pickedDistrictIndex]; - List get cities => _pickedProvince.cityList; + List get cities => _pickedProvince.cityList ?? []; - List get districts => _pickedCity.cityList; + List get districts => _pickedCity.cityList ?? []; final FixedExtentScrollController _cityController = FixedExtentScrollController();