ajuste da url query
This commit is contained in:
@@ -8,13 +8,12 @@ import 'package:universal_html/html.dart' as html;
|
|||||||
import 'models/aluno_model.dart';
|
import 'models/aluno_model.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Uri uri = Uri.parse(html.window.location.href);
|
|
||||||
cidade = uri.queryParameters['cidade']??'';
|
|
||||||
usePathUrlStrategy();
|
usePathUrlStrategy();
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
String cidade = '';
|
String cidade = '';
|
||||||
|
String urlCompleta = '';
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
const MyApp({super.key});
|
const MyApp({super.key});
|
||||||
@@ -24,10 +23,12 @@ class MyApp extends StatelessWidget {
|
|||||||
double height = MediaQuery.of(context).size.height;
|
double height = MediaQuery.of(context).size.height;
|
||||||
double width = MediaQuery.of(context).size.width;
|
double width = MediaQuery.of(context).size.width;
|
||||||
|
|
||||||
|
Uri? uri = Uri.parse(html.window.location.href);
|
||||||
|
cidade = uri.pathSegments.isNotEmpty ? uri.pathSegments.last : '';
|
||||||
|
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
title: 'CONTROLE DE ACESSO',
|
title: 'CONTROLE DE ACESSO',
|
||||||
initialRoute: '/',
|
|
||||||
onUnknownRoute: (RouteSettings settings) {
|
onUnknownRoute: (RouteSettings settings) {
|
||||||
return MaterialPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (context) => Scaffold(
|
builder: (context) => Scaffold(
|
||||||
@@ -48,10 +49,14 @@ class MyApp extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
routes: {
|
routes: {
|
||||||
'/cidade?cidade=${cidade}': (context)=> LoginScreen(cidade: cidade),
|
'/$cidade': (_)=> LoginScreen(cidade: cidade),
|
||||||
'/home':(context)=> HomeScreen(dados: ModalRoute.of(context)!.settings.arguments as List),
|
'/home':(context)=> HomeScreen(dados: ModalRoute.of(context)!.settings.arguments as List),
|
||||||
'/cadastro':(context)=>ResponsibleRegisterScreen(ModalRoute.of(context)!.settings.arguments as AlunoModel),
|
'/cadastro':(context)=>ResponsibleRegisterScreen(ModalRoute.of(context)!.settings.arguments as AlunoModel),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//http://localhost:63123/cidade?cidade=iracemapolis
|
||||||
|
//https://homol-controle-educa.rkmsistemas.com.br/cidade?cidade=iracemapolis
|
||||||
|
//https://homol-controle-educa.rkmsistemas.com.br/
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
List listCodigo = [];
|
List listCodigo = [];
|
||||||
String urlAPI = 'https://homol-controle-educa-api.rkmsistemas.com.br';
|
String urlAPI = 'https://homol-controle-educa-api.rkmsistemas.com.br';
|
||||||
int contLogo = 0;
|
int contLogo = 0;
|
||||||
String cidade = '';
|
|
||||||
|
|
||||||
carregarLista(){
|
carregarLista(){
|
||||||
for(int i=0;Cidades().listCidades.length>i;i++){
|
for(int i=0;Cidades().listCidades.length>i;i++){
|
||||||
@@ -45,10 +44,9 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
verificacao(){
|
verificacao(){
|
||||||
if(inputLogin.text.isNotEmpty){
|
if(inputLogin.text.isNotEmpty){
|
||||||
if(inputSenha.text.isNotEmpty){
|
if(inputSenha.text.isNotEmpty){
|
||||||
if(cidade!=''){
|
if(widget.cidade!=''){
|
||||||
if(listCodigo.contains(cidade.toLowerCase())){
|
if(listCodigo.contains(widget.cidade.toLowerCase())){
|
||||||
print('baseParam');
|
print('vindo da main ${widget.cidade}');
|
||||||
print(cidade);
|
|
||||||
setState(() {
|
setState(() {
|
||||||
carregando = true;
|
carregando = true;
|
||||||
});
|
});
|
||||||
@@ -72,7 +70,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAcessosMariaDB()async{
|
getAcessosMariaDB()async{
|
||||||
final url = '$urlAPI/acesso_maria?LOGIN=${inputLogin.text.toUpperCase()}&CIDADE=${cidade.toUpperCase()}';
|
final url = '$urlAPI/acesso_maria?LOGIN=${inputLogin.text.toUpperCase()}&CIDADE=${widget.cidade.toUpperCase()}';
|
||||||
print(url);
|
print(url);
|
||||||
final response = await http.get(Uri.parse(url));
|
final response = await http.get(Uri.parse(url));
|
||||||
var map = json.decode(response.body);
|
var map = json.decode(response.body);
|
||||||
@@ -99,7 +97,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
|
|
||||||
conectAPI()async{
|
conectAPI()async{
|
||||||
|
|
||||||
final url = '$urlAPI/logincontrole?NO_USERNAME=${inputLogin.text.toUpperCase()}&CIDADE=${cidade.toUpperCase()}';
|
final url = '$urlAPI/logincontrole?NO_USERNAME=${inputLogin.text.toUpperCase()}&CIDADE=${widget.cidade.toUpperCase()}';
|
||||||
print(url);
|
print(url);
|
||||||
final response = await http.get(Uri.parse(url));
|
final response = await http.get(Uri.parse(url));
|
||||||
var map = json.decode(response.body);
|
var map = json.decode(response.body);
|
||||||
@@ -110,7 +108,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
if(map['NO_USERNAME']==map['SENHA']){
|
if(map['NO_USERNAME']==map['SENHA']){
|
||||||
if(map['NO_USERNAME']==inputLogin.text.toUpperCase() && map['SENHA']==inputSenha.text.toUpperCase()){
|
if(map['NO_USERNAME']==inputLogin.text.toUpperCase() && map['SENHA']==inputSenha.text.toUpperCase()){
|
||||||
showSnackBar(context, 'Acesso validado', Colors.green);
|
showSnackBar(context, 'Acesso validado', Colors.green);
|
||||||
List dados = [cidade.toUpperCase(),inputLogin.text,urlAPI];
|
List dados = [widget.cidade.toUpperCase(),inputLogin.text,urlAPI];
|
||||||
Navigator.pushNamed(context, '/home',arguments: dados);
|
Navigator.pushNamed(context, '/home',arguments: dados);
|
||||||
}else{
|
}else{
|
||||||
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta e/ou Código incorreto', Colors.red);
|
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta e/ou Código incorreto', Colors.red);
|
||||||
@@ -118,7 +116,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
}else{
|
}else{
|
||||||
if(MainControllers().encrypt(inputSenha.text,map['SENHA']) == map['SENHA']){
|
if(MainControllers().encrypt(inputSenha.text,map['SENHA']) == map['SENHA']){
|
||||||
showSnackBar(context, 'Acesso validado', Colors.green);
|
showSnackBar(context, 'Acesso validado', Colors.green);
|
||||||
List dados = [cidade.toUpperCase(),inputLogin.text,urlAPI];
|
List dados = [widget.cidade.toUpperCase(),inputLogin.text,urlAPI];
|
||||||
Navigator.pushNamed(context, '/home',arguments: dados);
|
Navigator.pushNamed(context, '/home',arguments: dados);
|
||||||
}else{
|
}else{
|
||||||
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta e/ou Código incorreto', Colors.red);
|
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta e/ou Código incorreto', Colors.red);
|
||||||
@@ -141,10 +139,6 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
double height = MediaQuery.of(context).size.height;
|
double height = MediaQuery.of(context).size.height;
|
||||||
double width = MediaQuery.of(context).size.width;
|
double width = MediaQuery.of(context).size.width;
|
||||||
|
|
||||||
Uri uri = Uri.parse(html.window.location.href);
|
|
||||||
cidade = uri.queryParameters['cidade']!;
|
|
||||||
print(cidade);
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: PaletteColors.white,
|
backgroundColor: PaletteColors.white,
|
||||||
body: Center(
|
body: Center(
|
||||||
|
|||||||
Reference in New Issue
Block a user