diff --git a/lib/models/base/skip_model.dart b/lib/models/base/skip_model.dart index fae56bb..b914142 100644 --- a/lib/models/base/skip_model.dart +++ b/lib/models/base/skip_model.dart @@ -4,13 +4,15 @@ class SkipModel { String requiredTaobaoAuth; String skipIdentifier; String isJump; + Map data; SkipModel({ this.url, this.requiredLogin, this.requiredTaobaoAuth, this.skipIdentifier, - this.isJump + this.isJump, + this.data }); SkipModel.fromJson(Map json) { @@ -18,6 +20,7 @@ class SkipModel { } void fromJson(Map json) { + data = json['data'] ?? {}; url = json['url']; requiredLogin = json['required_login']?.toString(); requiredTaobaoAuth = json['required_taobao_auth']?.toString(); @@ -32,6 +35,7 @@ class SkipModel { data['required_taobao_auth'] = this.requiredTaobaoAuth; data['skip_identifier'] = this.skipIdentifier; data['is_jump'] = this.isJump; + data['data'] = this.data; return data; } } diff --git a/lib/pages/login_page/login_page.dart b/lib/pages/login_page/login_page.dart index 3bc86d7..4084d0b 100644 --- a/lib/pages/login_page/login_page.dart +++ b/lib/pages/login_page/login_page.dart @@ -89,8 +89,7 @@ class _LoginPageContainerState extends State { /// 微信or手机登陆 void _loginClick(String type, LoginStyleModel model) { - if(!checkBool){ - Fluttertoast.showToast(msg: "请阅读并勾选同意用户协议选项"); + if(!isCheck()){ return; } print('登陆$type'); @@ -148,8 +147,7 @@ class _LoginPageContainerState extends State { /// 第三方登陆 void _otherLoginClick(BottomIcons model) async { - if(!checkBool){ - Fluttertoast.showToast(msg: "请阅读并勾选同意用户协议选项"); + if(!isCheck()){ return; } print('第三方登陆${model.type}'); @@ -359,7 +357,9 @@ class _LoginPageContainerState extends State { /// 按钮 _buttonsWidget(model), _sizedHeight9, - + ///账号密码登录 + _buildOrderLogin(), + _sizedHeight9, /// 协议 _protocolWidget(model), @@ -565,4 +565,28 @@ class _LoginPageContainerState extends State { ), ); } + + ///账号密码登录 + _buildOrderLogin() { + return Center( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + if(isCheck()){ + Navigator.push(context, CupertinoPageRoute(builder: (_) => LoginAccountPage(null))); + } + }, + child: Text("使用账号密码登录",style: TextStyle(color: HexColor.fromHex("#FFFF4242"),fontSize: 14),), + ), + ); + } + + bool isCheck(){ + if(!checkBool){ + Fluttertoast.showToast(msg: "请阅读并勾选同意用户协议选项"); + return false; + }else{ + return true; + } + } } diff --git a/lib/util/encode_util.dart b/lib/util/encode_util.dart index cab1dfd..e9af625 100644 --- a/lib/util/encode_util.dart +++ b/lib/util/encode_util.dart @@ -1,7 +1,10 @@ import 'package:crypto/crypto.dart'; +import 'package:flutter/cupertino.dart'; import 'dart:convert'; import 'dart:io'; import 'package:flutter_native_image/flutter_native_image.dart'; +import 'package:zhiying_comm/util/dialog/loading/loading.dart'; +import 'package:zhiying_comm/zhiying_comm.dart'; class EncodeUtil { /* @@ -38,8 +41,20 @@ class EncodeUtil { } // 压缩图片至指定大小 - static Future compressImage(File file, int size) async { - List originBytes = await file.readAsBytes(); + static Future compressImage(BuildContext context, {File file, List images, int size}) async { + List originBytes; + if (images != null) { + originBytes = images; + Directory dir = await getTemporaryDirectory(); + File tempFile = File(dir.path + "/temp.png"); + tempFile = await tempFile.writeAsBytes(originBytes); + file = tempFile; + } else if (file != null) { + originBytes = await file.readAsBytes(); + } else { + return null; + } + int originSize = (originBytes.length / 1024).ceil(); print('原图大小:' + originSize.toString() + 'kb'); if (originSize <= size) { @@ -66,7 +81,7 @@ class EncodeUtil { } } while (maxQuality - minQuality > 1); File compressedFile = - await FlutterNativeImage.compressImage(file.path, quality: minQuality); + await FlutterNativeImage.compressImage(file.path, quality: minQuality); imageBytes = await compressedFile.readAsBytes(); int compressSize = (imageBytes.length / 1024).ceil(); print('quality:' + diff --git a/lib/util/mob_util/secverify/quick_login_util.dart b/lib/util/mob_util/secverify/quick_login_util.dart index e2fa811..a404f88 100644 --- a/lib/util/mob_util/secverify/quick_login_util.dart +++ b/lib/util/mob_util/secverify/quick_login_util.dart @@ -56,7 +56,7 @@ class QuickLoginUtil { } /// 打开秒验登录页面的方法 - void openQuickLogin(BuildContext context, Quick model) { + void openQuickLogin(BuildContext context, Quick model) async { Loading.show(context); // 取号前设置 Secverify.autoFinishOauthPage(false); @@ -231,6 +231,8 @@ class QuickLoginUtil { Secverify.finshOauthPage(); } } + }).then((value){ + print(value); }); } }); @@ -305,7 +307,8 @@ class QuickLoginUtil { "switchAccTextSize": 13, //切换登录文字大小 "switchAccHidden": false, //切换登录是否隐藏 "switchAccAlignParentRight": false, //切换登录是否靠屏幕右侧 - "switchAccText": model?.textTip ?? '切换账号', //切换登录文本内容 + // "switchAccText": model?.textTip ?? '切换账号', //切换登录文本内容 + "switchAccText": ' ', "switchAccTextBold": false, //切换登录文本是否加粗 "portraitLayout": { // "layoutLeft": 30,//切换登录左间距 diff --git a/lib/util/net_util.dart b/lib/util/net_util.dart index d3bd139..d5b7a57 100644 --- a/lib/util/net_util.dart +++ b/lib/util/net_util.dart @@ -364,6 +364,7 @@ class NetUtil { String masterId = setting['master_id']; if (null != masterId && masterId != '' && (!params.containsKey('master_id') || params['master_id'] == '')) { params['master_id'] = masterId; //!EmptyUtil.isEmpty(masterId) ? masterId : 'template_database'; + params['MasterId'] = masterId; //!EmptyUtil.isEmpty(masterId) ? masterId : 'template_database'; } // token 读取SP缓存中的用户token @@ -438,8 +439,13 @@ class NetUtil { } /// 根据请求参数,获取缓存的数据 - static Future getRequestCachedData(String url, {Map params}) async { - Map cacheMap = await SharedPreferencesUtil.getNetCacheResult(getRequestParamsCachedKey(params, url)); + static Future getRequestCachedData(String url, {Map params,Map queryParameters}) async { + var paramsData = { + 'postData': params ?? {}, + 'queryParameters': queryParameters ?? {} + }; + Map cacheMap = await SharedPreferencesUtil.getNetCacheResult(getRequestParamsCachedKey(paramsData, url)); + if (!EmptyUtil.isEmpty(cacheMap) && cacheMap.containsKey(GlobalConfig.HTTP_RESPONSE_KEY_CODE) && (cacheMap[GlobalConfig.HTTP_RESPONSE_KEY_CODE] == GlobalConfig.RESPONSE_SUCCESS_CODE || @@ -466,10 +472,13 @@ class NetUtil { /// 根据请求参数,获取缓存的Key static String getRequestParamsCachedKey(Map map, String path) { + String key; if (EmptyUtil.isEmpty(map)) { - return EncodeUtil.generateMd5(path); + key= EncodeUtil.generateMd5(path); + }else{ + key= EncodeUtil.generateMd5(path + map.toString()); } - return EncodeUtil.generateMd5(path + map.toString()); + return key; } // 七牛云文件上传 diff --git a/lib/util/wxpay_util.dart b/lib/util/wxpay_util.dart new file mode 100644 index 0000000..9f50185 --- /dev/null +++ b/lib/util/wxpay_util.dart @@ -0,0 +1,25 @@ +import 'package:zhiying_comm/zhiying_comm.dart'; + +////微信支付简单封装 +class WxPayUtil { + + ////调用此方法 + static Future toPay(Map params) async { + var payInfo = SyPayInfo(); + payInfo.appid = params['appid']; + payInfo.noncestr = params['noncestr']; + payInfo.package = params['package']; + payInfo.partnerid = params['partnerid']; + payInfo.sign = params['sign']; + payInfo.timestamp = params['timestamp']; + payInfo.prepayid = params['prepayid']; + print("发起微信支付"); + SyPayResult result = await SyFlutterWechat.pay(payInfo); + + if (result == SyPayResult.success) { + return true; + } else { + return false; + } + } +} diff --git a/lib/zhiying_comm.dart b/lib/zhiying_comm.dart index dd7c282..d5369c8 100644 --- a/lib/zhiying_comm.dart +++ b/lib/zhiying_comm.dart @@ -44,4 +44,8 @@ export 'util/event_util/login_success_event.dart'; export 'package:zhiying_comm/util/custom_sliver_persistent_header_delegate.dart'; export 'package:save_image/save_image.dart'; export 'package:zhiying_comm/pages/login_page/login_style_util.dart'; +export 'package:sy_flutter_wechat/sy_flutter_wechat.dart'; +export 'package:zhiying_comm/util/wxpay_util.dart'; +export 'package:zhiying_comm/util/encode_util.dart'; +export 'package:path_provider/path_provider.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index 9bae654..4f17206 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,7 +35,7 @@ dependencies: # Android app更新 flutter_xupdate: git: - ref: 1.0.1 + ref: '1.0.1' url: http://192.168.0.138:3000/FnuoOS_ZhiYing/flutter_xupdate.git # app更新dialogUI(用于IOS,以便统一样式) flutter_update_dialog: 1.0.0 @@ -52,9 +52,10 @@ dependencies: sharesdk_plugin: ^1.2.9 #秒验 secverify: + #path: ../secverify git: url: 'http://192.168.0.138:3000/FnuoOS_ZhiYing/secverify.git' - ref: '0.0.1' + ref: '0.0.2' #短信 mobsms: ^1.1.0 #锁粉 @@ -90,6 +91,7 @@ dependencies: git: url: 'http://192.168.0.138:3000/FnuoOS_ZhiYing/tobias.git' ref: '0.0.2' + sy_flutter_wechat: '0.2.2' event_bus: 1.1.1