登陆跳转
parent
b920194baa
commit
135caf5adc
|
@ -13,15 +13,24 @@ PODS:
|
|||
- device_info_plus (0.0.1):
|
||||
- Flutter
|
||||
- Flutter (1.0.0)
|
||||
- getuiflut (0.0.1):
|
||||
- Flutter
|
||||
- GTSDK
|
||||
- GTCommonSDK (3.1.1.0):
|
||||
- ZXSDK
|
||||
- GTSDK (3.0.5.0):
|
||||
- GTCommonSDK (> 3.0.9.0)
|
||||
- shared_preferences_foundation (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- ZXSDK (3.2.5)
|
||||
|
||||
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`)
|
||||
- getuiflut (from `.symlinks/plugins/getuiflut/ios`)
|
||||
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
||||
|
||||
SPEC REPOS:
|
||||
|
@ -29,6 +38,9 @@ SPEC REPOS:
|
|||
- AMap3DMap
|
||||
- AMapFoundation
|
||||
- AMapLocation
|
||||
- GTCommonSDK
|
||||
- GTSDK
|
||||
- ZXSDK
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
amap_flutter_location:
|
||||
|
@ -39,6 +51,8 @@ EXTERNAL SOURCES:
|
|||
:path: ".symlinks/plugins/device_info_plus/ios"
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
getuiflut:
|
||||
:path: ".symlinks/plugins/getuiflut/ios"
|
||||
shared_preferences_foundation:
|
||||
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
|
||||
|
||||
|
@ -49,8 +63,12 @@ SPEC CHECKSUMS:
|
|||
AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec
|
||||
AMapLocation: 5248aec2455ebb5d104b367813c946430a2ee033
|
||||
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
|
||||
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||
getuiflut: 8628ba2b64a738a847a07d2b67e0ac305778e2ee
|
||||
GTCommonSDK: 2be8c2d5b094929f81b64dba8767bf110bae78de
|
||||
GTSDK: cc04d169c5c6cb8f8884849153eaac9e6ccfdd7c
|
||||
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
|
||||
ZXSDK: 414bed508b670437a9bdf7c75d49816b8cb7b2d4
|
||||
|
||||
PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
|
||||
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:autosos_flutter/pages/home/home_page.dart';
|
||||
import 'package:autosos_flutter/util/sp_util.dart';
|
||||
import 'package:autosos_flutter/util/xhttp.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LoginApi {
|
||||
static XHttp xHttp = XHttp.getInstance();
|
||||
static SPUtil spUtil = SPUtil();
|
||||
|
||||
static void login(int type, String username, String password, String code,
|
||||
static void login(BuildContext context,int type, String username, String password, String code,
|
||||
String cid, String openid, String unionid) async {
|
||||
var data = {
|
||||
"type": type,
|
||||
|
@ -15,7 +21,17 @@ class LoginApi {
|
|||
"wx_unionid": unionid
|
||||
};
|
||||
var headers = {'Content-Type': 'application/x-www-form-urlencoded'};
|
||||
var post = await xHttp.post("/v2/auth/get-access-token", data, headers);
|
||||
// print(post);
|
||||
Result response = await xHttp.post("/v2/auth/get-access-token", data, headers);
|
||||
var resData = response.data;
|
||||
var resCode = resData['code'];
|
||||
if(resCode==1){
|
||||
var accessToken = resData['data']['access_token'];
|
||||
spUtil.setString("accessToken", accessToken);
|
||||
if(!context.mounted) return;
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context)=> const HomePage()));
|
||||
}else{
|
||||
var msg = resData['message'];
|
||||
Toast.show(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class GetuiConstant{
|
||||
static const String appId = "D3cqMVd0aA6nYsVx9Gdgo9";
|
||||
static const String appKey = "OtBVS1PjCy5aLWNVM3aQY1";
|
||||
static const String appSecret = "juiYAn4XXc6BPVAI6DQlh8";
|
||||
}
|
172
lib/main.dart
172
lib/main.dart
|
@ -1,18 +1,30 @@
|
|||
|
||||
import 'dart:io';
|
||||
|
||||
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:autosos_flutter/util/sp_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:getuiflut/getuiflut.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'config/getui_constant.dart';
|
||||
|
||||
void main() {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
_MyAppState createState() => _MyAppState();
|
||||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -26,4 +38,160 @@ class MyApp extends StatelessWidget {
|
|||
builder: EasyLoading.init(),
|
||||
);
|
||||
}
|
||||
|
||||
String _platformVersion = 'Unknown';
|
||||
String _payloadInfo = 'Null';
|
||||
String _userMsg = "";
|
||||
String _notificationState = "";
|
||||
String _getClientId = "";
|
||||
String _getDeviceToken = "";
|
||||
String _onReceivePayload = "";
|
||||
String _onReceiveNotificationResponse = "";
|
||||
String _onAppLinkPayLoad = "";
|
||||
|
||||
SPUtil spUtil = SPUtil();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
initPlatformState();
|
||||
}
|
||||
|
||||
// Platform messages are asynchronous, so we initialize in an async method.
|
||||
Future<void> initPlatformState() async {
|
||||
String platformVersion;
|
||||
String payloadInfo = "default";
|
||||
String notificationState = "default";
|
||||
// Platform messages may fail, so we use a try/catch PlatformException.
|
||||
|
||||
if (Platform.isIOS) {
|
||||
getSdkVersion();
|
||||
Getuiflut().startSdk(
|
||||
appId: GetuiConstant.appId,
|
||||
appKey: GetuiConstant.appKey,
|
||||
appSecret: GetuiConstant.appSecret);
|
||||
}
|
||||
|
||||
try {
|
||||
platformVersion = await Getuiflut.platformVersion;
|
||||
|
||||
print('platformVersion' + platformVersion);
|
||||
} on PlatformException {
|
||||
platformVersion = 'Failed to get platform version.';
|
||||
}
|
||||
|
||||
// If the widget was removed from the tree while the asynchronous platform
|
||||
// message was in flight, we want to discard the reply rather than calling
|
||||
// setState to update our non-existent appearance.
|
||||
if (!mounted) return;
|
||||
|
||||
setState(() {
|
||||
_platformVersion = platformVersion;
|
||||
_payloadInfo = payloadInfo;
|
||||
_notificationState = notificationState;
|
||||
});
|
||||
|
||||
Getuiflut().addEventHandler(onReceiveClientId: (String message) async {
|
||||
print("flutter onReceiveClientId: $message");
|
||||
spUtil.setString("clientId", message);
|
||||
setState(() {
|
||||
_getClientId = "ClientId: $message";
|
||||
});
|
||||
}, onReceiveMessageData: (Map<String, dynamic> msg) async {
|
||||
print("flutter onReceiveMessageData: $msg");
|
||||
setState(() {
|
||||
_payloadInfo = msg['payload'];
|
||||
});
|
||||
}, onNotificationMessageArrived: (Map<String, dynamic> msg) async {
|
||||
print("flutter onNotificationMessageArrived: $msg");
|
||||
setState(() {
|
||||
_notificationState = 'Arrived';
|
||||
});
|
||||
}, onNotificationMessageClicked: (Map<String, dynamic> msg) async {
|
||||
print("flutter onNotificationMessageClicked: $msg");
|
||||
setState(() {
|
||||
_notificationState = 'Clicked';
|
||||
});
|
||||
}, onTransmitUserMessageReceive: (Map<String, dynamic> msg) async {
|
||||
print("flutter onTransmitUserMessageReceive:$msg");
|
||||
setState(() {
|
||||
_userMsg = msg["msg"];
|
||||
});
|
||||
}, onRegisterDeviceToken: (String message) async {
|
||||
print("flutter onRegisterDeviceToken: $message");
|
||||
setState(() {
|
||||
_getDeviceToken = "$message";
|
||||
});
|
||||
}, onReceivePayload: (Map<String, dynamic> message) async {
|
||||
print("flutter onReceivePayload: $message");
|
||||
setState(() {
|
||||
_onReceivePayload = "$message";
|
||||
});
|
||||
}, onReceiveNotificationResponse: (Map<String, dynamic> message) async {
|
||||
print("flutter onReceiveNotificationResponse: $message");
|
||||
setState(() {
|
||||
_onReceiveNotificationResponse = "$message";
|
||||
});
|
||||
}, onAppLinkPayload: (String message) async {
|
||||
print("flutter onAppLinkPayload: $message");
|
||||
setState(() {
|
||||
_onAppLinkPayLoad = "$message";
|
||||
});
|
||||
}, onPushModeResult: (Map<String, dynamic> message) async {
|
||||
print("flutter onPushModeResult: $message");
|
||||
}, onSetTagResult: (Map<String, dynamic> message) async {
|
||||
print("flutter onSetTagResult: $message");
|
||||
}, onAliasResult: (Map<String, dynamic> message) async {
|
||||
print("flutter onAliasResult: $message");
|
||||
}, onQueryTagResult: (Map<String, dynamic> message) async {
|
||||
print("flutter onQueryTagResult: $message");
|
||||
}, onWillPresentNotification: (Map<String, dynamic> message) async {
|
||||
print("flutter onWillPresentNotification: $message");
|
||||
}, onOpenSettingsForNotification: (Map<String, dynamic> message) async {
|
||||
print("flutter onOpenSettingsForNotification: $message");
|
||||
}, onGrantAuthorization: (String granted) async {
|
||||
print("flutter onGrantAuthorization: $granted");
|
||||
}, onLiveActivityResult: (Map<String, dynamic> message) async {
|
||||
print("flutter onLiveActivityResult: $message");
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> initGetuiSdk() async {
|
||||
try {
|
||||
Getuiflut.initGetuiSdk;
|
||||
} catch (e) {
|
||||
e.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getClientId() async {
|
||||
String getClientId;
|
||||
try {
|
||||
getClientId = await Getuiflut.getClientId;
|
||||
print(getClientId);
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getSdkVersion() async {
|
||||
String ver;
|
||||
try {
|
||||
ver = await Getuiflut.sdkVersion;
|
||||
print(ver);
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getLaunchNotification() async {
|
||||
Map info;
|
||||
try {
|
||||
info = await Getuiflut.getLaunchNotification;
|
||||
print(info);
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,10 +16,12 @@ class HomePage extends StatefulWidget {
|
|||
class _HomePageState extends State<HomePage> {
|
||||
bool enabled = false;
|
||||
late AMapController _mapController;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
title: const Text(
|
||||
"首页",
|
||||
style: TextStyle(color: Colors.white),
|
||||
|
@ -34,7 +36,9 @@ class _HomePageState extends State<HomePage> {
|
|||
fit: BoxFit.cover)),
|
||||
)),
|
||||
backgroundColor: const Color(0xFFF3F3F3),
|
||||
body: Padding(
|
||||
body: PopScope(
|
||||
canPop: false,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
|
@ -43,6 +47,7 @@ class _HomePageState extends State<HomePage> {
|
|||
buildBottomWidget()
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -236,7 +241,7 @@ class _HomePageState extends State<HomePage> {
|
|||
circleStrokeColor: Colors.blue,
|
||||
circleStrokeWidth: 1,
|
||||
),
|
||||
onMapCreated: (AMapController controller){
|
||||
onMapCreated: (AMapController controller) {
|
||||
setState(() {
|
||||
_mapController = controller;
|
||||
getApprovalNumber();
|
||||
|
@ -247,7 +252,7 @@ class _HomePageState extends State<HomePage> {
|
|||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 10,bottom: 10),
|
||||
margin: const EdgeInsets.only(top: 10, bottom: 10),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
|
@ -256,11 +261,14 @@ class _HomePageState extends State<HomePage> {
|
|||
Positioned(
|
||||
bottom: 20,
|
||||
right: 20,
|
||||
child: Image.asset("images/3.0x/current_location.png",width: 30,height: 30,),
|
||||
child: Image.asset(
|
||||
"images/3.0x/current_location.png",
|
||||
width: 30,
|
||||
height: 30,
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
///获取审图号
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:autosos_flutter/api/login_api.dart';
|
||||
import 'package:autosos_flutter/util/sp_util.dart';
|
||||
import 'package:autosos_flutter/util/xhttp.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -15,6 +16,7 @@ class LoginPage extends StatefulWidget {
|
|||
class _LoginPageState extends State<LoginPage> {
|
||||
final TextEditingController _unameController = TextEditingController();
|
||||
final TextEditingController _pwdController = TextEditingController();
|
||||
SPUtil spUtil = SPUtil();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
|
@ -77,7 +79,7 @@ class _LoginPageState extends State<LoginPage> {
|
|||
Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: GestureDetector(
|
||||
onTap:()=>_login(),
|
||||
onTap:()=>_login(context),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
margin: const EdgeInsets.only(top: 40),
|
||||
|
@ -99,9 +101,10 @@ class _LoginPageState extends State<LoginPage> {
|
|||
);
|
||||
}
|
||||
|
||||
void _login() async{
|
||||
void _login(BuildContext context) async{
|
||||
String username = _unameController.text;
|
||||
String password = _pwdController.text;
|
||||
LoginApi.login(1, username, password, "", "", "", "");
|
||||
String cid = spUtil.get("clientId");
|
||||
LoginApi.login(context,1, username, password, "", cid, "", "");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue