From 6d0e8522679cb12fd7910aecd684bd5361cb832b Mon Sep 17 00:00:00 2001 From: RezaAshrafi77 Date: Tue, 3 Aug 2021 22:57:26 +0430 Subject: [PATCH] bexoda qr ro zadam --- src/AppRouter.js | 42 ++-- src/Redux/reducers/qr.js | 2 +- src/Redux/reducers/user.js | 1 + src/views/Auth/Login/Cellphone/index.scss | 2 +- src/views/Auth/Login/Code/index.scss | 2 +- src/views/Auth/Profile/Input/index.js | 1 - src/views/Auth/Profile/index.js | 25 +- src/views/Auth/Profile/index.scss | 1 - src/views/Auth/index.scss | 3 - src/views/QR/index.js | 265 ++++++++++++---------- src/views/QR/index.scss | 11 + src/views/QRScan/index.scss | 16 ++ 12 files changed, 210 insertions(+), 161 deletions(-) diff --git a/src/AppRouter.js b/src/AppRouter.js index c7c3816..14df449 100644 --- a/src/AppRouter.js +++ b/src/AppRouter.js @@ -1,8 +1,13 @@ import React, { Component } from "react"; import "./App.css"; -import { BrowserRouter as Router, Route, Switch } from "react-router-dom"; -import history from "./History/index"; +import { + BrowserRouter as Router, + Route, + Switch, + Redirect, +} from "react-router-dom"; import { connect } from "react-redux"; +import { user } from "~/Redux/actions"; import proxy from "./Redux/proxy"; import Home from "./views/Home/index"; @@ -26,34 +31,27 @@ class AppRouter extends Component { super(props); window.router = this; } + state = {}; + render() { let home = ( - {proxy.status() ? ( - this.props.profile.username ? ( - - ) : ( - - ) - ) : ( - // - - )} + {proxy.status() ? : } ); return ( - + {home} - + - + - + @@ -65,6 +63,7 @@ class AppRouter extends Component { + @@ -74,6 +73,7 @@ class AppRouter extends Component { + @@ -94,6 +94,14 @@ class AppRouter extends Component { ) : null} + +
diff --git a/src/views/Auth/Profile/index.js b/src/views/Auth/Profile/index.js index 82f1f93..febeaf0 100644 --- a/src/views/Auth/Profile/index.js +++ b/src/views/Auth/Profile/index.js @@ -73,14 +73,6 @@ class Profile extends Component { getProfile(); } - componentDidUpdate(prevProps) { - if (prevProps.profile !== this.props.profile) { - this.setState({ - render: true, - }); - } - } - onSubmit = async (e) => { const { firstName, @@ -133,7 +125,7 @@ class Profile extends Component { name="firstName" label="نام" parent={this} - defaultValue={profile.firstName} + defaultValue={profile} />
@@ -141,7 +133,7 @@ class Profile extends Component { name="lastName" label="نام خانوادگی" parent={this} - defaultValue={profile.lastName} + defaultValue={profile} />
@@ -149,7 +141,7 @@ class Profile extends Component { name="username" label="نام کاربری" parent={this} - defaultValue={profile.username} + defaultValue={profile} align="left" />
@@ -168,6 +160,7 @@ class Profile extends Component { label="کد ملی" parent={this} align="left" + defaultValue={profile} />
@@ -272,6 +265,7 @@ class Profile extends Component { parent={this} name="schoolId" label={"نام مدرسه"} + defaultValue={profile} />
) : null} @@ -281,6 +275,7 @@ class Profile extends Component { parent={this} name="schoolId" label={"محل تدریس"} + defaultValue={profile} /> ) : null} @@ -290,6 +285,7 @@ class Profile extends Component { name="postalCode" label={"کد پستی"} align="left" + defaultValue={profile} />
@@ -307,7 +303,12 @@ class Profile extends Component {
) : ( - +
+ +
) ) : null} {window.innerWidth < 1000 ? ( diff --git a/src/views/Auth/Profile/index.scss b/src/views/Auth/Profile/index.scss index 6a8f787..250b7ca 100644 --- a/src/views/Auth/Profile/index.scss +++ b/src/views/Auth/Profile/index.scss @@ -146,7 +146,6 @@ .auth-profile { width: 100vw; - // height: 100vh; scrollbar-width: 0px; margin: 50px 0px; &::-webkit-scrollbar { diff --git a/src/views/Auth/index.scss b/src/views/Auth/index.scss index 505fb88..6cbe47d 100644 --- a/src/views/Auth/index.scss +++ b/src/views/Auth/index.scss @@ -1,7 +1,4 @@ .auth { width: 100%; - height: 100vh; - min-height: 100vh; overflow-x: hidden; - min-height: 450px; } diff --git a/src/views/QR/index.js b/src/views/QR/index.js index dbd6ef5..cec2c42 100644 --- a/src/views/QR/index.js +++ b/src/views/QR/index.js @@ -2,6 +2,7 @@ import React, { Component } from "react"; import { Link } from "react-router-dom"; import Navbar from "../Home/Navbar/index"; import Footer from "../Home/Footer/index"; +import Loader from "~/components/Loader/index"; import VoiceBox from "./VoiceBox/index.js"; import VideoBox from "./VideoBox/index"; import PDF from "./PDF/index"; @@ -48,8 +49,15 @@ class QR extends Component { }; componentDidMount() { - console.log(typeof this.props.qrList); + if (window.location.search) { + let tail = window.location.search.slice( + window.location.search.lastIndexOf("/") + 1, + window.location.search.length + ); + this.props.info({ tail: tail }); + } } + render() { const { QR, qrList } = this.props; const fontSize = { @@ -80,125 +88,153 @@ class QR extends Component { return ( <> {window.innerWidth > 1000 ? ( - <> -
- -
-
-
-
- {QR.title} -
-
-

- {QR.title} -

-

- {QR.subTitle} -

-
- شما در حال مطالعه صفحه {QR.sample.page}{" "} - هستید. -
-
- پیشرفت شما در مطالعه کتاب به{" "} - {QR.sample.percent} درصد رسیده است. -
-
-
- - -
-
-
-
- - this.setState({ theme: !this.state.theme }) - } - > - - - this.handleZoom("increase")} - > - + - - this.handleZoom("decrease")} - > - - - -
-
- {QR.data.map((item, i) => ( - - ))} -
+ !this.props.loading ? ( + <> +
+ + {qrList ? ( +
+
+
+
+ {QR.title} +
+
+

+ {QR.title} +

+

+ {QR.subTitle} +

+
+ شما در حال مطالعه{" "} + صفحه {QR.sample.page} هستید. +
+
+ پیشرفت شما در مطالعه کتاب به{" "} + {QR.sample.percent} درصد رسیده است. +
+
+
+ + +
+
+
+
+ + this.setState({ theme: !this.state.theme }) + } + > + + + this.handleZoom("increase")} + > + + + + this.handleZoom("decrease")} + > + - + +
+
+ {qrList.content.map((item, i) => ( + + ))} +
+
+ ) : ( +
+

محتوایی برای این صفحه در دسترس نیست.!

+
+ )}
+