reza completed login and profile

master
RezaAshrafi77 3 years ago
parent 1d4a139246
commit f5325128b4
  1. 9
      src/AppRouter.js
  2. BIN
      src/Redux.rar
  3. 11
      src/Redux/actions/qr.js
  4. 57
      src/Redux/reducers/qr.js
  5. 4
      src/Redux/reducers/user.js
  6. BIN
      src/assets/icons/qr.png
  7. 2
      src/views/Auth/Login/index.js
  8. 27
      src/views/Auth/Profile/index.js
  9. 22
      src/views/Home/Navbar/Mobile/index.js
  10. 11
      src/views/Home/Navbar/Mobile/index.scss
  11. 15
      src/views/Home/Navbar/index.js
  12. 2
      src/views/QRScan/Scanner/index.js
  13. 2
      src/views/QRScan/index.js

@ -31,11 +31,12 @@ class AppRouter extends Component {
let home = ( let home = (
<Route exact path={"/"}> <Route exact path={"/"}>
{proxy.status() ? ( {proxy.status() ? (
this.props.profile.username ? ( // this.props.profile.username ? (
// <Home />
// ) : (
// <Auth page={"profile"} />
// )
<Home /> <Home />
) : (
<Auth page={"profile"} />
)
) : ( ) : (
<Auth /> <Auth />
)} )}

Binary file not shown.

@ -5,15 +5,10 @@ const qr = {
async (dispatch) => async (dispatch) =>
await proxy.get("qr/list", data, { dispatch }), await proxy.get("qr/list", data, { dispatch }),
info: info:
// (data = {}) =>
// async (dispatch) => {
// await proxy.get("qr/info", data, { dispatch });
// },
(data = {}) => (data = {}) =>
async (dispatch) => async (dispatch) => {
dispatch({ type: "qr/info", payload: data }), await proxy.get("qr/info", data, { dispatch });
},
add: add:
(data = {}, data2 = {}) => (data = {}, data2 = {}) =>
async (dispatch) => { async (dispatch) => {

@ -1,45 +1,7 @@
const initialState = { const initialState = {
loading: false, loading: false,
error: null, error: null,
list: [ list: new Array(),
{
type: "voice",
title: "استاد رضایی:توضیح در مورد درس آتشفشان",
file: null,
},
{
type: "video",
title: "ویدئوی آزمایشی آتش فشان سرکه",
file: null,
},
{
type: "ppt",
title: "فایل پاورپوینت ارائه درس آتشفشان",
link: "",
},
{
type: "pdf",
title: "فایل پی دی اف ارائه درس آتشفشان",
link: "",
},
{
type: "links",
links: [
{
title: "وبسایت آموزشی دانوین",
link: "",
},
{
title: "وبسایت رسمی مدیریت راهبردی کشور",
link: "",
},
{
title: "سازمان تبلیغات صنایع سبک",
link: "",
},
],
},
],
}; };
export default function qr(state = initialState, action) { export default function qr(state = initialState, action) {
let { type, data } = action; let { type, data } = action;
@ -56,22 +18,7 @@ export default function qr(state = initialState, action) {
return { return {
...state, ...state,
loading: false, loading: false,
list: list: data.content,
action.payload === "Zist10-13"
? [
{
type: "pdf",
title: "فایل پی دی اف ارائه درس آتشفشان",
link: "",
},
]
: [
{
type: "h1",
text: "صفحهای یافت نشد",
file: null,
},
],
error: null, error: null,
}; };
///////////// /////////////

@ -13,6 +13,7 @@ export default function user(state = initialState, action) {
case "user/login": case "user/login":
case "user/register": case "user/register":
case "user/switchRole": case "user/switchRole":
case "user/getProfile":
case "public/sendOTP": case "public/sendOTP":
case "user/otp/login": case "user/otp/login":
return { ...state, loading: false, status: data, error: null }; return { ...state, loading: false, status: data, error: null };
@ -26,7 +27,8 @@ export default function user(state = initialState, action) {
return { ...state, loading: false, domains: data, error: null }; return { ...state, loading: false, domains: data, error: null };
case "mothers/list": case "mothers/list":
return { ...state, loading: false, mothers: data, error: null }; return { ...state, loading: false, mothers: data, error: null };
case "user/setProfile":
return { ...state, loading: false, error: null };
///////////// /////////////
case "loading": case "loading":
return { ...state, loading: true }; return { ...state, loading: true };

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -26,8 +26,6 @@ class Login extends Component {
userToken: "1", userToken: "1",
applicationToken: "11", applicationToken: "11",
}); });
localStorage.setItem("refresh", "sff234r324rf423dfsdfsaf");
localStorage.setItem("userData", "srrfsadf");
} }
resend = () => { resend = () => {

@ -36,10 +36,12 @@ class Profile extends Component {
password: "", password: "",
username: "", username: "",
address: "", address: "",
email: "",
gender: "", gender: "",
userRoleId: "معلم", userRoleId: "معلم",
nationalId: "", nationalId: "",
provinceId: "", provinceId: "",
phone: "",
cityId: "", cityId: "",
zoneId: "", zoneId: "",
schoolId: "", schoolId: "",
@ -66,21 +68,34 @@ class Profile extends Component {
componentDidMount() { componentDidMount() {
const { getProfile, profile } = this.props; const { getProfile, profile } = this.props;
// getProfile();
getProfile();
} }
onSubmit = (e) => { onSubmit = async (e) => {
e.preventDefault(); const {
const { firstName, lastName, username, cellphone } = this.state; firstName,
lastName,
username,
cellphone,
password,
postalCode,
address,
email,
phone,
} = this.state;
const { profile, setProfile } = this.props; const { profile, setProfile } = this.props;
const data = { const data = {
firstName: firstName || profile.firstName, firstName: firstName || profile.firstName,
lastName: lastName || profile.lastName, lastName: lastName || profile.lastName,
username: username || profile.username, username: username || profile.username,
cellphone: profile.cellphone, cellphone: profile.cellphone,
password: password || profile.password,
postalCode: postalCode || profile.postalCode,
address: address || profile.address,
email: email || profile.email,
phone: phone || profile.phone,
}; };
setProfile(data); await setProfile(data);
}; };
render() { render() {

@ -1,10 +1,13 @@
import React, { useState, Component } from "react"; import React, { useState, Component } from "react";
import { Link } from "react-router-dom";
import { makeStyles } from "@material-ui/core/styles"; import { makeStyles } from "@material-ui/core/styles";
import { SwipeableDrawer } from "@material-ui/core"; import { SwipeableDrawer } from "@material-ui/core";
import NavbarDrawer from "./NavbarDrawer/NavbarDrawer.js"; import NavbarDrawer from "./NavbarDrawer/NavbarDrawer.js";
import clsx from "clsx"; import clsx from "clsx";
import logo from "../../../../assets/icons/logoMobile.png"; import logo from "../../../../assets/icons/logoMobile.png";
import ar from "../../../../assets/icons/ar.png";
import qr from "../../../../assets/icons/qr.png";
import hamburger from "../../../../assets/icons/hamburger.png"; import hamburger from "../../../../assets/icons/hamburger.png";
import search from "../../../../assets/icons/navbarSearch.png"; import search from "../../../../assets/icons/navbarSearch.png";
@ -30,6 +33,7 @@ export default function MobileNavbar(props) {
right: false, right: false,
searchFlag: false, searchFlag: false,
}); });
const { page } = props;
const toggleDrawer = (anchor, open) => (event) => { const toggleDrawer = (anchor, open) => (event) => {
if ( if (
@ -49,7 +53,6 @@ export default function MobileNavbar(props) {
[classes.fullList]: anchor === "top" || anchor === "bottom", [classes.fullList]: anchor === "top" || anchor === "bottom",
})} })}
role="presentation" role="presentation"
> >
<NavbarDrawer <NavbarDrawer
setShare={props.setShare} setShare={props.setShare}
@ -67,11 +70,26 @@ export default function MobileNavbar(props) {
> >
<img src={hamburger} alt="منو" /> <img src={hamburger} alt="منو" />
</div> </div>
<div className="mobile-navbar__logo"> <div
className="mobile-navbar__logo"
style={{ transform: page !== "home" ? "translateX(-29px)" : "none" }}
>
<img src={logo} alt="لوگو" /> <img src={logo} alt="لوگو" />
</div> </div>
<div className="mobile-navbar__left"> <div className="mobile-navbar__left">
{page === "home" ? (
<img src={search} alt="جستجو" /> <img src={search} alt="جستجو" />
) : (
<div className="d-flex align-items-center">
<img src={search} alt="جستجو" />
<Link to={"/qr-scan"}>
<img src={qr} alt="QR" />
</Link>
<Link to={"/ar"}>
<img src={ar} alt="AR" />
</Link>
</div>
)}
</div> </div>
<SwipeableDrawer <SwipeableDrawer
anchor="right" anchor="right"

@ -7,20 +7,23 @@
align-items: center; align-items: center;
background-color: white; background-color: white;
z-index: 400; z-index: 400;
padding: 15px 10px; padding: 10px 10px;
&__menu { &__menu {
justify-self: flex-start;
img { img {
width: 25px; width: 26px;
} }
} }
&__logo { &__logo {
img { img {
width: 80px; width: 85px;
} }
} }
&__left { &__left {
justify-self: flex-end;
img { img {
width: 25px; width: 24px;
margin-right: 8px;
} }
} }
} }

@ -1,17 +1,18 @@
import React, { Component } from "react"; import React, { Component } from "react";
import LaptopNavbar from './Laptop/index'; import LaptopNavbar from "./Laptop/index";
import MobileNavbar from './Mobile/index'; import MobileNavbar from "./Mobile/index";
import './index.scss'; import "./index.scss";
export default class Navbar extends Component { export default class Navbar extends Component {
render() { render() {
return ( return (
<div className="navbar d-flex"> <div className="navbar d-flex">
{ {window.innerWidth > 1000 ? (
window.innerWidth > 1000 ? <LaptopNavbar page={this.props.page} />
<LaptopNavbar page={this.props.page} /> : <MobileNavbar /> ) : (
} <MobileNavbar page={this.props.page} />
)}
</div> </div>
); );
} }

@ -30,7 +30,7 @@ export default class Scanner extends Component {
delay={300} delay={300}
onError={this.handleError} onError={this.handleError}
onScan={this.handleScan} onScan={this.handleScan}
style={{ width: "100%", maxWidth: 300 }} style={{ width: "100%" }}
facingMode={facingMode[this.props.parent.state.facingMode]} facingMode={facingMode[this.props.parent.state.facingMode]}
/> />
) : null} ) : null}

@ -38,7 +38,7 @@ class QRScan extends Component {
this.state.value.lastIndexOf("/") + 1, this.state.value.lastIndexOf("/") + 1,
this.state.value.length this.state.value.length
); );
this.props.info(tail); this.props.info({ tail: tail });
console.log(this.props.list, tail); console.log(this.props.list, tail);
this.setState({ value: null, tail: tail }); this.setState({ value: null, tail: tail });
} }

Loading…
Cancel
Save