瀏覽代碼

1、mob 短信完成

2、mob 秒验完成
tags/0.0.2+8
PH2 4 年之前
父節點
當前提交
7386a252e9
共有 10 個檔案被更改,包括 172 行新增45 行删除
  1. +24
    -0
      example/android/app/build.gradle
  2. +2
    -1
      example/android/app/src/main/AndroidManifest.xml
  3. +3
    -1
      lib/pages/security_page/security_bind_alipay/security_bind_alipay_bloc.dart
  4. +29
    -8
      lib/pages/security_page/security_bind_alipay/security_bind_alipay_page.dart
  5. +31
    -13
      lib/pages/security_page/security_mobile/security_mobile.dart
  6. +26
    -8
      lib/pages/security_page/security_mobile/security_mobile_unbind.dart
  7. +3
    -0
      lib/pages/security_page/security_page.dart
  8. +26
    -4
      lib/pages/security_page/security_password/security_password.dart
  9. +26
    -7
      lib/pages/security_page/security_unbind_alipay/security_unbin_alipay.dart
  10. +2
    -3
      lib/register.dart

+ 24
- 0
example/android/app/build.gradle 查看文件

@@ -57,12 +57,29 @@ android {
}
}

// 签名配置
signingConfigs {
// 智夜生活
zhiying {
storeFile file('zhiying.jks')
storePassword 'zhioscom'
keyAlias 'zysh'
keyPassword 'zhioscom'
v1SigningEnabled true
v2SigningEnabled true
}

}

flavorDimensions "app"

buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
minifyEnabled false
zipAlignEnabled true
shrinkResources false
signingConfig signingConfigs.zhiying
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
@@ -70,6 +87,7 @@ android {
minifyEnabled false
shrinkResources false
zipAlignEnabled true
signingConfig signingConfigs.zhiying
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
@@ -189,6 +207,12 @@ MobSDK {
appKey "30dc33054b635"
appSecret "396e98c293130c9976fb7428b6b434d6"

//手机验证登录
SecVerify {}

//短信
SMSSDK {}

ShareSDK {

// platform configuration information


+ 2
- 1
example/android/app/src/main/AndroidManifest.xml 查看文件

@@ -28,8 +28,9 @@
android:name="io.flutter.app.FlutterApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:allowBackup="true"
android:usesCleartextTraffic="true"
tools:replace="android:name">
tools:replace="android:name, android:allowBackup">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"


+ 3
- 1
lib/pages/security_page/security_bind_alipay/security_bind_alipay_bloc.dart 查看文件

@@ -49,13 +49,15 @@ class SecurityBindAlipayBloc extends BlocBase {
}
}

Future<bool> bindAlipay(String name, String account, String code) {
Future<bool> bindAlipay(String name, String account, String code, String phone) {
return NetUtil.post('/api/v1/settings/account/security/alipay',
method: NetMethod.POST,
params: Map<String, dynamic>.from({
'alipay_real_name': name,
'alipay_account': account,
'valid_code': code,
'phone': phone,
'zone': '86'
})).then((result) {
if (result['code'] == 1) return true;
return false;


+ 29
- 8
lib/pages/security_page/security_bind_alipay/security_bind_alipay_page.dart 查看文件

@@ -12,8 +12,11 @@ import 'package:zhiying_base_widget/pages/security_page/widgets/security_code_bu
import 'package:zhiying_base_widget/pages/security_page/widgets/security_confirm_button.dart';
import 'package:zhiying_comm/util/base_bloc.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:zhiying_comm/util/mob_util/mob_util.dart';

// 绑定支付宝
///
/// 绑定支付宝
///
class SecurityBindAlipayPage extends StatefulWidget {
final Map<String, dynamic> model;

@@ -34,7 +37,7 @@ class _SecurityBindAlipayPageState extends State<SecurityBindAlipayPage> {
} else {
return BlocProvider<SecurityBindAlipayBloc>(
bloc: SecurityBindAlipayBloc(),
child: _SecurityBindAlipayContainer(datas),
child: _SecurityBindAlipayContainer(datas, status['mobile_setting_text']),
);
}
}
@@ -42,8 +45,9 @@ class _SecurityBindAlipayPageState extends State<SecurityBindAlipayPage> {

class _SecurityBindAlipayContainer extends StatefulWidget {
final Map<String, dynamic> model;
final String phone;

const _SecurityBindAlipayContainer(this.model, {Key key}) : super(key: key);
const _SecurityBindAlipayContainer(this.model, this.phone, {Key key}) : super(key: key);

@override
_SecurityBindAlipayContainerState createState() =>
@@ -140,7 +144,9 @@ class _SecurityBindAlipayContainerState
if (await _bloc.bindAlipay(
_nameController.text,
_accountController.text,
_codeController.text)) {
_codeController.text,
widget.phone
)) {
Fluttertoast.showToast(msg: '绑定成功');
Navigator.of(context).pop(true);
}
@@ -193,9 +199,22 @@ class _SecurityBindAlipayContainerState
}

void _sendCode() async {
NetUtil.request('/api/v1/settings/account/security/alipay/sms',
onSuccess: (result) {
Logger.debug(result);
// NetUtil.request('/api/v1/settings/account/security/alipay/sms',
// onSuccess: (result) {
// Logger.debug(result);
// Fluttertoast.showToast(msg: '发送成功');
// _second = 60;
// Timer.periodic(Duration(seconds: 1), (timer) {
// _second--;
// if (_second <= 0) {
// timer.cancel();
// }
// setState(() {});
// });
// });

bool result = await MobUtil.getTextCode(widget.phone, smsCodeType: SMSCodeType.BIND_ALIPAY);
if(result){
Fluttertoast.showToast(msg: '发送成功');
_second = 60;
Timer.periodic(Duration(seconds: 1), (timer) {
@@ -205,6 +224,8 @@ class _SecurityBindAlipayContainerState
}
setState(() {});
});
});
}else{
Fluttertoast.showToast(msg: '获取验证码失败');
}
}
}

+ 31
- 13
lib/pages/security_page/security_mobile/security_mobile.dart 查看文件

@@ -9,7 +9,11 @@ import 'package:zhiying_base_widget/pages/security_page/widgets/security_bind_in
import 'package:zhiying_base_widget/pages/security_page/widgets/security_code_button.dart';
import 'package:zhiying_base_widget/pages/security_page/widgets/security_confirm_button.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:zhiying_comm/util/mob_util/mob_util.dart';

///
/// 绑定手机号
///
class SecurityMobile extends StatefulWidget {
final Map<String, dynamic> model;

@@ -37,8 +41,7 @@ class _SecurityMobileContainer extends StatefulWidget {
const _SecurityMobileContainer(this.model, {Key key}) : super(key: key);

@override
_SecurityMobileContainerState createState() =>
_SecurityMobileContainerState();
_SecurityMobileContainerState createState() => _SecurityMobileContainerState();
}

class _SecurityMobileContainerState extends State<_SecurityMobileContainer> {
@@ -74,8 +77,7 @@ class _SecurityMobileContainerState extends State<_SecurityMobileContainer> {
? Container()
: Container(
width: double.infinity,
padding: EdgeInsets.only(
left: 12.5, right: 12.5, top: 10, bottom: 10),
padding: EdgeInsets.only(left: 12.5, right: 12.5, top: 10, bottom: 10),
child: Text(
'请绑定新的手机号码,如未完成绑定将继续使用原手机号码',
style: TextStyle(fontSize: 12, color: Color(0xff999999)),
@@ -157,8 +159,7 @@ class _SecurityMobileContainerState extends State<_SecurityMobileContainer> {
}

void _verifiy() {
bool canConfirm =
_phoneController.text.length > 0 && _codeController.text.length == 6;
bool canConfirm = _phoneController.text.length > 0 && _codeController.text.length == 6;
if (canConfirm != _canConfirm) {
setState(() {
_canConfirm = canConfirm;
@@ -167,12 +168,25 @@ class _SecurityMobileContainerState extends State<_SecurityMobileContainer> {
}

void _sendCode() async {
NetUtil.request('/api/v1/settings/account/security/mobile/sms',
params: Map<String, dynamic>.from({
'mobile': _phoneController.text,
}),
method: NetMethod.POST, onSuccess: (result) {
Logger.debug(result);
// NetUtil.request('/api/v1/settings/account/security/mobile/sms',
// params: Map<String, dynamic>.from({
// 'mobile': _phoneController.text,
// }),
// method: NetMethod.POST, onSuccess: (result) {
// Logger.debug(result);
// Fluttertoast.showToast(msg: '发送成功');
// _second = 60;
// Timer.periodic(Duration(seconds: 1), (timer) {
// _second--;
// if (_second <= 0) {
// timer.cancel();
// }
// setState(() {});
// });
// });

bool result = await MobUtil.getTextCode(_phoneController.text, smsCodeType: SMSCodeType.BIND_PHONE);
if (result) {
Fluttertoast.showToast(msg: '发送成功');
_second = 60;
Timer.periodic(Duration(seconds: 1), (timer) {
@@ -182,7 +196,9 @@ class _SecurityMobileContainerState extends State<_SecurityMobileContainer> {
}
setState(() {});
});
});
} else {
Fluttertoast.showToast(msg: '获取验证码失败');
}
}

// 设置手机号,没有手机号的调这个😵
@@ -205,6 +221,8 @@ class _SecurityMobileContainerState extends State<_SecurityMobileContainer> {
params: Map<String, dynamic>.from({
'mobile': _phoneController.text,
'valid_code': _codeController.text,
'phone': _phoneController.text,
'zone': '86'
}),
method: NetMethod.POST, onSuccess: (result) {
Logger.debug(result);


+ 26
- 8
lib/pages/security_page/security_mobile/security_mobile_unbind.dart 查看文件

@@ -9,7 +9,11 @@ import 'package:zhiying_base_widget/pages/security_page/widgets/security_bind_in
import 'package:zhiying_base_widget/pages/security_page/widgets/security_code_button.dart';
import 'package:zhiying_base_widget/pages/security_page/widgets/security_confirm_button.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:zhiying_comm/util/mob_util/mob_util.dart';

///
/// 接绑手机号
///
class SecurityMobileUnbind extends StatefulWidget {
final Map<String, dynamic> model;

@@ -45,8 +49,7 @@ class _SecurityMobileUnbindState extends State<SecurityMobileUnbind> {
children: <Widget>[
Container(
width: double.infinity,
padding:
EdgeInsets.only(left: 12.5, right: 12.5, top: 10, bottom: 10),
padding: EdgeInsets.only(left: 12.5, right: 12.5, top: 10, bottom: 10),
child: Text(
'为了您的账户安全,将对原有手机号进行验证',
style: TextStyle(fontSize: 12, color: Color(0xff999999)),
@@ -136,9 +139,21 @@ class _SecurityMobileUnbindState extends State<SecurityMobileUnbind> {
}

void _sendCode() async {
NetUtil.request('/api/v1/settings/account/security/mobile/sms',
method: NetMethod.GET, onSuccess: (result) {
Logger.debug(result);
// NetUtil.request('/api/v1/settings/account/security/mobile/sms',
// method: NetMethod.GET, onSuccess: (result) {
// Logger.debug(result);
// Fluttertoast.showToast(msg: '发送成功');
// _second = 60;
// Timer.periodic(Duration(seconds: 1), (timer) {
// _second--;
// if (_second <= 0) {
// timer.cancel();
// }
// setState(() {});
// });
// });
bool result = await MobUtil.getTextCode(_phone, smsCodeType: SMSCodeType.UNBIND_PHONE);
if (result) {
Fluttertoast.showToast(msg: '发送成功');
_second = 60;
Timer.periodic(Duration(seconds: 1), (timer) {
@@ -148,7 +163,9 @@ class _SecurityMobileUnbindState extends State<SecurityMobileUnbind> {
}
setState(() {});
});
});
} else {
Fluttertoast.showToast(msg: '获取验证码失败');
}
}

// 解绑手机号
@@ -156,12 +173,13 @@ class _SecurityMobileUnbindState extends State<SecurityMobileUnbind> {
NetUtil.request('/api/v1/settings/account/security/mobile/unbind',
params: Map<String, dynamic>.from({
'valid_code': _codeController.text,
'phone': _phone,
'zone': '86'
}),
method: NetMethod.POST, onSuccess: (result) {
_status['mobile_setting'] = '0';
_status['code'] = _codeController.text;
Navigator.of(context).pushReplacement(CupertinoPageRoute(
builder: (context) => SecurityMobile(widget.model)));
Navigator.of(context).pushReplacement(CupertinoPageRoute(builder: (context) => SecurityMobile(widget.model)));
});
}
}

+ 3
- 0
lib/pages/security_page/security_page.dart 查看文件

@@ -5,6 +5,9 @@ import 'package:zhiying_base_widget/pages/security_page/security_page_bloc.dart'
import 'package:zhiying_comm/util/base_bloc.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

///
/// 账号安全
///
class SecurityPage extends StatefulWidget {
final Map<String, dynamic> data;



+ 26
- 4
lib/pages/security_page/security_password/security_password.dart 查看文件

@@ -8,7 +8,11 @@ import 'package:zhiying_base_widget/pages/security_page/widgets/security_bind_in
import 'package:zhiying_base_widget/pages/security_page/widgets/security_code_button.dart';
import 'package:zhiying_base_widget/pages/security_page/widgets/security_confirm_button.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:zhiying_comm/util/mob_util/mob_util.dart';

///
/// 修改密码页面
///
class SecurityPassword extends StatefulWidget {
final Map<String, dynamic> model;

@@ -149,10 +153,10 @@ class _SecurityPasswordState extends State<SecurityPassword> {
}
}

/// 获取验证码
void _sendCode() async {
NetUtil.request('/api/v1/settings/account/security/password/sms',
method: NetMethod.POST, onSuccess: (result) {
Logger.debug(result);
bool result = await MobUtil.getTextCode(_phone, smsCodeType: SMSCodeType.NORMAL);
if(result){
Fluttertoast.showToast(msg: '发送成功');
_second = 60;
Timer.periodic(Duration(seconds: 1), (timer) {
@@ -162,7 +166,23 @@ class _SecurityPasswordState extends State<SecurityPassword> {
}
setState(() {});
});
});
}else{
Fluttertoast.showToast(msg: '获取验证码失败');
}

// NetUtil.request('/api/v1/settings/account/security/password/sms',
// method: NetMethod.POST, onSuccess: (result) {
// Logger.debug(result);
// Fluttertoast.showToast(msg: '发送成功');
// _second = 60;
// Timer.periodic(Duration(seconds: 1), (timer) {
// _second--;
// if (_second <= 0) {
// timer.cancel();
// }
// setState(() {});
// });
// });
}

void _confirm() async {
@@ -171,6 +191,8 @@ class _SecurityPasswordState extends State<SecurityPassword> {
'new_password': _passwordController.text,
'new_password_ack': _confirmController.text,
'valid_code': _codeController.text,
'phone': _phone,
'zone': '86'
}),
method: NetMethod.POST, onSuccess: (result) {
Logger.debug(result);


+ 26
- 7
lib/pages/security_page/security_unbind_alipay/security_unbin_alipay.dart 查看文件

@@ -9,6 +9,7 @@ import 'package:zhiying_base_widget/pages/security_page/widgets/security_bind_in
import 'package:zhiying_base_widget/pages/security_page/widgets/security_code_button.dart';
import 'package:zhiying_base_widget/pages/security_page/widgets/security_confirm_button.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:zhiying_comm/util/mob_util/mob_util.dart';

class SecurityUnbinAlipay extends StatefulWidget {
final Map<String, dynamic> model;
@@ -128,9 +129,22 @@ class _SecurityUnbinAlipayState extends State<SecurityUnbinAlipay> {
}

void _sendCode() async {
NetUtil.request('/api/v1/settings/account/security/alipay/sms',
method: NetMethod.GET, onSuccess: (result) {
Logger.debug(result);
// NetUtil.request('/api/v1/settings/account/security/alipay/sms',
// method: NetMethod.GET, onSuccess: (result) {
// Logger.debug(result);
// Fluttertoast.showToast(msg: '发送成功');
// _second = 60;
// Timer.periodic(Duration(seconds: 1), (timer) {
// _second--;
// if (_second <= 0) {
// timer.cancel();
// }
// setState(() {});
// });
// });

bool result = await MobUtil.getTextCode(_status['mobile_setting_text'], smsCodeType: SMSCodeType.BIND_ALIPAY);
if (result) {
Fluttertoast.showToast(msg: '发送成功');
_second = 60;
Timer.periodic(Duration(seconds: 1), (timer) {
@@ -140,18 +154,23 @@ class _SecurityUnbinAlipayState extends State<SecurityUnbinAlipay> {
}
setState(() {});
});
});
} else {
Fluttertoast.showToast(msg: '获取验证码失败');
}
}

void _unbind() async {
NetUtil.request('/api/v1/settings/account/security/alipay/unbind',
params: Map<String, dynamic>.from({'valid_code': _codeController.text}),
params: Map<String, dynamic>.from({
'valid_code': _codeController.text,
'phone': _status['mobile_setting_text'],
'zone': '86',
}),
method: NetMethod.POST, onSuccess: (result) {
Logger.debug(result);
Fluttertoast.showToast(msg: '解绑成功');
_status['alipay_setting'] = '0';
Navigator.of(context).pushReplacement(CupertinoPageRoute(
builder: (context) => SecurityBindAlipayPage(widget.model)));
Navigator.of(context).pushReplacement(CupertinoPageRoute(builder: (context) => SecurityBindAlipayPage(widget.model)));
});
}
}

+ 2
- 3
lib/register.dart 查看文件

@@ -79,8 +79,7 @@ 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/search_input/search_result_input.dart';
import 'package:secverify/secverify.dart';
import 'package:zhiying_comm/util/second_test/second_test_util.dart';
import 'package:zhiying_comm/util/mob_util/mob_util.dart';

class BaseWidgetRegister {
/// 初始化方法
@@ -129,7 +128,7 @@ class BaseWidgetRegister {
});

// MOB 秒验
SecondTestUtil.getInstance().init();
MobUtil.init();

Application.addMethod(() async {
return Future.delayed(Duration(seconds: 1));


Loading…
取消
儲存