reza completed login and profile

master
RezaAshrafi77 3 years ago
parent 1d4a139246
commit f5325128b4
  1. 11
      src/AppRouter.js
  2. BIN
      src/Redux.rar
  3. 13
      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. 24
      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 = (
<Route exact path={"/"}>
{proxy.status() ? (
this.props.profile.username ? (
<Home />
) : (
<Auth page={"profile"} />
)
// this.props.profile.username ? (
// <Home />
// ) : (
// <Auth page={"profile"} />
// )
<Home />
) : (
<Auth />
)}

Binary file not shown.

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

@ -1,45 +1,7 @@
const initialState = {
loading: false,
error: null,
list: [
{
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: "",
},
],
},
],
list: new Array(),
};
export default function qr(state = initialState, action) {
let { type, data } = action;
@ -56,22 +18,7 @@ export default function qr(state = initialState, action) {
return {
...state,
loading: false,
list:
action.payload === "Zist10-13"
? [
{
type: "pdf",
title: "فایل پی دی اف ارائه درس آتشفشان",
link: "",
},
]
: [
{
type: "h1",
text: "صفحهای یافت نشد",
file: null,
},
],
list: data.content,
error: null,
};
/////////////

@ -13,6 +13,7 @@ export default function user(state = initialState, action) {
case "user/login":
case "user/register":
case "user/switchRole":
case "user/getProfile":
case "public/sendOTP":
case "user/otp/login":
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 };
case "mothers/list":
return { ...state, loading: false, mothers: data, error: null };
case "user/setProfile":
return { ...state, loading: false, error: null };
/////////////
case "loading":
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",
applicationToken: "11",
});
localStorage.setItem("refresh", "sff234r324rf423dfsdfsaf");
localStorage.setItem("userData", "srrfsadf");
}
resend = () => {

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

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

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

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

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

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

Loading…
Cancel
Save