@@ -4,13 +4,15 @@ class SkipModel { | |||||
String requiredTaobaoAuth; | String requiredTaobaoAuth; | ||||
String skipIdentifier; | String skipIdentifier; | ||||
String isJump; | String isJump; | ||||
Map<String, dynamic> data; | |||||
SkipModel({ | SkipModel({ | ||||
this.url, | this.url, | ||||
this.requiredLogin, | this.requiredLogin, | ||||
this.requiredTaobaoAuth, | this.requiredTaobaoAuth, | ||||
this.skipIdentifier, | this.skipIdentifier, | ||||
this.isJump | |||||
this.isJump, | |||||
this.data | |||||
}); | }); | ||||
SkipModel.fromJson(Map<String, dynamic> json) { | SkipModel.fromJson(Map<String, dynamic> json) { | ||||
@@ -18,6 +20,7 @@ class SkipModel { | |||||
} | } | ||||
void fromJson(Map<String, dynamic> json) { | void fromJson(Map<String, dynamic> json) { | ||||
data = json['data'] ?? {}; | |||||
url = json['url']; | url = json['url']; | ||||
requiredLogin = json['required_login']?.toString(); | requiredLogin = json['required_login']?.toString(); | ||||
requiredTaobaoAuth = json['required_taobao_auth']?.toString(); | requiredTaobaoAuth = json['required_taobao_auth']?.toString(); | ||||
@@ -32,6 +35,7 @@ class SkipModel { | |||||
data['required_taobao_auth'] = this.requiredTaobaoAuth; | data['required_taobao_auth'] = this.requiredTaobaoAuth; | ||||
data['skip_identifier'] = this.skipIdentifier; | data['skip_identifier'] = this.skipIdentifier; | ||||
data['is_jump'] = this.isJump; | data['is_jump'] = this.isJump; | ||||
data['data'] = this.data; | |||||
return data; | return data; | ||||
} | } | ||||
} | } |
@@ -89,8 +89,7 @@ class _LoginPageContainerState extends State<LoginPageContainer> { | |||||
/// 微信or手机登陆 | /// 微信or手机登陆 | ||||
void _loginClick(String type, LoginStyleModel model) { | void _loginClick(String type, LoginStyleModel model) { | ||||
if(!checkBool){ | |||||
Fluttertoast.showToast(msg: "请阅读并勾选同意用户协议选项"); | |||||
if(!isCheck()){ | |||||
return; | return; | ||||
} | } | ||||
print('登陆$type'); | print('登陆$type'); | ||||
@@ -148,8 +147,7 @@ class _LoginPageContainerState extends State<LoginPageContainer> { | |||||
/// 第三方登陆 | /// 第三方登陆 | ||||
void _otherLoginClick(BottomIcons model) async { | void _otherLoginClick(BottomIcons model) async { | ||||
if(!checkBool){ | |||||
Fluttertoast.showToast(msg: "请阅读并勾选同意用户协议选项"); | |||||
if(!isCheck()){ | |||||
return; | return; | ||||
} | } | ||||
print('第三方登陆${model.type}'); | print('第三方登陆${model.type}'); | ||||
@@ -359,7 +357,9 @@ class _LoginPageContainerState extends State<LoginPageContainer> { | |||||
/// 按钮 | /// 按钮 | ||||
_buttonsWidget(model), | _buttonsWidget(model), | ||||
_sizedHeight9, | _sizedHeight9, | ||||
///账号密码登录 | |||||
_buildOrderLogin(), | |||||
_sizedHeight9, | |||||
/// 协议 | /// 协议 | ||||
_protocolWidget(model), | _protocolWidget(model), | ||||
@@ -565,4 +565,28 @@ class _LoginPageContainerState extends State<LoginPageContainer> { | |||||
), | ), | ||||
); | ); | ||||
} | } | ||||
///账号密码登录 | |||||
_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; | |||||
} | |||||
} | |||||
} | } |
@@ -1,7 +1,10 @@ | |||||
import 'package:crypto/crypto.dart'; | import 'package:crypto/crypto.dart'; | ||||
import 'package:flutter/cupertino.dart'; | |||||
import 'dart:convert'; | import 'dart:convert'; | ||||
import 'dart:io'; | import 'dart:io'; | ||||
import 'package:flutter_native_image/flutter_native_image.dart'; | 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 { | class EncodeUtil { | ||||
/* | /* | ||||
@@ -38,8 +41,20 @@ class EncodeUtil { | |||||
} | } | ||||
// 压缩图片至指定大小 | // 压缩图片至指定大小 | ||||
static Future<File> compressImage(File file, int size) async { | |||||
List<int> originBytes = await file.readAsBytes(); | |||||
static Future<File> compressImage(BuildContext context, {File file, List<int> images, int size}) async { | |||||
List<int> 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(); | int originSize = (originBytes.length / 1024).ceil(); | ||||
print('原图大小:' + originSize.toString() + 'kb'); | print('原图大小:' + originSize.toString() + 'kb'); | ||||
if (originSize <= size) { | if (originSize <= size) { | ||||
@@ -66,7 +81,7 @@ class EncodeUtil { | |||||
} | } | ||||
} while (maxQuality - minQuality > 1); | } while (maxQuality - minQuality > 1); | ||||
File compressedFile = | File compressedFile = | ||||
await FlutterNativeImage.compressImage(file.path, quality: minQuality); | |||||
await FlutterNativeImage.compressImage(file.path, quality: minQuality); | |||||
imageBytes = await compressedFile.readAsBytes(); | imageBytes = await compressedFile.readAsBytes(); | ||||
int compressSize = (imageBytes.length / 1024).ceil(); | int compressSize = (imageBytes.length / 1024).ceil(); | ||||
print('quality:' + | print('quality:' + | ||||
@@ -56,7 +56,7 @@ class QuickLoginUtil { | |||||
} | } | ||||
/// 打开秒验登录页面的方法 | /// 打开秒验登录页面的方法 | ||||
void openQuickLogin(BuildContext context, Quick model) { | |||||
void openQuickLogin(BuildContext context, Quick model) async { | |||||
Loading.show(context); | Loading.show(context); | ||||
// 取号前设置 | // 取号前设置 | ||||
Secverify.autoFinishOauthPage(false); | Secverify.autoFinishOauthPage(false); | ||||
@@ -231,6 +231,8 @@ class QuickLoginUtil { | |||||
Secverify.finshOauthPage(); | Secverify.finshOauthPage(); | ||||
} | } | ||||
} | } | ||||
}).then((value){ | |||||
print(value); | |||||
}); | }); | ||||
} | } | ||||
}); | }); | ||||
@@ -305,7 +307,8 @@ class QuickLoginUtil { | |||||
"switchAccTextSize": 13, //切换登录文字大小 | "switchAccTextSize": 13, //切换登录文字大小 | ||||
"switchAccHidden": false, //切换登录是否隐藏 | "switchAccHidden": false, //切换登录是否隐藏 | ||||
"switchAccAlignParentRight": false, //切换登录是否靠屏幕右侧 | "switchAccAlignParentRight": false, //切换登录是否靠屏幕右侧 | ||||
"switchAccText": model?.textTip ?? '切换账号', //切换登录文本内容 | |||||
// "switchAccText": model?.textTip ?? '切换账号', //切换登录文本内容 | |||||
"switchAccText": ' ', | |||||
"switchAccTextBold": false, //切换登录文本是否加粗 | "switchAccTextBold": false, //切换登录文本是否加粗 | ||||
"portraitLayout": { | "portraitLayout": { | ||||
// "layoutLeft": 30,//切换登录左间距 | // "layoutLeft": 30,//切换登录左间距 | ||||
@@ -364,6 +364,7 @@ class NetUtil { | |||||
String masterId = setting['master_id']; | String masterId = setting['master_id']; | ||||
if (null != masterId && masterId != '' && (!params.containsKey('master_id') || params['master_id'] == '')) { | if (null != masterId && masterId != '' && (!params.containsKey('master_id') || params['master_id'] == '')) { | ||||
params['master_id'] = masterId; //!EmptyUtil.isEmpty(masterId) ? masterId : 'template_database'; | params['master_id'] = masterId; //!EmptyUtil.isEmpty(masterId) ? masterId : 'template_database'; | ||||
params['MasterId'] = masterId; //!EmptyUtil.isEmpty(masterId) ? masterId : 'template_database'; | |||||
} | } | ||||
// token 读取SP缓存中的用户token | // token 读取SP缓存中的用户token | ||||
@@ -438,8 +439,13 @@ class NetUtil { | |||||
} | } | ||||
/// 根据请求参数,获取缓存的数据 | /// 根据请求参数,获取缓存的数据 | ||||
static Future<dynamic> getRequestCachedData(String url, {Map<String, dynamic> params}) async { | |||||
Map<String, dynamic> cacheMap = await SharedPreferencesUtil.getNetCacheResult(getRequestParamsCachedKey(params, url)); | |||||
static Future<dynamic> getRequestCachedData(String url, {Map<String, dynamic> params,Map<String, dynamic> queryParameters}) async { | |||||
var paramsData = { | |||||
'postData': params ?? {}, | |||||
'queryParameters': queryParameters ?? {} | |||||
}; | |||||
Map<String, dynamic> cacheMap = await SharedPreferencesUtil.getNetCacheResult(getRequestParamsCachedKey(paramsData, url)); | |||||
if (!EmptyUtil.isEmpty(cacheMap) && | if (!EmptyUtil.isEmpty(cacheMap) && | ||||
cacheMap.containsKey(GlobalConfig.HTTP_RESPONSE_KEY_CODE) && | cacheMap.containsKey(GlobalConfig.HTTP_RESPONSE_KEY_CODE) && | ||||
(cacheMap[GlobalConfig.HTTP_RESPONSE_KEY_CODE] == GlobalConfig.RESPONSE_SUCCESS_CODE || | (cacheMap[GlobalConfig.HTTP_RESPONSE_KEY_CODE] == GlobalConfig.RESPONSE_SUCCESS_CODE || | ||||
@@ -466,10 +472,13 @@ class NetUtil { | |||||
/// 根据请求参数,获取缓存的Key | /// 根据请求参数,获取缓存的Key | ||||
static String getRequestParamsCachedKey(Map<String, dynamic> map, String path) { | static String getRequestParamsCachedKey(Map<String, dynamic> map, String path) { | ||||
String key; | |||||
if (EmptyUtil.isEmpty(map)) { | 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; | |||||
} | } | ||||
// 七牛云文件上传 | // 七牛云文件上传 | ||||
@@ -0,0 +1,25 @@ | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
////微信支付简单封装 | |||||
class WxPayUtil { | |||||
////调用此方法 | |||||
static Future<bool> toPay(Map<String, dynamic> 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; | |||||
} | |||||
} | |||||
} |
@@ -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:zhiying_comm/util/custom_sliver_persistent_header_delegate.dart'; | ||||
export 'package:save_image/save_image.dart'; | export 'package:save_image/save_image.dart'; | ||||
export 'package:zhiying_comm/pages/login_page/login_style_util.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'; | |||||
@@ -35,7 +35,7 @@ dependencies: | |||||
# Android app更新 | # Android app更新 | ||||
flutter_xupdate: | flutter_xupdate: | ||||
git: | git: | ||||
ref: 1.0.1 | |||||
ref: '1.0.1' | |||||
url: http://192.168.0.138:3000/FnuoOS_ZhiYing/flutter_xupdate.git | url: http://192.168.0.138:3000/FnuoOS_ZhiYing/flutter_xupdate.git | ||||
# app更新dialogUI(用于IOS,以便统一样式) | # app更新dialogUI(用于IOS,以便统一样式) | ||||
flutter_update_dialog: 1.0.0 | flutter_update_dialog: 1.0.0 | ||||
@@ -52,9 +52,10 @@ dependencies: | |||||
sharesdk_plugin: ^1.2.9 | sharesdk_plugin: ^1.2.9 | ||||
#秒验 | #秒验 | ||||
secverify: | secverify: | ||||
#path: ../secverify | |||||
git: | git: | ||||
url: 'http://192.168.0.138:3000/FnuoOS_ZhiYing/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 | mobsms: ^1.1.0 | ||||
#锁粉 | #锁粉 | ||||
@@ -90,6 +91,7 @@ dependencies: | |||||
git: | git: | ||||
url: 'http://192.168.0.138:3000/FnuoOS_ZhiYing/tobias.git' | url: 'http://192.168.0.138:3000/FnuoOS_ZhiYing/tobias.git' | ||||
ref: '0.0.2' | ref: '0.0.2' | ||||
sy_flutter_wechat: '0.2.2' | |||||
event_bus: 1.1.1 | event_bus: 1.1.1 | ||||