diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index fffaf3b..d0640e1 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -620,7 +620,7 @@ "languageVersion": "2.8" } ], - "generated": "2020-10-16T06:45:33.016683Z", + "generated": "2020-10-17T09:07:26.676256Z", "generator": "pub", "generatorVersion": "2.8.2" } diff --git a/example/ios/Runner/AppDelegate.m b/example/ios/Runner/AppDelegate.m index dd6f455..225bb80 100644 --- a/example/ios/Runner/AppDelegate.m +++ b/example/ios/Runner/AppDelegate.m @@ -1,6 +1,7 @@ #import "AppDelegate.h" #import "GeneratedPluginRegistrant.h" #import +#import @implementation AppDelegate @@ -32,4 +33,31 @@ }; } +#pragma mark -- 第三方应用跳转 +- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{ + // 如果百川处理过会返回YES + if (![[AlibcTradeSDK sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation]) { + return YES; + } + return NO; +} + + +//IOS9.0 系统新的处理openURL 的API +- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options { + + + if (@available(iOS 9.0, *)) { + __unused BOOL isHandledByALBBSDK=[[AlibcTradeSDK sharedInstance] application:application openURL:url options:options]; + return isHandledByALBBSDK; + } else { + // Fallback on earlier versions + }//处理其他app跳转到自己的app,如果百川处理过会返回YES + + return NO; + + +} + + @end diff --git a/lib/pages/feedback_page/feedback_page.dart b/lib/pages/feedback_page/feedback_page.dart new file mode 100644 index 0000000..f66b956 --- /dev/null +++ b/lib/pages/feedback_page/feedback_page.dart @@ -0,0 +1,343 @@ +import 'dart:io'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:zhiying_base_widget/pages/feedback_page/feedback_record_page.dart'; +import 'package:zhiying_base_widget/pages/feedback_page/widgets/feedback_image.dart'; +import 'package:zhiying_base_widget/pages/feedback_page/widgets/feedback_tab_widget.dart'; +import 'package:zhiying_base_widget/widgets/others/action_selected_alert/action_selected_alert.dart'; +import 'package:zhiying_comm/util/log/let_log.dart'; + +class FeedbackPage extends StatefulWidget { + @override + _FeedbackPageState createState() => _FeedbackPageState(); +} + +class _FeedbackPageState extends State { + List _images = List(); + bool _submitable = false; + TextEditingController _feedback = TextEditingController(); + + @override + void dispose() { + _feedback.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + appBar: _createNav(), + body: GestureDetector( + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: SafeArea( + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + children: [ + Container( + width: double.infinity, + margin: EdgeInsets.only( + top: 10, bottom: 10, left: 12.5, right: 12.5), + padding: EdgeInsets.all(12.5), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(7.5)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + _createTitle(), + _createUpload(), + _createSubmit(), + ], + ), + ) + ], + ), + ), + ), + Center( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.push( + context, + CupertinoPageRoute( + builder: (_) => FeedbackRecordPage(), + ), + ); + }, + child: Container( + width: 120, + height: 30, + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15)), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.only(right: 6), + child: Icon( + Icons.list, + size: 12, + ), + ), + Text( + '反馈记录', + style: + TextStyle(fontSize: 13, color: Color(0xff333333)), + ) + ], + ), + ), + ), + ), + ], + ), + ), + ), + ); + } + + // 导航栏 + Widget _createNav() { + return CupertinoNavigationBar( + border: Border( + bottom: BorderSide( + width: 0.0, // One physical pixel. + style: BorderStyle.none, + ), + ), + backgroundColor: Colors.white, + leading: Navigator.canPop(context) + ? GestureDetector( + child: Container( + padding: EdgeInsets.zero, + child: Icon( + Icons.arrow_back_ios, + size: 20, + ), + ), + onTap: () { + if (Navigator.canPop(context)) { + Navigator.pop(context); + } + }, + ) + : Container(), + middle: Text( + '意见反馈', + style: TextStyle( + fontSize: 15, + color: Color(0xff333333), + ), + ), + ); + } + + Widget _createTitle() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + '反馈描述', + style: TextStyle( + fontSize: 14, + color: Color(0xff333333), + fontWeight: FontWeight.bold, + ), + ), + Padding( + padding: EdgeInsets.only(top: 4, bottom: 4), + child: Row( + children: List.generate( + 3, + (index) => Expanded( + child: Container( + margin: EdgeInsets.only(left: 2, right: 2), + height: 28, + child: FeedbackTabWidget('功能异常')), + )), + ), + ), + Container( + height: 118, + margin: EdgeInsets.only(left: 2, right: 2, top: 4, bottom: 4), + child: CupertinoTextField( + controller: _feedback, + textAlignVertical: TextAlignVertical.top, + style: TextStyle(fontSize: 12, color: Color(0xff333333)), + maxLines: null, + placeholder: '请输入您的意见(最多100个字)', + placeholderStyle: TextStyle( + fontSize: 12, + color: Color(0xff999999), + ), + decoration: BoxDecoration( + color: Color(0xfff9f9f9), + borderRadius: BorderRadius.circular(7.5)), + onChanged: (value) { + if (value == null || value == '') { + _submitable = false; + } else { + _submitable = true; + } + setState(() {}); + }, + ), + ), + ], + ); + } + + Widget _createUpload() { + List images = List(); + _images.forEach((file) { + images.add(Container( + margin: EdgeInsets.only(top: 4, bottom: 4, right: 8), + width: 80, + height: 80, + child: FeedbackImageWidget( + file: file, + onDelete: () { + _images.remove(file); + setState(() {}); + }, + ), + )); + }); + if (images.length < 4) { + images.add(GestureDetector( + child: Container( + margin: EdgeInsets.only(top: 4, bottom: 4), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(7.5), + color: Color(0xfff9f9f9)), + height: 80, + width: 80, + child: Icon( + Icons.add, + size: 60, + color: Color(0xffd8d8d8), + ), + ), + onTap: _onAddImage, + )); + } + + return Column( + children: [ + Row( + children: [ + Padding( + padding: EdgeInsets.only(right: 10, top: 4, bottom: 4), + child: Text( + '上传图片', + style: TextStyle( + fontSize: 14, + color: Color(0xff333333), + fontWeight: FontWeight.bold, + ), + ), + ), + Text( + '最多上传4张,大小不超过1M/张', + style: TextStyle( + fontSize: 12, + color: Color(0xff999999), + ), + ), + ], + ), + Row( + children: images, + ) + ], + ); + } + + Widget _createSubmit() { + return GestureDetector( + onTap: () { + if (!_submitable) { + return; + } + Logger.debug('提交:${_feedback.text.toString()}'); + }, + child: Container( + margin: EdgeInsets.only(top: 24, bottom: 4), + height: 45, + decoration: BoxDecoration( + color: _submitable ? Colors.redAccent : Color(0xffffe1e1), + borderRadius: BorderRadius.circular(7.5), + ), + child: Center( + child: Text( + '提交意见', + style: TextStyle( + fontSize: 14, + color: Colors.white, + ), + ), + ), + ), + ); + } + + void _onAddImage() async { + if (_images.length >= 4) { + Fluttertoast.showToast(msg: '最多上传4张图片'); + return; + } + + var status = await Permission.photos.status; + if (status != PermissionStatus.granted) { + status = await Permission.photos.request(); + } + if (status == PermissionStatus.denied) { + Fluttertoast.showToast(msg: '暂无权限,图片选择失败'); + return null; + } + + final picker = ImagePicker(); + PickedFile file; + int index = await showModalBottomSheet( + context: context, + builder: (context) { + return ActionSelectedAlert( + // title: '拍照/选择图片', + actions: ['拍照', '从相册选择图片'], + ); + }, + isScrollControlled: false, + backgroundColor: Colors.transparent); + if (index != null) { + if (index == 0) { + file = await picker.getImage(source: ImageSource.camera); + } else { + file = await picker.getImage(source: ImageSource.gallery); + } + + if (file == null) return; + + setState(() { + _images.add(File(file.path)); + }); + + // File resultFile = await EncodeUtil.compressImage(file, 800); + } + } +} diff --git a/lib/pages/feedback_page/feedback_record_page.dart b/lib/pages/feedback_page/feedback_record_page.dart new file mode 100644 index 0000000..5e307c0 --- /dev/null +++ b/lib/pages/feedback_page/feedback_record_page.dart @@ -0,0 +1,65 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:zhiying_base_widget/pages/feedback_page/widgets/feedback_record_item.dart'; + +class FeedbackRecordPage extends StatefulWidget { + @override + _FeedbackRecordPageState createState() => _FeedbackRecordPageState(); +} + +class _FeedbackRecordPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: _createNav(), + body: GestureDetector( + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: SafeArea( + child: ListView.builder( + itemCount: 10, + itemBuilder: (context, index) { + return FeedbackRecordItem(); + }), + ), + ), + ); + } + + // 导航栏 + Widget _createNav() { + return CupertinoNavigationBar( + border: Border( + bottom: BorderSide( + width: 0.0, // One physical pixel. + style: BorderStyle.none, + ), + ), + backgroundColor: Colors.white, + leading: Navigator.canPop(context) + ? GestureDetector( + child: Container( + padding: EdgeInsets.zero, + child: Icon( + Icons.arrow_back_ios, + size: 20, + ), + ), + onTap: () { + if (Navigator.canPop(context)) { + Navigator.pop(context); + } + }, + ) + : Container(), + middle: Text( + '反馈列表', + style: TextStyle( + fontSize: 15, + color: Color(0xff333333), + ), + ), + ); + } +} diff --git a/lib/pages/feedback_page/widgets/feedback_image.dart b/lib/pages/feedback_page/widgets/feedback_image.dart new file mode 100644 index 0000000..f0c7b97 --- /dev/null +++ b/lib/pages/feedback_page/widgets/feedback_image.dart @@ -0,0 +1,46 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; + +class FeedbackImageWidget extends StatelessWidget { + final File file; + final VoidCallback onDelete; + + const FeedbackImageWidget({Key key, this.file, this.onDelete}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return Stack( + alignment: Alignment.topRight, + children: [ + Container( + width: double.infinity, + height: double.infinity, + child: Image.file( + file, + fit: BoxFit.cover, + ), + ), + GestureDetector( + onTap: onDelete, + child: Transform.translate( + offset: Offset(4, -4), + child: Container( + width: 16, + height: 16, + decoration: BoxDecoration( + color: Colors.redAccent, + borderRadius: BorderRadius.circular(8)), + child: Icon( + Icons.remove, + color: Colors.white, + size: 10, + ), + ), + ), + ) + ], + ); + } +} diff --git a/lib/pages/feedback_page/widgets/feedback_record_item.dart b/lib/pages/feedback_page/widgets/feedback_record_item.dart new file mode 100644 index 0000000..6e08064 --- /dev/null +++ b/lib/pages/feedback_page/widgets/feedback_record_item.dart @@ -0,0 +1,108 @@ +import 'package:flutter/material.dart'; + +class FeedbackRecordItem extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4), + padding: EdgeInsets.all(15), + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(7.5), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _createTitle(), + _createDesc(), + _createImage(), + _createTime(), + ], + ), + ), + Container( + width: 60, + height: 60, + decoration: BoxDecoration( + color: Colors.green, + borderRadius: BorderRadius.circular(30), + ), + ) + ], + ), + ); + } + + Widget _createTitle() { + List list = List(); + + list.add(WidgetSpan( + child: Container( + padding: EdgeInsets.only(left: 2, right: 2, top: 3, bottom: 3), + margin: EdgeInsets.only(right: 4), + child: Text( + '功能异常', + style: TextStyle( + fontSize: 9, + height: 1, + // color: HexColor.fromHex(style.providerNameColor), + color: Colors.white, + ), + ), + decoration: BoxDecoration( + color: Colors.redAccent, borderRadius: BorderRadius.circular(2.5)), + ), + )); + + list.add(TextSpan( + text: '关于关闭提现功能的反馈', + style: TextStyle( + fontSize: 14, color: Color(0xff333333), fontWeight: FontWeight.bold), + )); + return RichText( + maxLines: 2, + overflow: TextOverflow.ellipsis, + text: TextSpan(children: list), + ); + } + + Widget _createDesc() { + return Container( + child: Text( + '我今天想使用我的提现功能的时候,发现官方已经把这个功能给暂时关闭了,所以我很伤心,不开心不开心不开心,所以我很伤心,不开心不开心不开心', + style: TextStyle(fontSize: 11, color: Color(0xff999999)), + ), + ); + } + + Widget _createImage() { + return Container( + margin: EdgeInsets.only(top: 4, bottom: 4), + child: Wrap( + children: [ + Container( + width: 60, + height: 60, + color: Colors.redAccent, + ), + ], + ), + ); + } + + Widget _createTime() { + return Container( + child: Text( + '2020-06-23 01:00:06', + style: TextStyle(fontSize: 11, color: Color(0xffd8d8d8)), + ), + ); + } +} diff --git a/lib/pages/feedback_page/widgets/feedback_tab_widget.dart b/lib/pages/feedback_page/widgets/feedback_tab_widget.dart new file mode 100644 index 0000000..1408417 --- /dev/null +++ b/lib/pages/feedback_page/widgets/feedback_tab_widget.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; + +class FeedbackTabWidget extends StatelessWidget { + final bool isSelected; + final String title; + + const FeedbackTabWidget(this.title, {Key key, this.isSelected = false}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2.5), + border: Border.all( + color: isSelected ? Colors.redAccent : Color(0xffe7e7e7), + width: 1, + ), + ), + child: Center( + child: Text( + title ?? '', + style: TextStyle( + fontSize: 12, + color: isSelected ? Colors.redAccent : Color(0xff999999), + ), + ), + ), + ); + } +} diff --git a/lib/pages/mine_detail_page/mine_detail_page.dart b/lib/pages/mine_detail_page/mine_detail_page.dart index a748c16..89db894 100644 --- a/lib/pages/mine_detail_page/mine_detail_page.dart +++ b/lib/pages/mine_detail_page/mine_detail_page.dart @@ -7,6 +7,7 @@ import 'package:fluttertoast/fluttertoast.dart'; import 'package:image_cropper/image_cropper.dart'; import 'package:image_picker/image_picker.dart'; import 'package:intl/intl.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:zhiying_base_widget/dialog/loading/loading.dart'; import 'package:zhiying_base_widget/pages/mine_detail_page/mine_detail_bloc.dart'; import 'package:zhiying_base_widget/pages/mine_detail_page/models/mine_detail_model.dart'; @@ -277,6 +278,15 @@ class _MineDetailContainerState extends State<_MineDetailContainer> { } void _selectImage() async { + var status = await Permission.photos.status; + if (status != PermissionStatus.granted) { + status = await Permission.photos.request(); + } + if (status == PermissionStatus.denied) { + Fluttertoast.showToast(msg: '暂无权限,图片选择失败'); + return null; + } + final picker = ImagePicker(); PickedFile file; int index = await showModalBottomSheet( diff --git a/lib/pages/setting_page/setting_page.dart b/lib/pages/setting_page/setting_page.dart index 09245dd..03236c8 100644 --- a/lib/pages/setting_page/setting_page.dart +++ b/lib/pages/setting_page/setting_page.dart @@ -61,9 +61,10 @@ class _SettingContainerState extends State<_SettingContainer> { return _createSection(list); })?.toList() ?? []); - widgets.add(Provider.of(context).userInfo == null - ? Container() - : _createLogout()); + UserInfoModel user = Provider.of(context).userInfo; + if (user != null && (user.token != null && user.token != '')) { + widgets.add(_createLogout()); + } return Scaffold( backgroundColor: Color(0xfff9f9f9), diff --git a/lib/pages/test_page/test_page.dart b/lib/pages/test_page/test_page.dart deleted file mode 100644 index a3e6f5b..0000000 --- a/lib/pages/test_page/test_page.dart +++ /dev/null @@ -1,77 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_item_single.dart'; -import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_model.dart'; -import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_style_model.dart'; -import 'package:zhiying_comm/util/net_util.dart'; - -class TestPage extends StatefulWidget { - @override - _TestPageState createState() => _TestPageState(); -} - -class _TestPageState extends State { - List _goods; - HomeGoodsStyleModel _styleModel; - - @override - void initState() { - // NetUtil.request('/api/v1/rec/featured?page=3', method: NetMethod.GET, - // onSuccess: (data) { - // List goods = data['good']; - // _styleModel = HomeGoodsStyleModel( - // listColumn: '1', - // // recommendList, - // providerNameColor: '#ffffff', - // providerNameBackgroundColor: '#ff4242', - // shopNameColor: '#ffffff', - // shopIcon: '', - // couponFontColor: '#ffffff', - // couponBgColor: '#ff4242', - // commissionFontColor: '#ffffff', - // commissionBgColor: '#ff4242', - // marketPriceColor: '#ffffff', - // currentPriceColor: '#ff4242', - // ); - // _goods = goods.map((e) { - // return HomeGoodsModel.fromJson(Map.from(e)); - // }).toList(); - // setState(() {}); - // }); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text('测试'), - ), - body: Container(), - // body: CustomScrollView( - // slivers: [ - // SliverFixedExtentList( - // itemExtent: 200.0, - // delegate: new SliverChildBuilderDelegate( - // (BuildContext context, int index) { - // //创建列表项 - // return HomeGoodsItemSingle( - // _goods[index % _goods.length], _styleModel); - // }, - // childCount: (_goods?.length ?? 0) * 2000, //50个列表项 - // ), - // ), - // // SliverToBoxAdapter( - // // child: ListView.builder( - // // shrinkWrap: true, - // // physics: NeverScrollableScrollPhysics(), - // // itemCount: (_goods?.length ?? 0) * 20, - // // itemBuilder: (context, index) { - // // return HomeGoodsItemSingle( - // // _goods[index % _goods.length], _styleModel); - // // }), - // // ) - // ], - // )); - ); - } -} diff --git a/lib/pages/wechat_teacher_page/wechat_teacher_page.dart b/lib/pages/wechat_teacher_page/wechat_teacher_page.dart new file mode 100644 index 0000000..5f7adbe --- /dev/null +++ b/lib/pages/wechat_teacher_page/wechat_teacher_page.dart @@ -0,0 +1,168 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:zhiying_base_widget/pages/wechat_teacher_page/widgets/wechat_teacher_item.dart'; + +// 微信导师 +class WechatTeacherPage extends StatefulWidget { + @override + _WechatTeacherPageState createState() => _WechatTeacherPageState(); +} + +class _WechatTeacherPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: _createNav(), + body: SafeArea( + child: SingleChildScrollView( + child: Column( + children: [ + _createHeader(), + _createWechat(), + ], + ), + ), + ), + ); + } + + // 导航栏 + Widget _createNav() { + return CupertinoNavigationBar( + border: Border( + bottom: BorderSide( + width: 0.0, // One physical pixel. + style: BorderStyle.none, + ), + ), + backgroundColor: Colors.white, + leading: Navigator.canPop(context) + ? GestureDetector( + child: Container( + padding: EdgeInsets.zero, + child: Icon( + Icons.arrow_back_ios, + size: 20, + ), + ), + onTap: () { + if (Navigator.canPop(context)) { + Navigator.pop(context); + } + }, + ) + : Container(), + middle: Text( + '微信导师', + style: TextStyle( + fontSize: 15, + color: Color(0xff333333), + ), + ), + ); + } + + Widget _createHeader() { + return Container( + width: double.infinity, + height: 283, + child: Stack( + children: [ + Container( + width: double.infinity, + height: 185, + color: Colors.redAccent, + ), + Align( + alignment: Alignment.bottomCenter, + child: Container( + width: double.infinity, + height: 138, + margin: EdgeInsets.only(left: 10, right: 10), + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '我的导师', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 15, + color: Color(0xff333333), + ), + ), + Container( + margin: EdgeInsets.only(top: 8, bottom: 2), + child: CupertinoTextField( + placeholder: '请填写邀请人邀请码/手机号码', + placeholderStyle: TextStyle(fontSize: 14), + decoration: BoxDecoration(), + ), + ), + Container( + height: 0.5, + color: Color(0xffd5d5d5), + ), + Center( + child: Container( + margin: EdgeInsets.only(top: 10), + width: 130, + height: 30, + decoration: BoxDecoration( + color: Colors.redAccent, + borderRadius: BorderRadius.circular(15)), + child: Center( + child: Text( + '绑定邀请人', + style: TextStyle(color: Colors.white, fontSize: 14), + ), + ), + ), + ) + ], + ), + ), + ), + ], + ), + ); + } + + Widget _createWechat() { + return Container( + width: double.infinity, + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '官方微信', + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + ), + ), + WechatTeachetItem(), + Container( + margin: EdgeInsets.only(top: 4, bottom: 4), + width: double.infinity, + height: 0.5, + color: Color(0xffebebeb), + ), + WechatTeachetItem(), + ], + ), + ); + } +} diff --git a/lib/pages/wechat_teacher_page/widgets/wechat_teacher_item.dart b/lib/pages/wechat_teacher_page/widgets/wechat_teacher_item.dart new file mode 100644 index 0000000..cd6e91a --- /dev/null +++ b/lib/pages/wechat_teacher_page/widgets/wechat_teacher_item.dart @@ -0,0 +1,67 @@ +import 'package:flutter/material.dart'; + +class WechatTeachetItem extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(top: 8, bottom: 8), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '微信公众号 智莺生活公众号', + style: TextStyle( + fontSize: 14, + color: Color(0xff3c3c3c), + fontWeight: FontWeight.bold, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 8.0, bottom: 8), + child: Text( + '微信号:5645434', + style: TextStyle( + fontSize: 13, + color: Color(0xffff5050), + fontWeight: FontWeight.bold), + ), + ), + UnconstrainedBox( + child: Container( + decoration: BoxDecoration( + color: Color(0xffffdada), + borderRadius: BorderRadius.circular(20), + ), + padding: + EdgeInsets.only(left: 9, right: 9, top: 4, bottom: 4), + child: Text( + '长按保存二维码', + style: TextStyle(fontSize: 13, color: Color(0xffff0000)), + ), + ), + ), + ], + ), + ), + Column( + children: [ + Container( + margin: EdgeInsets.only(bottom: 4), + width: 55, + height: 55, + color: Colors.redAccent, + ), + Text( + '长按保存二维码', + style: TextStyle(fontSize: 12, color: Color(0xff999999)), + ), + ], + ) + ], + ), + ); + } +} diff --git a/lib/pages/withdraw_page/bloc/withdraw_bloc.dart b/lib/pages/withdraw_page/bloc/withdraw_bloc.dart index 41593aa..221e20c 100644 --- a/lib/pages/withdraw_page/bloc/withdraw_bloc.dart +++ b/lib/pages/withdraw_page/bloc/withdraw_bloc.dart @@ -18,9 +18,32 @@ class WithdrawBloc extends BlocBase { _dataController = null; } - void refresh() { - NetUtil.request('/api/v1/config.json', onSuccess: (data) { - _dataController.add(model); + void loadData(String skipIdentifier) async { + NetUtil.request('/api/v1/mod/${skipIdentifier.toString()}', + method: NetMethod.GET, onCache: (data) { + _loadData(data); + }, onSuccess: (data) { + _loadData(data); }); } + + void _loadData(dynamic data) { + try { + Map json = Map.from(data); + if (json == null || json.length == 0) { + return; + } + // List mods = json['mod_list']; + // if (mods.first != null) { + // json = Map.from(mods.first); + // String d = json['data']; + // Map da = + // Map.from(convert.jsonDecode(d)); + // _model = SecurityBindAlipayModel.fromJson(da); + // _dataController.add(_model); + // } + } catch (err) { + Logger.error(err); + } + } } diff --git a/lib/pages/withdraw_page/withdraw_page.dart b/lib/pages/withdraw_page/withdraw_page.dart index dd30c91..68194e6 100644 --- a/lib/pages/withdraw_page/withdraw_page.dart +++ b/lib/pages/withdraw_page/withdraw_page.dart @@ -1,8 +1,14 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:zhiying_base_widget/pages/withdraw_page/bloc/withdraw_bloc.dart'; +import 'package:zhiying_comm/util/base_bloc.dart'; /*提现页面*/ class WithdrawPage extends StatefulWidget { + final Map data; + + const WithdrawPage(this.data, {Key key}) : super(key: key); + @override _WithdrawPageState createState() => _WithdrawPageState(); } @@ -13,7 +19,10 @@ class _WithdrawPageState extends State { return Scaffold( appBar: _createNav(), body: SafeArea( - child: _WithdrawContainer(), + child: BlocProvider( + bloc: WithdrawBloc(), + child: _WithdrawContainer(widget.data), + ), ), ); } @@ -56,11 +65,26 @@ class _WithdrawPageState extends State { } class _WithdrawContainer extends StatefulWidget { + final Map data; + + const _WithdrawContainer(this.data, {Key key}) : super(key: key); + @override _WithdrawContainerState createState() => _WithdrawContainerState(); } class _WithdrawContainerState extends State<_WithdrawContainer> { + WithdrawBloc _bloc; + + @override + void initState() { + _bloc = BlocProvider.of(context); + if (widget.data.containsKey('skip_identifier')) { + _bloc.loadData(widget.data['skip_identifier']); + } + super.initState(); + } + @override Widget build(BuildContext context) { return SingleChildScrollView( diff --git a/lib/register.dart b/lib/register.dart index 3a7a3e0..453e976 100644 --- a/lib/register.dart +++ b/lib/register.dart @@ -1,6 +1,7 @@ import 'package:sharesdk_plugin/sharesdk_interface.dart'; import 'package:sharesdk_plugin/sharesdk_register.dart'; import 'package:zhiying_base_widget/pages/favorite_page/favorite_page.dart'; +import 'package:zhiying_base_widget/pages/feedback_page/feedback_page.dart'; import 'package:zhiying_base_widget/pages/goods_details_page/goods_details_page.dart'; import 'package:zhiying_base_widget/pages/home_page/home_page.dart'; import 'package:zhiying_base_widget/pages/hot_ranking_page/hot_ranking_page.dart'; @@ -18,8 +19,9 @@ import 'package:zhiying_base_widget/pages/security_page/security_page.dart'; import 'package:zhiying_base_widget/pages/security_page/security_password/security_password.dart'; import 'package:zhiying_base_widget/pages/setting_page/setting_page.dart'; import 'package:zhiying_base_widget/pages/team_page/team_page.dart'; -import 'package:zhiying_base_widget/pages/test_page/test_page.dart'; import 'package:zhiying_base_widget/pages/webview/base_webview.dart'; +import 'package:zhiying_base_widget/pages/wechat_teacher_page/wechat_teacher_page.dart'; +import 'package:zhiying_base_widget/pages/withdraw_page/withdraw_page.dart'; import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_widget.dart'; import 'package:zhiying_base_widget/widgets/goods_details/price/goods_details_price_widget.dart'; import 'package:zhiying_base_widget/widgets/goods_details/slide_banner/goods_details_slide_banner_widget.dart'; @@ -64,7 +66,6 @@ import 'widgets/search/hot_tag/search_hot_tag_widget.dart'; import 'widgets/search/input/search_input_widget.dart'; import 'widgets/search/tabbar/search_tab_creater.dart'; import 'widgets/search_result/goods_list/search_result_goods_list_creater.dart'; -import 'widgets/search_result/goods_list/search_result_goods_list_widget.dart'; import 'widgets/search_result/search_input/search_result_input.dart'; class BaseWidgetRegister { @@ -114,12 +115,10 @@ class BaseWidgetRegister { 'pub.flutter.search_index', (model) => SearchResultPage(model)); PageFactory.regist( 'search_result_item', (model) => SearchResultItemPage(model)); - PageFactory.regist('pub.flutter.feedback', (model) => TestPage()); - // PageFactory.regist('search_think_page', (model) => SearchThinkPage(model)); - // PageFactory.regist('login', (model) => LoginPage(model)); - // PageFactory.regist('login_quick', (model) => LoginQuickPage(model)); - // PageFactory.regist('login_account', (model) => LoginAccountPage(model)); - // PageFactory.regist('login_invite', (model) => LoginInvitePage()); + PageFactory.regist('pub.flutter.feedback', (model) => FeedbackPage()); + PageFactory.regist( + 'pub.flutter.wechat_teacher', (model) => WechatTeacherPage()); + PageFactory.regist('pub.flutter.cash_out', (model) => WithdrawPage(model)); // webview PageFactory.regist('pub.flutter.url', (model) => BaseWebview(model)); @@ -205,43 +204,43 @@ class BaseWidgetRegister { WidgetFactory.regist('search_result_taobao_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model))); // 搜索结果的商品列表 淘宝 - WidgetFactory.regist('search_result_taobao_item', - SearchResultGoodsListCreater()); + WidgetFactory.regist( + 'search_result_taobao_item', SearchResultGoodsListCreater()); // 搜索结果页筛选widget 京东 WidgetFactory.regist('search_result_jd_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model))); // 搜索结果的商品列表 京东 - WidgetFactory.regist('search_result_jd_item', - SearchResultGoodsListCreater()); + WidgetFactory.regist( + 'search_result_jd_item', SearchResultGoodsListCreater()); // 搜索结果页筛选widget 苏宁 WidgetFactory.regist('search_result_suning_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model))); // 搜索结果的商品列表 苏宁 - WidgetFactory.regist('search_result_suning_item', - SearchResultGoodsListCreater()); + WidgetFactory.regist( + 'search_result_suning_item', SearchResultGoodsListCreater()); // 搜索结果页筛选widget 拼多多 WidgetFactory.regist('search_result_pdd_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model))); // 搜索结果的商品列表 拼多多 - WidgetFactory.regist('search_result_pdd_item', - SearchResultGoodsListCreater()); + WidgetFactory.regist( + 'search_result_pdd_item', SearchResultGoodsListCreater()); // 搜索结果页筛选widget 唯品会 WidgetFactory.regist('search_result_vip_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model))); // 搜索结果的商品列表 唯品会 - WidgetFactory.regist('search_result_vip_item', - SearchResultGoodsListCreater()); + WidgetFactory.regist( + 'search_result_vip_item', SearchResultGoodsListCreater()); // 搜索结果页筛选widget 考拉 WidgetFactory.regist('search_result_kaola_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model))); // 搜索结果的商品列表 考拉 - WidgetFactory.regist('search_result_kaola_item', - SearchResultGoodsListCreater()); + WidgetFactory.regist( + 'search_result_kaola_item', SearchResultGoodsListCreater()); /// ==================== 商品详情 ==================== /// // 商品详情轮播图 @@ -311,10 +310,12 @@ class BaseWidgetRegister { //======================= 账单明细 - //======================== 热榜 - WidgetFactory.regist('hot_rank_appbar', DefaultWidgetCreater((model)=>HotRankingAppBar(model))); - WidgetFactory.regist('hot_rank_tabs', DefaultWidgetCreater((model)=>HotRankTableBar(model))); - WidgetFactory.regist('hot_rank_tab_view', DefaultWidgetCreater((model)=>HotRankingList(model))); + WidgetFactory.regist('hot_rank_appbar', + DefaultWidgetCreater((model) => HotRankingAppBar(model))); + WidgetFactory.regist('hot_rank_tabs', + DefaultWidgetCreater((model) => HotRankTableBar(model))); + WidgetFactory.regist('hot_rank_tab_view', + DefaultWidgetCreater((model) => HotRankingList(model))); } } diff --git a/lib/widgets/home/home_goods/home_goods.dart b/lib/widgets/home/home_goods/home_goods.dart index 8dbe683..45fce58 100644 --- a/lib/widgets/home/home_goods/home_goods.dart +++ b/lib/widgets/home/home_goods/home_goods.dart @@ -63,9 +63,9 @@ class _HomeGoodsContainerState extends State<_HomeGoodsContainer> { _style = HomeGoodsStyleModel.fromJson(Map.from(json)); widget.eventBus.on().listen((data) { + Loading.show(context); _provider = data.provider; _bloc.loadMore(_provider); - Loading.show(context); }); super.initState(); diff --git a/lib/widgets/mine/mine_data/mine_data.dart b/lib/widgets/mine/mine_data/mine_data.dart index 8127bbf..56fe199 100644 --- a/lib/widgets/mine/mine_data/mine_data.dart +++ b/lib/widgets/mine/mine_data/mine_data.dart @@ -23,10 +23,7 @@ class _MineDataState extends State { @override Widget build(BuildContext context) { UserInfoModel user = Provider.of(context).userInfo; - if (user == null) { - String value = '123'; - int result = int.tryParse(value); - + if (user == null || user.token == null || user.token == '') { // 未登录 String d = widget.data['data']; Map json = convert.jsonDecode(d); diff --git a/lib/widgets/mine/mine_data/mine_data_widget.dart b/lib/widgets/mine/mine_data/mine_data_widget.dart index 7cdab60..8bab92a 100644 --- a/lib/widgets/mine/mine_data/mine_data_widget.dart +++ b/lib/widgets/mine/mine_data/mine_data_widget.dart @@ -1,6 +1,7 @@ import 'dart:convert' as convert; import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:zhiying_base_widget/widgets/mine/mine_data/model/mine_data_model.dart'; import 'package:zhiying_base_widget/widgets/mine/mine_header/model/mine_profile_model.dart'; @@ -12,10 +13,11 @@ class MineDataWidget extends StatelessWidget { Map _json; MineDataModel _style; - MineDataWidget(this.profile, - this.data, { - Key key, - }) : super(key: key) { + MineDataWidget( + this.profile, + this.data, { + Key key, + }) : super(key: key) { String d = data['data']; _json = convert.jsonDecode(d); _style = MineDataModel.fromJson(Map.from(_json)); @@ -121,7 +123,12 @@ class MineDataWidget extends StatelessWidget { ), ), onTap: () { - // RouterUtil.route(_json, context); + SkipModel skipModel = SkipModel( + skipIdentifier: 'pub.flutter.cash_out', + requiredLogin: '1', + requiredTaobaoAuth: '0', + ); + RouterUtil.route(skipModel, skipModel.toJson(), context); }, ) ], diff --git a/lib/widgets/mine/mine_header/mine_header.dart b/lib/widgets/mine/mine_header/mine_header.dart index 1a598a8..8587099 100644 --- a/lib/widgets/mine/mine_header/mine_header.dart +++ b/lib/widgets/mine/mine_header/mine_header.dart @@ -24,7 +24,7 @@ class _MineHeaderState extends State { // } UserInfoModel user = Provider.of(context).userInfo; - if (user == null) { + if (user == null || user.token == null || user.token == '') { // 未登录 return MineStaticContainer(widget.data); } diff --git a/lib/widgets/mine/mine_header/mine_header_bloc.dart b/lib/widgets/mine/mine_header/mine_header_bloc.dart index 0dcef7f..3f2de02 100644 --- a/lib/widgets/mine/mine_header/mine_header_bloc.dart +++ b/lib/widgets/mine/mine_header/mine_header_bloc.dart @@ -23,6 +23,9 @@ class MineHeaderBloc extends BlocBase { method: NetMethod.GET, onCache: (data) {}, onSuccess: (data) { _profile = MineProfileModel.fromJson(Map.from(data)); _profileController.add(_profile); + }, onError: (err) { + _profile = MineProfileModel(); + _profileController.add(_profile); }); } }