This commit is contained in:
dangj501 2024-05-06 08:16:04 -06:00
commit f1d3edf2f7
21 changed files with 678 additions and 120 deletions

View File

@ -11,13 +11,14 @@ drop table alumno;
create table alumno( create table alumno(
id integer auto_increment primary key, id integer auto_increment primary key,
nombre varchar(40), nombre varchar(40),
apellidos varchar(100), apellido varchar(100),
fecha_nacimiento date, fecha_nacimiento date,
nacionalidad varchar(40), nacionalidad varchar(40),
tipoSangre varchar(40), tipoSangre varchar(40),
matricula varchar(40), matricula varchar(40),
contraseña varchar(40) contrasena varchar(40),
); )
drop table examen; drop table examen;
create table examen( create table examen(

View File

@ -2,27 +2,63 @@ package mx.uv;
import static spark.Spark.*; import static spark.Spark.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.UUID;
import com.google.gson.*; import com.google.gson.*;
import mx.uv.Controller.DAO;
import mx.uv.Model.*;
public class App public class App
{ {
static Gson gson = new Gson();
static HashMap<String, Alumno> usuarios = new HashMap<>();
public static void main( String[] args ) public static void main( String[] args )
{ {
System.out.println( "Hello World!" ); //fuente:https://gist.github.com/saeidzebardast/e375b7d17be3e0f4dddf
//port(80); options("/*",(request,response)->{
String accessControlRequestHeaders=request.headers("Access-Control-Request-Headers");
if(accessControlRequestHeaders!=null){
response.header("Access-Control-Allow-Headers",accessControlRequestHeaders);
}
String accessControlRequestMethod=request.headers("Access-Control-Request-Method");
if(accessControlRequestMethod!=null){
response.header("Access-Control-Allow-Methods",accessControlRequestMethod);
}
return "OK";
});
get("/usuarios", (request, response) ->{ before((request,response)->response.header("Access-Control-Allow-Origin","*"));
get("/TodosLosAlumnos", (request, response) ->{
response.type("application/json"); response.type("application/json");
JsonObject respuesta = new JsonObject(); return gson.toJson(DAO.dameUsuarios());
respuesta.addProperty("msj", "hola");
return respuesta;
}); });
post("/usuarios", (request, response) ->{ post("/agregarAlumno", (request, response) ->{
String payload = request.body(); String payload = request.body();
Alumno alumno = gson.fromJson(payload, Alumno.class);
boolean msj = DAO.agregarAlumno(new Alumno("Pedro","Lazaro","Mexicano","SAKHBD197", "PezGato"));
JsonObject respuesta = new JsonObject(); JsonObject respuesta = new JsonObject();
respuesta.addProperty("msj", ""); respuesta.addProperty("msj", msj);
return respuesta; return respuesta;
}); });
put("/EditarAlumno", (request, response) ->{
String payload = request.body();
Alumno alumno = gson.fromJson(payload, Alumno.class);
boolean verificado = DAO.editarAlumno(alumno);
JsonObject respuesta = new JsonObject();
respuesta.addProperty("existe", verificado);
return respuesta;
});
delete("/EliminarAlumno", (request, response) ->{
String payload = request.body();
Alumno alumno = gson.fromJson(payload, Alumno.class);
boolean verificado = DAO.eliminarAlumno(alumno);
JsonObject respuesta = new JsonObject();
respuesta.addProperty("existe", verificado);
return respuesta;
});
} }
} }

View File

@ -0,0 +1,56 @@
package mx.uv.Controller;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Logger;
public class Conexion {
private static Connection conexion;
private static Conexion instancia;
private static final String url = "jdbc:mysql://localhost:3306/universidad";
private static final String user = "root";
private static final String password = "Perro16tonto";
private static final Logger logger = Logger.getLogger(Conexion.class.getName());
private Conexion() {}
public static Conexion getInstance() {
if (instancia == null) {
synchronized (Conexion.class) {
if (instancia == null) {
instancia = new Conexion();
}
}
}
return instancia;
}
public Connection conectar() {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
conexion = DriverManager.getConnection(url, user, password);
if (conexion != null) {
logger.info("Conexión exitosa");
return conexion;
} else {
logger.severe("ERROR: No se pudo conectar");
}
} catch (Exception e) {
logger.severe("ERROR: " + e.getMessage());
}
return null;
}
public void cerrarConexion() {
try {
if (conexion != null && !conexion.isClosed()) {
conexion.close();
logger.info("Se desconectó de la base de datos");
}
} catch (SQLException e) {
logger.severe("ERROR: " + e.getMessage());
}
}
}

View File

@ -0,0 +1,124 @@
package mx.uv.Controller;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import mx.uv.Model.Alumno;
public class DAO {
private static Conexion cn = Conexion.getInstance();
public static List<Alumno> dameUsuarios() {
Statement stm = null;
ResultSet rs = null;
Connection conn = null;
List<Alumno> resultado = new ArrayList<>();
conn = cn.conectar();
try {
String sql = "SELECT * from alumno";
stm = conn.createStatement();
rs = stm.executeQuery(sql);
while (rs.next()) {
Alumno u = new Alumno(rs.getInt(1), rs.getString(2), rs.getString(3),rs.getString(4), rs.getString(5),rs.getString(6),rs.getString(7),rs.getString(8));
resultado.add(u);
}
} catch (Exception e) {
System.out.println(e);
} finally {
cerrarConexiones(null, conn);
}
return resultado;
}
public static boolean validarAlumno(Alumno alumno) {
Statement stm = null;
Connection conn = null;
boolean verificacion =false;
ResultSet rs = null;
conn = cn.conectar();
try {
String sql ="select * from usuarios "
+ "where matricula= '"+alumno.getMatricula()+"' and contrasena='"+alumno.getContrasena()+"'";
stm = (Statement) conn.createStatement();
rs = stm.executeQuery(sql);
if(rs.next()){
verificacion = true;
}else{
verificacion = false;
}
conn.close();
} catch (SQLException ex) {
System.err.println(ex);
}
return verificacion;
}
public static boolean agregarAlumno(Alumno alumno) {
PreparedStatement stm = null;
Connection conn = null;
boolean msj= false;
conn = cn.conectar();
try {
String sql = "INSERT INTO `alumno`(`nombre`,`apellido`,`nacionalidad`,`matricula`,`contrasena`)VALUES(?,?,?,?,?);";
stm = (PreparedStatement) conn.prepareStatement(sql);
stm.setString(1, alumno.getNombre());
stm.setString(2, alumno.getApellido());
stm.setString(3, alumno.getNacionalidad());
stm.setString(4, alumno.getMatricula());
stm.setString(5, alumno.getContrasena());
if (stm.executeUpdate() > 0)
msj = true;
else
msj = false;
} catch (Exception e) {
System.out.println(e);
} finally {
cerrarConexiones(stm,conn);
}
return msj;
}
private static void cerrarConexiones(PreparedStatement stm,Connection conn) {
if (stm != null) {
try {
stm.close();
} catch (Exception e) {
System.out.println(e);
}
stm = null;
}
try {
conn.close();
cn.cerrarConexion();
} catch (Exception e) {
System.out.println(e);
}
}
public static boolean eliminarAlumno(Alumno alumno) {
return false;
}
public static boolean editarAlumno(Alumno alumno) {
PreparedStatement stm = null;
Connection conn = null;
boolean verificacion =false;
conn = cn.conectar();
try {
String sql ="UPDATE `producto` SET `nombreProducto` = '"+p.getNombreProducto()+"',`precio` = '"+p.getPrecio()+"',`cantidad` = '"+p.getCantidad()+"',`imagen` = '"+p.getImagen()+"'WHERE `id` = '"+p.getId()+"';";
stm = conn.prepareStatement(sql);
stm.executeUpdate();
verificacion = true;
conn.close();
} catch (SQLException ex) {
System.err.println(ex);
}finally{
actualizarVenta(p);
}
return verificacion;
}
}

View File

@ -1,3 +1,5 @@
package mx.uv.Model;
public class Administrador { public class Administrador {
private int id; private int id;
private String matricula; private String matricula;

View File

@ -1,4 +1,4 @@
package model; package mx.uv.Model;
// * Clase Alumno que servira para comunicarse con el controlador. // * Clase Alumno que servira para comunicarse con el controlador.
public class Alumno { public class Alumno {
private int id; private int id;
@ -25,23 +25,21 @@ public class Alumno {
public Alumno() { public Alumno() {
} }
public Alumno(int id, String nombre, String apellido, String nacionalidad) { public Alumno(String nombre, String apellido, String nacionalidad, String matricula, String contrasena) {
this.id = id;
this.nombre = nombre; this.nombre = nombre;
this.apellido = apellido; this.apellido = apellido;
this.nacionalidad = nacionalidad; this.nacionalidad = nacionalidad;
}
public Alumno(int id, String matricula, String contrasena) {
this.id = id;
this.matricula = matricula; this.matricula = matricula;
this.contrasena = contrasena; this.contrasena = contrasena;
} }
public Alumno(String matricula, String contrasena) { public Alumno(String matricula, String contrasena) {
this.matricula = matricula; this.matricula = matricula;
this.contrasena = contrasena; this.contrasena = contrasena;
} }
public void setId(int id) { public void setId(int id) {
this.id = id; this.id = id;
} }

View File

@ -1,3 +1,4 @@
package mx.uv.Model;
public class Tutor { public class Tutor {
private int id; private int id;
private String nombre; private String nombre;

BIN
frontend/imagen.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -4,19 +4,11 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<<<<<<< HEAD
<title>Registro</title> <title>Registro</title>
=======
<title>SIU_Dran_net</title>
>>>>>>> 48e69d3c4957e0bdf3d622c1408a569a14d5a80c
</head> </head>
<body> <body>
<div id="root"></div>
<div id="root">
</div>
<DIV></DIV> <DIV></DIV>
<script type="module" src="/src/main.jsx"></script> <script type="module" src="/src/main.jsx"></script>
</body> </body>
</html> </html>

BIN
frontend/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -8,8 +8,10 @@
"name": "frontend", "name": "frontend",
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"axios": "^1.6.8",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0" "react-dom": "^18.2.0",
"react-dropzone": "^14.2.3"
}, },
"devDependencies": { "devDependencies": {
"@types/react": "^18.2.66", "@types/react": "^18.2.66",
@ -1435,6 +1437,19 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/attr-accept": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/attr-accept/-/attr-accept-2.2.2.tgz",
"integrity": "sha512-7prDjvt9HmqiZ0cl5CRjtS84sEyhsHP2coDkaZKRKVfCDo9s7iw7ChVmar78Gu9pC4SoR/28wFu/G5JJhTnqEg==",
"engines": {
"node": ">=4"
}
},
"node_modules/available-typed-arrays": { "node_modules/available-typed-arrays": {
"version": "1.0.7", "version": "1.0.7",
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz",
@ -1450,6 +1465,16 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/axios": {
"version": "1.6.8",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz",
"integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==",
"dependencies": {
"follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/balanced-match": { "node_modules/balanced-match": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@ -1575,6 +1600,17 @@
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
"dev": true "dev": true
}, },
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/concat-map": { "node_modules/concat-map": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@ -1715,6 +1751,14 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/doctrine": { "node_modules/doctrine": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
@ -2290,6 +2334,17 @@
"node": "^10.12.0 || >=12.0.0" "node": "^10.12.0 || >=12.0.0"
} }
}, },
"node_modules/file-selector": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/file-selector/-/file-selector-0.6.0.tgz",
"integrity": "sha512-QlZ5yJC0VxHxQQsQhXvBaC7VRJ2uaxTf+Tfpu4Z/OcVQJVpZO+DGU0rkoVW5ce2SccxugvpBJoMvUs59iILYdw==",
"dependencies": {
"tslib": "^2.4.0"
},
"engines": {
"node": ">= 12"
}
},
"node_modules/find-up": { "node_modules/find-up": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
@ -2326,6 +2381,25 @@
"integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==",
"dev": true "dev": true
}, },
"node_modules/follow-redirects": {
"version": "1.15.6",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/for-each": { "node_modules/for-each": {
"version": "0.3.3", "version": "0.3.3",
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
@ -2335,6 +2409,19 @@
"is-callable": "^1.1.3" "is-callable": "^1.1.3"
} }
}, },
"node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/fs.realpath": { "node_modules/fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@ -3154,6 +3241,25 @@
"yallist": "^3.0.2" "yallist": "^3.0.2"
} }
}, },
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/minimatch": { "node_modules/minimatch": {
"version": "3.1.2", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@ -3206,7 +3312,6 @@
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
"dev": true,
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
} }
@ -3470,13 +3575,17 @@
"version": "15.8.1", "version": "15.8.1",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
"integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",
"dev": true,
"dependencies": { "dependencies": {
"loose-envify": "^1.4.0", "loose-envify": "^1.4.0",
"object-assign": "^4.1.1", "object-assign": "^4.1.1",
"react-is": "^16.13.1" "react-is": "^16.13.1"
} }
}, },
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"node_modules/punycode": { "node_modules/punycode": {
"version": "2.3.1", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
@ -3529,11 +3638,26 @@
"react": "^18.2.0" "react": "^18.2.0"
} }
}, },
"node_modules/react-dropzone": {
"version": "14.2.3",
"resolved": "https://registry.npmjs.org/react-dropzone/-/react-dropzone-14.2.3.tgz",
"integrity": "sha512-O3om8I+PkFKbxCukfIR3QAGftYXDZfOE2N1mr/7qebQJHs7U+/RSL/9xomJNpRg9kM5h9soQSdf0Gc7OHF5Fug==",
"dependencies": {
"attr-accept": "^2.2.2",
"file-selector": "^0.6.0",
"prop-types": "^15.8.1"
},
"engines": {
"node": ">= 10.13"
},
"peerDependencies": {
"react": ">= 16.8 || 18.0.0"
}
},
"node_modules/react-is": { "node_modules/react-is": {
"version": "16.13.1", "version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
"dev": true
}, },
"node_modules/react-refresh": { "node_modules/react-refresh": {
"version": "0.14.0", "version": "0.14.0",
@ -3962,6 +4086,11 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/tslib": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
},
"node_modules/type-check": { "node_modules/type-check": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",

View File

@ -10,8 +10,10 @@
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"axios": "^1.6.8",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0" "react-dom": "^18.2.0",
"react-dropzone": "^14.2.3"
}, },
"devDependencies": { "devDependencies": {
"@types/react": "^18.2.66", "@types/react": "^18.2.66",

View File

@ -1,42 +0,0 @@
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'
import './login.css'
function App() {
//const [count, setCount] = useState(0)
const [usuario, setUsuario]= useState("")
const [password, setPassword]= useState("")
return (
<>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.jsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
</>
)
}
export default App

View File

@ -0,0 +1,69 @@
h1.tituloOE{
color: rgba(36, 15, 103, 0.922);
text-transform: capitalize;
padding-inline:initial;
margin-top:15%;
}
header.headerOE{
display: inline;
width: 100%;
height: 18%;
}
div.grupo1{
background-color: #D5EEBB;
padding: 0%;
}
#logo{
width: 70px;
height:min-content;
}
div.grupo2{
background-color: #D5EEBB;
margin-top: 10px;
margin-left: 10px;
text-align: left;
}
li.tit{
background-color: #D5EEBB;
color:rgba(36, 15, 103, 0.922);
font-size: 120%;
}
nav ul {
list-style-type: none;
background-color:#D5EEBB;
}
nav ul li {
display: inline;
margin-right: 80px;
}
li a{
background-color: #D5EEBB;
color:rgb(172, 104, 9);
}
.container{
display: grid;
grid-template-columns: auto auto auto auto;
gap: 10%;
justify-content: center; /* Centra horizontalmente el contenedor */
align-items: center; /* Ajusta el ancho del contenedor según sea necesario */
}
div.area{
color:rgb(27, 97, 154);
border: 1px solid rgb(27, 97, 154);
font-size: x-large;
}
div.listaLic{
color: rgb(172, 104, 9);
}
.footerOE{
font-size:large;
padding: 20px 0; /* Espaciado interno del footer */
position:fixed; /* Hace que el footer sea fijo en la parte inferior */
width: 100%;
font-weight: bold;
}

View File

@ -0,0 +1,74 @@
import './OfertaEducativa.css'
function OfertaEducativa (){
return (
<>
<body>
<header className='headerOE'>
<nav>
<ul>
<div className='grupo1'>
<img id='logo' src="logo.png" alt='Imagen'/>
<li className='tit'>Universidad Filadelfia de México</li>
</div>
<div className='grupo2'>
<li><a href="">Nosotros</a></li>
<li><a href="">Visión</a></li>
<li><a href="">Misión</a></li>
<li><a href="">Instalaciones</a></li>
</div>
</ul>
</nav>
</header>
<h1 className='tituloOE'>Oferta Educativa</h1>
<div className='container'>
<div className='area'>
Área Técnica
<div className='listaLic'>
<ul>
<li>Licenciatura en Matemáticas</li>
<li>Licenciatura en Física</li>
<li>Licenciatura en Arquitectura</li>
</ul>
</div>
</div>
<div className='area'>
Área Económico-Administrativo
<div className='listaLic'>
<ul>
<li>Licenciatura en Contabilidad</li>
<li>Licenciatura en Economía</li>
<li>Licenciatura en Administración</li>
</ul>
</div>
</div>
<div className='area'>
Área de Humanidades
<div className='listaLic'>
<ul>
<li>Licenciatura en historia</li>
<li>Licenciatura en Antropología</li>
<li>Licenciatura en Pedagogía</li>
</ul>
</div>
</div>
<div className='area'>
Área de Biológicas y Agropecuarias
<div className='listaLic'>
<ul>
<li>Licenciatura en Biología</li>
<li>Ingeniería Química</li>
<li>Ingeniero Agrónomo</li>
</ul>
</div>
</div>
</div>
<footer className='footerOE'>
© 2024 Universidad Filadelfia. Todos los derechos reservados
</footer>
</body>
</>
);
}
export default OfertaEducativa

View File

@ -0,0 +1,13 @@
import SubirPDF from "./SubirPDF";
import React from 'react';
const App = () => {
return (
<div>
<h1>Subir archivo PDF</h1>
<SubirPDF />
</div>
);
};
export default App;

36
frontend/src/SubirPDF.jsx Normal file
View File

@ -0,0 +1,36 @@
import React, { useCallback } from 'react';
import { useDropzone } from 'react-dropzone';
import axios from 'axios';
const SubirPDF = () => {
const onDrop = useCallback(acceptedFiles => {
const file = acceptedFiles[0];
const formData = new FormData();
formData.append('pdfFile', file);
axios.post('http://localhost:${port}', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
})
.then(response => {
// Manejar la respuesta del servidor
console.log(response.data);
})
.catch(error => {
// Manejar errores
console.error('Error al subir el archivo:', error);
});
}, []);
const { getRootProps, getInputProps } = useDropzone({ onDrop });
return (
<div {...getRootProps()} style={{ border: '1px solid black', padding: '20px', textAlign: 'center' }}>
<input {...getInputProps()} />
<p>Arrastra y suelta un archivo PDF aquí, o haz clic para seleccionar uno</p>
</div>
);
};
export default SubirPDF;

View File

@ -1,10 +1,19 @@
* { * {
background-color: #444941; background-color:#d8d8d8;
padding: 0;
margin: 10;
box-sizing: border-box; box-sizing: border-box;
font-family:Arial, Helvetica, sans-serif; flex-direction: column;
} }
.gridContainer {
display: grid;
grid-template-columns: 1fr 1fr; /* Dos columnas de ancho igual */
gap: 50px; /* Espacio entre las columnas */
}
.imgColum {
margin-top: auto;
}
.Formulario { .Formulario {
font-size: 20px; font-size: 20px;
@ -18,35 +27,87 @@ input[type="text"], input[type="password"]{
/* align-items: center; */ /* align-items: center; */
border-radius: 5px; border-radius: 5px;
display: block; display: block;
height: 30px; height: 40px;
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
font-size: large;
} }
header {
color: rgba(36, 15, 103, 0.922);
background-color: #D5EEBB;
padding: 20px 0; /* Espaciado interno del encabezado */
position: fixed; /* Hace que el encabezado sea fijo */
width: 100%; /* Ancho completo del encabezado */
top: 0; /* Lo posiciona en la parte superior */
z-index: 1000; /* Asegura que esté por encima del contenido */
font-weight:bold;
font-size: x-large;
}
font{
background-color: transparent;
}
/*#Formulario{
min-height: 89vh;
}*/
form{
margin-left: auto;
}
h1{ h1{
color: #D5EEBB; color: rgb(172, 104, 9);
font-family: Jockey One; font-family: Jockey One;
text-transform: capitalize;
margin-top: 30%;
padding-left: 30%;
} }
#button{ #button{
background-color: #D5EEBB; background-color: #D5EEBB;
margin-top: 20px; color:rgba(36, 15, 103, 0.922);
margin-top: 30px;
stroke: none; stroke: none;
font-family: Georgia, 'Times New Roman', Times, serif; font-family: Georgia, 'Times New Roman', Times, serif;
font-weight: bold; font-weight: bold;
padding-top: 100px; text-align: center;
padding: 5px; padding: 5px 5px 5px 5px;
height: fit-content;
font-size: x-large;
} }
label{ label{
color: #D5EEBBAA; color: rgb(172, 104, 9);
font-family: JejuMyeongjo; font-family: JejuMyeongjo;
font-size: 20px; font-size: 40px;
font-weight: 400; font-weight: 400;
text-align: left; text-align: left;
} }
.footer{ footer{
color: aliceblue; color: #000000;
background-color: #D5EEBB;
padding: 20px 0; /* Espaciado interno del footer */
position: absolute; /* Hace que el footer sea fijo en la parte inferior */
width: 100%; /* Ancho completo del footer */
bottom: 0; /* Lo posiciona en la parte inferior */
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
}
#footerId{
margin-left: 15px;
margin-right: 15px;
text-align: center;
font-size: large;
background-color: transparent;
font-weight: bold;
}
div a{
background-color: #D5EEBB;
color:rgb(172, 104, 9);
font-weight: bold;
} }

View File

@ -1,34 +1,35 @@
import { useState } from 'react'
import './login.css' import './login.css'
function Login() { function Login() {
return (
return ( <>
<> <body>
<header>La universidad que esta para ti, ¡UNETE!</header> <header className='encabezado'>La universidad que esta para ti, ¡UNETE!</header>
<div> <div className='gridContainer'>
<div className='imgColum'>
<h1>Bienvenido</h1> <img src="imagen.jpg" alt='Imagen'/>
<form className='Formulario'> </div>
<div className='loginColum'>
<label id='usuario'>Usuario:</label> <h1>Bienvenido</h1>
<input type='text' id='usuario'/> <form className='Formulario'>
<label>Contraseña:</label> <label id='usuario'>Usuario:</label>
<input type="password" id='password'/> <input type='text' id='usuario'/>
<button id='button'>Iniciar sesion</button> <label>Contraseña:</label>
<input type="password" id='password'/>
</form> <button id='button' >Iniciar sesion</button>
</form>
</div>
</div> </div>
<footer> <footer>
<nav> <div id="footerId"><a href=''>uniregistro@outlook.com</a></div>
<ul className='footer'> <div id="footerId"><a href=''>uniBandeVer</a></div>
<li>uniregistro@outlook.com</li> <div id="footerId"><a href=''>4582349234</a></div>
<li>uniBandeVer 4582349234</li> </footer>
</ul> </body>
</nav> </>
</footer> );
</>
);
} }
export default Login export default Login

View File

@ -1,11 +1,16 @@
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom/client' import ReactDOM from 'react-dom/client'
import OfertaEducativa from './OfertaEducativa.jsx'
import Preinscripcion from './Preinscripcion.jsx'
import SubirPDF from './SubirPDF.jsx'
import General from './General.jsx' import General from './General.jsx'
import './Registro.css' import './Registro.css'
import './login.css';
ReactDOM.createRoot(document.getElementById('root')).render( ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode> <React.StrictMode>
<General/> <OfertaEducativa/>
</React.StrictMode>, </React.StrictMode>,
) )