reza fixed qr

master
RezaAshrafi77 3 years ago
parent f5325128b4
commit 250ab86004
  1. 12
      src/AppRouter.js
  2. 2
      src/Redux/reducers/qr.js
  3. 22
      src/components/Loader/index.js
  4. 3
      src/views/Auth/Profile/Input/index.js
  5. 51
      src/views/Auth/Profile/index.js
  6. 4
      src/views/Home/index.js
  7. 15
      src/views/QR/index.js
  8. 11
      src/views/QR/index.scss

@ -31,13 +31,13 @@ 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 />
)}
</Route>
@ -102,7 +102,7 @@ class AppRouter extends Component {
export default connect(
(state) => ({
profile: state.user.status.profile || {},
profile: state.user.status || state.user.status.profile || {},
// status: state.user.status,
}),
{}

@ -18,7 +18,7 @@ export default function qr(state = initialState, action) {
return {
...state,
loading: false,
list: data.content,
list: data,
error: null,
};
/////////////

@ -0,0 +1,22 @@
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import CircularProgress from "@material-ui/core/CircularProgress";
const useStyles = makeStyles((theme) => ({
root: {
display: "flex",
"& > * + *": {
marginLeft: theme.spacing(2),
},
},
}));
export default function CircularIndeterminate() {
const classes = useStyles();
return (
<div className={classes.root}>
<CircularProgress />
</div>
);
}

@ -19,6 +19,7 @@ export default function FormPropsTextFields(props) {
const classes = useStyles();
const { parent, defaultValue } = props;
console.log(defaultValue[props.name]);
return (
<form className={classes.root} noValidate autoComplete="off">
<div>
@ -28,7 +29,7 @@ export default function FormPropsTextFields(props) {
label={props.label}
variant="outlined"
onChange={(e) => parent.onChange(e.target.name, e.target.value)}
defaultValue={defaultValue}
defaultValue={defaultValue[props.name]}
/>
</div>
</form>

@ -9,6 +9,7 @@ import Upload from "./Upload/index";
import Gender from "./GenderSwitch/index";
import Birthdate from "./Birthdate/index";
import MultipleSelector from "./MultipleSelector/index";
import Loader from "~/components/Loader/index";
import logo from "../../../assets/icons/logo.png";
import pic from "../../../assets/images/pic.png";
@ -30,6 +31,7 @@ const fontSize = {
};
class Profile extends Component {
state = {
render: false,
file: null,
firstName: "",
lastName: "",
@ -66,9 +68,17 @@ class Profile extends Component {
}
};
componentDidMount() {
async componentDidMount() {
const { getProfile, profile } = this.props;
// getProfile();
getProfile();
}
componentDidUpdate(prevProps) {
if (prevProps.profile !== this.props.profile) {
this.setState({
render: true,
});
}
}
onSubmit = async (e) => {
@ -103,6 +113,7 @@ class Profile extends Component {
return (
<>
{window.innerWidth > 1000 ? (
!this.props.loading ? (
<div className="auth-profile d-flex justify-content-center">
<div className="auth-profile__box d-flex flex-column p-4">
<h1 style={{ fontSize: fontSize.desktop.h1 }}>حساب کاربری</h1>
@ -295,8 +306,12 @@ class Profile extends Component {
</form>
</div>
</div>
) : (
<Loader />
)
) : null}
{window.innerWidth < 1000 ? (
!this.props.loading ? (
<div className="mobile-auth-profile d-flex flex-column">
<img src={logo} alt="دانوین" />
<h1 style={{ fontSize: fontSize.mobile.h1 }}>حساب کاربری</h1>
@ -308,19 +323,20 @@ class Profile extends Component {
name="firstName"
label="نام"
parent={this}
defaultValue={profile.firstName}
defaultValue={profile}
/>
<Input
name="lastName"
label="نام خانوادگی"
parent={this}
defaultValue={profile.lastName}
defaultValue={profile}
/>
<Input
name="username"
label="نام کاربری"
parent={this}
align="left"
defaultValue={profile}
/>
<Gender
options={["دختر", "پسر"]}
@ -333,6 +349,7 @@ class Profile extends Component {
label="کد ملی"
parent={this}
align="left"
defaultValue={profile}
/>
<Birthdate />
<Gender
@ -421,22 +438,41 @@ class Profile extends Component {
label={"شهر/روستا"}
/>
{this.state.userRoleId === "دانش آموز" ? (
<Input parent={this} name="schoolId" label={"نام مدرسه"} />
<Input
parent={this}
name="schoolId"
label={"نام مدرسه"}
defaultValue={profile}
/>
) : null}
{this.state.userRoleId === "معلم" ? (
<Input parent={this} name="schoolId" label={"محل تدریس"} />
<Input
parent={this}
name="schoolId"
label={"محل تدریس"}
defaultValue={profile}
/>
) : null}
<Input
parent={this}
name="postalCode"
label={"کد پستی"}
align="left"
defaultValue={profile}
/>
<TextArea parent={this} label={"آدرس محل سکونت"} name="address" />
<div className="mobile-auth-profile__footer d-flex justify-content-center">
<button onClick={() => this.onSubmit()}>ذخیره</button>
</div>
</div>
) : (
<div
className="d-flex justify-content-center align-items-center"
style={{ height: "100vh", width: "100vw" }}
>
<Loader />
</div>
)
) : null}
</>
);
@ -445,7 +481,8 @@ class Profile extends Component {
export default connect(
(state) => ({
profile: state.user.status.profile || {},
profile: state.user.status || {},
loading: state.user.loading,
}),
{ getProfile: user.getProfile, setProfile: user.setProfile }
)(Profile);

@ -196,7 +196,7 @@ Home.defaultProps = {
design: "flex",
title: "واقعیت افزوده",
subTitle: "توضیحات مختصر در این رابطه",
link: "/ar-scan",
link: "/ar",
badge: "",
flex: 1,
fontSize: "large",
@ -319,7 +319,7 @@ Home.defaultProps = {
subTitle: "",
justifyContent: "center",
alignItems: "center",
link: "/chatroom",
link: "/contact",
badge: "",
flex: 1,
fontSize: "normal",

@ -152,6 +152,7 @@ class QR extends Component {
<>
<div className="mobile-qr d-flex flex-column">
<Navbar />
{this.props.qrList ? (
<div className="d-flex p-3">
{this.state.menu ? (
<div className="mobile-qr__buttons d-flex flex-column align-items-center">
@ -165,7 +166,7 @@ class QR extends Component {
/>
</div>
<button>نمایش تمامی محتواها</button>
{qrList.map((item, i) => (
{qrList.content.map((item, i) => (
<MenuIdentifier data={item} key={i} />
))}
</div>
@ -173,7 +174,9 @@ class QR extends Component {
<div className="mobile-qr__buttons d-flex flex-column align-items-center">
<MoreVertIcon
style={{ fontSize: 40, color: "grey" }}
onClick={() => this.setState({ menu: !this.state.menu })}
onClick={() =>
this.setState({ menu: !this.state.menu })
}
/>
</div>
)}
@ -186,6 +189,14 @@ class QR extends Component {
))}
</div>
</div>
) : (
<div className="mobile-qr__notAccess d-flex flex-column p-3">
<div className="mobile-qr-scan__back d-flex mb-2">
<Link to="/">بازگشت</Link>
</div>
<h1>محتوایی برای این صفحه در دسترس نیست.!</h1>
</div>
)}
</div>
</>
) : null}

@ -6,6 +6,17 @@
direction: rtl;
padding-top: 70px;
overflow-x: hidden;
&__notAccess {
justify-content: center;
h1 {
font-size: calc(100vw / 28);
color: #6f7074;
text-align: center;
font-family: numeralLight;
margin-top: calc(100vh / 2 - 150px);
letter-spacing: -1px;
}
}
&__header {
padding: 0px 10px;
width: 100%;

Loading…
Cancel
Save