Showing
19 changed files
with
2256 additions
and
845 deletions
assets/icon_apple_login.png
0 → 100755
1.11 KB
assets/icon_wechat_login.png
100644 → 100755
assets/login_bg.png
0 → 100644
142 KB
assets/mine_radio_nor.png
100644 → 100755
assets/mine_radio_sel.png
100644 → 100755
| @@ -502,7 +502,7 @@ | @@ -502,7 +502,7 @@ | ||
| 502 | "$(inherited)", | 502 | "$(inherited)", |
| 503 | "$(PROJECT_DIR)/Flutter", | 503 | "$(PROJECT_DIR)/Flutter", |
| 504 | ); | 504 | ); |
| 505 | - MARKETING_VERSION = 3.3.8; | 505 | + MARKETING_VERSION = 3.4.0; |
| 506 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 506 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 507 | PRODUCT_NAME = Runner; | 507 | PRODUCT_NAME = Runner; |
| 508 | PROVISIONING_PROFILE_SPECIFIER = ""; | 508 | PROVISIONING_PROFILE_SPECIFIER = ""; |
| @@ -635,7 +635,7 @@ | @@ -635,7 +635,7 @@ | ||
| 635 | CURRENT_PROJECT_VERSION = 325; | 635 | CURRENT_PROJECT_VERSION = 325; |
| 636 | DEVELOPMENT_TEAM = 8J59HM8B82; | 636 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 637 | ENABLE_BITCODE = NO; | 637 | ENABLE_BITCODE = NO; |
| 638 | - FLUTTER_BUILD_MODE = release; | 638 | + FLUTTER_BUILD_MODE = debug; |
| 639 | FRAMEWORK_SEARCH_PATHS = ( | 639 | FRAMEWORK_SEARCH_PATHS = ( |
| 640 | "$(inherited)", | 640 | "$(inherited)", |
| 641 | "$(PROJECT_DIR)/Flutter", | 641 | "$(PROJECT_DIR)/Flutter", |
| @@ -647,7 +647,7 @@ | @@ -647,7 +647,7 @@ | ||
| 647 | "$(inherited)", | 647 | "$(inherited)", |
| 648 | "$(PROJECT_DIR)/Flutter", | 648 | "$(PROJECT_DIR)/Flutter", |
| 649 | ); | 649 | ); |
| 650 | - MARKETING_VERSION = 3.3.8; | 650 | + MARKETING_VERSION = 3.4.0; |
| 651 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 651 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 652 | PRODUCT_NAME = Runner; | 652 | PRODUCT_NAME = Runner; |
| 653 | PROVISIONING_PROFILE_SPECIFIER = ""; | 653 | PROVISIONING_PROFILE_SPECIFIER = ""; |
| @@ -682,7 +682,7 @@ | @@ -682,7 +682,7 @@ | ||
| 682 | "$(inherited)", | 682 | "$(inherited)", |
| 683 | "$(PROJECT_DIR)/Flutter", | 683 | "$(PROJECT_DIR)/Flutter", |
| 684 | ); | 684 | ); |
| 685 | - MARKETING_VERSION = 3.3.8; | 685 | + MARKETING_VERSION = 3.4.0; |
| 686 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 686 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 687 | PRODUCT_NAME = Runner; | 687 | PRODUCT_NAME = Runner; |
| 688 | PROVISIONING_PROFILE_SPECIFIER = ""; | 688 | PROVISIONING_PROFILE_SPECIFIER = ""; |
| @@ -14,6 +14,7 @@ import 'package:fluwx/fluwx.dart'; | @@ -14,6 +14,7 @@ import 'package:fluwx/fluwx.dart'; | ||
| 14 | import 'package:one_key/pages/detail/handle_online_page.dart'; | 14 | import 'package:one_key/pages/detail/handle_online_page.dart'; |
| 15 | import 'package:one_key/pages/home/home_page.dart'; | 15 | import 'package:one_key/pages/home/home_page.dart'; |
| 16 | import 'package:one_key/pages/login/first_page.dart'; | 16 | import 'package:one_key/pages/login/first_page.dart'; |
| 17 | +import 'package:one_key/pages/login/login_page_f.dart'; | ||
| 17 | import 'package:one_key/provider/base_info_provider.dart'; | 18 | import 'package:one_key/provider/base_info_provider.dart'; |
| 18 | import 'package:one_key/provider/coupon_provider.dart'; | 19 | import 'package:one_key/provider/coupon_provider.dart'; |
| 19 | import 'package:one_key/provider/create_store_model.dart'; | 20 | import 'package:one_key/provider/create_store_model.dart'; |
| @@ -109,29 +109,31 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -109,29 +109,31 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 109 | List<PullMarketingByUidSunModel> data = | 109 | List<PullMarketingByUidSunModel> data = |
| 110 | Provider.of<UserModel>(context, listen: false) | 110 | Provider.of<UserModel>(context, listen: false) |
| 111 | .pullMarketingByUidSunModel; | 111 | .pullMarketingByUidSunModel; |
| 112 | - if (data != null && data.length > 0) { | ||
| 113 | - Future.delayed(Duration(milliseconds: 300), () { | ||
| 114 | - DialogUtil.cupertinoAlertDialog(context, | ||
| 115 | - title: "全店任务", | ||
| 116 | - content: "管理员发布了新的任务,请立即查看并完成任务", | ||
| 117 | - lTitle: "稍后提醒", | ||
| 118 | - rTitle: "立即查看", lCallback: () { | ||
| 119 | - print("稍后提醒"); | ||
| 120 | - // 30分钟后重新弹窗 | ||
| 121 | - _startTimerSeller(); | ||
| 122 | - }, rCallback: () { | ||
| 123 | - _endTimerSeller(); | ||
| 124 | - if (data.length == 1) { | ||
| 125 | - //进入营销详情 | ||
| 126 | - NavigatorUtil.goSellerMyMarketingRecordsDetailPage( | ||
| 127 | - context, data[0].mid, | ||
| 128 | - fromNotify: true); | ||
| 129 | - } else { | ||
| 130 | - //进入我的客情首页 | ||
| 131 | - NavigatorUtil.goMyCustomerPage(context); | ||
| 132 | - } | 112 | + if (data != null) { |
| 113 | + if (data.length > 0) { | ||
| 114 | + Future.delayed(Duration(milliseconds: 300), () { | ||
| 115 | + DialogUtil.cupertinoAlertDialog(context, | ||
| 116 | + title: "全店任务", | ||
| 117 | + content: "管理员发布了新的任务,请立即查看并完成任务", | ||
| 118 | + lTitle: "稍后提醒", | ||
| 119 | + rTitle: "立即查看", lCallback: () { | ||
| 120 | + print("稍后提醒"); | ||
| 121 | + // 30分钟后重新弹窗 | ||
| 122 | + _startTimerSeller(); | ||
| 123 | + }, rCallback: () { | ||
| 124 | + _endTimerSeller(); | ||
| 125 | + if (data.length == 1) { | ||
| 126 | + //进入营销详情 | ||
| 127 | + NavigatorUtil.goSellerMyMarketingRecordsDetailPage( | ||
| 128 | + context, data[0].mid, | ||
| 129 | + fromNotify: true); | ||
| 130 | + } else { | ||
| 131 | + //进入我的客情首页 | ||
| 132 | + NavigatorUtil.goMyCustomerPage(context); | ||
| 133 | + } | ||
| 134 | + }); | ||
| 133 | }); | 135 | }); |
| 134 | - }); | 136 | + } |
| 135 | } | 137 | } |
| 136 | if (widget.initialIndex == 0) return; | 138 | if (widget.initialIndex == 0) return; |
| 137 | _getIntent(); | 139 | _getIntent(); |
lib/pages/login/account_login_page.dart
0 → 100644
| 1 | +import 'dart:async'; | ||
| 2 | +import 'dart:convert'; | ||
| 3 | +import 'dart:io'; | ||
| 4 | + | ||
| 5 | +import 'package:common_utils/common_utils.dart'; | ||
| 6 | +import 'package:dio/dio.dart'; | ||
| 7 | +import 'package:flutter/cupertino.dart'; | ||
| 8 | +import 'package:flutter/material.dart'; | ||
| 9 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 10 | +import 'package:fluwx/fluwx.dart' as fluwx; | ||
| 11 | +import 'package:fluwx/fluwx.dart'; | ||
| 12 | +import 'package:one_key/app.dart'; | ||
| 13 | +import 'package:one_key/models/checkbind_phone_model.dart'; | ||
| 14 | +import 'package:one_key/models/store_info.dart'; | ||
| 15 | +import 'package:one_key/net/dio_util.dart'; | ||
| 16 | +import 'package:one_key/provider/create_store_model.dart'; | ||
| 17 | +import 'package:one_key/provider/other_login_provider.dart'; | ||
| 18 | +import 'package:one_key/provider/user_model.dart'; | ||
| 19 | +import 'package:one_key/res/colors.dart'; | ||
| 20 | +import 'package:one_key/route/navigate_service.dart'; | ||
| 21 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 22 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 23 | +import 'package:one_key/utils/utils.dart'; | ||
| 24 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 25 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 26 | +import 'package:one_key/widgets/loading.dart'; | ||
| 27 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 28 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 29 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 30 | +import 'package:provider/provider.dart'; | ||
| 31 | +import 'package:sign_in_with_apple/sign_in_with_apple.dart'; | ||
| 32 | + | ||
| 33 | +class AccountLoginPage extends StatefulWidget { | ||
| 34 | + @override | ||
| 35 | + State<StatefulWidget> createState() { | ||
| 36 | + // TODO: implement createState | ||
| 37 | + return new AccountLoginPageState(); | ||
| 38 | + } | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +class AccountLoginPageState extends State<AccountLoginPage> | ||
| 42 | + with WidgetsBindingObserver { | ||
| 43 | + TextEditingController _sellerCodeController = TextEditingController(); | ||
| 44 | + TextEditingController _accountController = TextEditingController(); | ||
| 45 | + final TextEditingController _pwdController = TextEditingController(); | ||
| 46 | + final ScrollController _scrollController = new ScrollController(); | ||
| 47 | + | ||
| 48 | + final FocusNode _sellerCodeFocusNode = new FocusNode(); | ||
| 49 | + final FocusNode _accountFocusNode = new FocusNode(); | ||
| 50 | + final FocusNode _pwdFocusNode = new FocusNode(); | ||
| 51 | + | ||
| 52 | + bool isActivate = false; //是否激活登录 | ||
| 53 | + | ||
| 54 | + StreamSubscription<BaseWeChatResponse> streamSubscription; | ||
| 55 | + OtherLoginProvider otherLoginProvider; | ||
| 56 | + CreateStoreModel createStoreModel; | ||
| 57 | + | ||
| 58 | + @override | ||
| 59 | + void initState() { | ||
| 60 | + // TODO: implement initState | ||
| 61 | + super.initState(); | ||
| 62 | + | ||
| 63 | + WidgetsBinding.instance.addObserver(this); | ||
| 64 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 65 | + final UserModel userModel = | ||
| 66 | + Provider.of<UserModel>(context, listen: false); | ||
| 67 | + if (userModel != null && userModel.user != null) { | ||
| 68 | + Future.delayed(Duration(milliseconds: 50), () { | ||
| 69 | + _sellerCodeController.text = userModel.user.sellercode; | ||
| 70 | + _accountController.text = userModel.user.account; | ||
| 71 | + // FocusScope.of(context).requestFocus(_pwdFocusNode); | ||
| 72 | + }); | ||
| 73 | + } | ||
| 74 | + }); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + //当页面离开时要清除监听器 | ||
| 78 | + @override | ||
| 79 | + void dispose() { | ||
| 80 | + super.dispose(); | ||
| 81 | + WidgetsBinding.instance.removeObserver(this); | ||
| 82 | + if (streamSubscription != null) { | ||
| 83 | + streamSubscription.cancel(); | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + //监听输入框,设置登录按钮状态 | ||
| 88 | + setActivate() { | ||
| 89 | + if (_sellerCodeController.text.isNotEmpty && | ||
| 90 | + _accountController.text.isNotEmpty && | ||
| 91 | + _pwdController.text.isNotEmpty) { | ||
| 92 | + setState(() { | ||
| 93 | + isActivate = true; | ||
| 94 | + }); | ||
| 95 | + } else { | ||
| 96 | + setState(() { | ||
| 97 | + isActivate = false; | ||
| 98 | + }); | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + _showLoading(BuildContext context) { | ||
| 103 | + showGeneralDialog( | ||
| 104 | + context: context, | ||
| 105 | + barrierDismissible: false, | ||
| 106 | + barrierLabel: | ||
| 107 | + MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 108 | + transitionDuration: const Duration(milliseconds: 150), | ||
| 109 | + pageBuilder: (BuildContext context, Animation animation, | ||
| 110 | + Animation secondaryAnimation) { | ||
| 111 | + return Align( | ||
| 112 | + child: ClipRRect( | ||
| 113 | + borderRadius: BorderRadius.circular(10), | ||
| 114 | + child: Container( | ||
| 115 | + width: 80, | ||
| 116 | + height: 80, | ||
| 117 | + child: CupertinoActivityIndicator(), | ||
| 118 | + ), | ||
| 119 | + ), | ||
| 120 | + ); | ||
| 121 | + }).then((v) {}); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + @override | ||
| 125 | + Widget build(BuildContext context) { | ||
| 126 | + otherLoginProvider = | ||
| 127 | + Provider.of<OtherLoginProvider>(context, listen: false); | ||
| 128 | + createStoreModel = Provider.of<CreateStoreModel>(context, listen: false); | ||
| 129 | + | ||
| 130 | + final double prefixIconWidth = ScreenUtil().setWidth(24); | ||
| 131 | + | ||
| 132 | + return Scaffold( | ||
| 133 | + backgroundColor: MyColours.color_ffffff, | ||
| 134 | + appBar: SystemAppBar( | ||
| 135 | + '', | ||
| 136 | + onTap: () { | ||
| 137 | + Navigator.pop(context); | ||
| 138 | + }, | ||
| 139 | + ), | ||
| 140 | + body: Container( | ||
| 141 | + width: double.infinity, | ||
| 142 | + height: double.infinity, | ||
| 143 | + padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)), | ||
| 144 | + child: SingleChildScrollView( | ||
| 145 | + controller: _scrollController, | ||
| 146 | + child: Column( | ||
| 147 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 148 | + children: <Widget>[ | ||
| 149 | + VEmptyView(30), | ||
| 150 | + Row( | ||
| 151 | + children: [ | ||
| 152 | + Image.asset( | ||
| 153 | + "assets/logo.png", | ||
| 154 | + width: ScreenUtil().setWidth(20 * 2), | ||
| 155 | + height: ScreenUtil().setWidth(20 * 2), | ||
| 156 | + ), | ||
| 157 | + HEmptyView(16), | ||
| 158 | + Text( | ||
| 159 | + '账号密码登录', | ||
| 160 | + style: TextStyle( | ||
| 161 | + fontWeight: FontWeight.bold, | ||
| 162 | + fontSize: ScreenUtil().setSp(32)), | ||
| 163 | + ) | ||
| 164 | + ], | ||
| 165 | + ), | ||
| 166 | + VEmptyView(60), | ||
| 167 | + Text( | ||
| 168 | + '输入商户编号', | ||
| 169 | + style: TextStyle( | ||
| 170 | + fontWeight: FontWeight.bold, | ||
| 171 | + fontSize: ScreenUtil().setSp(26)), | ||
| 172 | + ), | ||
| 173 | + Container( | ||
| 174 | + height: ScreenUtil().setWidth(84), | ||
| 175 | + alignment: Alignment.center, | ||
| 176 | + decoration: BoxDecoration( | ||
| 177 | + border: Border( | ||
| 178 | + bottom: BorderSide( | ||
| 179 | + color: MyColours.color_efefef, | ||
| 180 | + width: ScreenUtil().setWidth(2))), | ||
| 181 | + ), | ||
| 182 | + child: TextField( | ||
| 183 | + controller: _sellerCodeController, | ||
| 184 | + focusNode: _sellerCodeFocusNode, | ||
| 185 | + // autofocus: _sellerCodeController.text.isEmpty, | ||
| 186 | + style: TextStyle( | ||
| 187 | + color: MyColours.color_353535, | ||
| 188 | + fontSize: ScreenUtil().setSp(28), | ||
| 189 | + ), | ||
| 190 | + // textAlignVertical: TextAlignVertical.center, | ||
| 191 | + decoration: InputDecoration( | ||
| 192 | + hintText: "例:001698", | ||
| 193 | + hintStyle: TextStyle( | ||
| 194 | + color: MyColours.color_c1c1c1, | ||
| 195 | + fontSize: ScreenUtil().setSp(28), | ||
| 196 | + ), | ||
| 197 | + border: InputBorder.none, | ||
| 198 | + contentPadding: EdgeInsets.only(bottom: -5), | ||
| 199 | + ), | ||
| 200 | + onChanged: (_) { | ||
| 201 | + setActivate(); | ||
| 202 | + }, | ||
| 203 | + keyboardType: TextInputType.number, | ||
| 204 | + )), | ||
| 205 | + VEmptyView(40), | ||
| 206 | + Text( | ||
| 207 | + '输入员工号', | ||
| 208 | + style: TextStyle( | ||
| 209 | + fontWeight: FontWeight.bold, | ||
| 210 | + fontSize: ScreenUtil().setSp(26)), | ||
| 211 | + ), | ||
| 212 | + Container( | ||
| 213 | + height: ScreenUtil().setWidth(84), | ||
| 214 | + alignment: Alignment.center, | ||
| 215 | + decoration: BoxDecoration( | ||
| 216 | + border: Border( | ||
| 217 | + bottom: BorderSide( | ||
| 218 | + color: MyColours.color_efefef, | ||
| 219 | + width: ScreenUtil().setWidth(2))), | ||
| 220 | + ), | ||
| 221 | + child: TextField( | ||
| 222 | + controller: _accountController, | ||
| 223 | + focusNode: _accountFocusNode, | ||
| 224 | + style: TextStyle( | ||
| 225 | + color: MyColours.color_353535, | ||
| 226 | + fontSize: ScreenUtil().setSp(28)), | ||
| 227 | + decoration: InputDecoration( | ||
| 228 | + hintText: "例:0001", | ||
| 229 | + hintStyle: TextStyle( | ||
| 230 | + color: MyColours.color_c1c1c1, | ||
| 231 | + fontSize: ScreenUtil().setSp(28)), | ||
| 232 | + border: InputBorder.none, | ||
| 233 | + contentPadding: EdgeInsets.only(bottom: -5), | ||
| 234 | + ), | ||
| 235 | + onChanged: (_) { | ||
| 236 | + setActivate(); | ||
| 237 | + }, | ||
| 238 | + keyboardType: TextInputType.number, | ||
| 239 | + )), | ||
| 240 | + VEmptyView(40), | ||
| 241 | + Text( | ||
| 242 | + '输入员工密码', | ||
| 243 | + style: TextStyle( | ||
| 244 | + fontWeight: FontWeight.bold, | ||
| 245 | + fontSize: ScreenUtil().setSp(26)), | ||
| 246 | + ), | ||
| 247 | + Container( | ||
| 248 | + height: ScreenUtil().setWidth(84), | ||
| 249 | + alignment: Alignment.center, | ||
| 250 | + decoration: BoxDecoration( | ||
| 251 | + border: Border( | ||
| 252 | + bottom: BorderSide( | ||
| 253 | + color: MyColours.color_efefef, | ||
| 254 | + width: ScreenUtil().setWidth(2))), | ||
| 255 | + ), | ||
| 256 | + child: TextField( | ||
| 257 | + controller: _pwdController, | ||
| 258 | + focusNode: _pwdFocusNode, | ||
| 259 | + // autofocus: _sellerCodeController.text.isNotEmpty && | ||
| 260 | + // _accountController.text.isNotEmpty && | ||
| 261 | + // _pwdController.text.isEmpty, | ||
| 262 | + style: TextStyle( | ||
| 263 | + color: MyColours.color_353535, | ||
| 264 | + fontSize: ScreenUtil().setSp(28)), | ||
| 265 | + decoration: InputDecoration( | ||
| 266 | + hintText: "请输入六位员工密码", | ||
| 267 | + hintStyle: TextStyle( | ||
| 268 | + color: MyColours.color_c1c1c1, | ||
| 269 | + fontSize: ScreenUtil().setSp(28)), | ||
| 270 | + border: InputBorder.none, | ||
| 271 | + contentPadding: EdgeInsets.only(bottom: -5), | ||
| 272 | + ), | ||
| 273 | + onChanged: (_) { | ||
| 274 | + setActivate(); | ||
| 275 | + }, | ||
| 276 | + obscureText: true, | ||
| 277 | + keyboardType: TextInputType.text, | ||
| 278 | + )), | ||
| 279 | + VEmptyView(40), | ||
| 280 | + Consumer<UserModel>( | ||
| 281 | + builder: | ||
| 282 | + (BuildContext context, UserModel value, Widget child) { | ||
| 283 | + return GestureDetector( | ||
| 284 | + onTap: () { | ||
| 285 | + if (!isActivate) return; | ||
| 286 | + | ||
| 287 | + if (App.sp.containsKey('unionid')) { | ||
| 288 | + //微信登陆的时候,退出清空数据 | ||
| 289 | + App.sp.remove('openid'); | ||
| 290 | + App.sp.remove("unionid"); | ||
| 291 | + } | ||
| 292 | + Map<String, String> params = { | ||
| 293 | + "seller_code": "${_sellerCodeController.text}", | ||
| 294 | + "alias": "ssahdahgdafgahjkhakjgh", | ||
| 295 | + "account": "${_accountController.text}", | ||
| 296 | + "password": "${_pwdController.text}" | ||
| 297 | + }; | ||
| 298 | + value | ||
| 299 | + .login(context, params, acclogin: true) | ||
| 300 | + .then((value) {}); | ||
| 301 | + }, | ||
| 302 | + child: Center( | ||
| 303 | + child: Container( | ||
| 304 | + height: ScreenUtil().setWidth(84), | ||
| 305 | + width: ScreenUtil().setWidth(350), | ||
| 306 | + alignment: Alignment.center, | ||
| 307 | + decoration: BoxDecoration( | ||
| 308 | + color: isActivate | ||
| 309 | + ? MyColours.color_41444B | ||
| 310 | + : MyColours.color_F7F7F7, | ||
| 311 | + borderRadius: BorderRadius.all( | ||
| 312 | + Radius.circular(ScreenUtil().setWidth(8)))), | ||
| 313 | + child: Text( | ||
| 314 | + "登录", | ||
| 315 | + style: TextStyle( | ||
| 316 | + color: isActivate | ||
| 317 | + ? MyColours.color_ffffff | ||
| 318 | + : MyColours.color_C9C9C9, | ||
| 319 | + fontSize: ScreenUtil().setSp(34)), | ||
| 320 | + ), | ||
| 321 | + ))); | ||
| 322 | + }, | ||
| 323 | + ), | ||
| 324 | + ], | ||
| 325 | + ), | ||
| 326 | + ), | ||
| 327 | + )); | ||
| 328 | + } | ||
| 329 | +} |
| @@ -98,6 +98,7 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore> | @@ -98,6 +98,7 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore> | ||
| 98 | ///进入某个店铺 | 98 | ///进入某个店铺 |
| 99 | _loginStore(context, CheckSellerAccSunModel sunModel) { | 99 | _loginStore(context, CheckSellerAccSunModel sunModel) { |
| 100 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 100 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 101 | + userModel.accountLogin = false; | ||
| 101 | Map<String, dynamic> seller = sunModel.toJson(); | 102 | Map<String, dynamic> seller = sunModel.toJson(); |
| 102 | Map<String, dynamic> userMap = { | 103 | Map<String, dynamic> userMap = { |
| 103 | "openid": seller['uid'], | 104 | "openid": seller['uid'], |
| @@ -308,6 +309,7 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore> | @@ -308,6 +309,7 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore> | ||
| 308 | } | 309 | } |
| 309 | return InkWell( | 310 | return InkWell( |
| 310 | onTap: () async { | 311 | onTap: () async { |
| 312 | + if (widget.changeStatus) { | ||
| 311 | UserModel userModel = | 313 | UserModel userModel = |
| 312 | Provider.of<UserModel>(context, | 314 | Provider.of<UserModel>(context, |
| 313 | listen: false); | 315 | listen: false); |
| @@ -321,6 +323,10 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore> | @@ -321,6 +323,10 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore> | ||
| 321 | _loginStore( | 323 | _loginStore( |
| 322 | context, model.sellerList[index]); | 324 | context, model.sellerList[index]); |
| 323 | } | 325 | } |
| 326 | + } else { | ||
| 327 | + _loginStore( | ||
| 328 | + context, model.sellerList[index]); | ||
| 329 | + } | ||
| 324 | }, | 330 | }, |
| 325 | child: IfNeedCreateStoreItem( | 331 | child: IfNeedCreateStoreItem( |
| 326 | model: model.sellerList[index]), | 332 | model: model.sellerList[index]), |
| 1 | -import 'dart:async'; | ||
| 2 | -import 'dart:convert'; | ||
| 3 | -import 'dart:io'; | ||
| 4 | - | ||
| 5 | -import 'package:common_utils/common_utils.dart'; | ||
| 6 | -import 'package:dio/dio.dart'; | ||
| 7 | -import 'package:flutter/cupertino.dart'; | ||
| 8 | -import 'package:flutter/material.dart'; | ||
| 9 | -import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 10 | -import 'package:fluwx/fluwx.dart' as fluwx; | ||
| 11 | -import 'package:fluwx/fluwx.dart'; | ||
| 12 | -import 'package:one_key/app.dart'; | ||
| 13 | -import 'package:one_key/models/checkbind_phone_model.dart'; | ||
| 14 | -import 'package:one_key/models/store_info.dart'; | ||
| 15 | -import 'package:one_key/net/dio_util.dart'; | ||
| 16 | -import 'package:one_key/provider/create_store_model.dart'; | ||
| 17 | -import 'package:one_key/provider/other_login_provider.dart'; | ||
| 18 | -import 'package:one_key/provider/user_model.dart'; | ||
| 19 | -import 'package:one_key/res/colors.dart'; | ||
| 20 | -import 'package:one_key/route/navigate_service.dart'; | ||
| 21 | -import 'package:one_key/route/navigator_util.dart'; | ||
| 22 | -import 'package:one_key/utils/dialog_util.dart'; | ||
| 23 | -import 'package:one_key/utils/utils.dart'; | ||
| 24 | -import 'package:one_key/widgets/MyDivider.dart'; | ||
| 25 | -import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 26 | -import 'package:one_key/widgets/loading.dart'; | ||
| 27 | -import 'package:one_key/widgets/round_button.dart'; | ||
| 28 | -import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 29 | -import 'package:provider/provider.dart'; | ||
| 30 | -import 'package:sign_in_with_apple/sign_in_with_apple.dart'; | ||
| 31 | - | ||
| 32 | -class LoginPage extends StatefulWidget { | ||
| 33 | - @override | ||
| 34 | - State<StatefulWidget> createState() { | ||
| 35 | - // TODO: implement createState | ||
| 36 | - return new LoginState(); | ||
| 37 | - } | ||
| 38 | -} | ||
| 39 | - | ||
| 40 | -class LoginState extends State<LoginPage> with WidgetsBindingObserver { | ||
| 41 | - TextEditingController _sellerCodeController = TextEditingController(); | ||
| 42 | - TextEditingController _accountController = TextEditingController(); | ||
| 43 | - final TextEditingController _pwdController = TextEditingController(); | ||
| 44 | - final ScrollController _scrollController = new ScrollController(); | ||
| 45 | - | ||
| 46 | - final FocusNode _sellerCodeFocusNode = new FocusNode(); | ||
| 47 | - final FocusNode _accountFocusNode = new FocusNode(); | ||
| 48 | - final FocusNode _pwdFocusNode = new FocusNode(); | ||
| 49 | - | ||
| 50 | - bool obscureText = true; //是否隐藏密码 | ||
| 51 | - bool isActivate = false; //是否激活登录 | ||
| 52 | - | ||
| 53 | - String errorText = ""; //错误提示 | ||
| 54 | - | ||
| 55 | - bool _check = false; | ||
| 56 | - StreamSubscription<BaseWeChatResponse> streamSubscription; | ||
| 57 | - OtherLoginProvider otherLoginProvider; | ||
| 58 | - CreateStoreModel createStoreModel; | ||
| 59 | - | ||
| 60 | - @override | ||
| 61 | - void initState() { | ||
| 62 | - // TODO: implement initState | ||
| 63 | - super.initState(); | ||
| 64 | - //第一次打开应用 | 1 | +// import 'dart:async'; |
| 2 | +// import 'dart:convert'; | ||
| 3 | +// import 'dart:io'; | ||
| 4 | + | ||
| 5 | +// import 'package:common_utils/common_utils.dart'; | ||
| 6 | +// import 'package:dio/dio.dart'; | ||
| 7 | +// import 'package:flutter/cupertino.dart'; | ||
| 8 | +// import 'package:flutter/material.dart'; | ||
| 9 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 10 | +// import 'package:fluwx/fluwx.dart' as fluwx; | ||
| 11 | +// import 'package:fluwx/fluwx.dart'; | ||
| 12 | +// import 'package:one_key/app.dart'; | ||
| 13 | +// import 'package:one_key/models/checkbind_phone_model.dart'; | ||
| 14 | +// import 'package:one_key/models/store_info.dart'; | ||
| 15 | +// import 'package:one_key/net/dio_util.dart'; | ||
| 16 | +// import 'package:one_key/provider/create_store_model.dart'; | ||
| 17 | +// import 'package:one_key/provider/other_login_provider.dart'; | ||
| 18 | +// import 'package:one_key/provider/user_model.dart'; | ||
| 19 | +// import 'package:one_key/res/colors.dart'; | ||
| 20 | +// import 'package:one_key/route/navigate_service.dart'; | ||
| 21 | +// import 'package:one_key/route/navigator_util.dart'; | ||
| 22 | +// import 'package:one_key/utils/dialog_util.dart'; | ||
| 23 | +// import 'package:one_key/utils/utils.dart'; | ||
| 24 | +// import 'package:one_key/widgets/MyDivider.dart'; | ||
| 25 | +// import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 26 | +// import 'package:one_key/widgets/loading.dart'; | ||
| 27 | +// import 'package:one_key/widgets/round_button.dart'; | ||
| 28 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 29 | +// import 'package:provider/provider.dart'; | ||
| 30 | +// import 'package:sign_in_with_apple/sign_in_with_apple.dart'; | ||
| 31 | + | ||
| 32 | +// class LoginPage extends StatefulWidget { | ||
| 33 | +// @override | ||
| 34 | +// State<StatefulWidget> createState() { | ||
| 35 | +// // TODO: implement createState | ||
| 36 | +// return new LoginState(); | ||
| 37 | +// } | ||
| 38 | +// } | ||
| 39 | + | ||
| 40 | +// class LoginState extends State<LoginPage> with WidgetsBindingObserver { | ||
| 41 | +// TextEditingController _sellerCodeController = TextEditingController(); | ||
| 42 | +// TextEditingController _accountController = TextEditingController(); | ||
| 43 | +// final TextEditingController _pwdController = TextEditingController(); | ||
| 44 | +// final ScrollController _scrollController = new ScrollController(); | ||
| 45 | + | ||
| 46 | +// final FocusNode _sellerCodeFocusNode = new FocusNode(); | ||
| 47 | +// final FocusNode _accountFocusNode = new FocusNode(); | ||
| 48 | +// final FocusNode _pwdFocusNode = new FocusNode(); | ||
| 49 | + | ||
| 50 | +// bool obscureText = true; //是否隐藏密码 | ||
| 51 | +// bool isActivate = false; //是否激活登录 | ||
| 52 | + | ||
| 53 | +// String errorText = ""; //错误提示 | ||
| 54 | + | ||
| 55 | +// bool _check = false; | ||
| 56 | +// StreamSubscription<BaseWeChatResponse> streamSubscription; | ||
| 57 | +// OtherLoginProvider otherLoginProvider; | ||
| 58 | +// CreateStoreModel createStoreModel; | ||
| 59 | + | ||
| 60 | +// @override | ||
| 61 | +// void initState() { | ||
| 62 | +// // TODO: implement initState | ||
| 63 | +// super.initState(); | ||
| 64 | +// //第一次打开应用 | ||
| 65 | 65 | ||
| 66 | 66 | ||
| 67 | - _checkWechat(); | ||
| 68 | - isLogin(); | ||
| 69 | - WidgetsBinding.instance.addObserver(this); | ||
| 70 | - WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 71 | - final UserModel userModel = | ||
| 72 | - Provider.of<UserModel>(context, listen: false); | ||
| 73 | - if (userModel != null && userModel.user != null) { | ||
| 74 | - Future.delayed(Duration(milliseconds: 50), () { | ||
| 75 | - _sellerCodeController.text = userModel.user.sellercode; | ||
| 76 | - _accountController.text = userModel.user.account; | ||
| 77 | - // FocusScope.of(context).requestFocus(_pwdFocusNode); | ||
| 78 | - }); | ||
| 79 | - } | ||
| 80 | - }); | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - //当页面离开时要清除监听器 | ||
| 84 | - @override | ||
| 85 | - void dispose() { | ||
| 86 | - super.dispose(); | ||
| 87 | - WidgetsBinding.instance.removeObserver(this); | ||
| 88 | - if (streamSubscription != null) { | ||
| 89 | - streamSubscription.cancel(); | ||
| 90 | - } | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - //微信是否安装 | ||
| 94 | - _checkWechat() async { | ||
| 95 | - // await registerWxApi( | ||
| 96 | - // appId: "wx85aa3cdd0f791e65", | ||
| 97 | - // doOnAndroid: true, | ||
| 98 | - // doOnIOS: true, | ||
| 99 | - // universalLink: "https://xt04.colorcun.com/link/OneKey/"); | ||
| 100 | - var result = await isWeChatInstalled; | ||
| 101 | - if (result != null && result) { | ||
| 102 | - App.isInstallWx = true; | ||
| 103 | - } else { | ||
| 104 | - App.isInstallWx = false; | ||
| 105 | - } | ||
| 106 | - setState(() {}); | ||
| 107 | - LogUtil.v("is installed $result"); | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - handlePostFrame(_) { | ||
| 111 | - // _scrollController.jumpTo(_scrollController.position.maxScrollExtent); | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | - @override | ||
| 115 | - void didChangeMetrics() { | ||
| 116 | - // TODO: implement didChangeMetrics | ||
| 117 | - WidgetsBinding.instance.addPostFrameCallback(handlePostFrame); | ||
| 118 | - super.didChangeDependencies(); | ||
| 119 | - } | ||
| 120 | - | ||
| 121 | - //监听输入框,设置登录按钮状态 | ||
| 122 | - setActivate() { | ||
| 123 | - if (_sellerCodeController.text.isNotEmpty && | ||
| 124 | - _accountController.text.isNotEmpty && | ||
| 125 | - _pwdController.text.isNotEmpty) { | ||
| 126 | - setState(() { | ||
| 127 | - errorText = ""; | ||
| 128 | - isActivate = true; | ||
| 129 | - }); | ||
| 130 | - } else { | ||
| 131 | - setState(() { | ||
| 132 | - errorText = ""; | ||
| 133 | - isActivate = false; | ||
| 134 | - }); | ||
| 135 | - } | ||
| 136 | - } | ||
| 137 | - | ||
| 138 | - //判断是否登录 | ||
| 139 | - void isLogin() async { | ||
| 140 | - await App.initSp(); | ||
| 141 | - UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 142 | - userModel.initUser(); | ||
| 143 | - if (App.sp.getBool("isLogin") ?? false) { | ||
| 144 | - Future.delayed(Duration(milliseconds: 200), () { | ||
| 145 | - NavigatorUtil.goHomePage(context); | ||
| 146 | - }); | ||
| 147 | - } else { | ||
| 148 | - _getWxCode(); | ||
| 149 | - } | ||
| 150 | - } | ||
| 151 | - | ||
| 152 | - ///微信登陆 | ||
| 153 | - | ||
| 154 | - _wxLogin() { | ||
| 155 | - sendWeChatAuth(scope: "snsapi_userinfo"); | ||
| 156 | - } | ||
| 157 | - | ||
| 158 | - ///获取微信登录code | ||
| 159 | - _getWxCode() { | ||
| 160 | - streamSubscription = fluwx.weChatResponseEventHandler | ||
| 161 | - .distinct((a, b) => a == b) | ||
| 162 | - .listen((res) { | ||
| 163 | - if (res is fluwx.WeChatAuthResponse && res.errCode == 0) { | ||
| 164 | - LogUtil.v("code:" + res.code); | ||
| 165 | - // Loading.showLoading(context); | ||
| 166 | - _getAccessToken(res.code); | ||
| 167 | - } else { | ||
| 168 | -// Utils.showToast(res.errStr??"登录失败,请稍后重试"); | ||
| 169 | - } | ||
| 170 | - }); | ||
| 171 | - } | ||
| 172 | - | ||
| 173 | - ///获取微信登录access_token | ||
| 174 | - _getAccessToken(String code) async { | ||
| 175 | - Response response = await DioUtil.getInstance().getDio().get( | ||
| 176 | - "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx85aa3cdd0f791e65&secret=87c9a23c2e6032b2da75af6b0efc5424&code=$code&grant_type=authorization_code"); | ||
| 177 | - LogUtil.v("access_token:${response.toString()}"); | ||
| 178 | - Map<String, dynamic> responseData = json.decode(response.data.toString()); | ||
| 179 | - if (responseData["errcode"] != null) { | ||
| 180 | - Utils.showToast(responseData["errmsg"] ?? "登录失败,请稍后重试"); | ||
| 181 | - // Loading.hideLoading(context); | ||
| 182 | - } else { | ||
| 183 | - App.sp.setString("openid", responseData["openid"]); | ||
| 184 | - App.sp.setString("unionid", responseData["unionid"]); | ||
| 185 | - | ||
| 186 | - //跳转至手机号绑定页面 | ||
| 187 | - //判断是否已经绑定手机号码 ******调用接口******* | ||
| 188 | - //有,通过手机号吗或者opened查找店铺信息进行登陆 | ||
| 189 | - //没有,跳转至绑定手机号码页面 | ||
| 190 | - // Map<String, String> params = { | ||
| 191 | - // "unionid": responseData["unionid"], | ||
| 192 | - // }; | ||
| 193 | - // BuildContext contextTemp = | ||
| 194 | - // App.getIt<NavigateService>().key.currentState.overlay.context; | ||
| 195 | - // CheckbindPhoneSunModel model = | ||
| 196 | - // await otherLoginProvider.checkbindPhone(contextTemp, params); | ||
| 197 | - // // Loading.hideLoading(context); | ||
| 198 | - // if (model != null) { | ||
| 199 | - // createStoreModel.storeInfo = StoreInfo(); | ||
| 200 | - // createStoreModel.storeInfo.phone = model.phone; | ||
| 201 | - createStoreModel.storeInfo = StoreInfo(); | ||
| 202 | - NavigatorUtil.goIfNeedCreateStorePage(context); | ||
| 203 | - // } else { | ||
| 204 | - // NavigatorUtil.goBindingPhonePage(context); | ||
| 205 | - // } | ||
| 206 | - | ||
| 207 | - // _getUserInfo(responseData["access_token"], responseData["openid"]); | ||
| 208 | - } | ||
| 209 | - } | ||
| 210 | - | ||
| 211 | -// //获取用户信息 | ||
| 212 | -// _getUserInfo(String access_token, String openid) async { | 67 | +// _checkWechat(); |
| 68 | +// isLogin(); | ||
| 69 | +// WidgetsBinding.instance.addObserver(this); | ||
| 70 | +// WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 71 | +// final UserModel userModel = | ||
| 72 | +// Provider.of<UserModel>(context, listen: false); | ||
| 73 | +// if (userModel != null && userModel.user != null) { | ||
| 74 | +// Future.delayed(Duration(milliseconds: 50), () { | ||
| 75 | +// _sellerCodeController.text = userModel.user.sellercode; | ||
| 76 | +// _accountController.text = userModel.user.account; | ||
| 77 | +// // FocusScope.of(context).requestFocus(_pwdFocusNode); | ||
| 78 | +// }); | ||
| 79 | +// } | ||
| 80 | +// }); | ||
| 81 | +// } | ||
| 82 | + | ||
| 83 | +// //当页面离开时要清除监听器 | ||
| 84 | +// @override | ||
| 85 | +// void dispose() { | ||
| 86 | +// super.dispose(); | ||
| 87 | +// WidgetsBinding.instance.removeObserver(this); | ||
| 88 | +// if (streamSubscription != null) { | ||
| 89 | +// streamSubscription.cancel(); | ||
| 90 | +// } | ||
| 91 | +// } | ||
| 92 | + | ||
| 93 | +// //微信是否安装 | ||
| 94 | +// _checkWechat() async { | ||
| 95 | +// // await registerWxApi( | ||
| 96 | +// // appId: "wx85aa3cdd0f791e65", | ||
| 97 | +// // doOnAndroid: true, | ||
| 98 | +// // doOnIOS: true, | ||
| 99 | +// // universalLink: "https://xt04.colorcun.com/link/OneKey/"); | ||
| 100 | +// var result = await isWeChatInstalled; | ||
| 101 | +// if (result != null && result) { | ||
| 102 | +// App.isInstallWx = true; | ||
| 103 | +// } else { | ||
| 104 | +// App.isInstallWx = false; | ||
| 105 | +// } | ||
| 106 | +// setState(() {}); | ||
| 107 | +// LogUtil.v("is installed $result"); | ||
| 108 | +// } | ||
| 109 | + | ||
| 110 | +// handlePostFrame(_) { | ||
| 111 | +// // _scrollController.jumpTo(_scrollController.position.maxScrollExtent); | ||
| 112 | +// } | ||
| 113 | + | ||
| 114 | +// @override | ||
| 115 | +// void didChangeMetrics() { | ||
| 116 | +// // TODO: implement didChangeMetrics | ||
| 117 | +// WidgetsBinding.instance.addPostFrameCallback(handlePostFrame); | ||
| 118 | +// super.didChangeDependencies(); | ||
| 119 | +// } | ||
| 120 | + | ||
| 121 | +// //监听输入框,设置登录按钮状态 | ||
| 122 | +// setActivate() { | ||
| 123 | +// if (_sellerCodeController.text.isNotEmpty && | ||
| 124 | +// _accountController.text.isNotEmpty && | ||
| 125 | +// _pwdController.text.isNotEmpty) { | ||
| 126 | +// setState(() { | ||
| 127 | +// errorText = ""; | ||
| 128 | +// isActivate = true; | ||
| 129 | +// }); | ||
| 130 | +// } else { | ||
| 131 | +// setState(() { | ||
| 132 | +// errorText = ""; | ||
| 133 | +// isActivate = false; | ||
| 134 | +// }); | ||
| 135 | +// } | ||
| 136 | +// } | ||
| 137 | + | ||
| 138 | +// //判断是否登录 | ||
| 139 | +// void isLogin() async { | ||
| 140 | +// await App.initSp(); | ||
| 141 | +// UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 142 | +// userModel.initUser(); | ||
| 143 | +// if (App.sp.getBool("isLogin") ?? false) { | ||
| 144 | +// Future.delayed(Duration(milliseconds: 200), () { | ||
| 145 | +// NavigatorUtil.goHomePage(context); | ||
| 146 | +// }); | ||
| 147 | +// } else { | ||
| 148 | +// _getWxCode(); | ||
| 149 | +// } | ||
| 150 | +// } | ||
| 151 | + | ||
| 152 | +// ///微信登陆 | ||
| 153 | + | ||
| 154 | +// _wxLogin() { | ||
| 155 | +// sendWeChatAuth(scope: "snsapi_userinfo"); | ||
| 156 | +// } | ||
| 157 | + | ||
| 158 | +// ///获取微信登录code | ||
| 159 | +// _getWxCode() { | ||
| 160 | +// streamSubscription = fluwx.weChatResponseEventHandler | ||
| 161 | +// .distinct((a, b) => a == b) | ||
| 162 | +// .listen((res) { | ||
| 163 | +// if (res is fluwx.WeChatAuthResponse && res.errCode == 0) { | ||
| 164 | +// LogUtil.v("code:" + res.code); | ||
| 165 | +// // Loading.showLoading(context); | ||
| 166 | +// _getAccessToken(res.code); | ||
| 167 | +// } else { | ||
| 168 | +// // Utils.showToast(res.errStr??"登录失败,请稍后重试"); | ||
| 169 | +// } | ||
| 170 | +// }); | ||
| 171 | +// } | ||
| 172 | + | ||
| 173 | +// ///获取微信登录access_token | ||
| 174 | +// _getAccessToken(String code) async { | ||
| 213 | // Response response = await DioUtil.getInstance().getDio().get( | 175 | // Response response = await DioUtil.getInstance().getDio().get( |
| 214 | -// "https://api.weixin.qq.com/sns/userinfo?access_token=$access_token&openid=$openid"); | ||
| 215 | -// LogUtil.v('userinfo:' + response.data); | 176 | +// "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx85aa3cdd0f791e65&secret=87c9a23c2e6032b2da75af6b0efc5424&code=$code&grant_type=authorization_code"); |
| 177 | +// LogUtil.v("access_token:${response.toString()}"); | ||
| 216 | // Map<String, dynamic> responseData = json.decode(response.data.toString()); | 178 | // Map<String, dynamic> responseData = json.decode(response.data.toString()); |
| 217 | // if (responseData["errcode"] != null) { | 179 | // if (responseData["errcode"] != null) { |
| 218 | -// // Utils.showToast(responseData["errmsg"]??"登录,请稍后重试"); | 180 | +// Utils.showToast(responseData["errmsg"] ?? "登录失败,请稍后重试"); |
| 181 | +// // Loading.hideLoading(context); | ||
| 219 | // } else { | 182 | // } else { |
| 220 | -// App.sp.setString("nickName", responseData["nickname"]); | ||
| 221 | -// App.sp.setString("headImg", responseData["headimgurl"]); | 183 | +// App.sp.setString("openid", responseData["openid"]); |
| 222 | // App.sp.setString("unionid", responseData["unionid"]); | 184 | // App.sp.setString("unionid", responseData["unionid"]); |
| 223 | -// App.sp.setBool("isLogin", true); | ||
| 224 | -// // _fromTypeGo(); | ||
| 225 | -// String unionId = App.sp.getString("unionid"); | ||
| 226 | -// _getMiniOpenid(unionId); | 185 | + |
| 186 | +// //跳转至手机号绑定页面 | ||
| 187 | +// //判断是否已经绑定手机号码 ******调用接口******* | ||
| 188 | +// //有,通过手机号吗或者opened查找店铺信息进行登陆 | ||
| 189 | +// //没有,跳转至绑定手机号码页面 | ||
| 190 | +// // Map<String, String> params = { | ||
| 191 | +// // "unionid": responseData["unionid"], | ||
| 192 | +// // }; | ||
| 193 | +// // BuildContext contextTemp = | ||
| 194 | +// // App.getIt<NavigateService>().key.currentState.overlay.context; | ||
| 195 | +// // CheckbindPhoneSunModel model = | ||
| 196 | +// // await otherLoginProvider.checkbindPhone(contextTemp, params); | ||
| 197 | +// // // Loading.hideLoading(context); | ||
| 198 | +// // if (model != null) { | ||
| 199 | +// // createStoreModel.storeInfo = StoreInfo(); | ||
| 200 | +// // createStoreModel.storeInfo.phone = model.phone; | ||
| 201 | +// createStoreModel.storeInfo = StoreInfo(); | ||
| 202 | +// NavigatorUtil.goIfNeedCreateStorePage(context); | ||
| 203 | +// // } else { | ||
| 204 | +// // NavigatorUtil.goBindingPhonePage(context); | ||
| 205 | +// // } | ||
| 206 | + | ||
| 207 | +// // _getUserInfo(responseData["access_token"], responseData["openid"]); | ||
| 208 | +// } | ||
| 209 | +// } | ||
| 210 | + | ||
| 211 | +// // //获取用户信息 | ||
| 212 | +// // _getUserInfo(String access_token, String openid) async { | ||
| 213 | +// // Response response = await DioUtil.getInstance().getDio().get( | ||
| 214 | +// // "https://api.weixin.qq.com/sns/userinfo?access_token=$access_token&openid=$openid"); | ||
| 215 | +// // LogUtil.v('userinfo:' + response.data); | ||
| 216 | +// // Map<String, dynamic> responseData = json.decode(response.data.toString()); | ||
| 217 | +// // if (responseData["errcode"] != null) { | ||
| 218 | +// // // Utils.showToast(responseData["errmsg"]??"登录,请稍后重试"); | ||
| 219 | +// // } else { | ||
| 220 | +// // App.sp.setString("nickName", responseData["nickname"]); | ||
| 221 | +// // App.sp.setString("headImg", responseData["headimgurl"]); | ||
| 222 | +// // App.sp.setString("unionid", responseData["unionid"]); | ||
| 223 | +// // App.sp.setBool("isLogin", true); | ||
| 224 | +// // // _fromTypeGo(); | ||
| 225 | +// // String unionId = App.sp.getString("unionid"); | ||
| 226 | +// // _getMiniOpenid(unionId); | ||
| 227 | +// // } | ||
| 228 | +// // } | ||
| 229 | +// // //获取绑定小程序openid | ||
| 230 | +// // _getMiniOpenid(String unionId) async { | ||
| 231 | +// // UserModel userInfoProvider = UserModel(); | ||
| 232 | +// // // Provider.of<UserInfoProvider>(context, listen: false); | ||
| 233 | +// // Map<String, String> params = {"unionid": unionId}; | ||
| 234 | +// // String miniOpenid = | ||
| 235 | +// // await userInfoProvider.getMiniProgramOpenid(context, params); | ||
| 236 | +// // if (miniOpenid == null) { | ||
| 237 | +// // goMiniProgramMd(unionId); | ||
| 238 | +// // } | ||
| 239 | +// // } | ||
| 240 | + | ||
| 241 | +// /* | ||
| 242 | +// 苹果登录获取用户信息 | ||
| 243 | +// */ | ||
| 244 | +// _getUserInfoIOS() async { | ||
| 245 | +// // Map<String, String> params = {"openid": App.sp.getString("openid")}; | ||
| 246 | +// // UserInfoProvider userInfoProvider = | ||
| 247 | +// // Provider.of<UserInfoProvider>(context, listen: false); | ||
| 248 | +// // UseInfoItemModel useInfoItemModel = | ||
| 249 | +// // await userInfoProvider.getUserInfo(context, params); | ||
| 250 | + | ||
| 251 | +// // if (ObjectUtil.isNotEmpty(useInfoItemModel.openid)) { | ||
| 252 | +// // _hideLoading(context); | ||
| 253 | +// // App.sp.setString("nickName", useInfoItemModel.nickname); | ||
| 254 | +// // App.sp.setString("headImg", ''); | ||
| 255 | +// // App.sp.setString("unionid", ''); | ||
| 256 | +// // App.sp.setBool("isLogin", true); | ||
| 257 | +// // UserInfoProvider userInfoProvider = new UserInfoProvider(); | ||
| 258 | +// // userInfoProvider.initPlatformState(context); | ||
| 259 | +// // // Loading.hideLoading(context); | ||
| 260 | +// // _fromTypeGo(); | ||
| 261 | +// // } else { | ||
| 262 | +// // // 已经授权,但是后台库里没有数据,版本差异,重新插入数据库 | ||
| 263 | +// // Map param = { | ||
| 264 | +// // 'openid': App.sp.getString("openid"), | ||
| 265 | +// // 'avatar': 'ios_avatar', | ||
| 266 | +// // 'nickname': '', | ||
| 267 | +// // 'gender': '1' | ||
| 268 | +// // }; | ||
| 269 | +// // LoginRespository().appleLogin(context, param, () { | ||
| 270 | +// // _getUserInfoIOS(); | ||
| 271 | +// // }); | ||
| 272 | +// // } | ||
| 273 | +// } | ||
| 274 | + | ||
| 275 | +// _showLoading(BuildContext context) { | ||
| 276 | +// showGeneralDialog( | ||
| 277 | +// context: context, | ||
| 278 | +// barrierDismissible: false, | ||
| 279 | +// barrierLabel: | ||
| 280 | +// MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 281 | +// transitionDuration: const Duration(milliseconds: 150), | ||
| 282 | +// pageBuilder: (BuildContext context, Animation animation, | ||
| 283 | +// Animation secondaryAnimation) { | ||
| 284 | +// return Align( | ||
| 285 | +// child: ClipRRect( | ||
| 286 | +// borderRadius: BorderRadius.circular(10), | ||
| 287 | +// child: Container( | ||
| 288 | +// width: 80, | ||
| 289 | +// height: 80, | ||
| 290 | +// child: CupertinoActivityIndicator(), | ||
| 291 | +// ), | ||
| 292 | +// ), | ||
| 293 | +// ); | ||
| 294 | +// }).then((v) {}); | ||
| 295 | +// } | ||
| 296 | + | ||
| 297 | +// ///苹果登陆 | ||
| 298 | +// _iosLogin(UserModel value) async { | ||
| 299 | +// String info = await Utils.getDeviceInfoSystem(); | ||
| 300 | +// int systemInfo = info.compareTo('13'); | ||
| 301 | +// if (systemInfo < 0) { | ||
| 302 | +// Utils.showToast('该系统版本不支持苹果登录'); | ||
| 303 | +// return; | ||
| 227 | // } | 304 | // } |
| 305 | +// final credential = await SignInWithApple.getAppleIDCredential( | ||
| 306 | +// scopes: [ | ||
| 307 | +// AppleIDAuthorizationScopes.email, | ||
| 308 | +// AppleIDAuthorizationScopes.fullName, | ||
| 309 | +// ], | ||
| 310 | +// webAuthenticationOptions: WebAuthenticationOptions( | ||
| 311 | +// // TODO: Set the `clientId` and `redirectUri` arguments to the values you entered in the Apple Developer portal during the setup | ||
| 312 | +// clientId: 'com.naji.reserveLine', | ||
| 313 | +// redirectUri: Uri.parse( | ||
| 314 | +// 'https://flutter-sign-in-with-apple-example.glitch.me/callbacks/sign_in_with_apple', | ||
| 315 | +// ), | ||
| 316 | +// ), | ||
| 317 | +// ); | ||
| 318 | +// // _showLoading(context); | ||
| 319 | +// // print(credential.userIdentifier); | ||
| 320 | +// _loginAppleData(value); | ||
| 321 | +// // NavigatorUtil.goBindingPhonePage(context, wechat: false); | ||
| 322 | +// // String mdString = Utils.generateMd5(credential.userIdentifier); | ||
| 323 | +// // String temp = mdString.substring(8, mdString.length - 2); | ||
| 324 | +// // String openid = 'IOSID_$temp'; | ||
| 325 | +// // App.sp.setString("openid", openid); | ||
| 326 | +// // App.sp.setString("unionid", ''); | ||
| 327 | +// // print(openid.length); | ||
| 328 | + | ||
| 329 | +// // 第一次授权 | ||
| 330 | +// // if (ObjectUtil.isNotEmpty(credential.familyName)) { | ||
| 331 | +// // Map param = { | ||
| 332 | +// // 'openid': openid, | ||
| 333 | +// // 'avatar': 'ios_avatar', | ||
| 334 | +// // 'nickname': '${credential.familyName}${credential.givenName}', | ||
| 335 | +// // 'gender': '1' | ||
| 336 | +// // }; | ||
| 337 | +// // LoginRespository().appleLogin(context, param, () { | ||
| 338 | +// // _getUserInfoIOS(); | ||
| 339 | +// // }); | ||
| 340 | +// // } else { | ||
| 341 | +// // if (ObjectUtil.isNotEmpty(App.sp.getString("newUserMsg"))) { | ||
| 342 | +// // Map newUserMsg = jsonDecode(App.sp.getString("newUserMsg")); | ||
| 343 | +// // //上次失败了,这次重新传 | ||
| 344 | +// // LoginRespository().appleLogin(context, newUserMsg, () { | ||
| 345 | +// // _getUserInfoIOS(); | ||
| 346 | +// // }); | ||
| 347 | +// // } else { | ||
| 348 | +// // _getUserInfoIOS(); | ||
| 349 | +// // } | ||
| 350 | +// // } | ||
| 228 | // } | 351 | // } |
| 229 | -// //获取绑定小程序openid | ||
| 230 | -// _getMiniOpenid(String unionId) async { | ||
| 231 | -// UserModel userInfoProvider = UserModel(); | ||
| 232 | -// // Provider.of<UserInfoProvider>(context, listen: false); | ||
| 233 | -// Map<String, String> params = {"unionid": unionId}; | ||
| 234 | -// String miniOpenid = | ||
| 235 | -// await userInfoProvider.getMiniProgramOpenid(context, params); | ||
| 236 | -// if (miniOpenid == null) { | ||
| 237 | -// goMiniProgramMd(unionId); | 352 | + |
| 353 | +// _loginAppleData(UserModel value) { | ||
| 354 | +// if (App.sp.containsKey('unionid')) { | ||
| 355 | +// //微信登陆的时候,退出清空数据 | ||
| 356 | +// App.sp.remove('openid'); | ||
| 357 | +// App.sp.remove("unionid"); | ||
| 238 | // } | 358 | // } |
| 359 | +// Map<String, String> params = { | ||
| 360 | +// "seller_code": "001297", | ||
| 361 | +// "alias": "ssahdahgdafgahjkhakjgh", | ||
| 362 | +// "account": "0001", | ||
| 363 | +// "password": "123456" | ||
| 364 | +// }; | ||
| 365 | +// value.login(context, params).then((value) { | ||
| 366 | +// // setState(() { | ||
| 367 | +// // // errorText = value ?? ""; | ||
| 368 | +// // }); | ||
| 369 | +// }); | ||
| 239 | // } | 370 | // } |
| 240 | 371 | ||
| 241 | - /* | ||
| 242 | - 苹果登录获取用户信息 | ||
| 243 | - */ | ||
| 244 | - _getUserInfoIOS() async { | ||
| 245 | - // Map<String, String> params = {"openid": App.sp.getString("openid")}; | ||
| 246 | - // UserInfoProvider userInfoProvider = | ||
| 247 | - // Provider.of<UserInfoProvider>(context, listen: false); | ||
| 248 | - // UseInfoItemModel useInfoItemModel = | ||
| 249 | - // await userInfoProvider.getUserInfo(context, params); | ||
| 250 | - | ||
| 251 | - // if (ObjectUtil.isNotEmpty(useInfoItemModel.openid)) { | ||
| 252 | - // _hideLoading(context); | ||
| 253 | - // App.sp.setString("nickName", useInfoItemModel.nickname); | ||
| 254 | - // App.sp.setString("headImg", ''); | ||
| 255 | - // App.sp.setString("unionid", ''); | ||
| 256 | - // App.sp.setBool("isLogin", true); | ||
| 257 | - // UserInfoProvider userInfoProvider = new UserInfoProvider(); | ||
| 258 | - // userInfoProvider.initPlatformState(context); | ||
| 259 | - // // Loading.hideLoading(context); | ||
| 260 | - // _fromTypeGo(); | ||
| 261 | - // } else { | ||
| 262 | - // // 已经授权,但是后台库里没有数据,版本差异,重新插入数据库 | ||
| 263 | - // Map param = { | ||
| 264 | - // 'openid': App.sp.getString("openid"), | ||
| 265 | - // 'avatar': 'ios_avatar', | ||
| 266 | - // 'nickname': '', | ||
| 267 | - // 'gender': '1' | ||
| 268 | - // }; | ||
| 269 | - // LoginRespository().appleLogin(context, param, () { | ||
| 270 | - // _getUserInfoIOS(); | ||
| 271 | - // }); | ||
| 272 | - // } | ||
| 273 | - } | ||
| 274 | - | ||
| 275 | - _showLoading(BuildContext context) { | ||
| 276 | - showGeneralDialog( | ||
| 277 | - context: context, | ||
| 278 | - barrierDismissible: false, | ||
| 279 | - barrierLabel: | ||
| 280 | - MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 281 | - transitionDuration: const Duration(milliseconds: 150), | ||
| 282 | - pageBuilder: (BuildContext context, Animation animation, | ||
| 283 | - Animation secondaryAnimation) { | ||
| 284 | - return Align( | ||
| 285 | - child: ClipRRect( | ||
| 286 | - borderRadius: BorderRadius.circular(10), | ||
| 287 | - child: Container( | ||
| 288 | - width: 80, | ||
| 289 | - height: 80, | ||
| 290 | - child: CupertinoActivityIndicator(), | ||
| 291 | - ), | ||
| 292 | - ), | ||
| 293 | - ); | ||
| 294 | - }).then((v) {}); | ||
| 295 | - } | ||
| 296 | - | ||
| 297 | - ///苹果登陆 | ||
| 298 | - _iosLogin(UserModel value) async { | ||
| 299 | - String info = await Utils.getDeviceInfoSystem(); | ||
| 300 | - int systemInfo = info.compareTo('13'); | ||
| 301 | - if (systemInfo < 0) { | ||
| 302 | - Utils.showToast('该系统版本不支持苹果登录'); | ||
| 303 | - return; | ||
| 304 | - } | ||
| 305 | - final credential = await SignInWithApple.getAppleIDCredential( | ||
| 306 | - scopes: [ | ||
| 307 | - AppleIDAuthorizationScopes.email, | ||
| 308 | - AppleIDAuthorizationScopes.fullName, | ||
| 309 | - ], | ||
| 310 | - webAuthenticationOptions: WebAuthenticationOptions( | ||
| 311 | - // TODO: Set the `clientId` and `redirectUri` arguments to the values you entered in the Apple Developer portal during the setup | ||
| 312 | - clientId: 'com.naji.reserveLine', | ||
| 313 | - redirectUri: Uri.parse( | ||
| 314 | - 'https://flutter-sign-in-with-apple-example.glitch.me/callbacks/sign_in_with_apple', | ||
| 315 | - ), | ||
| 316 | - ), | ||
| 317 | - ); | ||
| 318 | - // _showLoading(context); | ||
| 319 | - // print(credential.userIdentifier); | ||
| 320 | - _loginAppleData(value); | ||
| 321 | - // NavigatorUtil.goBindingPhonePage(context, wechat: false); | ||
| 322 | - // String mdString = Utils.generateMd5(credential.userIdentifier); | ||
| 323 | - // String temp = mdString.substring(8, mdString.length - 2); | ||
| 324 | - // String openid = 'IOSID_$temp'; | ||
| 325 | - // App.sp.setString("openid", openid); | ||
| 326 | - // App.sp.setString("unionid", ''); | ||
| 327 | - // print(openid.length); | ||
| 328 | - | ||
| 329 | - // 第一次授权 | ||
| 330 | - // if (ObjectUtil.isNotEmpty(credential.familyName)) { | ||
| 331 | - // Map param = { | ||
| 332 | - // 'openid': openid, | ||
| 333 | - // 'avatar': 'ios_avatar', | ||
| 334 | - // 'nickname': '${credential.familyName}${credential.givenName}', | ||
| 335 | - // 'gender': '1' | ||
| 336 | - // }; | ||
| 337 | - // LoginRespository().appleLogin(context, param, () { | ||
| 338 | - // _getUserInfoIOS(); | ||
| 339 | - // }); | ||
| 340 | - // } else { | ||
| 341 | - // if (ObjectUtil.isNotEmpty(App.sp.getString("newUserMsg"))) { | ||
| 342 | - // Map newUserMsg = jsonDecode(App.sp.getString("newUserMsg")); | ||
| 343 | - // //上次失败了,这次重新传 | ||
| 344 | - // LoginRespository().appleLogin(context, newUserMsg, () { | ||
| 345 | - // _getUserInfoIOS(); | ||
| 346 | - // }); | ||
| 347 | - // } else { | ||
| 348 | - // _getUserInfoIOS(); | ||
| 349 | - // } | ||
| 350 | - // } | ||
| 351 | - } | ||
| 352 | - | ||
| 353 | - _loginAppleData(UserModel value) { | ||
| 354 | - if (App.sp.containsKey('unionid')) { | ||
| 355 | - //微信登陆的时候,退出清空数据 | ||
| 356 | - App.sp.remove('openid'); | ||
| 357 | - App.sp.remove("unionid"); | ||
| 358 | - } | ||
| 359 | - Map<String, String> params = { | ||
| 360 | - "seller_code": "001297", | ||
| 361 | - "alias": "ssahdahgdafgahjkhakjgh", | ||
| 362 | - "account": "0001", | ||
| 363 | - "password": "123456" | ||
| 364 | - }; | ||
| 365 | - value.login(context, params).then((value) { | ||
| 366 | - // setState(() { | ||
| 367 | - // // errorText = value ?? ""; | ||
| 368 | - // }); | ||
| 369 | - }); | ||
| 370 | - } | ||
| 371 | - | ||
| 372 | - @override | ||
| 373 | - Widget build(BuildContext context) { | ||
| 374 | - ScreenUtil.init(context, width: 750, height: 1334); | ||
| 375 | - otherLoginProvider = | ||
| 376 | - Provider.of<OtherLoginProvider>(context, listen: false); | ||
| 377 | - createStoreModel = Provider.of<CreateStoreModel>(context, listen: false); | ||
| 378 | - final Size size = MediaQuery.of(context).size; | ||
| 379 | - App.screenWidth = size.width; | ||
| 380 | - App.screenHeight = size.height; | ||
| 381 | - App.statusBarHeight = MediaQuery.of(context).padding.top; | ||
| 382 | - App.bottomBarHeight = MediaQuery.of(context).padding.bottom; | ||
| 383 | - | ||
| 384 | - final double prefixIconWidth = ScreenUtil().setWidth(24); | ||
| 385 | - | ||
| 386 | - return Scaffold( | ||
| 387 | - backgroundColor: MyColours.color_ffffff, | ||
| 388 | - body: Container( | ||
| 389 | - width: double.infinity, | ||
| 390 | - height: double.infinity, | ||
| 391 | - child: SingleChildScrollView( | ||
| 392 | - controller: _scrollController, | ||
| 393 | - child: Column( | ||
| 394 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 395 | - children: <Widget>[ | ||
| 396 | - // VEmptyView(218 - App.statusBarHeight), | ||
| 397 | - VEmptyView(80 + App.statusBarHeight), | ||
| 398 | - Image.asset( | ||
| 399 | - "assets/logo.png", | ||
| 400 | - width: ScreenUtil().setWidth(74 * 2), | ||
| 401 | - height: ScreenUtil().setWidth(71 * 2), | ||
| 402 | - ), | ||
| 403 | - VEmptyView(80), | ||
| 404 | - Container( | ||
| 405 | - height: ScreenUtil().setHeight(84), | ||
| 406 | - width: ScreenUtil().setWidth(611), | ||
| 407 | - padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)), | ||
| 408 | - alignment: Alignment.center, | ||
| 409 | - decoration: BoxDecoration( | ||
| 410 | - border: Border.all( | ||
| 411 | - color: MyColours.color_bff6f7, | ||
| 412 | - width: ScreenUtil().setWidth(2)), | ||
| 413 | - borderRadius: | ||
| 414 | - BorderRadius.circular(ScreenUtil().setWidth(8))), | ||
| 415 | - child: Row( | ||
| 416 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 417 | - children: <Widget>[ | ||
| 418 | - Image.asset( | ||
| 419 | - "assets/icon_sellercode.png", | ||
| 420 | - width: prefixIconWidth, | ||
| 421 | - ), | ||
| 422 | - HEmptyView(26), | ||
| 423 | - Center( | ||
| 424 | - child: Text( | ||
| 425 | - "商户编号", | ||
| 426 | - style: TextStyle( | ||
| 427 | - color: MyColours.color_353535, | ||
| 428 | - fontSize: ScreenUtil().setSp(28)), | ||
| 429 | - )), | ||
| 430 | - Expanded( | ||
| 431 | - child: Container( | ||
| 432 | - height: ScreenUtil().setHeight(84), | ||
| 433 | - padding: EdgeInsets.only( | ||
| 434 | - left: ScreenUtil().setWidth(20), | ||
| 435 | - right: ScreenUtil().setWidth(20), | ||
| 436 | - top: ScreenUtil().setWidth(8)), | ||
| 437 | - child: TextField( | ||
| 438 | - controller: _sellerCodeController, | ||
| 439 | - focusNode: _sellerCodeFocusNode, | ||
| 440 | - // autofocus: _sellerCodeController.text.isEmpty, | ||
| 441 | - style: TextStyle( | ||
| 442 | - color: MyColours.color_353535, | ||
| 443 | - fontSize: ScreenUtil().setSp(28), | ||
| 444 | - textBaseline: TextBaseline.alphabetic), | ||
| 445 | - // textAlignVertical: TextAlignVertical.center, | ||
| 446 | - decoration: InputDecoration( | ||
| 447 | - hintText: "请输入6位商户编码", | ||
| 448 | - hintStyle: TextStyle( | ||
| 449 | - color: MyColours.color_c1c1c1, | ||
| 450 | - fontSize: ScreenUtil().setSp(28), | ||
| 451 | - ), | ||
| 452 | - border: OutlineInputBorder( | ||
| 453 | - borderSide: BorderSide.none), | ||
| 454 | - contentPadding: EdgeInsets.zero, | ||
| 455 | - ), | ||
| 456 | - onChanged: (_) { | ||
| 457 | - setActivate(); | ||
| 458 | - }, | ||
| 459 | - keyboardType: TextInputType.number, | ||
| 460 | - )), | ||
| 461 | - ) | ||
| 462 | - ], | ||
| 463 | - )), | ||
| 464 | - | ||
| 465 | - Container( | ||
| 466 | - height: ScreenUtil().setHeight(84), | ||
| 467 | - width: ScreenUtil().setWidth(611), | ||
| 468 | - padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)), | ||
| 469 | - margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)), | ||
| 470 | - alignment: Alignment.center, | ||
| 471 | - decoration: BoxDecoration( | ||
| 472 | - border: Border.all( | ||
| 473 | - color: MyColours.color_bff6f7, | ||
| 474 | - width: ScreenUtil().setWidth(2)), | ||
| 475 | - borderRadius: | ||
| 476 | - BorderRadius.circular(ScreenUtil().setWidth(8))), | ||
| 477 | - child: Row( | ||
| 478 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 479 | - children: <Widget>[ | ||
| 480 | - Image.asset( | ||
| 481 | - "assets/icon_account.png", | ||
| 482 | - width: prefixIconWidth, | ||
| 483 | - ), | ||
| 484 | - HEmptyView(26), | ||
| 485 | - Text( | ||
| 486 | - "工 号", | ||
| 487 | - style: TextStyle( | ||
| 488 | - color: MyColours.color_353535, | ||
| 489 | - fontSize: ScreenUtil().setSp(28)), | ||
| 490 | - ), | ||
| 491 | - Expanded( | ||
| 492 | - child: Container( | ||
| 493 | - height: ScreenUtil().setHeight(84), | ||
| 494 | - padding: EdgeInsets.only( | ||
| 495 | - left: ScreenUtil().setWidth(20), | ||
| 496 | - right: ScreenUtil().setWidth(20), | ||
| 497 | - top: ScreenUtil().setWidth(8)), | ||
| 498 | - child: TextField( | ||
| 499 | - controller: _accountController, | ||
| 500 | - focusNode: _accountFocusNode, | ||
| 501 | - style: TextStyle( | ||
| 502 | - color: MyColours.color_353535, | ||
| 503 | - fontSize: ScreenUtil().setSp(28)), | ||
| 504 | - decoration: InputDecoration( | ||
| 505 | - hintText: "请输入4位工号", | ||
| 506 | - hintStyle: TextStyle( | ||
| 507 | - color: MyColours.color_c1c1c1, | ||
| 508 | - fontSize: ScreenUtil().setSp(28)), | ||
| 509 | - border: OutlineInputBorder( | ||
| 510 | - borderSide: BorderSide.none), | ||
| 511 | - contentPadding: EdgeInsets.zero, | ||
| 512 | - ), | ||
| 513 | - onChanged: (_) { | ||
| 514 | - setActivate(); | ||
| 515 | - }, | ||
| 516 | - keyboardType: TextInputType.number, | ||
| 517 | - ), | ||
| 518 | - )) | ||
| 519 | - ], | ||
| 520 | - )), | ||
| 521 | - Container( | ||
| 522 | - height: ScreenUtil().setHeight(84), | ||
| 523 | - width: ScreenUtil().setWidth(611), | ||
| 524 | - padding: EdgeInsets.only( | ||
| 525 | - left: ScreenUtil().setWidth(20), | ||
| 526 | - right: ScreenUtil().setWidth(27)), | ||
| 527 | - margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)), | ||
| 528 | - alignment: Alignment.center, | ||
| 529 | - decoration: BoxDecoration( | ||
| 530 | - border: Border.all( | ||
| 531 | - color: MyColours.color_bff6f7, | ||
| 532 | - width: ScreenUtil().setWidth(2)), | ||
| 533 | - borderRadius: | ||
| 534 | - BorderRadius.circular(ScreenUtil().setWidth(8))), | ||
| 535 | - child: Row( | ||
| 536 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 537 | - children: <Widget>[ | ||
| 538 | - Image.asset( | ||
| 539 | - "assets/icon_pwd.png", | ||
| 540 | - width: prefixIconWidth, | ||
| 541 | - ), | ||
| 542 | - HEmptyView(26), | ||
| 543 | - Text( | ||
| 544 | - "密 码", | ||
| 545 | - style: TextStyle( | ||
| 546 | - color: MyColours.color_353535, | ||
| 547 | - fontSize: ScreenUtil().setSp(28)), | ||
| 548 | - ), | ||
| 549 | - Expanded( | ||
| 550 | - child: Container( | ||
| 551 | - height: ScreenUtil().setHeight(84), | ||
| 552 | - padding: EdgeInsets.only( | ||
| 553 | - left: ScreenUtil().setWidth(20), | ||
| 554 | - right: ScreenUtil().setWidth(20), | ||
| 555 | - top: ScreenUtil().setWidth(8)), | ||
| 556 | - child: TextField( | ||
| 557 | - controller: _pwdController, | ||
| 558 | - focusNode: _pwdFocusNode, | ||
| 559 | - // autofocus: _sellerCodeController.text.isNotEmpty && | ||
| 560 | - // _accountController.text.isNotEmpty && | ||
| 561 | - // _pwdController.text.isEmpty, | ||
| 562 | - style: TextStyle( | ||
| 563 | - color: MyColours.color_353535, | ||
| 564 | - fontSize: ScreenUtil().setSp(28)), | ||
| 565 | - decoration: InputDecoration( | ||
| 566 | - hintText: "请输入密码", | ||
| 567 | - hintStyle: TextStyle( | ||
| 568 | - color: MyColours.color_c1c1c1, | ||
| 569 | - fontSize: ScreenUtil().setSp(28)), | ||
| 570 | - border: OutlineInputBorder( | ||
| 571 | - borderSide: BorderSide.none), | ||
| 572 | - contentPadding: EdgeInsets.zero, | ||
| 573 | - ), | ||
| 574 | - onChanged: (_) { | ||
| 575 | - setActivate(); | ||
| 576 | - }, | ||
| 577 | - obscureText: obscureText, | ||
| 578 | - keyboardType: TextInputType.text, | ||
| 579 | - )), | ||
| 580 | - ), | ||
| 581 | - GestureDetector( | ||
| 582 | - child: Padding( | ||
| 583 | - padding: EdgeInsets.all(ScreenUtil().setWidth(10)), | ||
| 584 | - child: Image.asset( | ||
| 585 | - obscureText | ||
| 586 | - ? "assets/icon_pwd_show.png" | ||
| 587 | - : "assets/icon_pwd_hide.png", | ||
| 588 | - width: ScreenUtil().setWidth(35), | ||
| 589 | - height: ScreenUtil().setHeight(24), | ||
| 590 | - ), | ||
| 591 | - ), | ||
| 592 | - onTap: () { | ||
| 593 | - setState(() { | ||
| 594 | - obscureText = !obscureText; | ||
| 595 | - }); | ||
| 596 | - }, | ||
| 597 | - ) | ||
| 598 | - ], | ||
| 599 | - )), | ||
| 600 | - | ||
| 601 | - Container( | ||
| 602 | - width: ScreenUtil().setWidth(611), | ||
| 603 | - margin: EdgeInsets.only(top: ScreenUtil().setHeight(16)), | ||
| 604 | - alignment: Alignment.centerLeft, | ||
| 605 | - child: Text( | ||
| 606 | - errorText, | ||
| 607 | - // 'hfhfhf', | ||
| 608 | - style: TextStyle( | ||
| 609 | - color: MyColours.color_d93535, | ||
| 610 | - fontSize: ScreenUtil().setSp(16)), | ||
| 611 | - ), | ||
| 612 | - ), | ||
| 613 | - VEmptyView(40), | ||
| 614 | - Consumer<UserModel>( | ||
| 615 | - builder: | ||
| 616 | - (BuildContext context, UserModel value, Widget child) { | ||
| 617 | - return GestureDetector( | ||
| 618 | - onTap: () { | ||
| 619 | - if (!isActivate) return; | ||
| 620 | - if (!_check) { | ||
| 621 | - Utils.showToast('请先仔细阅读并同意协议'); | ||
| 622 | - return; | ||
| 623 | - } | ||
| 624 | - if (App.sp.containsKey('unionid')) { | ||
| 625 | - //微信登陆的时候,退出清空数据 | ||
| 626 | - App.sp.remove('openid'); | ||
| 627 | - App.sp.remove("unionid"); | ||
| 628 | - } | ||
| 629 | - Map<String, String> params = { | ||
| 630 | - "seller_code": "${_sellerCodeController.text}", | ||
| 631 | - "alias": "ssahdahgdafgahjkhakjgh", | ||
| 632 | - "account": "${_accountController.text}", | ||
| 633 | - "password": "${_pwdController.text}" | ||
| 634 | - }; | ||
| 635 | - value.login(context, params).then((value) { | ||
| 636 | - setState(() { | ||
| 637 | - errorText = value ?? ""; | ||
| 638 | - }); | ||
| 639 | - }); | ||
| 640 | - }, | ||
| 641 | - child: Container( | ||
| 642 | - height: ScreenUtil().setWidth(84), | ||
| 643 | - width: ScreenUtil().setWidth(611), | ||
| 644 | - alignment: Alignment.center, | ||
| 645 | - decoration: BoxDecoration( | ||
| 646 | - color: isActivate | ||
| 647 | - ? MyColours.color_2bb5b7 | ||
| 648 | - : MyColours.color_2bb5b7, | ||
| 649 | - boxShadow: [ | ||
| 650 | - BoxShadow( | ||
| 651 | - color: MyColours.color_26000000, | ||
| 652 | - offset: Offset(0, ScreenUtil().setWidth(4)), | ||
| 653 | - ) | ||
| 654 | - ], | ||
| 655 | - borderRadius: BorderRadius.all( | ||
| 656 | - Radius.circular(ScreenUtil().setWidth(8)))), | ||
| 657 | - child: Text( | ||
| 658 | - "登录", | ||
| 659 | - style: TextStyle( | ||
| 660 | - color: MyColours.color_ffffff, | ||
| 661 | - fontSize: ScreenUtil().setSp(34)), | ||
| 662 | - ), | ||
| 663 | - ), | ||
| 664 | - ); | ||
| 665 | - }, | ||
| 666 | - ), | ||
| 667 | - | ||
| 668 | - VEmptyView(20), | ||
| 669 | - Row( | ||
| 670 | - // mainAxisSize: MainAxisSize.min, | ||
| 671 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 672 | - children: <Widget>[ | ||
| 673 | - InkWell( | ||
| 674 | - onTap: () { | ||
| 675 | - setState(() { | ||
| 676 | - _check = !_check; | ||
| 677 | - }); | ||
| 678 | - }, | ||
| 679 | - child: Container( | ||
| 680 | - alignment: Alignment.topCenter, | ||
| 681 | - // color: Colors.red, | ||
| 682 | - height: ScreenUtil().setWidth(134), | ||
| 683 | - padding: EdgeInsets.only( | ||
| 684 | - left: ScreenUtil().setWidth(102), | ||
| 685 | - bottom: ScreenUtil().setWidth(10)), | ||
| 686 | - child: Image.asset( | ||
| 687 | - _check | ||
| 688 | - ? "assets/mine_radio_sel.png" | ||
| 689 | - : "assets/mine_radio_nor.png", | ||
| 690 | - width: ScreenUtil().setWidth(42), | ||
| 691 | - height: ScreenUtil().setWidth(42)), | ||
| 692 | - )), | ||
| 693 | - HEmptyView(6), | ||
| 694 | - Padding( | ||
| 695 | - padding: EdgeInsets.only(top: ScreenUtil().setWidth(10)), | ||
| 696 | - child: Text( | ||
| 697 | - '已阅读并同意', | ||
| 698 | - style: TextStyle( | ||
| 699 | - fontSize: ScreenUtil().setSp(24), | ||
| 700 | - color: MyColours.color_353535), | ||
| 701 | - ), | ||
| 702 | - ), | ||
| 703 | - InkWell( | ||
| 704 | - onTap: () { | ||
| 705 | - NavigatorUtil.goWebPage(context, '软件服务协议', "xy"); | ||
| 706 | - }, | ||
| 707 | - child: Padding( | ||
| 708 | - padding: | ||
| 709 | - EdgeInsets.only(top: ScreenUtil().setWidth(10)), | ||
| 710 | - child: Text( | ||
| 711 | - '《软件服务协议》', | ||
| 712 | - style: TextStyle( | ||
| 713 | - fontSize: ScreenUtil().setSp(24), | ||
| 714 | - color: MyColours.color_2bb5b7), | ||
| 715 | - )), | ||
| 716 | - ), | ||
| 717 | - Padding( | ||
| 718 | - padding: | ||
| 719 | - EdgeInsets.only(top: ScreenUtil().setWidth(10)), | ||
| 720 | - child: Text('及', | ||
| 721 | - style: TextStyle( | ||
| 722 | - fontSize: ScreenUtil().setSp(24), | ||
| 723 | - color: MyColours.color_353535))), | ||
| 724 | - InkWell( | ||
| 725 | - onTap: () { | ||
| 726 | - NavigatorUtil.goWebPage(context, '隐私政策', "zc"); | ||
| 727 | - }, | ||
| 728 | - child: Padding( | ||
| 729 | - padding: | ||
| 730 | - EdgeInsets.only(top: ScreenUtil().setWidth(10)), | ||
| 731 | - child: Text('《隐私政策》', | ||
| 732 | - style: TextStyle( | ||
| 733 | - fontSize: ScreenUtil().setSp(24), | ||
| 734 | - color: MyColours.color_2bb5b7))), | ||
| 735 | - ) | ||
| 736 | - ], | ||
| 737 | - ), | ||
| 738 | - VEmptyView(120), | ||
| 739 | - Row( | ||
| 740 | - mainAxisAlignment: MainAxisAlignment.center, | ||
| 741 | - children: [ | ||
| 742 | - MyDivider( | ||
| 743 | - ScreenUtil().setWidth(68 * 2), ScreenUtil().setWidth(2), | ||
| 744 | - color: MyColours.color_e5e5e5), | ||
| 745 | - HEmptyView(20), | ||
| 746 | - Text( | ||
| 747 | - '其他登录方式', | ||
| 748 | - style: TextStyle( | ||
| 749 | - fontSize: ScreenUtil().setWidth(24), | ||
| 750 | - color: MyColours.color_999999), | ||
| 751 | - ), | ||
| 752 | - HEmptyView(20), | ||
| 753 | - MyDivider( | ||
| 754 | - ScreenUtil().setWidth(68 * 2), ScreenUtil().setWidth(2), | ||
| 755 | - color: MyColours.color_e5e5e5), | ||
| 756 | - ], | ||
| 757 | - ), | ||
| 758 | - VEmptyView(80), | ||
| 759 | - Row( | ||
| 760 | - mainAxisAlignment: MainAxisAlignment.center, | ||
| 761 | - children: <Widget>[ | ||
| 762 | - Platform.isAndroid | ||
| 763 | - ? Text('') | ||
| 764 | - : Consumer<UserModel>(builder: (BuildContext context, | ||
| 765 | - UserModel value, Widget child) { | ||
| 766 | - return InkWell( | ||
| 767 | - child: Image.asset(Utils.getImgPath('apple'), | ||
| 768 | - width: ScreenUtil().setWidth(100)), | ||
| 769 | - onTap: () { | ||
| 770 | - if (!_check) { | ||
| 771 | - Utils.showToast('请先仔细阅读并同意协议'); | ||
| 772 | - return; | ||
| 773 | - } | ||
| 774 | - _iosLogin(value); | ||
| 775 | - }); | ||
| 776 | - }), | ||
| 777 | - Offstage( | ||
| 778 | - offstage: !App.isInstallWx, | ||
| 779 | - child: InkWell( | ||
| 780 | - child: Container( | ||
| 781 | - margin: EdgeInsets.only( | ||
| 782 | - left: Platform.isAndroid | ||
| 783 | - ? ScreenUtil().setWidth(0) | ||
| 784 | - : ScreenUtil().setWidth(140)), | ||
| 785 | - child: Image.asset( | ||
| 786 | - Utils.getImgPath('icon_wechat_login'), | ||
| 787 | - width: ScreenUtil().setWidth(100))), | ||
| 788 | - onTap: () { | ||
| 789 | - if (!_check) { | ||
| 790 | - Utils.showToast('请先仔细阅读并同意协议'); | ||
| 791 | - return; | ||
| 792 | - } | ||
| 793 | - _wxLogin(); | ||
| 794 | - }, | ||
| 795 | - )), | ||
| 796 | - ], | ||
| 797 | - ), | ||
| 798 | - ], | ||
| 799 | - ), | ||
| 800 | - ), | ||
| 801 | - )); | ||
| 802 | - } | ||
| 803 | -} | 372 | +// @override |
| 373 | +// Widget build(BuildContext context) { | ||
| 374 | +// ScreenUtil.init(context, width: 750, height: 1334); | ||
| 375 | +// otherLoginProvider = | ||
| 376 | +// Provider.of<OtherLoginProvider>(context, listen: false); | ||
| 377 | +// createStoreModel = Provider.of<CreateStoreModel>(context, listen: false); | ||
| 378 | +// final Size size = MediaQuery.of(context).size; | ||
| 379 | +// App.screenWidth = size.width; | ||
| 380 | +// App.screenHeight = size.height; | ||
| 381 | +// App.statusBarHeight = MediaQuery.of(context).padding.top; | ||
| 382 | +// App.bottomBarHeight = MediaQuery.of(context).padding.bottom; | ||
| 383 | + | ||
| 384 | +// final double prefixIconWidth = ScreenUtil().setWidth(24); | ||
| 385 | + | ||
| 386 | +// return Scaffold( | ||
| 387 | +// backgroundColor: MyColours.color_ffffff, | ||
| 388 | +// body: Container( | ||
| 389 | +// width: double.infinity, | ||
| 390 | +// height: double.infinity, | ||
| 391 | +// child: SingleChildScrollView( | ||
| 392 | +// controller: _scrollController, | ||
| 393 | +// child: Column( | ||
| 394 | +// crossAxisAlignment: CrossAxisAlignment.center, | ||
| 395 | +// children: <Widget>[ | ||
| 396 | +// // VEmptyView(218 - App.statusBarHeight), | ||
| 397 | +// VEmptyView(80 + App.statusBarHeight), | ||
| 398 | +// Image.asset( | ||
| 399 | +// "assets/logo.png", | ||
| 400 | +// width: ScreenUtil().setWidth(74 * 2), | ||
| 401 | +// height: ScreenUtil().setWidth(71 * 2), | ||
| 402 | +// ), | ||
| 403 | +// VEmptyView(80), | ||
| 404 | +// Container( | ||
| 405 | +// height: ScreenUtil().setHeight(84), | ||
| 406 | +// width: ScreenUtil().setWidth(611), | ||
| 407 | +// padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)), | ||
| 408 | +// alignment: Alignment.center, | ||
| 409 | +// decoration: BoxDecoration( | ||
| 410 | +// border: Border.all( | ||
| 411 | +// color: MyColours.color_bff6f7, | ||
| 412 | +// width: ScreenUtil().setWidth(2)), | ||
| 413 | +// borderRadius: | ||
| 414 | +// BorderRadius.circular(ScreenUtil().setWidth(8))), | ||
| 415 | +// child: Row( | ||
| 416 | +// crossAxisAlignment: CrossAxisAlignment.center, | ||
| 417 | +// children: <Widget>[ | ||
| 418 | +// Image.asset( | ||
| 419 | +// "assets/icon_sellercode.png", | ||
| 420 | +// width: prefixIconWidth, | ||
| 421 | +// ), | ||
| 422 | +// HEmptyView(26), | ||
| 423 | +// Center( | ||
| 424 | +// child: Text( | ||
| 425 | +// "商户编号", | ||
| 426 | +// style: TextStyle( | ||
| 427 | +// color: MyColours.color_353535, | ||
| 428 | +// fontSize: ScreenUtil().setSp(28)), | ||
| 429 | +// )), | ||
| 430 | +// Expanded( | ||
| 431 | +// child: Container( | ||
| 432 | +// height: ScreenUtil().setHeight(84), | ||
| 433 | +// padding: EdgeInsets.only( | ||
| 434 | +// left: ScreenUtil().setWidth(20), | ||
| 435 | +// right: ScreenUtil().setWidth(20), | ||
| 436 | +// top: ScreenUtil().setWidth(8)), | ||
| 437 | +// child: TextField( | ||
| 438 | +// controller: _sellerCodeController, | ||
| 439 | +// focusNode: _sellerCodeFocusNode, | ||
| 440 | +// // autofocus: _sellerCodeController.text.isEmpty, | ||
| 441 | +// style: TextStyle( | ||
| 442 | +// color: MyColours.color_353535, | ||
| 443 | +// fontSize: ScreenUtil().setSp(28), | ||
| 444 | +// textBaseline: TextBaseline.alphabetic), | ||
| 445 | +// // textAlignVertical: TextAlignVertical.center, | ||
| 446 | +// decoration: InputDecoration( | ||
| 447 | +// hintText: "请输入6位商户编码", | ||
| 448 | +// hintStyle: TextStyle( | ||
| 449 | +// color: MyColours.color_c1c1c1, | ||
| 450 | +// fontSize: ScreenUtil().setSp(28), | ||
| 451 | +// ), | ||
| 452 | +// border: OutlineInputBorder( | ||
| 453 | +// borderSide: BorderSide.none), | ||
| 454 | +// contentPadding: EdgeInsets.zero, | ||
| 455 | +// ), | ||
| 456 | +// onChanged: (_) { | ||
| 457 | +// setActivate(); | ||
| 458 | +// }, | ||
| 459 | +// keyboardType: TextInputType.number, | ||
| 460 | +// )), | ||
| 461 | +// ) | ||
| 462 | +// ], | ||
| 463 | +// )), | ||
| 464 | + | ||
| 465 | +// Container( | ||
| 466 | +// height: ScreenUtil().setHeight(84), | ||
| 467 | +// width: ScreenUtil().setWidth(611), | ||
| 468 | +// padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)), | ||
| 469 | +// margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)), | ||
| 470 | +// alignment: Alignment.center, | ||
| 471 | +// decoration: BoxDecoration( | ||
| 472 | +// border: Border.all( | ||
| 473 | +// color: MyColours.color_bff6f7, | ||
| 474 | +// width: ScreenUtil().setWidth(2)), | ||
| 475 | +// borderRadius: | ||
| 476 | +// BorderRadius.circular(ScreenUtil().setWidth(8))), | ||
| 477 | +// child: Row( | ||
| 478 | +// crossAxisAlignment: CrossAxisAlignment.center, | ||
| 479 | +// children: <Widget>[ | ||
| 480 | +// Image.asset( | ||
| 481 | +// "assets/icon_account.png", | ||
| 482 | +// width: prefixIconWidth, | ||
| 483 | +// ), | ||
| 484 | +// HEmptyView(26), | ||
| 485 | +// Text( | ||
| 486 | +// "工 号", | ||
| 487 | +// style: TextStyle( | ||
| 488 | +// color: MyColours.color_353535, | ||
| 489 | +// fontSize: ScreenUtil().setSp(28)), | ||
| 490 | +// ), | ||
| 491 | +// Expanded( | ||
| 492 | +// child: Container( | ||
| 493 | +// height: ScreenUtil().setHeight(84), | ||
| 494 | +// padding: EdgeInsets.only( | ||
| 495 | +// left: ScreenUtil().setWidth(20), | ||
| 496 | +// right: ScreenUtil().setWidth(20), | ||
| 497 | +// top: ScreenUtil().setWidth(8)), | ||
| 498 | +// child: TextField( | ||
| 499 | +// controller: _accountController, | ||
| 500 | +// focusNode: _accountFocusNode, | ||
| 501 | +// style: TextStyle( | ||
| 502 | +// color: MyColours.color_353535, | ||
| 503 | +// fontSize: ScreenUtil().setSp(28)), | ||
| 504 | +// decoration: InputDecoration( | ||
| 505 | +// hintText: "请输入4位工号", | ||
| 506 | +// hintStyle: TextStyle( | ||
| 507 | +// color: MyColours.color_c1c1c1, | ||
| 508 | +// fontSize: ScreenUtil().setSp(28)), | ||
| 509 | +// border: OutlineInputBorder( | ||
| 510 | +// borderSide: BorderSide.none), | ||
| 511 | +// contentPadding: EdgeInsets.zero, | ||
| 512 | +// ), | ||
| 513 | +// onChanged: (_) { | ||
| 514 | +// setActivate(); | ||
| 515 | +// }, | ||
| 516 | +// keyboardType: TextInputType.number, | ||
| 517 | +// ), | ||
| 518 | +// )) | ||
| 519 | +// ], | ||
| 520 | +// )), | ||
| 521 | +// Container( | ||
| 522 | +// height: ScreenUtil().setHeight(84), | ||
| 523 | +// width: ScreenUtil().setWidth(611), | ||
| 524 | +// padding: EdgeInsets.only( | ||
| 525 | +// left: ScreenUtil().setWidth(20), | ||
| 526 | +// right: ScreenUtil().setWidth(27)), | ||
| 527 | +// margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)), | ||
| 528 | +// alignment: Alignment.center, | ||
| 529 | +// decoration: BoxDecoration( | ||
| 530 | +// border: Border.all( | ||
| 531 | +// color: MyColours.color_bff6f7, | ||
| 532 | +// width: ScreenUtil().setWidth(2)), | ||
| 533 | +// borderRadius: | ||
| 534 | +// BorderRadius.circular(ScreenUtil().setWidth(8))), | ||
| 535 | +// child: Row( | ||
| 536 | +// crossAxisAlignment: CrossAxisAlignment.center, | ||
| 537 | +// children: <Widget>[ | ||
| 538 | +// Image.asset( | ||
| 539 | +// "assets/icon_pwd.png", | ||
| 540 | +// width: prefixIconWidth, | ||
| 541 | +// ), | ||
| 542 | +// HEmptyView(26), | ||
| 543 | +// Text( | ||
| 544 | +// "密 码", | ||
| 545 | +// style: TextStyle( | ||
| 546 | +// color: MyColours.color_353535, | ||
| 547 | +// fontSize: ScreenUtil().setSp(28)), | ||
| 548 | +// ), | ||
| 549 | +// Expanded( | ||
| 550 | +// child: Container( | ||
| 551 | +// height: ScreenUtil().setHeight(84), | ||
| 552 | +// padding: EdgeInsets.only( | ||
| 553 | +// left: ScreenUtil().setWidth(20), | ||
| 554 | +// right: ScreenUtil().setWidth(20), | ||
| 555 | +// top: ScreenUtil().setWidth(8)), | ||
| 556 | +// child: TextField( | ||
| 557 | +// controller: _pwdController, | ||
| 558 | +// focusNode: _pwdFocusNode, | ||
| 559 | +// // autofocus: _sellerCodeController.text.isNotEmpty && | ||
| 560 | +// // _accountController.text.isNotEmpty && | ||
| 561 | +// // _pwdController.text.isEmpty, | ||
| 562 | +// style: TextStyle( | ||
| 563 | +// color: MyColours.color_353535, | ||
| 564 | +// fontSize: ScreenUtil().setSp(28)), | ||
| 565 | +// decoration: InputDecoration( | ||
| 566 | +// hintText: "请输入密码", | ||
| 567 | +// hintStyle: TextStyle( | ||
| 568 | +// color: MyColours.color_c1c1c1, | ||
| 569 | +// fontSize: ScreenUtil().setSp(28)), | ||
| 570 | +// border: OutlineInputBorder( | ||
| 571 | +// borderSide: BorderSide.none), | ||
| 572 | +// contentPadding: EdgeInsets.zero, | ||
| 573 | +// ), | ||
| 574 | +// onChanged: (_) { | ||
| 575 | +// setActivate(); | ||
| 576 | +// }, | ||
| 577 | +// obscureText: obscureText, | ||
| 578 | +// keyboardType: TextInputType.text, | ||
| 579 | +// )), | ||
| 580 | +// ), | ||
| 581 | +// GestureDetector( | ||
| 582 | +// child: Padding( | ||
| 583 | +// padding: EdgeInsets.all(ScreenUtil().setWidth(10)), | ||
| 584 | +// child: Image.asset( | ||
| 585 | +// obscureText | ||
| 586 | +// ? "assets/icon_pwd_show.png" | ||
| 587 | +// : "assets/icon_pwd_hide.png", | ||
| 588 | +// width: ScreenUtil().setWidth(35), | ||
| 589 | +// height: ScreenUtil().setHeight(24), | ||
| 590 | +// ), | ||
| 591 | +// ), | ||
| 592 | +// onTap: () { | ||
| 593 | +// setState(() { | ||
| 594 | +// obscureText = !obscureText; | ||
| 595 | +// }); | ||
| 596 | +// }, | ||
| 597 | +// ) | ||
| 598 | +// ], | ||
| 599 | +// )), | ||
| 600 | + | ||
| 601 | +// Container( | ||
| 602 | +// width: ScreenUtil().setWidth(611), | ||
| 603 | +// margin: EdgeInsets.only(top: ScreenUtil().setHeight(16)), | ||
| 604 | +// alignment: Alignment.centerLeft, | ||
| 605 | +// child: Text( | ||
| 606 | +// errorText, | ||
| 607 | +// // 'hfhfhf', | ||
| 608 | +// style: TextStyle( | ||
| 609 | +// color: MyColours.color_d93535, | ||
| 610 | +// fontSize: ScreenUtil().setSp(16)), | ||
| 611 | +// ), | ||
| 612 | +// ), | ||
| 613 | +// VEmptyView(40), | ||
| 614 | +// Consumer<UserModel>( | ||
| 615 | +// builder: | ||
| 616 | +// (BuildContext context, UserModel value, Widget child) { | ||
| 617 | +// return GestureDetector( | ||
| 618 | +// onTap: () { | ||
| 619 | +// if (!isActivate) return; | ||
| 620 | +// if (!_check) { | ||
| 621 | +// Utils.showToast('请先仔细阅读并同意协议'); | ||
| 622 | +// return; | ||
| 623 | +// } | ||
| 624 | +// if (App.sp.containsKey('unionid')) { | ||
| 625 | +// //微信登陆的时候,退出清空数据 | ||
| 626 | +// App.sp.remove('openid'); | ||
| 627 | +// App.sp.remove("unionid"); | ||
| 628 | +// } | ||
| 629 | +// Map<String, String> params = { | ||
| 630 | +// "seller_code": "${_sellerCodeController.text}", | ||
| 631 | +// "alias": "ssahdahgdafgahjkhakjgh", | ||
| 632 | +// "account": "${_accountController.text}", | ||
| 633 | +// "password": "${_pwdController.text}" | ||
| 634 | +// }; | ||
| 635 | +// value.login(context, params).then((value) { | ||
| 636 | +// setState(() { | ||
| 637 | +// errorText = value ?? ""; | ||
| 638 | +// }); | ||
| 639 | +// }); | ||
| 640 | +// }, | ||
| 641 | +// child: Container( | ||
| 642 | +// height: ScreenUtil().setWidth(84), | ||
| 643 | +// width: ScreenUtil().setWidth(611), | ||
| 644 | +// alignment: Alignment.center, | ||
| 645 | +// decoration: BoxDecoration( | ||
| 646 | +// color: isActivate | ||
| 647 | +// ? MyColours.color_2bb5b7 | ||
| 648 | +// : MyColours.color_2bb5b7, | ||
| 649 | +// boxShadow: [ | ||
| 650 | +// BoxShadow( | ||
| 651 | +// color: MyColours.color_26000000, | ||
| 652 | +// offset: Offset(0, ScreenUtil().setWidth(4)), | ||
| 653 | +// ) | ||
| 654 | +// ], | ||
| 655 | +// borderRadius: BorderRadius.all( | ||
| 656 | +// Radius.circular(ScreenUtil().setWidth(8)))), | ||
| 657 | +// child: Text( | ||
| 658 | +// "登录", | ||
| 659 | +// style: TextStyle( | ||
| 660 | +// color: MyColours.color_ffffff, | ||
| 661 | +// fontSize: ScreenUtil().setSp(34)), | ||
| 662 | +// ), | ||
| 663 | +// ), | ||
| 664 | +// ); | ||
| 665 | +// }, | ||
| 666 | +// ), | ||
| 667 | + | ||
| 668 | +// VEmptyView(20), | ||
| 669 | +// Row( | ||
| 670 | +// // mainAxisSize: MainAxisSize.min, | ||
| 671 | +// crossAxisAlignment: CrossAxisAlignment.start, | ||
| 672 | +// children: <Widget>[ | ||
| 673 | +// InkWell( | ||
| 674 | +// onTap: () { | ||
| 675 | +// setState(() { | ||
| 676 | +// _check = !_check; | ||
| 677 | +// }); | ||
| 678 | +// }, | ||
| 679 | +// child: Container( | ||
| 680 | +// alignment: Alignment.topCenter, | ||
| 681 | +// // color: Colors.red, | ||
| 682 | +// height: ScreenUtil().setWidth(134), | ||
| 683 | +// padding: EdgeInsets.only( | ||
| 684 | +// left: ScreenUtil().setWidth(102), | ||
| 685 | +// bottom: ScreenUtil().setWidth(10)), | ||
| 686 | +// child: Image.asset( | ||
| 687 | +// _check | ||
| 688 | +// ? "assets/mine_radio_sel.png" | ||
| 689 | +// : "assets/mine_radio_nor.png", | ||
| 690 | +// width: ScreenUtil().setWidth(42), | ||
| 691 | +// height: ScreenUtil().setWidth(42)), | ||
| 692 | +// )), | ||
| 693 | +// HEmptyView(6), | ||
| 694 | +// Padding( | ||
| 695 | +// padding: EdgeInsets.only(top: ScreenUtil().setWidth(10)), | ||
| 696 | +// child: Text( | ||
| 697 | +// '已阅读并同意', | ||
| 698 | +// style: TextStyle( | ||
| 699 | +// fontSize: ScreenUtil().setSp(24), | ||
| 700 | +// color: MyColours.color_353535), | ||
| 701 | +// ), | ||
| 702 | +// ), | ||
| 703 | +// InkWell( | ||
| 704 | +// onTap: () { | ||
| 705 | +// NavigatorUtil.goWebPage(context, '软件服务协议', "xy"); | ||
| 706 | +// }, | ||
| 707 | +// child: Padding( | ||
| 708 | +// padding: | ||
| 709 | +// EdgeInsets.only(top: ScreenUtil().setWidth(10)), | ||
| 710 | +// child: Text( | ||
| 711 | +// '《软件服务协议》', | ||
| 712 | +// style: TextStyle( | ||
| 713 | +// fontSize: ScreenUtil().setSp(24), | ||
| 714 | +// color: MyColours.color_2bb5b7), | ||
| 715 | +// )), | ||
| 716 | +// ), | ||
| 717 | +// Padding( | ||
| 718 | +// padding: | ||
| 719 | +// EdgeInsets.only(top: ScreenUtil().setWidth(10)), | ||
| 720 | +// child: Text('及', | ||
| 721 | +// style: TextStyle( | ||
| 722 | +// fontSize: ScreenUtil().setSp(24), | ||
| 723 | +// color: MyColours.color_353535))), | ||
| 724 | +// InkWell( | ||
| 725 | +// onTap: () { | ||
| 726 | +// NavigatorUtil.goWebPage(context, '隐私政策', "zc"); | ||
| 727 | +// }, | ||
| 728 | +// child: Padding( | ||
| 729 | +// padding: | ||
| 730 | +// EdgeInsets.only(top: ScreenUtil().setWidth(10)), | ||
| 731 | +// child: Text('《隐私政策》', | ||
| 732 | +// style: TextStyle( | ||
| 733 | +// fontSize: ScreenUtil().setSp(24), | ||
| 734 | +// color: MyColours.color_2bb5b7))), | ||
| 735 | +// ) | ||
| 736 | +// ], | ||
| 737 | +// ), | ||
| 738 | +// VEmptyView(120), | ||
| 739 | +// Row( | ||
| 740 | +// mainAxisAlignment: MainAxisAlignment.center, | ||
| 741 | +// children: [ | ||
| 742 | +// MyDivider( | ||
| 743 | +// ScreenUtil().setWidth(68 * 2), ScreenUtil().setWidth(2), | ||
| 744 | +// color: MyColours.color_e5e5e5), | ||
| 745 | +// HEmptyView(20), | ||
| 746 | +// Text( | ||
| 747 | +// '其他登录方式', | ||
| 748 | +// style: TextStyle( | ||
| 749 | +// fontSize: ScreenUtil().setWidth(24), | ||
| 750 | +// color: MyColours.color_999999), | ||
| 751 | +// ), | ||
| 752 | +// HEmptyView(20), | ||
| 753 | +// MyDivider( | ||
| 754 | +// ScreenUtil().setWidth(68 * 2), ScreenUtil().setWidth(2), | ||
| 755 | +// color: MyColours.color_e5e5e5), | ||
| 756 | +// ], | ||
| 757 | +// ), | ||
| 758 | +// VEmptyView(80), | ||
| 759 | +// Row( | ||
| 760 | +// mainAxisAlignment: MainAxisAlignment.center, | ||
| 761 | +// children: <Widget>[ | ||
| 762 | +// Platform.isAndroid | ||
| 763 | +// ? Text('') | ||
| 764 | +// : Consumer<UserModel>(builder: (BuildContext context, | ||
| 765 | +// UserModel value, Widget child) { | ||
| 766 | +// return InkWell( | ||
| 767 | +// child: Image.asset(Utils.getImgPath('apple'), | ||
| 768 | +// width: ScreenUtil().setWidth(100)), | ||
| 769 | +// onTap: () { | ||
| 770 | +// if (!_check) { | ||
| 771 | +// Utils.showToast('请先仔细阅读并同意协议'); | ||
| 772 | +// return; | ||
| 773 | +// } | ||
| 774 | +// _iosLogin(value); | ||
| 775 | +// }); | ||
| 776 | +// }), | ||
| 777 | +// Offstage( | ||
| 778 | +// offstage: !App.isInstallWx, | ||
| 779 | +// child: InkWell( | ||
| 780 | +// child: Container( | ||
| 781 | +// margin: EdgeInsets.only( | ||
| 782 | +// left: Platform.isAndroid | ||
| 783 | +// ? ScreenUtil().setWidth(0) | ||
| 784 | +// : ScreenUtil().setWidth(140)), | ||
| 785 | +// child: Image.asset( | ||
| 786 | +// Utils.getImgPath('icon_wechat_login'), | ||
| 787 | +// width: ScreenUtil().setWidth(100))), | ||
| 788 | +// onTap: () { | ||
| 789 | +// if (!_check) { | ||
| 790 | +// Utils.showToast('请先仔细阅读并同意协议'); | ||
| 791 | +// return; | ||
| 792 | +// } | ||
| 793 | +// _wxLogin(); | ||
| 794 | +// }, | ||
| 795 | +// )), | ||
| 796 | +// ], | ||
| 797 | +// ), | ||
| 798 | +// ], | ||
| 799 | +// ), | ||
| 800 | +// ), | ||
| 801 | +// )); | ||
| 802 | +// } | ||
| 803 | +// } |
| 1 | +import 'dart:async'; | ||
| 2 | +import 'dart:convert'; | ||
| 3 | +import 'dart:io'; | ||
| 4 | + | ||
| 5 | +import 'package:common_utils/common_utils.dart'; | ||
| 6 | +import 'package:dio/dio.dart'; | ||
| 7 | +import 'package:flutter/cupertino.dart'; | ||
| 8 | +import 'package:flutter/material.dart'; | ||
| 9 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 10 | +import 'package:fluwx/fluwx.dart' as fluwx; | ||
| 11 | +import 'package:fluwx/fluwx.dart'; | ||
| 12 | +import 'package:one_key/app.dart'; | ||
| 13 | +import 'package:one_key/models/checkbind_phone_model.dart'; | ||
| 14 | +import 'package:one_key/models/store_info.dart'; | ||
| 15 | +import 'package:one_key/net/dio_util.dart'; | ||
| 16 | +import 'package:one_key/provider/create_store_model.dart'; | ||
| 17 | +import 'package:one_key/provider/other_login_provider.dart'; | ||
| 18 | +import 'package:one_key/provider/user_model.dart'; | ||
| 19 | +import 'package:one_key/res/colors.dart'; | ||
| 20 | +import 'package:one_key/route/navigate_service.dart'; | ||
| 21 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 22 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 23 | +import 'package:one_key/utils/utils.dart'; | ||
| 24 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 25 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 26 | +import 'package:one_key/widgets/loading.dart'; | ||
| 27 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 28 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 29 | +import 'package:provider/provider.dart'; | ||
| 30 | +import 'package:sign_in_with_apple/sign_in_with_apple.dart'; | ||
| 31 | + | ||
| 32 | +class LoginPage extends StatefulWidget { | ||
| 33 | + @override | ||
| 34 | + State<StatefulWidget> createState() { | ||
| 35 | + // TODO: implement createState | ||
| 36 | + return new LoginState(); | ||
| 37 | + } | ||
| 38 | +} | ||
| 39 | + | ||
| 40 | +class LoginState extends State<LoginPage> with WidgetsBindingObserver { | ||
| 41 | + TextEditingController _sellerCodeController = TextEditingController(); | ||
| 42 | + TextEditingController _accountController = TextEditingController(); | ||
| 43 | + final TextEditingController _pwdController = TextEditingController(); | ||
| 44 | + final ScrollController _scrollController = new ScrollController(); | ||
| 45 | + | ||
| 46 | + final FocusNode _sellerCodeFocusNode = new FocusNode(); | ||
| 47 | + final FocusNode _accountFocusNode = new FocusNode(); | ||
| 48 | + final FocusNode _pwdFocusNode = new FocusNode(); | ||
| 49 | + | ||
| 50 | + bool obscureText = true; //是否隐藏密码 | ||
| 51 | + bool isActivate = false; //是否激活登录 | ||
| 52 | + | ||
| 53 | + String errorText = ""; //错误提示 | ||
| 54 | + | ||
| 55 | + bool _check = false; | ||
| 56 | + StreamSubscription<BaseWeChatResponse> streamSubscription; | ||
| 57 | + OtherLoginProvider otherLoginProvider; | ||
| 58 | + CreateStoreModel createStoreModel; | ||
| 59 | + | ||
| 60 | + @override | ||
| 61 | + void initState() { | ||
| 62 | + // TODO: implement initState | ||
| 63 | + super.initState(); | ||
| 64 | + //第一次打开应用 | ||
| 65 | + | ||
| 66 | + _checkWechat(); | ||
| 67 | + isLogin(); | ||
| 68 | + WidgetsBinding.instance.addObserver(this); | ||
| 69 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 70 | + final UserModel userModel = | ||
| 71 | + Provider.of<UserModel>(context, listen: false); | ||
| 72 | + if (userModel != null && userModel.user != null) { | ||
| 73 | + Future.delayed(Duration(milliseconds: 50), () { | ||
| 74 | + _sellerCodeController.text = userModel.user.sellercode; | ||
| 75 | + _accountController.text = userModel.user.account; | ||
| 76 | + // FocusScope.of(context).requestFocus(_pwdFocusNode); | ||
| 77 | + }); | ||
| 78 | + } | ||
| 79 | + }); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + //当页面离开时要清除监听器 | ||
| 83 | + @override | ||
| 84 | + void dispose() { | ||
| 85 | + super.dispose(); | ||
| 86 | + WidgetsBinding.instance.removeObserver(this); | ||
| 87 | + if (streamSubscription != null) { | ||
| 88 | + streamSubscription.cancel(); | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + //微信是否安装 | ||
| 93 | + _checkWechat() async { | ||
| 94 | + // await registerWxApi( | ||
| 95 | + // appId: "wx85aa3cdd0f791e65", | ||
| 96 | + // doOnAndroid: true, | ||
| 97 | + // doOnIOS: true, | ||
| 98 | + // universalLink: "https://xt04.colorcun.com/link/OneKey/"); | ||
| 99 | + var result = await isWeChatInstalled; | ||
| 100 | + if (result != null && result) { | ||
| 101 | + App.isInstallWx = true; | ||
| 102 | + } else { | ||
| 103 | + App.isInstallWx = false; | ||
| 104 | + } | ||
| 105 | + setState(() {}); | ||
| 106 | + LogUtil.v("is installed $result"); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + handlePostFrame(_) { | ||
| 110 | + // _scrollController.jumpTo(_scrollController.position.maxScrollExtent); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + @override | ||
| 114 | + void didChangeMetrics() { | ||
| 115 | + // TODO: implement didChangeMetrics | ||
| 116 | + WidgetsBinding.instance.addPostFrameCallback(handlePostFrame); | ||
| 117 | + super.didChangeDependencies(); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + //监听输入框,设置登录按钮状态 | ||
| 121 | + setActivate() { | ||
| 122 | + if (_sellerCodeController.text.isNotEmpty && | ||
| 123 | + _accountController.text.isNotEmpty && | ||
| 124 | + _pwdController.text.isNotEmpty) { | ||
| 125 | + setState(() { | ||
| 126 | + errorText = ""; | ||
| 127 | + isActivate = true; | ||
| 128 | + }); | ||
| 129 | + } else { | ||
| 130 | + setState(() { | ||
| 131 | + errorText = ""; | ||
| 132 | + isActivate = false; | ||
| 133 | + }); | ||
| 134 | + } | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + //判断是否登录 | ||
| 138 | + void isLogin() async { | ||
| 139 | + await App.initSp(); | ||
| 140 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 141 | + userModel.initUser(); | ||
| 142 | + if (App.sp.getBool("isLogin") ?? false) { | ||
| 143 | + Future.delayed(Duration(milliseconds: 200), () { | ||
| 144 | + NavigatorUtil.goHomePage(context); | ||
| 145 | + }); | ||
| 146 | + } else { | ||
| 147 | + _getWxCode(); | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + ///微信登陆 | ||
| 152 | + | ||
| 153 | + _wxLogin() { | ||
| 154 | + sendWeChatAuth(scope: "snsapi_userinfo"); | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + ///获取微信登录code | ||
| 158 | + _getWxCode() { | ||
| 159 | + streamSubscription = fluwx.weChatResponseEventHandler | ||
| 160 | + .distinct((a, b) => a == b) | ||
| 161 | + .listen((res) { | ||
| 162 | + if (res is fluwx.WeChatAuthResponse && res.errCode == 0) { | ||
| 163 | + LogUtil.v("code:" + res.code); | ||
| 164 | + // Loading.showLoading(context); | ||
| 165 | + _getAccessToken(res.code); | ||
| 166 | + } else { | ||
| 167 | +// Utils.showToast(res.errStr??"登录失败,请稍后重试"); | ||
| 168 | + } | ||
| 169 | + }); | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + ///获取微信登录access_token | ||
| 173 | + _getAccessToken(String code) async { | ||
| 174 | + Response response = await DioUtil.getInstance().getDio().get( | ||
| 175 | + "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx85aa3cdd0f791e65&secret=87c9a23c2e6032b2da75af6b0efc5424&code=$code&grant_type=authorization_code"); | ||
| 176 | + LogUtil.v("access_token:${response.toString()}"); | ||
| 177 | + Map<String, dynamic> responseData = json.decode(response.data.toString()); | ||
| 178 | + if (responseData["errcode"] != null) { | ||
| 179 | + Utils.showToast(responseData["errmsg"] ?? "登录失败,请稍后重试"); | ||
| 180 | + // Loading.hideLoading(context); | ||
| 181 | + } else { | ||
| 182 | + App.sp.setString("openid", responseData["openid"]); | ||
| 183 | + App.sp.setString("unionid", responseData["unionid"]); | ||
| 184 | + | ||
| 185 | + //跳转至手机号绑定页面 | ||
| 186 | + //判断是否已经绑定手机号码 ******调用接口******* | ||
| 187 | + //有,通过手机号吗或者opened查找店铺信息进行登陆 | ||
| 188 | + //没有,跳转至绑定手机号码页面 | ||
| 189 | + // Map<String, String> params = { | ||
| 190 | + // "unionid": responseData["unionid"], | ||
| 191 | + // }; | ||
| 192 | + // BuildContext contextTemp = | ||
| 193 | + // App.getIt<NavigateService>().key.currentState.overlay.context; | ||
| 194 | + // CheckbindPhoneSunModel model = | ||
| 195 | + // await otherLoginProvider.checkbindPhone(contextTemp, params); | ||
| 196 | + // // Loading.hideLoading(context); | ||
| 197 | + // if (model != null) { | ||
| 198 | + // createStoreModel.storeInfo = StoreInfo(); | ||
| 199 | + // createStoreModel.storeInfo.phone = model.phone; | ||
| 200 | + createStoreModel.storeInfo = StoreInfo(); | ||
| 201 | + NavigatorUtil.goIfNeedCreateStorePage(context); | ||
| 202 | + // } else { | ||
| 203 | + // NavigatorUtil.goBindingPhonePage(context); | ||
| 204 | + // } | ||
| 205 | + | ||
| 206 | + // _getUserInfo(responseData["access_token"], responseData["openid"]); | ||
| 207 | + } | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | +// //获取用户信息 | ||
| 211 | +// _getUserInfo(String access_token, String openid) async { | ||
| 212 | +// Response response = await DioUtil.getInstance().getDio().get( | ||
| 213 | +// "https://api.weixin.qq.com/sns/userinfo?access_token=$access_token&openid=$openid"); | ||
| 214 | +// LogUtil.v('userinfo:' + response.data); | ||
| 215 | +// Map<String, dynamic> responseData = json.decode(response.data.toString()); | ||
| 216 | +// if (responseData["errcode"] != null) { | ||
| 217 | +// // Utils.showToast(responseData["errmsg"]??"登录,请稍后重试"); | ||
| 218 | +// } else { | ||
| 219 | +// App.sp.setString("nickName", responseData["nickname"]); | ||
| 220 | +// App.sp.setString("headImg", responseData["headimgurl"]); | ||
| 221 | +// App.sp.setString("unionid", responseData["unionid"]); | ||
| 222 | +// App.sp.setBool("isLogin", true); | ||
| 223 | +// // _fromTypeGo(); | ||
| 224 | +// String unionId = App.sp.getString("unionid"); | ||
| 225 | +// _getMiniOpenid(unionId); | ||
| 226 | +// } | ||
| 227 | +// } | ||
| 228 | +// //获取绑定小程序openid | ||
| 229 | +// _getMiniOpenid(String unionId) async { | ||
| 230 | +// UserModel userInfoProvider = UserModel(); | ||
| 231 | +// // Provider.of<UserInfoProvider>(context, listen: false); | ||
| 232 | +// Map<String, String> params = {"unionid": unionId}; | ||
| 233 | +// String miniOpenid = | ||
| 234 | +// await userInfoProvider.getMiniProgramOpenid(context, params); | ||
| 235 | +// if (miniOpenid == null) { | ||
| 236 | +// goMiniProgramMd(unionId); | ||
| 237 | +// } | ||
| 238 | +// } | ||
| 239 | + | ||
| 240 | + /* | ||
| 241 | + 苹果登录获取用户信息 | ||
| 242 | + */ | ||
| 243 | + _getUserInfoIOS() async { | ||
| 244 | + // Map<String, String> params = {"openid": App.sp.getString("openid")}; | ||
| 245 | + // UserInfoProvider userInfoProvider = | ||
| 246 | + // Provider.of<UserInfoProvider>(context, listen: false); | ||
| 247 | + // UseInfoItemModel useInfoItemModel = | ||
| 248 | + // await userInfoProvider.getUserInfo(context, params); | ||
| 249 | + | ||
| 250 | + // if (ObjectUtil.isNotEmpty(useInfoItemModel.openid)) { | ||
| 251 | + // _hideLoading(context); | ||
| 252 | + // App.sp.setString("nickName", useInfoItemModel.nickname); | ||
| 253 | + // App.sp.setString("headImg", ''); | ||
| 254 | + // App.sp.setString("unionid", ''); | ||
| 255 | + // App.sp.setBool("isLogin", true); | ||
| 256 | + // UserInfoProvider userInfoProvider = new UserInfoProvider(); | ||
| 257 | + // userInfoProvider.initPlatformState(context); | ||
| 258 | + // // Loading.hideLoading(context); | ||
| 259 | + // _fromTypeGo(); | ||
| 260 | + // } else { | ||
| 261 | + // // 已经授权,但是后台库里没有数据,版本差异,重新插入数据库 | ||
| 262 | + // Map param = { | ||
| 263 | + // 'openid': App.sp.getString("openid"), | ||
| 264 | + // 'avatar': 'ios_avatar', | ||
| 265 | + // 'nickname': '', | ||
| 266 | + // 'gender': '1' | ||
| 267 | + // }; | ||
| 268 | + // LoginRespository().appleLogin(context, param, () { | ||
| 269 | + // _getUserInfoIOS(); | ||
| 270 | + // }); | ||
| 271 | + // } | ||
| 272 | + } | ||
| 273 | + | ||
| 274 | + _showLoading(BuildContext context) { | ||
| 275 | + showGeneralDialog( | ||
| 276 | + context: context, | ||
| 277 | + barrierDismissible: false, | ||
| 278 | + barrierLabel: | ||
| 279 | + MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 280 | + transitionDuration: const Duration(milliseconds: 150), | ||
| 281 | + pageBuilder: (BuildContext context, Animation animation, | ||
| 282 | + Animation secondaryAnimation) { | ||
| 283 | + return Align( | ||
| 284 | + child: ClipRRect( | ||
| 285 | + borderRadius: BorderRadius.circular(10), | ||
| 286 | + child: Container( | ||
| 287 | + width: 80, | ||
| 288 | + height: 80, | ||
| 289 | + child: CupertinoActivityIndicator(), | ||
| 290 | + ), | ||
| 291 | + ), | ||
| 292 | + ); | ||
| 293 | + }).then((v) {}); | ||
| 294 | + } | ||
| 295 | + | ||
| 296 | + ///苹果登陆 | ||
| 297 | + _iosLogin(UserModel value) async { | ||
| 298 | + String info = await Utils.getDeviceInfoSystem(); | ||
| 299 | + int systemInfo = info.compareTo('13'); | ||
| 300 | + if (systemInfo < 0) { | ||
| 301 | + Utils.showToast('该系统版本不支持苹果登录'); | ||
| 302 | + return; | ||
| 303 | + } | ||
| 304 | + final credential = await SignInWithApple.getAppleIDCredential( | ||
| 305 | + scopes: [ | ||
| 306 | + AppleIDAuthorizationScopes.email, | ||
| 307 | + AppleIDAuthorizationScopes.fullName, | ||
| 308 | + ], | ||
| 309 | + webAuthenticationOptions: WebAuthenticationOptions( | ||
| 310 | + // TODO: Set the `clientId` and `redirectUri` arguments to the values you entered in the Apple Developer portal during the setup | ||
| 311 | + clientId: 'com.naji.reserveLine', | ||
| 312 | + redirectUri: Uri.parse( | ||
| 313 | + 'https://flutter-sign-in-with-apple-example.glitch.me/callbacks/sign_in_with_apple', | ||
| 314 | + ), | ||
| 315 | + ), | ||
| 316 | + ); | ||
| 317 | + // _showLoading(context); | ||
| 318 | + // print(credential.userIdentifier); | ||
| 319 | + _loginAppleData(value); | ||
| 320 | + // NavigatorUtil.goBindingPhonePage(context, wechat: false); | ||
| 321 | + // String mdString = Utils.generateMd5(credential.userIdentifier); | ||
| 322 | + // String temp = mdString.substring(8, mdString.length - 2); | ||
| 323 | + // String openid = 'IOSID_$temp'; | ||
| 324 | + // App.sp.setString("openid", openid); | ||
| 325 | + // App.sp.setString("unionid", ''); | ||
| 326 | + // print(openid.length); | ||
| 327 | + | ||
| 328 | + // 第一次授权 | ||
| 329 | + // if (ObjectUtil.isNotEmpty(credential.familyName)) { | ||
| 330 | + // Map param = { | ||
| 331 | + // 'openid': openid, | ||
| 332 | + // 'avatar': 'ios_avatar', | ||
| 333 | + // 'nickname': '${credential.familyName}${credential.givenName}', | ||
| 334 | + // 'gender': '1' | ||
| 335 | + // }; | ||
| 336 | + // LoginRespository().appleLogin(context, param, () { | ||
| 337 | + // _getUserInfoIOS(); | ||
| 338 | + // }); | ||
| 339 | + // } else { | ||
| 340 | + // if (ObjectUtil.isNotEmpty(App.sp.getString("newUserMsg"))) { | ||
| 341 | + // Map newUserMsg = jsonDecode(App.sp.getString("newUserMsg")); | ||
| 342 | + // //上次失败了,这次重新传 | ||
| 343 | + // LoginRespository().appleLogin(context, newUserMsg, () { | ||
| 344 | + // _getUserInfoIOS(); | ||
| 345 | + // }); | ||
| 346 | + // } else { | ||
| 347 | + // _getUserInfoIOS(); | ||
| 348 | + // } | ||
| 349 | + // } | ||
| 350 | + } | ||
| 351 | + | ||
| 352 | + _loginAppleData(UserModel value) { | ||
| 353 | + if (App.sp.containsKey('unionid')) { | ||
| 354 | + //微信登陆的时候,退出清空数据 | ||
| 355 | + App.sp.remove('openid'); | ||
| 356 | + App.sp.remove("unionid"); | ||
| 357 | + } | ||
| 358 | + Map<String, String> params = { | ||
| 359 | + "seller_code": "001297", | ||
| 360 | + "alias": "ssahdahgdafgahjkhakjgh", | ||
| 361 | + "account": "0001", | ||
| 362 | + "password": "123456" | ||
| 363 | + }; | ||
| 364 | + value.login(context, params).then((value) { | ||
| 365 | + // setState(() { | ||
| 366 | + // // errorText = value ?? ""; | ||
| 367 | + // }); | ||
| 368 | + }); | ||
| 369 | + } | ||
| 370 | + | ||
| 371 | + @override | ||
| 372 | + Widget build(BuildContext context) { | ||
| 373 | + ScreenUtil.init(context, width: 750, height: 1334); | ||
| 374 | + otherLoginProvider = | ||
| 375 | + Provider.of<OtherLoginProvider>(context, listen: false); | ||
| 376 | + createStoreModel = Provider.of<CreateStoreModel>(context, listen: false); | ||
| 377 | + final Size size = MediaQuery.of(context).size; | ||
| 378 | + App.screenWidth = size.width; | ||
| 379 | + App.screenHeight = size.height; | ||
| 380 | + App.statusBarHeight = MediaQuery.of(context).padding.top; | ||
| 381 | + App.bottomBarHeight = MediaQuery.of(context).padding.bottom; | ||
| 382 | + | ||
| 383 | + final double prefixIconWidth = ScreenUtil().setWidth(24); | ||
| 384 | + | ||
| 385 | + return Scaffold( | ||
| 386 | + backgroundColor: MyColours.color_ffffff, | ||
| 387 | + body: Container( | ||
| 388 | + width: double.infinity, | ||
| 389 | + height: double.infinity, | ||
| 390 | + child: SingleChildScrollView( | ||
| 391 | + controller: _scrollController, | ||
| 392 | + child: Column( | ||
| 393 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 394 | + children: <Widget>[ | ||
| 395 | + // VEmptyView(218 - App.statusBarHeight), | ||
| 396 | + VEmptyView(80 + App.statusBarHeight), | ||
| 397 | + Padding( | ||
| 398 | + padding: EdgeInsets.symmetric( | ||
| 399 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 400 | + child: Row( | ||
| 401 | + mainAxisAlignment: MainAxisAlignment.start, | ||
| 402 | + children: [ | ||
| 403 | + Image.asset( | ||
| 404 | + "assets/logo.png", | ||
| 405 | + width: ScreenUtil().setWidth(40 * 2), | ||
| 406 | + height: ScreenUtil().setWidth(40 * 2), | ||
| 407 | + ) | ||
| 408 | + ], | ||
| 409 | + )), | ||
| 410 | + VEmptyView(120), | ||
| 411 | + Image.asset( | ||
| 412 | + Utils.getImgPath('login_bg'), | ||
| 413 | + ), | ||
| 414 | + // Container( | ||
| 415 | + // height: ScreenUtil().setHeight(84), | ||
| 416 | + // width: ScreenUtil().setWidth(611), | ||
| 417 | + // padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)), | ||
| 418 | + // alignment: Alignment.center, | ||
| 419 | + // decoration: BoxDecoration( | ||
| 420 | + // border: Border.all( | ||
| 421 | + // color: MyColours.color_bff6f7, | ||
| 422 | + // width: ScreenUtil().setWidth(2)), | ||
| 423 | + // borderRadius: | ||
| 424 | + // BorderRadius.circular(ScreenUtil().setWidth(8))), | ||
| 425 | + // child: Row( | ||
| 426 | + // crossAxisAlignment: CrossAxisAlignment.center, | ||
| 427 | + // children: <Widget>[ | ||
| 428 | + // Image.asset( | ||
| 429 | + // "assets/icon_sellercode.png", | ||
| 430 | + // width: prefixIconWidth, | ||
| 431 | + // ), | ||
| 432 | + // HEmptyView(26), | ||
| 433 | + // Center( | ||
| 434 | + // child: Text( | ||
| 435 | + // "商户编号", | ||
| 436 | + // style: TextStyle( | ||
| 437 | + // color: MyColours.color_353535, | ||
| 438 | + // fontSize: ScreenUtil().setSp(28)), | ||
| 439 | + // )), | ||
| 440 | + // Expanded( | ||
| 441 | + // child: Container( | ||
| 442 | + // height: ScreenUtil().setHeight(84), | ||
| 443 | + // padding: EdgeInsets.only( | ||
| 444 | + // left: ScreenUtil().setWidth(20), | ||
| 445 | + // right: ScreenUtil().setWidth(20), | ||
| 446 | + // top: ScreenUtil().setWidth(8)), | ||
| 447 | + // child: TextField( | ||
| 448 | + // controller: _sellerCodeController, | ||
| 449 | + // focusNode: _sellerCodeFocusNode, | ||
| 450 | + // // autofocus: _sellerCodeController.text.isEmpty, | ||
| 451 | + // style: TextStyle( | ||
| 452 | + // color: MyColours.color_353535, | ||
| 453 | + // fontSize: ScreenUtil().setSp(28), | ||
| 454 | + // textBaseline: TextBaseline.alphabetic), | ||
| 455 | + // // textAlignVertical: TextAlignVertical.center, | ||
| 456 | + // decoration: InputDecoration( | ||
| 457 | + // hintText: "请输入6位商户编码", | ||
| 458 | + // hintStyle: TextStyle( | ||
| 459 | + // color: MyColours.color_c1c1c1, | ||
| 460 | + // fontSize: ScreenUtil().setSp(28), | ||
| 461 | + // ), | ||
| 462 | + // border: OutlineInputBorder( | ||
| 463 | + // borderSide: BorderSide.none), | ||
| 464 | + // contentPadding: EdgeInsets.zero, | ||
| 465 | + // ), | ||
| 466 | + // onChanged: (_) { | ||
| 467 | + // setActivate(); | ||
| 468 | + // }, | ||
| 469 | + // keyboardType: TextInputType.number, | ||
| 470 | + // )), | ||
| 471 | + // ) | ||
| 472 | + // ], | ||
| 473 | + // )), | ||
| 474 | + | ||
| 475 | + // Container( | ||
| 476 | + // height: ScreenUtil().setHeight(84), | ||
| 477 | + // width: ScreenUtil().setWidth(611), | ||
| 478 | + // padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)), | ||
| 479 | + // margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)), | ||
| 480 | + // alignment: Alignment.center, | ||
| 481 | + // decoration: BoxDecoration( | ||
| 482 | + // border: Border.all( | ||
| 483 | + // color: MyColours.color_bff6f7, | ||
| 484 | + // width: ScreenUtil().setWidth(2)), | ||
| 485 | + // borderRadius: | ||
| 486 | + // BorderRadius.circular(ScreenUtil().setWidth(8))), | ||
| 487 | + // child: Row( | ||
| 488 | + // crossAxisAlignment: CrossAxisAlignment.center, | ||
| 489 | + // children: <Widget>[ | ||
| 490 | + // Image.asset( | ||
| 491 | + // "assets/icon_account.png", | ||
| 492 | + // width: prefixIconWidth, | ||
| 493 | + // ), | ||
| 494 | + // HEmptyView(26), | ||
| 495 | + // Text( | ||
| 496 | + // "工 号", | ||
| 497 | + // style: TextStyle( | ||
| 498 | + // color: MyColours.color_353535, | ||
| 499 | + // fontSize: ScreenUtil().setSp(28)), | ||
| 500 | + // ), | ||
| 501 | + // Expanded( | ||
| 502 | + // child: Container( | ||
| 503 | + // height: ScreenUtil().setHeight(84), | ||
| 504 | + // padding: EdgeInsets.only( | ||
| 505 | + // left: ScreenUtil().setWidth(20), | ||
| 506 | + // right: ScreenUtil().setWidth(20), | ||
| 507 | + // top: ScreenUtil().setWidth(8)), | ||
| 508 | + // child: TextField( | ||
| 509 | + // controller: _accountController, | ||
| 510 | + // focusNode: _accountFocusNode, | ||
| 511 | + // style: TextStyle( | ||
| 512 | + // color: MyColours.color_353535, | ||
| 513 | + // fontSize: ScreenUtil().setSp(28)), | ||
| 514 | + // decoration: InputDecoration( | ||
| 515 | + // hintText: "请输入4位工号", | ||
| 516 | + // hintStyle: TextStyle( | ||
| 517 | + // color: MyColours.color_c1c1c1, | ||
| 518 | + // fontSize: ScreenUtil().setSp(28)), | ||
| 519 | + // border: OutlineInputBorder( | ||
| 520 | + // borderSide: BorderSide.none), | ||
| 521 | + // contentPadding: EdgeInsets.zero, | ||
| 522 | + // ), | ||
| 523 | + // onChanged: (_) { | ||
| 524 | + // setActivate(); | ||
| 525 | + // }, | ||
| 526 | + // keyboardType: TextInputType.number, | ||
| 527 | + // ), | ||
| 528 | + // )) | ||
| 529 | + // ], | ||
| 530 | + // )), | ||
| 531 | + // Container( | ||
| 532 | + // height: ScreenUtil().setHeight(84), | ||
| 533 | + // width: ScreenUtil().setWidth(611), | ||
| 534 | + // padding: EdgeInsets.only( | ||
| 535 | + // left: ScreenUtil().setWidth(20), | ||
| 536 | + // right: ScreenUtil().setWidth(27)), | ||
| 537 | + // margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)), | ||
| 538 | + // alignment: Alignment.center, | ||
| 539 | + // decoration: BoxDecoration( | ||
| 540 | + // border: Border.all( | ||
| 541 | + // color: MyColours.color_bff6f7, | ||
| 542 | + // width: ScreenUtil().setWidth(2)), | ||
| 543 | + // borderRadius: | ||
| 544 | + // BorderRadius.circular(ScreenUtil().setWidth(8))), | ||
| 545 | + // child: Row( | ||
| 546 | + // crossAxisAlignment: CrossAxisAlignment.center, | ||
| 547 | + // children: <Widget>[ | ||
| 548 | + // Image.asset( | ||
| 549 | + // "assets/icon_pwd.png", | ||
| 550 | + // width: prefixIconWidth, | ||
| 551 | + // ), | ||
| 552 | + // HEmptyView(26), | ||
| 553 | + // Text( | ||
| 554 | + // "密 码", | ||
| 555 | + // style: TextStyle( | ||
| 556 | + // color: MyColours.color_353535, | ||
| 557 | + // fontSize: ScreenUtil().setSp(28)), | ||
| 558 | + // ), | ||
| 559 | + // Expanded( | ||
| 560 | + // child: Container( | ||
| 561 | + // height: ScreenUtil().setHeight(84), | ||
| 562 | + // padding: EdgeInsets.only( | ||
| 563 | + // left: ScreenUtil().setWidth(20), | ||
| 564 | + // right: ScreenUtil().setWidth(20), | ||
| 565 | + // top: ScreenUtil().setWidth(8)), | ||
| 566 | + // child: TextField( | ||
| 567 | + // controller: _pwdController, | ||
| 568 | + // focusNode: _pwdFocusNode, | ||
| 569 | + // // autofocus: _sellerCodeController.text.isNotEmpty && | ||
| 570 | + // // _accountController.text.isNotEmpty && | ||
| 571 | + // // _pwdController.text.isEmpty, | ||
| 572 | + // style: TextStyle( | ||
| 573 | + // color: MyColours.color_353535, | ||
| 574 | + // fontSize: ScreenUtil().setSp(28)), | ||
| 575 | + // decoration: InputDecoration( | ||
| 576 | + // hintText: "请输入密码", | ||
| 577 | + // hintStyle: TextStyle( | ||
| 578 | + // color: MyColours.color_c1c1c1, | ||
| 579 | + // fontSize: ScreenUtil().setSp(28)), | ||
| 580 | + // border: OutlineInputBorder( | ||
| 581 | + // borderSide: BorderSide.none), | ||
| 582 | + // contentPadding: EdgeInsets.zero, | ||
| 583 | + // ), | ||
| 584 | + // onChanged: (_) { | ||
| 585 | + // setActivate(); | ||
| 586 | + // }, | ||
| 587 | + // obscureText: obscureText, | ||
| 588 | + // keyboardType: TextInputType.text, | ||
| 589 | + // )), | ||
| 590 | + // ), | ||
| 591 | + // GestureDetector( | ||
| 592 | + // child: Padding( | ||
| 593 | + // padding: EdgeInsets.all(ScreenUtil().setWidth(10)), | ||
| 594 | + // child: Image.asset( | ||
| 595 | + // obscureText | ||
| 596 | + // ? "assets/icon_pwd_show.png" | ||
| 597 | + // : "assets/icon_pwd_hide.png", | ||
| 598 | + // width: ScreenUtil().setWidth(35), | ||
| 599 | + // height: ScreenUtil().setHeight(24), | ||
| 600 | + // ), | ||
| 601 | + // ), | ||
| 602 | + // onTap: () { | ||
| 603 | + // setState(() { | ||
| 604 | + // obscureText = !obscureText; | ||
| 605 | + // }); | ||
| 606 | + // }, | ||
| 607 | + // ) | ||
| 608 | + // ], | ||
| 609 | + // )), | ||
| 610 | + | ||
| 611 | + // Container( | ||
| 612 | + // width: ScreenUtil().setWidth(611), | ||
| 613 | + // margin: EdgeInsets.only(top: ScreenUtil().setHeight(16)), | ||
| 614 | + // alignment: Alignment.centerLeft, | ||
| 615 | + // child: Text( | ||
| 616 | + // errorText, | ||
| 617 | + // // 'hfhfhf', | ||
| 618 | + // style: TextStyle( | ||
| 619 | + // color: MyColours.color_d93535, | ||
| 620 | + // fontSize: ScreenUtil().setSp(16)), | ||
| 621 | + // ), | ||
| 622 | + // ), | ||
| 623 | + VEmptyView(60), | ||
| 624 | + // Consumer<UserModel>( | ||
| 625 | + // builder: | ||
| 626 | + // (BuildContext context, UserModel value, Widget child) { | ||
| 627 | + // return GestureDetector( | ||
| 628 | + // onTap: () { | ||
| 629 | + // if (!isActivate) return; | ||
| 630 | + // if (!_check) { | ||
| 631 | + // Utils.showToast('请先仔细阅读并同意协议'); | ||
| 632 | + // return; | ||
| 633 | + // } | ||
| 634 | + // if (App.sp.containsKey('unionid')) { | ||
| 635 | + // //微信登陆的时候,退出清空数据 | ||
| 636 | + // App.sp.remove('openid'); | ||
| 637 | + // App.sp.remove("unionid"); | ||
| 638 | + // } | ||
| 639 | + // Map<String, String> params = { | ||
| 640 | + // "seller_code": "${_sellerCodeController.text}", | ||
| 641 | + // "alias": "ssahdahgdafgahjkhakjgh", | ||
| 642 | + // "account": "${_accountController.text}", | ||
| 643 | + // "password": "${_pwdController.text}" | ||
| 644 | + // }; | ||
| 645 | + // value.login(context, params).then((value) { | ||
| 646 | + // setState(() { | ||
| 647 | + // errorText = value ?? ""; | ||
| 648 | + // }); | ||
| 649 | + // }); | ||
| 650 | + // }, | ||
| 651 | + // child: Container( | ||
| 652 | + // height: ScreenUtil().setWidth(84), | ||
| 653 | + // width: ScreenUtil().setWidth(611), | ||
| 654 | + // alignment: Alignment.center, | ||
| 655 | + // decoration: BoxDecoration( | ||
| 656 | + // color: isActivate | ||
| 657 | + // ? MyColours.color_2bb5b7 | ||
| 658 | + // : MyColours.color_2bb5b7, | ||
| 659 | + // boxShadow: [ | ||
| 660 | + // BoxShadow( | ||
| 661 | + // color: MyColours.color_26000000, | ||
| 662 | + // offset: Offset(0, ScreenUtil().setWidth(4)), | ||
| 663 | + // ) | ||
| 664 | + // ], | ||
| 665 | + // borderRadius: BorderRadius.all( | ||
| 666 | + // Radius.circular(ScreenUtil().setWidth(8)))), | ||
| 667 | + // child: Text( | ||
| 668 | + // "登录", | ||
| 669 | + // style: TextStyle( | ||
| 670 | + // color: MyColours.color_ffffff, | ||
| 671 | + // fontSize: ScreenUtil().setSp(34)), | ||
| 672 | + // ), | ||
| 673 | + // ), | ||
| 674 | + // ); | ||
| 675 | + // }, | ||
| 676 | + // ), | ||
| 677 | + | ||
| 678 | + Row( | ||
| 679 | + // mainAxisSize: MainAxisSize.min, | ||
| 680 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 681 | + children: <Widget>[ | ||
| 682 | + InkWell( | ||
| 683 | + onTap: () { | ||
| 684 | + setState(() { | ||
| 685 | + _check = !_check; | ||
| 686 | + }); | ||
| 687 | + }, | ||
| 688 | + child: Container( | ||
| 689 | + alignment: Alignment.topCenter, | ||
| 690 | + // color: Colors.red, | ||
| 691 | + height: ScreenUtil().setWidth(110), | ||
| 692 | + padding: EdgeInsets.only( | ||
| 693 | + right: ScreenUtil().setWidth(30), | ||
| 694 | + left: ScreenUtil().setWidth(102), | ||
| 695 | + bottom: ScreenUtil().setWidth(10)), | ||
| 696 | + child: Image.asset( | ||
| 697 | + _check | ||
| 698 | + ? "assets/mine_radio_sel.png" | ||
| 699 | + : "assets/mine_radio_nor.png", | ||
| 700 | + width: ScreenUtil().setWidth(26), | ||
| 701 | + height: ScreenUtil().setWidth(26)), | ||
| 702 | + )), | ||
| 703 | + // HEmptyView(30), | ||
| 704 | + Padding( | ||
| 705 | + padding: EdgeInsets.only(top: ScreenUtil().setWidth(2)), | ||
| 706 | + child: Text( | ||
| 707 | + '已阅读并同意', | ||
| 708 | + style: TextStyle( | ||
| 709 | + fontSize: ScreenUtil().setSp(24), | ||
| 710 | + color: MyColours.color_999999), | ||
| 711 | + ), | ||
| 712 | + ), | ||
| 713 | + InkWell( | ||
| 714 | + onTap: () { | ||
| 715 | + NavigatorUtil.goWebPage(context, '软件服务协议', "xy"); | ||
| 716 | + }, | ||
| 717 | + child: Padding( | ||
| 718 | + padding: | ||
| 719 | + EdgeInsets.only(top: ScreenUtil().setWidth(2)), | ||
| 720 | + child: Text( | ||
| 721 | + '《软件服务协议》', | ||
| 722 | + style: TextStyle( | ||
| 723 | + fontSize: ScreenUtil().setSp(24), | ||
| 724 | + color: MyColours.color_333333), | ||
| 725 | + )), | ||
| 726 | + ), | ||
| 727 | + Padding( | ||
| 728 | + padding: EdgeInsets.only(top: ScreenUtil().setWidth(2)), | ||
| 729 | + child: Text('及', | ||
| 730 | + style: TextStyle( | ||
| 731 | + fontSize: ScreenUtil().setSp(24), | ||
| 732 | + color: MyColours.color_999999))), | ||
| 733 | + InkWell( | ||
| 734 | + onTap: () { | ||
| 735 | + NavigatorUtil.goWebPage(context, '隐私政策', "zc"); | ||
| 736 | + }, | ||
| 737 | + child: Padding( | ||
| 738 | + padding: | ||
| 739 | + EdgeInsets.only(top: ScreenUtil().setWidth(2)), | ||
| 740 | + child: Text('《隐私政策》', | ||
| 741 | + style: TextStyle( | ||
| 742 | + fontSize: ScreenUtil().setSp(24), | ||
| 743 | + color: MyColours.color_333333))), | ||
| 744 | + ) | ||
| 745 | + ], | ||
| 746 | + ), | ||
| 747 | + | ||
| 748 | + //微信登录 | ||
| 749 | + Offstage( | ||
| 750 | + offstage: !App.isInstallWx, | ||
| 751 | + child: InkWell( | ||
| 752 | + child: Container( | ||
| 753 | + width: double.infinity, | ||
| 754 | + height: ScreenUtil().setWidth(90), | ||
| 755 | + margin: EdgeInsets.only( | ||
| 756 | + bottom: ScreenUtil().setWidth(30), | ||
| 757 | + right: ScreenUtil().setWidth(80), | ||
| 758 | + left: ScreenUtil().setWidth(80)), | ||
| 759 | + decoration: BoxDecoration( | ||
| 760 | + color: MyColours.color_55AA67, | ||
| 761 | + borderRadius: BorderRadius.circular( | ||
| 762 | + ScreenUtil().setWidth(8))), | ||
| 763 | + child: Row( | ||
| 764 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 765 | + children: [ | ||
| 766 | + Image.asset(Utils.getImgPath('icon_wechat_login'), | ||
| 767 | + width: ScreenUtil().setWidth(46)), | ||
| 768 | + HEmptyView(20), | ||
| 769 | + Text('微信登录', | ||
| 770 | + style: TextStyle( | ||
| 771 | + color: MyColours.color_ffffff, | ||
| 772 | + fontSize: ScreenUtil().setSp(28), | ||
| 773 | + fontWeight: FontWeight.bold)), | ||
| 774 | + ], | ||
| 775 | + )), | ||
| 776 | + onTap: () { | ||
| 777 | + if (!_check) { | ||
| 778 | + DialogUtil.openAlertDialogLogin(context, 500, | ||
| 779 | + onTap: () { | ||
| 780 | + Navigator.pop(context); | ||
| 781 | + _wxLogin(); | ||
| 782 | + }); | ||
| 783 | + return; | ||
| 784 | + } | ||
| 785 | + _wxLogin(); | ||
| 786 | + }, | ||
| 787 | + )), | ||
| 788 | + //账号登录 | ||
| 789 | + Consumer<UserModel>(builder: | ||
| 790 | + (BuildContext context, UserModel value, Widget child) { | ||
| 791 | + return InkWell( | ||
| 792 | + child: Container( | ||
| 793 | + width: double.infinity, | ||
| 794 | + height: ScreenUtil().setWidth(90), | ||
| 795 | + margin: EdgeInsets.only( | ||
| 796 | + bottom: ScreenUtil().setWidth(30), | ||
| 797 | + right: ScreenUtil().setWidth(80), | ||
| 798 | + left: ScreenUtil().setWidth(80)), | ||
| 799 | + decoration: BoxDecoration( | ||
| 800 | + color: MyColours.color_41444B, | ||
| 801 | + borderRadius: BorderRadius.circular( | ||
| 802 | + ScreenUtil().setWidth(8))), | ||
| 803 | + child: Row( | ||
| 804 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 805 | + children: [ | ||
| 806 | + Text('一键订账号登录', | ||
| 807 | + style: TextStyle( | ||
| 808 | + color: MyColours.color_ffffff, | ||
| 809 | + fontSize: ScreenUtil().setSp(28), | ||
| 810 | + fontWeight: FontWeight.bold)), | ||
| 811 | + ], | ||
| 812 | + )), | ||
| 813 | + onTap: () { | ||
| 814 | + if (!_check) { | ||
| 815 | + DialogUtil.openAlertDialogLogin(context, 500, | ||
| 816 | + onTap: () { | ||
| 817 | + Navigator.pop(context); | ||
| 818 | + NavigatorUtil.goAccountLoginPage(context); | ||
| 819 | + }); | ||
| 820 | + return; | ||
| 821 | + } | ||
| 822 | + NavigatorUtil.goAccountLoginPage(context); | ||
| 823 | + }); | ||
| 824 | + }), | ||
| 825 | + // ios登录 | ||
| 826 | + Platform.isAndroid | ||
| 827 | + ? Text('') | ||
| 828 | + : Consumer<UserModel>(builder: | ||
| 829 | + (BuildContext context, UserModel value, Widget child) { | ||
| 830 | + return InkWell( | ||
| 831 | + child: Container( | ||
| 832 | + width: double.infinity, | ||
| 833 | + height: ScreenUtil().setWidth(90), | ||
| 834 | + margin: EdgeInsets.only( | ||
| 835 | + bottom: ScreenUtil().setWidth(30), | ||
| 836 | + right: ScreenUtil().setWidth(80), | ||
| 837 | + left: ScreenUtil().setWidth(80)), | ||
| 838 | + decoration: BoxDecoration( | ||
| 839 | + color: MyColours.color_ffffff, | ||
| 840 | + border: Border.all( | ||
| 841 | + color: MyColours.color_E4E4E4, | ||
| 842 | + width: ScreenUtil().setWidth(2)), | ||
| 843 | + borderRadius: BorderRadius.circular( | ||
| 844 | + ScreenUtil().setWidth(8))), | ||
| 845 | + child: Row( | ||
| 846 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 847 | + children: [ | ||
| 848 | + Image.asset( | ||
| 849 | + Utils.getImgPath('icon_apple_login'), | ||
| 850 | + width: ScreenUtil().setWidth(46)), | ||
| 851 | + HEmptyView(20), | ||
| 852 | + Text('通过 Apple 登录', | ||
| 853 | + style: TextStyle( | ||
| 854 | + color: MyColours.color_41444B, | ||
| 855 | + fontSize: ScreenUtil().setSp(28), | ||
| 856 | + fontWeight: FontWeight.bold)), | ||
| 857 | + ], | ||
| 858 | + )), | ||
| 859 | + onTap: () { | ||
| 860 | + if (!_check) { | ||
| 861 | + DialogUtil.openAlertDialogLogin(context, 500, | ||
| 862 | + onTap: () { | ||
| 863 | + Navigator.pop(context); | ||
| 864 | + _iosLogin(value); | ||
| 865 | + }); | ||
| 866 | + return; | ||
| 867 | + } | ||
| 868 | + _iosLogin(value); | ||
| 869 | + }); | ||
| 870 | + }), | ||
| 871 | + InkWell( | ||
| 872 | + onTap: () { | ||
| 873 | + Utils.goPhone("400-000-9690"); | ||
| 874 | + }, | ||
| 875 | + child: Text('联系客服', | ||
| 876 | + style: TextStyle( | ||
| 877 | + color: MyColours.color_333333, | ||
| 878 | + fontWeight: FontWeight.bold, | ||
| 879 | + fontSize: ScreenUtil().setSp(26), | ||
| 880 | + decoration: TextDecoration.underline))), | ||
| 881 | + ], | ||
| 882 | + ), | ||
| 883 | + ), | ||
| 884 | + )); | ||
| 885 | + } | ||
| 886 | +} |
| @@ -232,9 +232,17 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -232,9 +232,17 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 232 | height: ScreenUtil().setWidth(56), | 232 | height: ScreenUtil().setWidth(56), |
| 233 | fontSize: 28, | 233 | fontSize: 28, |
| 234 | isBold: false, | 234 | isBold: false, |
| 235 | - textColor: MyColours.color_199095, | 235 | + textColor: |
| 236 | + Provider.of<UserModel>(context, listen: false) | ||
| 237 | + .accountLogin | ||
| 238 | + ? MyColours.color_999999 | ||
| 239 | + : MyColours.color_199095, | ||
| 236 | radius: ScreenUtil().setWidth(20), | 240 | radius: ScreenUtil().setWidth(20), |
| 237 | onPressed: () { | 241 | onPressed: () { |
| 242 | + if (Provider.of<UserModel>(context, listen: false) | ||
| 243 | + .accountLogin) { | ||
| 244 | + return; | ||
| 245 | + } | ||
| 238 | NavigatorUtil.goIfNeedCreateStorePage(context, | 246 | NavigatorUtil.goIfNeedCreateStorePage(context, |
| 239 | changeStatus: true); | 247 | changeStatus: true); |
| 240 | }, | 248 | }, |
| @@ -25,6 +25,7 @@ class UserModel with ChangeNotifier { | @@ -25,6 +25,7 @@ class UserModel with ChangeNotifier { | ||
| 25 | String _registrationId; //极光推送registrationId | 25 | String _registrationId; //极光推送registrationId |
| 26 | String _token; //信鸽推送token | 26 | String _token; //信鸽推送token |
| 27 | List<PullMarketingByUidSunModel> pullMarketingByUidSunModel; | 27 | List<PullMarketingByUidSunModel> pullMarketingByUidSunModel; |
| 28 | + bool accountLogin = false; | ||
| 28 | 29 | ||
| 29 | User get user => _user; | 30 | User get user => _user; |
| 30 | 31 | ||
| @@ -47,7 +48,8 @@ class UserModel with ChangeNotifier { | @@ -47,7 +48,8 @@ class UserModel with ChangeNotifier { | ||
| 47 | } | 48 | } |
| 48 | 49 | ||
| 49 | /// 登录 | 50 | /// 登录 |
| 50 | - Future<String> login(BuildContext context, Map<String, String> params) async { | 51 | + Future<String> login(BuildContext context, Map<String, String> params, |
| 52 | + {bool acclogin = false}) async { | ||
| 51 | BaseResp<List> baseResp = await DioUtil() | 53 | BaseResp<List> baseResp = await DioUtil() |
| 52 | .request<List>(context, Method.get, HttpUrl.app_user_login, | 54 | .request<List>(context, Method.get, HttpUrl.app_user_login, |
| 53 | data: params) | 55 | data: params) |
| @@ -55,8 +57,16 @@ class UserModel with ChangeNotifier { | @@ -55,8 +57,16 @@ class UserModel with ChangeNotifier { | ||
| 55 | print(error.toString()); | 57 | print(error.toString()); |
| 56 | }); | 58 | }); |
| 57 | if (baseResp.code != Constant.status_success) { | 59 | if (baseResp.code != Constant.status_success) { |
| 58 | - return baseResp.msg ?? '登录失败,请检查账号密码'; | 60 | + Utils.showToast('用户名密码错误,请重新输入'); |
| 61 | + | ||
| 62 | + return ''; | ||
| 63 | + // return baseResp.msg ?? '用户名密码错误,请重新输入'; | ||
| 59 | } else { | 64 | } else { |
| 65 | + if (acclogin) { | ||
| 66 | + accountLogin = true; | ||
| 67 | + } else { | ||
| 68 | + accountLogin = false; | ||
| 69 | + } | ||
| 60 | Map<String, dynamic> seller = baseResp.data[0]["seller"]; | 70 | Map<String, dynamic> seller = baseResp.data[0]["seller"]; |
| 61 | Map<String, dynamic> user = baseResp.data[0]["user"]; | 71 | Map<String, dynamic> user = baseResp.data[0]["user"]; |
| 62 | Map<String, dynamic> userMap = { | 72 | Map<String, dynamic> userMap = { |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | 2 | ||
| 3 | class MyColours { | 3 | class MyColours { |
| 4 | + static const Color color_C9C9C9 = Color(0xffC9C9C9); | ||
| 5 | + static const Color color_F7F7F7 = Color(0xffF7F7F7); | ||
| 6 | + static const Color color_A3A3A3 = Color(0xffA3A3A3); | ||
| 7 | + static const Color color_5688F3 = Color(0xff5688F3); | ||
| 8 | + static const Color color_6097F4 = Color(0xff6097F4); | ||
| 9 | + static const Color color_2C2C2C = Color(0xff2C2C2C); | ||
| 10 | + static const Color color_404040 = Color(0xff404040); | ||
| 11 | + static const Color color_2264FF = Color(0xff2264FF); | ||
| 12 | + static const Color color_E4E4E4 = Color(0xffE4E4E4); | ||
| 13 | + static const Color color_41444B = Color(0xff41444B); | ||
| 14 | + static const Color color_55AA67 = Color(0xff55AA67); | ||
| 4 | static const Color color_d7d7d7 = Color(0xffD7D7D7); | 15 | static const Color color_d7d7d7 = Color(0xffD7D7D7); |
| 5 | static const Color color_F4FAFF = Color(0xffF4FAFF); | 16 | static const Color color_F4FAFF = Color(0xffF4FAFF); |
| 6 | static const Color app_main = Color(0xFF24A4A8); | 17 | static const Color app_main = Color(0xFF24A4A8); |
| @@ -46,6 +46,11 @@ class NavigatorUtil { | @@ -46,6 +46,11 @@ class NavigatorUtil { | ||
| 46 | _navigateTo(context, Routes.login, clearStack: true); | 46 | _navigateTo(context, Routes.login, clearStack: true); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | + /// 账号登录页 | ||
| 50 | + static void goAccountLoginPage(BuildContext context) { | ||
| 51 | + _navigateTo(context, Routes.account_login_page); | ||
| 52 | + } | ||
| 53 | + | ||
| 49 | /// 首页 | 54 | /// 首页 |
| 50 | static void goHomePage(BuildContext context, {int initialIndex = 1}) { | 55 | static void goHomePage(BuildContext context, {int initialIndex = 1}) { |
| 51 | _navigateTo(context, "${Routes.home}?initialIndex=$initialIndex", | 56 | _navigateTo(context, "${Routes.home}?initialIndex=$initialIndex", |
| @@ -39,11 +39,13 @@ import 'package:one_key/pages/detail/notebook_detail_change_page_f.dart'; | @@ -39,11 +39,13 @@ import 'package:one_key/pages/detail/notebook_detail_change_page_f.dart'; | ||
| 39 | import 'package:one_key/pages/detail/select_tables_f_page.dart'; | 39 | import 'package:one_key/pages/detail/select_tables_f_page.dart'; |
| 40 | import 'package:one_key/pages/home/home_page.dart'; | 40 | import 'package:one_key/pages/home/home_page.dart'; |
| 41 | import 'package:one_key/pages/invicate/invitation_page.dart'; | 41 | import 'package:one_key/pages/invicate/invitation_page.dart'; |
| 42 | +import 'package:one_key/pages/login/account_login_page.dart'; | ||
| 42 | import 'package:one_key/pages/login/binding_phone.dart'; | 43 | import 'package:one_key/pages/login/binding_phone.dart'; |
| 43 | import 'package:one_key/pages/login/if_need_create_store.dart'; | 44 | import 'package:one_key/pages/login/if_need_create_store.dart'; |
| 44 | import 'package:one_key/pages/login/login_page.dart'; | 45 | import 'package:one_key/pages/login/login_page.dart'; |
| 45 | import 'package:one_key/pages/detail/handle_online_page.dart'; | 46 | import 'package:one_key/pages/detail/handle_online_page.dart'; |
| 46 | import 'package:one_key/pages/detail/notebook_detail_page.dart'; | 47 | import 'package:one_key/pages/detail/notebook_detail_page.dart'; |
| 48 | +import 'package:one_key/pages/login/login_page_f.dart'; | ||
| 47 | import 'package:one_key/pages/login/web_page.dart'; | 49 | import 'package:one_key/pages/login/web_page.dart'; |
| 48 | import 'package:one_key/pages/message/message_order_menu.dart'; | 50 | import 'package:one_key/pages/message/message_order_menu.dart'; |
| 49 | 51 | ||
| @@ -1186,3 +1188,10 @@ var tableManagerPageHandle = new Handler( | @@ -1186,3 +1188,10 @@ var tableManagerPageHandle = new Handler( | ||
| 1186 | child: TableManagerPage(guest: guest), | 1188 | child: TableManagerPage(guest: guest), |
| 1187 | ); | 1189 | ); |
| 1188 | }); | 1190 | }); |
| 1191 | + | ||
| 1192 | +///账号登录页面 | ||
| 1193 | +var accountLoginPageHandle = new Handler( | ||
| 1194 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 1195 | + return ChangeNotifierProvider<OtherLoginProvider>( | ||
| 1196 | + create: (_) => OtherLoginProvider(), child: AccountLoginPage()); | ||
| 1197 | +}); |
| 1 | import 'package:fluro/fluro.dart'; | 1 | import 'package:fluro/fluro.dart'; |
| 2 | import 'package:flutter/material.dart' hide Router; | 2 | import 'package:flutter/material.dart' hide Router; |
| 3 | import 'package:one_key/pages/login/login_page.dart'; | 3 | import 'package:one_key/pages/login/login_page.dart'; |
| 4 | +import 'package:one_key/pages/login/login_page_f.dart'; | ||
| 4 | 5 | ||
| 5 | import 'route_handles.dart'; | 6 | import 'route_handles.dart'; |
| 6 | 7 | ||
| @@ -104,6 +105,8 @@ class Routes { | @@ -104,6 +105,8 @@ class Routes { | ||
| 104 | static String my_show_customer_list_page = | 105 | static String my_show_customer_list_page = |
| 105 | "/my_show_customer_list_page"; //仅展示的客户列表----我的 | 106 | "/my_show_customer_list_page"; //仅展示的客户列表----我的 |
| 106 | static String table_manager_page = "/table_manager_page"; //客情再次预订跳转的桌位预订页面 | 107 | static String table_manager_page = "/table_manager_page"; //客情再次预订跳转的桌位预订页面 |
| 108 | + static String account_login_page = "/account_login_page"; //账号登录页面 | ||
| 109 | + | ||
| 107 | 110 | ||
| 108 | static void configureRoutes(FluroRouter router) { | 111 | static void configureRoutes(FluroRouter router) { |
| 109 | router.notFoundHandler = new Handler( | 112 | router.notFoundHandler = new Handler( |
| @@ -212,5 +215,7 @@ class Routes { | @@ -212,5 +215,7 @@ class Routes { | ||
| 212 | router.define(my_show_customer_list_page, | 215 | router.define(my_show_customer_list_page, |
| 213 | handler: myShowCustomerListPageHandle); | 216 | handler: myShowCustomerListPageHandle); |
| 214 | router.define(table_manager_page, handler: tableManagerPageHandle); | 217 | router.define(table_manager_page, handler: tableManagerPageHandle); |
| 218 | + router.define(account_login_page, handler: accountLoginPageHandle); | ||
| 219 | + | ||
| 215 | } | 220 | } |
| 216 | } | 221 | } |
| @@ -857,46 +857,49 @@ class DialogUtil { | @@ -857,46 +857,49 @@ class DialogUtil { | ||
| 857 | width: double.infinity, | 857 | width: double.infinity, |
| 858 | height: ScreenUtil().setWidth(114) * 2 + | 858 | height: ScreenUtil().setWidth(114) * 2 + |
| 859 | ScreenUtil().setWidth(114) + | 859 | ScreenUtil().setWidth(114) + |
| 860 | - ScreenUtil().setWidth(70), | ||
| 861 | - decoration: BoxDecoration( | ||
| 862 | - color: MyColours.color_ffffff, | ||
| 863 | - borderRadius: BorderRadius.only( | ||
| 864 | - topLeft: Radius.circular(ScreenUtil().setWidth(40)), | ||
| 865 | - topRight: Radius.circular(ScreenUtil().setWidth(40)))), | 860 | + ScreenUtil().setWidth(70) - |
| 861 | + ScreenUtil().setWidth(104), | ||
| 862 | + color: Colors.transparent, | ||
| 863 | + // decoration: BoxDecoration( | ||
| 864 | + // color: MyColours.color_ffffff, | ||
| 865 | + // borderRadius: BorderRadius.only( | ||
| 866 | + // topLeft: Radius.circular(ScreenUtil().setWidth(40)), | ||
| 867 | + // topRight: Radius.circular(ScreenUtil().setWidth(40)))), | ||
| 866 | child: Column( | 868 | child: Column( |
| 867 | children: <Widget>[ | 869 | children: <Widget>[ |
| 868 | VEmptyView(60), | 870 | VEmptyView(60), |
| 869 | - Container( | ||
| 870 | - height: ScreenUtil().setWidth(44), | ||
| 871 | - alignment: Alignment.center, | ||
| 872 | - child: Text(phone, | ||
| 873 | - style: TextStyle( | ||
| 874 | - color: MyColours.color_666666, | ||
| 875 | - fontSize: ScreenUtil().setSp(36)))), | ||
| 876 | - VEmptyView(60), | 871 | + // Container( |
| 872 | + // height: ScreenUtil().setWidth(44), | ||
| 873 | + // alignment: Alignment.center, | ||
| 874 | + // child: Text(phone, | ||
| 875 | + // style: TextStyle( | ||
| 876 | + // color: MyColours.color_666666, | ||
| 877 | + // fontSize: ScreenUtil().setSp(36)))), | ||
| 878 | + // VEmptyView(60), | ||
| 877 | InkWell( | 879 | InkWell( |
| 878 | child: Container( | 880 | child: Container( |
| 879 | width: double.infinity, | 881 | width: double.infinity, |
| 880 | height: ScreenUtil().setWidth(114), | 882 | height: ScreenUtil().setWidth(114), |
| 881 | alignment: Alignment.topCenter, | 883 | alignment: Alignment.topCenter, |
| 882 | - color: MyColours.color_ffffff, | 884 | + // color: MyColours.color_404040, |
| 883 | child: Container( | 885 | child: Container( |
| 884 | width: ScreenUtil().setWidth(670), | 886 | width: ScreenUtil().setWidth(670), |
| 885 | height: ScreenUtil().setWidth(84), | 887 | height: ScreenUtil().setWidth(84), |
| 886 | alignment: Alignment.center, | 888 | alignment: Alignment.center, |
| 887 | decoration: BoxDecoration( | 889 | decoration: BoxDecoration( |
| 888 | - color: MyColours.color_f5f5f5, | 890 | + color: MyColours.color_404040, |
| 889 | borderRadius: | 891 | borderRadius: |
| 890 | - BorderRadius.circular(ScreenUtil().setWidth(42))), | 892 | + BorderRadius.circular(ScreenUtil().setWidth(8))), |
| 891 | child: Text( | 893 | child: Text( |
| 892 | - "呼叫", | 894 | + "呼叫 $phone", |
| 893 | style: TextStyle( | 895 | style: TextStyle( |
| 894 | - color: MyColours.color_666666, | ||
| 895 | - fontSize: ScreenUtil().setSp(28)), | 896 | + color: MyColours.color_6097F4, |
| 897 | + fontSize: ScreenUtil().setSp(32)), | ||
| 896 | ), | 898 | ), |
| 897 | )), | 899 | )), |
| 898 | onTap: () { | 900 | onTap: () { |
| 899 | Navigator.of(context).pop(); | 901 | Navigator.of(context).pop(); |
| 902 | + Utils.goPhone(phone); | ||
| 900 | }, | 903 | }, |
| 901 | ), | 904 | ), |
| 902 | InkWell( | 905 | InkWell( |
| @@ -904,20 +907,21 @@ class DialogUtil { | @@ -904,20 +907,21 @@ class DialogUtil { | ||
| 904 | width: double.infinity, | 907 | width: double.infinity, |
| 905 | height: ScreenUtil().setWidth(114), | 908 | height: ScreenUtil().setWidth(114), |
| 906 | alignment: Alignment.topCenter, | 909 | alignment: Alignment.topCenter, |
| 907 | - color: MyColours.color_ffffff, | 910 | + // color: MyColours.color_2C2C2C, |
| 908 | child: Container( | 911 | child: Container( |
| 909 | width: ScreenUtil().setWidth(670), | 912 | width: ScreenUtil().setWidth(670), |
| 910 | height: ScreenUtil().setWidth(84), | 913 | height: ScreenUtil().setWidth(84), |
| 911 | alignment: Alignment.center, | 914 | alignment: Alignment.center, |
| 912 | decoration: BoxDecoration( | 915 | decoration: BoxDecoration( |
| 913 | - color: MyColours.color_f5f5f5, | 916 | + color: MyColours.color_2C2C2C, |
| 914 | borderRadius: | 917 | borderRadius: |
| 915 | - BorderRadius.circular(ScreenUtil().setWidth(42))), | 918 | + BorderRadius.circular(ScreenUtil().setWidth(8))), |
| 916 | child: Text( | 919 | child: Text( |
| 917 | "取消", | 920 | "取消", |
| 918 | style: TextStyle( | 921 | style: TextStyle( |
| 919 | - color: MyColours.color_666666, | ||
| 920 | - fontSize: ScreenUtil().setSp(28)), | 922 | + fontWeight: FontWeight.bold, |
| 923 | + color: MyColours.color_5688F3, | ||
| 924 | + fontSize: ScreenUtil().setSp(32)), | ||
| 921 | ), | 925 | ), |
| 922 | )), | 926 | )), |
| 923 | onTap: () { | 927 | onTap: () { |
| @@ -2063,6 +2067,141 @@ class DialogUtil { | @@ -2063,6 +2067,141 @@ class DialogUtil { | ||
| 2063 | ); | 2067 | ); |
| 2064 | } | 2068 | } |
| 2065 | 2069 | ||
| 2070 | + static Future openAlertDialogLogin(BuildContext context, double height, | ||
| 2071 | + {GestureTapCallback onTap, double fontSize = 36}) async { | ||
| 2072 | + final action = await showDialog( | ||
| 2073 | + context: context, | ||
| 2074 | + barrierDismissible: true, | ||
| 2075 | + builder: (BuildContext context) { | ||
| 2076 | + return Center( | ||
| 2077 | + child: Container( | ||
| 2078 | + padding: | ||
| 2079 | + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(72)), | ||
| 2080 | + height: ScreenUtil().setWidth(height), | ||
| 2081 | + decoration: BoxDecoration( | ||
| 2082 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))), | ||
| 2083 | + child: Card( | ||
| 2084 | + shape: RoundedRectangleBorder( | ||
| 2085 | + borderRadius: BorderRadius.all( | ||
| 2086 | + Radius.circular(ScreenUtil().setWidth(30)))), //设置圆角 | ||
| 2087 | + child: Column( | ||
| 2088 | + children: [ | ||
| 2089 | + VEmptyView(40), | ||
| 2090 | + Container( | ||
| 2091 | + height: ScreenUtil().setWidth(48), | ||
| 2092 | + alignment: Alignment.center, | ||
| 2093 | + child: Text('欢迎使用一键订', | ||
| 2094 | + style: TextStyle( | ||
| 2095 | + fontSize: ScreenUtil().setSp(fontSize), | ||
| 2096 | + fontWeight: FontWeight.bold, | ||
| 2097 | + color: MyColours.color_333333)), | ||
| 2098 | + ), | ||
| 2099 | + VEmptyView(40), | ||
| 2100 | + Container( | ||
| 2101 | + // height: ScreenUtil().setWidth(80), | ||
| 2102 | + // color: Colors.red, | ||
| 2103 | + padding: EdgeInsets.symmetric( | ||
| 2104 | + horizontal: ScreenUtil().setWidth(68)), | ||
| 2105 | + alignment: Alignment.center, | ||
| 2106 | + child: Transform.translate( | ||
| 2107 | + offset: Offset( | ||
| 2108 | + 0, | ||
| 2109 | + ScreenUtil().setWidth(2) / | ||
| 2110 | + ScreenUtil() | ||
| 2111 | + .setWidth(2)), //1为 StrutStyle 的 leading的值 | ||
| 2112 | + child: Text( | ||
| 2113 | + '登录一键订前,请先阅读并同意', | ||
| 2114 | + style: TextStyle( | ||
| 2115 | + color: MyColours.color_333333, | ||
| 2116 | + fontSize: ScreenUtil().setSp(30), | ||
| 2117 | + ), | ||
| 2118 | + strutStyle: StrutStyle( | ||
| 2119 | + forceStrutHeight: true, | ||
| 2120 | + height: ScreenUtil().setWidth(0.8), | ||
| 2121 | + leading: ScreenUtil().setWidth(2)), | ||
| 2122 | + ), | ||
| 2123 | + )), | ||
| 2124 | + VEmptyView(10), | ||
| 2125 | + Row( | ||
| 2126 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 2127 | + children: [ | ||
| 2128 | + InkWell( | ||
| 2129 | + onTap: () { | ||
| 2130 | + NavigatorUtil.goWebPage(context, '软件服务协议', "xy"); | ||
| 2131 | + }, | ||
| 2132 | + child: Padding( | ||
| 2133 | + padding: | ||
| 2134 | + EdgeInsets.only(top: ScreenUtil().setWidth(2)), | ||
| 2135 | + child: Text( | ||
| 2136 | + '《软件服务协议》', | ||
| 2137 | + style: TextStyle( | ||
| 2138 | + fontSize: ScreenUtil().setSp(27), | ||
| 2139 | + color: MyColours.color_2264FF), | ||
| 2140 | + )), | ||
| 2141 | + ), | ||
| 2142 | + Padding( | ||
| 2143 | + padding: | ||
| 2144 | + EdgeInsets.only(top: ScreenUtil().setWidth(2)), | ||
| 2145 | + child: Text('及', | ||
| 2146 | + style: TextStyle( | ||
| 2147 | + fontSize: ScreenUtil().setSp(27), | ||
| 2148 | + color: MyColours.color_353535))), | ||
| 2149 | + InkWell( | ||
| 2150 | + onTap: () { | ||
| 2151 | + NavigatorUtil.goWebPage(context, '隐私政策', "zc"); | ||
| 2152 | + }, | ||
| 2153 | + child: Padding( | ||
| 2154 | + padding: | ||
| 2155 | + EdgeInsets.only(top: ScreenUtil().setWidth(2)), | ||
| 2156 | + child: Text('《隐私政策》', | ||
| 2157 | + style: TextStyle( | ||
| 2158 | + fontSize: ScreenUtil().setSp(27), | ||
| 2159 | + color: MyColours.color_2264FF))), | ||
| 2160 | + ) | ||
| 2161 | + ], | ||
| 2162 | + ), | ||
| 2163 | + VEmptyView(60), | ||
| 2164 | + MyDivider(double.infinity, ScreenUtil().setWidth(2), | ||
| 2165 | + color: MyColours.color_efefef), | ||
| 2166 | + InkWell( | ||
| 2167 | + child: Container( | ||
| 2168 | + height: ScreenUtil().setWidth(50 * 2), | ||
| 2169 | + alignment: Alignment.center, | ||
| 2170 | + child: Text( | ||
| 2171 | + '我已阅读并同意', | ||
| 2172 | + style: TextStyle( | ||
| 2173 | + color: MyColours.color_2264FF, | ||
| 2174 | + fontSize: ScreenUtil().setWidth(38)), | ||
| 2175 | + ), | ||
| 2176 | + ), | ||
| 2177 | + onTap: onTap, | ||
| 2178 | + ), | ||
| 2179 | + MyDivider(double.infinity, ScreenUtil().setWidth(2), | ||
| 2180 | + color: MyColours.color_efefef), | ||
| 2181 | + InkWell( | ||
| 2182 | + child: Container( | ||
| 2183 | + height: ScreenUtil().setWidth(50 * 2), | ||
| 2184 | + alignment: Alignment.center, | ||
| 2185 | + child: Text( | ||
| 2186 | + '暂不同意', | ||
| 2187 | + style: TextStyle( | ||
| 2188 | + color: MyColours.color_999999, | ||
| 2189 | + fontSize: ScreenUtil().setWidth(38)), | ||
| 2190 | + ), | ||
| 2191 | + ), | ||
| 2192 | + onTap: () { | ||
| 2193 | + Navigator.pop(context); | ||
| 2194 | + }, | ||
| 2195 | + ) | ||
| 2196 | + ], | ||
| 2197 | + ), | ||
| 2198 | + ), | ||
| 2199 | + ), | ||
| 2200 | + ); | ||
| 2201 | + }, | ||
| 2202 | + ); | ||
| 2203 | + } | ||
| 2204 | + | ||
| 2066 | static Future openAlertDialog(BuildContext context, String title, | 2205 | static Future openAlertDialog(BuildContext context, String title, |
| 2067 | String content, String btnTitle, double height, | 2206 | String content, String btnTitle, double height, |
| 2068 | {GestureTapCallback onTap, double fontSize = 36}) async { | 2207 | {GestureTapCallback onTap, double fontSize = 36}) async { |
-
Please register or login to post a comment