Procházet zdrojové kódy

增加修改密码。

liujq před 6 měsíci
rodič
revize
c585f16846

+ 5 - 0
android/build.gradle

@@ -1,4 +1,9 @@
1 1
 allprojects {
2
+    gradle.projectsEvaluated {
3
+        tasks.withType(JavaCompile) {
4
+            options.compilerArgs << "-Xlint:unchecked"
5
+        }
6
+    }
2 7
     repositories {
3 8
         google()
4 9
         mavenCentral()

+ 1 - 1
ios/Flutter/AppFrameworkInfo.plist

@@ -21,6 +21,6 @@
21 21
   <key>CFBundleVersion</key>
22 22
   <string>1.0</string>
23 23
   <key>MinimumOSVersion</key>
24
-  <string>11.0</string>
24
+  <string>12.0</string>
25 25
 </dict>
26 26
 </plist>

+ 1 - 1
ios/Podfile

@@ -1,5 +1,5 @@
1 1
 # Uncomment this line to define a global platform for your project
2
-# platform :ios, '11.0'
2
+platform :ios, '12.0'
3 3
 
4 4
 # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 5
 ENV['COCOAPODS_DISABLE_STATS'] = 'true'

+ 4 - 4
ios/Runner.xcodeproj/project.pbxproj

@@ -169,7 +169,7 @@
169 169
 			isa = PBXProject;
170 170
 			attributes = {
171 171
 				BuildIndependentTargetsInParallel = YES;
172
-				LastUpgradeCheck = 1430;
172
+				LastUpgradeCheck = 1510;
173 173
 				ORGANIZATIONNAME = "";
174 174
 				TargetAttributes = {
175 175
 					331C8080294A63A400263BE5 = {
@@ -345,7 +345,7 @@
345 345
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
346 346
 				GCC_WARN_UNUSED_FUNCTION = YES;
347 347
 				GCC_WARN_UNUSED_VARIABLE = YES;
348
-				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
348
+				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
349 349
 				MTL_ENABLE_DEBUG_INFO = NO;
350 350
 				SDKROOT = iphoneos;
351 351
 				SUPPORTED_PLATFORMS = iphoneos;
@@ -472,7 +472,7 @@
472 472
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
473 473
 				GCC_WARN_UNUSED_FUNCTION = YES;
474 474
 				GCC_WARN_UNUSED_VARIABLE = YES;
475
-				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
475
+				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
476 476
 				MTL_ENABLE_DEBUG_INFO = YES;
477 477
 				ONLY_ACTIVE_ARCH = YES;
478 478
 				SDKROOT = iphoneos;
@@ -521,7 +521,7 @@
521 521
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
522 522
 				GCC_WARN_UNUSED_FUNCTION = YES;
523 523
 				GCC_WARN_UNUSED_VARIABLE = YES;
524
-				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
524
+				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
525 525
 				MTL_ENABLE_DEBUG_INFO = NO;
526 526
 				SDKROOT = iphoneos;
527 527
 				SUPPORTED_PLATFORMS = iphoneos;

+ 1 - 1
ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

@@ -1,6 +1,6 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <Scheme
3
-   LastUpgradeVersion = "1430"
3
+   LastUpgradeVersion = "1510"
4 4
    version = "1.3">
5 5
    <BuildAction
6 6
       parallelizeBuildables = "YES"

+ 9 - 1
lib/network/api.dart

@@ -8,6 +8,7 @@ import 'package:lszlgl/model/rsp/login_rsp.dart';
8 8
 import 'package:lszlgl/model/rsp/sample_task_rsp.dart';
9 9
 import 'package:lszlgl/model/rsp/user_rsp.dart';
10 10
 import 'package:lszlgl/network/base_dio.dart';
11
+import 'package:retrofit/http.dart';
11 12
 import 'package:retrofit/retrofit.dart';
12 13
 
13 14
 import '../model/req/device_req.dart';
@@ -94,5 +95,12 @@ abstract class Api {
94 95
   /// 提交设备绑定信息
95 96
   @POST('/admin-api/zj/base-device/createBatch')
96 97
   Future<ApiRsp> postDeviceInfos(@Body() List<DeviceReq> req);
97
-
98
+  
99
+  /// 获取手机验证码
100
+  @POST('/admin-api/system/auth/reset_password_send_sms_code')
101
+  Future<ApiRsp<bool?>> postPhoneMsg(@Body() Map<String, dynamic> map);
102
+
103
+  ///忘记密码
104
+  @POST('/admin-api/system/auth/reset_password')
105
+  Future<ApiRsp<bool?>> resetPassword(@Body() Map<String, dynamic> map);
98 106
 }

+ 62 - 0
lib/network/api.g.dart

@@ -574,6 +574,68 @@ class _Api implements Api {
574 574
     return value;
575 575
   }
576 576
 
577
+  @override
578
+  Future<ApiRsp<bool?>> postPhoneMsg(Map<String, dynamic> map) async {
579
+    const _extra = <String, dynamic>{};
580
+    final queryParameters = <String, dynamic>{};
581
+    final _headers = <String, dynamic>{};
582
+    final _data = <String, dynamic>{};
583
+    _data.addAll(map);
584
+    final _result = await _dio
585
+        .fetch<Map<String, dynamic>>(_setStreamType<ApiRsp<bool>>(Options(
586
+      method: 'POST',
587
+      headers: _headers,
588
+      extra: _extra,
589
+    )
590
+            .compose(
591
+              _dio.options,
592
+              '/admin-api/system/auth/reset_password_send_sms_code',
593
+              queryParameters: queryParameters,
594
+              data: _data,
595
+            )
596
+            .copyWith(
597
+                baseUrl: _combineBaseUrls(
598
+              _dio.options.baseUrl,
599
+              baseUrl,
600
+            ))));
601
+    final value = ApiRsp<bool?>.fromJson(
602
+      _result.data!,
603
+      (json) => json as bool?,
604
+    );
605
+    return value;
606
+  }
607
+
608
+  @override
609
+  Future<ApiRsp<bool?>> resetPassword(Map<String, dynamic> map) async {
610
+    const _extra = <String, dynamic>{};
611
+    final queryParameters = <String, dynamic>{};
612
+    final _headers = <String, dynamic>{};
613
+    final _data = <String, dynamic>{};
614
+    _data.addAll(map);
615
+    final _result = await _dio
616
+        .fetch<Map<String, dynamic>>(_setStreamType<ApiRsp<bool>>(Options(
617
+      method: 'POST',
618
+      headers: _headers,
619
+      extra: _extra,
620
+    )
621
+            .compose(
622
+              _dio.options,
623
+              '/admin-api/system/auth/reset_password',
624
+              queryParameters: queryParameters,
625
+              data: _data,
626
+            )
627
+            .copyWith(
628
+                baseUrl: _combineBaseUrls(
629
+              _dio.options.baseUrl,
630
+              baseUrl,
631
+            ))));
632
+    final value = ApiRsp<bool?>.fromJson(
633
+      _result.data!,
634
+      (json) => json as bool?,
635
+    );
636
+    return value;
637
+  }
638
+
577 639
   RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
578 640
     if (T != dynamic &&
579 641
         !(requestOptions.responseType == ResponseType.bytes ||

+ 1 - 1
lib/network/my_api.dart

@@ -7,7 +7,7 @@ class MyApi {
7 7
   MyApi._();
8 8
 
9 9
   /// 生产url
10
-  static String productUrl = 'http://121.36.17.6:49099';
10
+  static String productUrl = 'http://121.36.17.6:39099';
11 11
 
12 12
   /// 测试url
13 13
   static String testUrl = 'http://121.36.17.6:19090';

+ 37 - 11
lib/page/login/login_page.dart

@@ -28,6 +28,7 @@ class LoginPage extends StatefulWidget {
28 28
 class _LoginPageState extends BaseLifecycleState<LoginPage> {
29 29
   late TextEditingController accountCtrl;
30 30
   late TextEditingController pwdCtrl;
31
+  late ValueNotifier<bool> _showPwd;
31 32
 
32 33
   void onLogin() async {
33 34
     var account = accountCtrl.text;
@@ -94,6 +95,7 @@ class _LoginPageState extends BaseLifecycleState<LoginPage> {
94 95
   void onInit() {
95 96
     accountCtrl = TextEditingController();
96 97
     pwdCtrl = TextEditingController();
98
+    _showPwd = ValueNotifier<bool>(true);
97 99
   }
98 100
 
99 101
   @override
@@ -106,7 +108,8 @@ class _LoginPageState extends BaseLifecycleState<LoginPage> {
106 108
     RefreshConfig.get().initDefault();
107 109
     LocationUtils.updatePrivacyShow(true, true);
108 110
     LocationUtils.updatePrivacyAgree(true);
109
-    LocationUtils.setApiKey(kReleaseMode ? '2c783509376e267b24d63b21681686fa' : '7d0c033909f84adc14a0e60a835f044f', '');
111
+    LocationUtils.setApiKey(
112
+        kReleaseMode ? '2c783509376e267b24d63b21681686fa' : '7d0c033909f84adc14a0e60a835f044f', '');
110 113
 
111 114
     /// 获取手机设备信息
112 115
     PrintService.getDeviceInfo();
@@ -214,7 +217,8 @@ class _LoginPageState extends BaseLifecycleState<LoginPage> {
214 217
       child: Container(
215 218
         padding: const EdgeInsets.symmetric(horizontal: 24),
216 219
         alignment: Alignment.center,
217
-        decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(32))),
220
+        decoration: const BoxDecoration(
221
+            color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(32))),
218 222
         child: Column(
219 223
           children: [
220 224
             const SizedBox(height: 56),
@@ -225,16 +229,36 @@ class _LoginPageState extends BaseLifecycleState<LoginPage> {
225 229
               action: TextInputAction.next,
226 230
             ),
227 231
             const SizedBox(height: 32),
228
-            buildEdit(
229
-              ctrl: pwdCtrl,
230
-              hint: '请输入登录密码',
231
-              icon: imgLoginPwd,
232
-              obscure: true,
233
-              onSubmit: (value) => onLogin(),
234
-            ),
235
-            const SizedBox(height: 64),
232
+            ValueListenableBuilder(
233
+                valueListenable: _showPwd,
234
+                builder: (BuildContext ctx, bool show, Widget? child) {
235
+                  return buildEdit(
236
+                    ctrl: pwdCtrl,
237
+                    hint: '请输入登录密码',
238
+                    icon: imgLoginPwd,
239
+                    obscure: show,
240
+                    onSubmit: (value) => onLogin(),
241
+                    rightIcon: child,
242
+                  );
243
+                },
244
+                child: IconButton(
245
+                  icon: const Icon(Icons.remove_red_eye_outlined, size: 16, color: Color(0xFFBBBBBB)),
246
+                  onPressed: () {
247
+                    _showPwd.value = !_showPwd.value;
248
+                  },
249
+                )),
250
+            const SizedBox(height: 44),
236 251
             buildLoginBtn(),
237
-            const SizedBox(height: 48),
252
+            SizedBox(
253
+              width: double.infinity,
254
+              child: TextButton(
255
+                  onPressed: () {
256
+                    MyRouter.forgetPwd();
257
+                  },
258
+                  style: const ButtonStyle(alignment: Alignment.centerRight),
259
+                  child: const Text('忘记密码', style: TextStyle(color: Color(0xFF25A6EE), fontSize: 14))),
260
+            ),
261
+            const SizedBox(height: 18),
238 262
           ],
239 263
         ),
240 264
       ),
@@ -248,6 +272,7 @@ class _LoginPageState extends BaseLifecycleState<LoginPage> {
248 272
     TextInputAction action = TextInputAction.done,
249 273
     bool obscure = false,
250 274
     ValueChanged? onSubmit,
275
+    Widget? rightIcon,
251 276
   }) {
252 277
     return TextField(
253 278
       controller: ctrl,
@@ -268,6 +293,7 @@ class _LoginPageState extends BaseLifecycleState<LoginPage> {
268 293
         hintStyle: const TextStyle(color: Color(0xFFBBBBBB)),
269 294
         isDense: true,
270 295
         contentPadding: EdgeInsets.zero,
296
+        suffixIcon: rightIcon,
271 297
       ),
272 298
       style: const TextStyle(fontSize: 14),
273 299
       textInputAction: action,

+ 11 - 2
lib/page/print/print_page.dart

@@ -234,16 +234,25 @@ class _PrintPageState extends BaseLifecycleState<PrintPage> {
234 234
           myAppBar(title: '打印二维码'),
235 235
           const SizedBox(height: 18),
236 236
           buildServiceItem(serviceList[0]),
237
-          const Text('已连接打印机'),
237
+
238
+          Offstage(
239
+            offstage: PrintService.connectedDeviceList.isEmpty,
240
+            child: const Text('已连接打印机'),
241
+          ),
238 242
           ...List.generate(
239 243
             PrintService.connectedDeviceList.length,
240 244
                 (index) => buildDeviceItem(PrintService.connectedDeviceList[index]),
241 245
           ).toList(),
242
-          const Text('可用打印机'),
246
+
247
+          Offstage(
248
+            offstage: deviceList.isEmpty,
249
+            child: const Text('可用打印机'),
250
+          ),
243 251
           ...List.generate(
244 252
             deviceList.length,
245 253
                 (index) => buildDeviceItem(deviceList[index]),
246 254
           ).toList(),
255
+
247 256
           Offstage(
248 257
             offstage: PrintService.connectedDeviceList.isEmpty,
249 258
             child: buildServiceItem(serviceList[1]),

+ 18 - 9
lib/page/user_center/change_pwd_page.dart

@@ -142,16 +142,25 @@ class _ChangePwdPageState extends BaseState<ChangePwdPage> {
142 142
     return Column(
143 143
       children: [
144 144
         myAppBar(title: '修改密码'),
145
-        buildList(),
146
-        const SizedBox(height: 32),
147
-        MyButton(
148
-          '确认修改',
149
-          onTap: onChange,
150
-          gradient: const LinearGradient(colors: [Color(0xFF3BD2E5), Color(0xFF247AF8)]),
151
-          alignment: Alignment.center,
152
-          minHeight: 40,
153
-          margin: const EdgeInsets.symmetric(horizontal: 24),
145
+        Expanded(
146
+          child: SingleChildScrollView(
147
+            child: Column(
148
+              children: [
149
+                buildList(),
150
+                const SizedBox(height: 32),
151
+                MyButton(
152
+                  '确认修改',
153
+                  onTap: onChange,
154
+                  gradient: const LinearGradient(colors: [Color(0xFF3BD2E5), Color(0xFF247AF8)]),
155
+                  alignment: Alignment.center,
156
+                  minHeight: 40,
157
+                  margin: const EdgeInsets.symmetric(horizontal: 24),
158
+                ),
159
+              ],
160
+            ),
161
+          ),
154 162
         ),
163
+
155 164
       ],
156 165
     );
157 166
   }

+ 9 - 0
lib/router/my_router.dart

@@ -1,4 +1,5 @@
1 1
 import 'package:lszlgl/base/base_lifecycle_state.dart';
2
+import 'package:lszlgl/page/login/forget_password_page.dart';
2 3
 import 'package:lszlgl/page/login/login_page.dart';
3 4
 import 'package:lszlgl/page/main_tab_page.dart';
4 5
 import 'package:lszlgl/page/print/connect_print_page.dart';
@@ -38,6 +39,8 @@ const rPrintPage = '/PrintPage';
38 39
 const rConnectPrintPage = '/ConnectPrintPage';
39 40
 // 扫一扫
40 41
 const rQrCodeScanPage = '/QrCodeScanPage';
42
+// 忘记密码
43
+const rForgetPasswordPage = '/ForgetPasswordPage';
41 44
 
42 45
 final Map<String, MyNavigatorBuilder> rRouteMap = {
43 46
   // 根页面
@@ -53,6 +56,7 @@ final Map<String, MyNavigatorBuilder> rRouteMap = {
53 56
   rPrintPage: (context, args) => PrintPage(args: args as PrintPageArgs),
54 57
   rConnectPrintPage: (context, args) => ConnectPrintPage(args: args as ConnectPrintPageArgs),
55 58
   rQrCodeScanPage: (context, args) => const QrCodeScanPage(),
59
+  rForgetPasswordPage:(context,args) => const ForgetPasswordPage(),
56 60
 };
57 61
 
58 62
 class MyRouter {
@@ -91,6 +95,11 @@ class MyRouter {
91 95
     MyNavigator.push(rChangePwdPage, args: startHome);
92 96
   }
93 97
 
98
+  /// 忘记密码
99
+  static void forgetPwd(){
100
+    MyNavigator.push(rForgetPasswordPage);
101
+  }
102
+
94 103
   /// 收获环节列表
95 104
   static Future<dynamic> startSampleTaskList(SampleTaskListTabPageArgs args) {
96 105
     return MyNavigator.push(rSampleTaskListTabPage, args: args);

+ 12 - 0
lib/utils/string_utils.dart

@@ -17,4 +17,16 @@ class StringUtils {
17 17
       _ => '',
18 18
     };
19 19
   }
20
+
21
+  /// 判断是否是手机号
22
+  static bool isPhoneNum(String? nums) {
23
+    if(nums == null){
24
+      return false;
25
+    }
26
+
27
+    RegExp mobile = RegExp(
28
+        r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$');
29
+    return mobile.hasMatch(nums);
30
+  }
31
+
20 32
 }

+ 1 - 1
pubspec.yaml

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
16 16
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
17 17
 # In Windows, build-name is used as the major, minor, and patch parts
18 18
 # of the product and file versions while build-number is used as the build suffix.
19
-version: 0.0.19+19
19
+version: 0.0.20+20
20 20
 
21 21
 environment:
22 22
   sdk: '>=3.1.5 <4.0.0'