From 60b6f780d291083b0fba68c560958c3943c933ea Mon Sep 17 00:00:00 2001 From: zhuce <821293938@qq.com> Date: Sat, 9 Mar 2024 17:13:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=BA=9B=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Podfile.lock | 13 +++++++++++++ ios/Runner.xcodeproj/project.pbxproj | 18 ++++++++++++++++++ lib/api/login_api.dart | 1 + lib/config/constant.dart | 6 +++--- lib/main.dart | 5 ++++- lib/util/platform_utils.dart | 21 +++++++++++++++++++++ lib/util/xhttp.dart | 4 +++- pubspec.lock | 24 ++++++++++++++++++++++++ pubspec.yaml | 1 + 9 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 lib/util/platform_utils.dart diff --git a/ios/Podfile.lock b/ios/Podfile.lock index d12bfb1..9984e41 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -10,12 +10,19 @@ PODS: - AMapFoundation (1.8.2) - AMapLocation (2.10.0): - AMapFoundation (>= 1.8.0) + - device_info_plus (0.0.1): + - Flutter - Flutter (1.0.0) + - shared_preferences_foundation (0.0.1): + - Flutter + - FlutterMacOS DEPENDENCIES: - amap_flutter_location (from `.symlinks/plugins/amap_flutter_location/ios`) - amap_flutter_map (from `.symlinks/plugins/amap_flutter_map/ios`) + - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) - Flutter (from `Flutter`) + - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) SPEC REPOS: trunk: @@ -28,8 +35,12 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/amap_flutter_location/ios" amap_flutter_map: :path: ".symlinks/plugins/amap_flutter_map/ios" + device_info_plus: + :path: ".symlinks/plugins/device_info_plus/ios" Flutter: :path: Flutter + shared_preferences_foundation: + :path: ".symlinks/plugins/shared_preferences_foundation/darwin" SPEC CHECKSUMS: AMap3DMap: dce25dd3e51e6b92109caa7d0c97fc6055830fb3 @@ -37,7 +48,9 @@ SPEC CHECKSUMS: amap_flutter_map: 979e54d227cedac6c7504a2151bfbf3bcf96760a AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec AMapLocation: 5248aec2455ebb5d104b367813c946430a2ee033 + device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 6c38f62..9f372a8 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -199,6 +199,7 @@ 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 89E1D2AC08093F01356506F3 /* [CP] Copy Pods Resources */, + AED7BE96CE0DD7BE394CFAEB /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -340,6 +341,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + AED7BE96CE0DD7BE394CFAEB /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; AFD723CBD5C5EAB85535EEC4 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/lib/api/login_api.dart b/lib/api/login_api.dart index 5892c07..b33f913 100644 --- a/lib/api/login_api.dart +++ b/lib/api/login_api.dart @@ -14,6 +14,7 @@ class LoginApi { "wx_openid": openid, "wx_unionid": unionid }; + var headers = {'Content-Type': 'x-www-form-urlencoded'}; var post = await xHttp.post("/v2/auth/get-access-token", data); // print(post); } diff --git a/lib/config/constant.dart b/lib/config/constant.dart index 1f0e04c..0afbab6 100644 --- a/lib/config/constant.dart +++ b/lib/config/constant.dart @@ -1,10 +1,10 @@ class Constant{ //测试地址 - static const String testHost = "http://api.test.jjsos.cn/"; + static const String testHost = "http://api.test.jjsos.cn"; //线上地址 - static const String host = "http://api.jjsos.cn/"; + static const String host = "http://api.jjsos.cn"; //图片的host - static const String pictureHost = "http://pic.jjsos.cn/"; + static const String pictureHost = "http://pic.jjsos.cn"; //工单签字地址 static const String testWorkOrderUrl = "http://backend.test.jjsos.cn/old/elc-work-new-app?order_id="; static const String workOrderUrl = "http://backend.jjsos.cn/old/elc-work-new-app?order_id="; diff --git a/lib/main.dart b/lib/main.dart index 2ad801b..e6b8729 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,9 +1,12 @@ +import 'package:autosos_flutter/config/theme_colors.dart'; import 'package:autosos_flutter/pages/home/home_page.dart'; import 'package:autosos_flutter/pages/login/login_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:shared_preferences/shared_preferences.dart'; void main() { + SharedPreferences.setMockInitialValues({}); runApp(const MyApp()); } @@ -16,7 +19,7 @@ class MyApp extends StatelessWidget { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( - colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), + colorScheme: ColorScheme.fromSeed(seedColor: ThemeColors.primary), useMaterial3: true, ), home: const LoginPage(), diff --git a/lib/util/platform_utils.dart b/lib/util/platform_utils.dart new file mode 100644 index 0000000..e7b1080 --- /dev/null +++ b/lib/util/platform_utils.dart @@ -0,0 +1,21 @@ +import 'dart:io'; + +class PlatformUtils{ + static String getOSName(){ + if(Platform.isAndroid){ + return 'android'; + }else if(Platform.isFuchsia){ + return 'fuchsia'; + }else if(Platform.isIOS){ + return 'ios'; + }else if(Platform.isLinux){ + return 'linux'; + }else if(Platform.isMacOS){ + return 'macos'; + }else if(Platform.isWindows){ + return 'windows'; + }else{ + return 'unknown'; + } + } +} \ No newline at end of file diff --git a/lib/util/xhttp.dart b/lib/util/xhttp.dart index 85d81a2..a3e8dd7 100644 --- a/lib/util/xhttp.dart +++ b/lib/util/xhttp.dart @@ -49,7 +49,9 @@ class XHttp { baseUrl: _getBaseUrl(), // contentType: , // responseType: , - headers: {'Content-Type': 'application/json'}, + headers: { + 'Content-Type': 'application/json', + }, connectTimeout: const Duration(milliseconds: CONNECT_TIMEOUT), receiveTimeout: const Duration(milliseconds: RECEIVE_TIMEOUT), sendTimeout: const Duration(milliseconds: SEND_TIMEOUT), diff --git a/pubspec.lock b/pubspec.lock index f128666..2d21620 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -97,6 +97,22 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.6" + device_info_plus: + dependency: "direct main" + description: + name: device_info_plus + sha256: "77f757b789ff68e4eaf9c56d1752309bd9f7ad557cb105b938a7f8eb89e59110" + url: "https://pub.flutter-io.cn" + source: hosted + version: "9.1.2" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64 + url: "https://pub.flutter-io.cn" + source: hosted + version: "7.0.0" dio: dependency: "direct main" description: @@ -477,6 +493,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "5.2.0" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.2" xdg_directories: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 0850f20..f5459d9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -38,6 +38,7 @@ dependencies: shared_preferences: ^2.2.2 basic_utils: ^5.7.0 uuid: ^4.3.3 + device_info_plus: ^9.1.2 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons.