对接:电子商务获取分类信息

hmxc
张萌 4 years ago
parent 9ef282b2ae
commit 19af701c61

@ -236,6 +236,18 @@ class _Manager {
/// ///
String get recordAlarmInfo => '/user/alarm/insertAlarmRecord'; String get recordAlarmInfo => '/user/alarm/insertAlarmRecord';
///app(app)
String get electronicCommercCategory =>
'/user/electronicCommerce/categoryList';
///appid
String get electronicCommercList =>
'/user/electronicCommerce/electronicCommerceList';
///appid
String get electronicCommercDetail =>
'/user/electronicCommerce/findElectronicCommerceById';
} }
class _Community { class _Community {

@ -0,0 +1,19 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
part 'electronic_commerc_category_model.g.dart';
@JsonSerializable()
class ElectronicCommercCategoryModel extends Equatable {
final int id;
final String name;
ElectronicCommercCategoryModel({
required this.id,
required this.name,
});
factory ElectronicCommercCategoryModel.fromJson(Map<String, dynamic> json) =>
_$ElectronicCommercCategoryModelFromJson(json);
@override
List<Object> get props => [id, name];
}

@ -0,0 +1,15 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'electronic_commerc_category_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
ElectronicCommercCategoryModel _$ElectronicCommercCategoryModelFromJson(
Map<String, dynamic> json) {
return ElectronicCommercCategoryModel(
id: json['id'] as int,
name: json['name'] as String,
);
}

@ -0,0 +1,37 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
part 'electronic_commerc_detail_model.g.dart';
@JsonSerializable()
class ElectronicCommercDetailModel extends Equatable {
final int id;
final String title;
final String code;
final String content;
final String electronicCommerceCategoryName;
final String createName;
final String createDate;
ElectronicCommercDetailModel({
required this.id,
required this.title,
required this.code,
required this.content,
required this.electronicCommerceCategoryName,
required this.createName,
required this.createDate,
});
factory ElectronicCommercDetailModel.fromJson(Map<String, dynamic> json) =>
_$ElectronicCommercDetailModelFromJson(json);
@override
List<Object> get props {
return [
id,
title,
code,
content,
electronicCommerceCategoryName,
createName,
createDate,
];
}
}

@ -0,0 +1,21 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'electronic_commerc_detail_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
ElectronicCommercDetailModel _$ElectronicCommercDetailModelFromJson(
Map<String, dynamic> json) {
return ElectronicCommercDetailModel(
id: json['id'] as int,
title: json['title'] as String,
code: json['code'] as String,
content: json['content'] as String,
electronicCommerceCategoryName:
json['electronicCommerceCategoryName'] as String,
createName: json['createName'] as String,
createDate: json['createDate'] as String,
);
}

@ -0,0 +1,24 @@
import 'package:equatable/equatable.dart';
import 'package:aku_community/model/common/img_model.dart';
import 'package:json_annotation/json_annotation.dart';
part 'electronic_commerc_list_model.g.dart';
@JsonSerializable()
class ElectronicCommercListModel extends Equatable {
final int id;
final String title;
final String createDate;
final List<ImgModel> imgList;
ElectronicCommercListModel({
required this.id,
required this.title,
required this.createDate,
required this.imgList,
});
factory ElectronicCommercListModel.fromJson(Map<String, dynamic> json) =>
_$ElectronicCommercListModelFromJson(json);
@override
List<Object> get props => [id, title, createDate, imgList];
}

@ -0,0 +1,19 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'electronic_commerc_list_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
ElectronicCommercListModel _$ElectronicCommercListModelFromJson(
Map<String, dynamic> json) {
return ElectronicCommercListModel(
id: json['id'] as int,
title: json['title'] as String,
createDate: json['createDate'] as String,
imgList: (json['imgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);
}

@ -1,7 +1,15 @@
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/pages/electronic_commerc/electronic_commerc_view.dart'; import 'package:aku_community/pages/electronic_commerc/electronic_commerc_view.dart';
import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart'; import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:aku_community/extensions/num_ext.dart';
import 'package:aku_community/models/electronic_commerc/electronic_commerc_category_model.dart';
class ElectronicCommercPage extends StatefulWidget { class ElectronicCommercPage extends StatefulWidget {
ElectronicCommercPage({Key? key}) : super(key: key); ElectronicCommercPage({Key? key}) : super(key: key);
@ -12,25 +20,30 @@ class ElectronicCommercPage extends StatefulWidget {
class _ElectronicCommercPageState extends State<ElectronicCommercPage> class _ElectronicCommercPageState extends State<ElectronicCommercPage>
with TickerProviderStateMixin { with TickerProviderStateMixin {
List<String> _tabs = [ List<String> _tabs = [''];
'小区教育',
'健康运动',
'家政服务',
'居家养老',
'装修服务',
'物业租售',
'网上商城',
'代购代送',
'网上询价',
'网上采购',
'商品退换',
'质量投诉'
];
late TabController _tabController; late TabController _tabController;
bool _onloading = true;
late List<ElectronicCommercCategoryModel> _models;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_tabController = TabController(length: _tabs.length, vsync: this); _tabController = TabController(length: _tabs.length, vsync: this);
Future.delayed(
Duration(
milliseconds: 0,
), () async {
BaseModel baseModel =
await NetUtil().get(API.manager.electronicCommercCategory);
if (baseModel.status == true && baseModel.data != null) {
_models = (baseModel.data as List)
.map((e) => ElectronicCommercCategoryModel.fromJson(e))
.toList();
_tabs = List.generate(_models.length, (index) => _models[index].name);
_onloading = false;
_tabController = TabController(length: _tabs.length, vsync: this);
setState(() {});
}
});
} }
@override @override
@ -52,11 +65,58 @@ class _ElectronicCommercPageState extends State<ElectronicCommercPage>
controller: _tabController, controller: _tabController,
children: List.generate( children: List.generate(
_tabs.length, _tabs.length,
(index) => ElectronicCommercView( (index) => _onloading
index: index, ? ListView(
), children: [_buildShimmer()],
)
: ElectronicCommercView(
index: index,
),
), ),
), ),
); );
} }
_buildShimmer() {
return Padding(
padding: EdgeInsets.all(32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Shimmer.fromColors(
baseColor: Colors.black12,
highlightColor: Colors.white10,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VxBox().height(53.w).width(152.w).color(Colors.white).make(),
30.hb,
VxBox().height(40.w).width(600.w).color(Colors.white).make(),
24.hb,
VxBox().height(33.w).width(263.w).color(Colors.white).make(),
50.hb,
VxBox().height(53.w).width(152.w).color(Colors.white).make(),
30.hb,
VxBox().height(40.w).width(600.w).color(Colors.white).make(),
24.hb,
VxBox().height(33.w).width(263.w).color(Colors.white).make(),
],
),
),
// Divider(
// height: 50.w,
// thickness: 1.w,
// color: Color(0xFFD8D8D8),
// ),
// GridView.count(
// crossAxisCount: 2,
// children: [
// VxBox().height(53.w).width(53.w).color(Colors.white).make(),
// ],
// )
],
),
);
}
} }

@ -18,7 +18,6 @@ import 'package:aku_community/provider/user_provider.dart';
import 'package:aku_community/utils/developer_util.dart'; import 'package:aku_community/utils/developer_util.dart';
import 'package:aku_community/utils/hive_store.dart'; import 'package:aku_community/utils/hive_store.dart';
//TODO splashPage
class SplashPage extends StatefulWidget { class SplashPage extends StatefulWidget {
SplashPage({Key? key}) : super(key: key); SplashPage({Key? key}) : super(key: key);

Loading…
Cancel
Save