From ed1bd15f99f0e33bf1e25801839af78eca7f1bbc Mon Sep 17 00:00:00 2001 From: RezaAshrafi77 Date: Wed, 25 Aug 2021 15:44:35 +0430 Subject: [PATCH] reza add some changes --- src/AppRouter.js | 76 ++- src/views/AR/Item/index.js | 22 +- src/views/AR/Item/index.scss | 76 --- src/views/Activation/index.js | 2 +- src/views/Activation/index.scss | 3 + src/views/Auth/Profile/Input/index.js | 3 +- src/views/Blogs/index.js | 50 ++ src/views/Blogs/index.scss | 59 ++ src/views/Home/HomeSlider/index.scss | 46 +- src/views/Home/HomeStatic/Flex/index.js | 4 +- src/views/Home/HomeStatic/Simple/index.js | 4 +- src/views/Home/HomeStatic/Vitrin/index.js | 7 +- src/views/Home/HomeStatic/index.scss | 1 + .../Mobile/NavbarDrawer/NavbarDrawer.js | 55 +- .../Mobile/NavbarDrawer/NavbarDrawer.scss | 3 + src/views/Home/SingleBlog/index.js | 13 +- src/views/MyBooks/index.js | 27 +- src/views/NewProfile/index.js | 557 ++++++++++++++++++ src/views/Products/Product/index.js | 18 +- src/views/Products/Product/index.scss | 17 +- src/views/Products/Sort/index.js | 2 +- src/views/Products/index.js | 9 +- src/views/QRScan/Modal/index.js | 11 +- src/views/QRScan/Modal/index.scss | 26 + src/views/QRScan/index.js | 4 +- src/views/Support/index.js | 54 ++ 26 files changed, 929 insertions(+), 220 deletions(-) delete mode 100644 src/views/AR/Item/index.scss create mode 100644 src/views/Blogs/index.js create mode 100644 src/views/Blogs/index.scss create mode 100644 src/views/NewProfile/index.js create mode 100644 src/views/Support/index.js diff --git a/src/AppRouter.js b/src/AppRouter.js index 0e03167..c90b746 100644 --- a/src/AppRouter.js +++ b/src/AppRouter.js @@ -25,7 +25,9 @@ import Chatroom from "./views/ChatRoom/index"; import Cart from "./views/Cart/index"; import MyBooks from "./views/MyBooks/index"; import AR from "./views/AR/index"; +import Support from "./views/Support/index"; import Callback from "./views/Callback/index"; +import NewProfile from "./views/NewProfile/index"; class AppRouter extends Component { constructor(props) { @@ -36,9 +38,10 @@ class AppRouter extends Component { state = {}; render() { - let home = ( + const mobile = window.innerWidth < 1000 ? true : false; + let home = mobile ? ( - {proxy.status() ? ( + {proxy.status ? ( this.props.profile ? ( ) : ( @@ -48,32 +51,43 @@ class AppRouter extends Component { )} + ) : ( + + + ); - return ( {home} - {proxy.status() ? ( - + {mobile ? ( + window.innerWiproxy.status() ? ( + + ) : ( + + ) ) : ( - + )} - {proxy.status() ? ( - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) ) : ( - + )} @@ -85,6 +99,12 @@ class AppRouter extends Component { + + + + + + @@ -117,17 +137,21 @@ class AppRouter extends Component { - {proxy.status() ? ( - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) ) : ( - + )} - {window.innerWidth < 1000 ? ( + {mobile ? ( {proxy.status() ? ( @@ -141,7 +165,7 @@ class AppRouter extends Component { ) : null} - {proxy.status ? ( + {proxy.status() ? ( {window.innerWidth < 1000 ? ( - + + ) : null} {window.innerWidth > 1000 ? (
diff --git a/src/views/AR/Item/index.scss b/src/views/AR/Item/index.scss deleted file mode 100644 index fcd1bf1..0000000 --- a/src/views/AR/Item/index.scss +++ /dev/null @@ -1,76 +0,0 @@ -.mobile-ar-book { - width: calc(100% / 2); - padding: 10px; - a { - width: 100%; - text-decoration: none; - &:hover { - } - img { - width: 100%; - height: 170px; - border-radius: 20px; - } - h1 { - font-family: numeralBold; - margin-top: 15px; - color: #4d4d4d; - letter-spacing: -1px; - } - } -} - -.products-product { - width: calc(100% / 4); - padding: 10px; - margin-bottom: 20px; - a { - width: 100%; - text-decoration: none; - &:hover { - } - img { - width: 100%; - height: 200px; - border-radius: 30px; - } - h1 { - font-family: numeralBold; - margin-top: 15px; - color: #02a1a6; - letter-spacing: -1px; - text-align: center; - } - } - &__notAvailabe { - font-family: numeralBold; - width: 100%; - text-align: center; - color: #6f7074; - margin-top: 15px; - } - &__price { - width: 100%; - margin-top: 15px; - text-align: center; - &--old { - font-family: numeralBold; - color: #6f7074; - position: relative; - margin-left: 10px; - align-items: center; - span { - position: absolute; - left: 0px; - width: 100%; - height: 2px; - background-color: rgba(121, 121, 121, 0.534); - transform: rotate(-14deg); - } - } - &--price { - color: #4d4d4d; - font-family: numeralBold; - } - } -} diff --git a/src/views/Activation/index.js b/src/views/Activation/index.js index 1cb5aac..a07d337 100644 --- a/src/views/Activation/index.js +++ b/src/views/Activation/index.js @@ -23,7 +23,7 @@ const fontSize = { }, mobile: { h1: window.innerWidth > maxMobileSize ? 24 : window.innerWidth / 15, - p: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 28, + p: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 30, form: window.innerWidth > maxMobileSize ? 18 : window.innerWidth / 24, span: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 25, }, diff --git a/src/views/Activation/index.scss b/src/views/Activation/index.scss index 8f6f4fd..38a960f 100644 --- a/src/views/Activation/index.scss +++ b/src/views/Activation/index.scss @@ -30,6 +30,9 @@ color: #00cc69; letter-spacing: -2px; } + img { + width: calc(100vh / 5); + } } &__description { width: 100%; diff --git a/src/views/Auth/Profile/Input/index.js b/src/views/Auth/Profile/Input/index.js index cb9c380..678a36d 100644 --- a/src/views/Auth/Profile/Input/index.js +++ b/src/views/Auth/Profile/Input/index.js @@ -29,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[props.name]} + defaultValue={defaultValue[props.name] || ""} maxLength={maxLength} onInput={(e) => (e.target.value = onInput(e.target.value))} /> @@ -42,4 +42,5 @@ FormPropsTextFields.defaultProps = { align: "right", maxLength: "", inputMode: "numeric", + defaultValue: "", }; diff --git a/src/views/Blogs/index.js b/src/views/Blogs/index.js new file mode 100644 index 0000000..5d61da7 --- /dev/null +++ b/src/views/Blogs/index.js @@ -0,0 +1,50 @@ +import React, { Component } from "react"; +import { connect } from "react-redux"; + +import "./index.scss"; +class Blogs extends Component { + componentDidMount() { + // this.props.contentList(1, 100, CONTENT_LIST_3); + } + + render() { + const { blogs } = this.props; + return ( + <> + {window.innerWidth > 1000 ? ( +
+
+ +

اخبار

+
+
+ {blogs.map((item) => ( + + ))} +
+
+ ) : null} + {window.innerWidth < 1000 ? ( +
+
+ +

اخبار

+
+
+ {blogs.map((item) => ( + + ))} +
+
+ ) : null} + + ); + } +} + +export default connect( + (state) => ({ + all: state.content.all, + }), + {} +)(Blogs); diff --git a/src/views/Blogs/index.scss b/src/views/Blogs/index.scss new file mode 100644 index 0000000..bc27d8c --- /dev/null +++ b/src/views/Blogs/index.scss @@ -0,0 +1,59 @@ +.landscape-blogs { + width: 100vw; + padding: 90px 10px 10px; + max-width: 1250px; + margin: 0px auto; + direction: rtl; + &__header { + width: 100%; + height: 40px; + align-items: center; + padding: 0px; + & h3 { + font-size: 36px; + margin-bottom: 20px; + letter-spacing: -1px; + margin-right: 10px; + // color : $bright-cerulean; + } + } + &__scroll { + width: 100%; + direction: rtl; + overflow-x: scroll; + &::-webkit-scrollbar { + display: none; + width: 0px; + } + } +} + +.portrait-blogs { + width: 100vw; + padding: 90px 10px 10px; + max-width: 680px; + margin: 0px auto; + direction: rtl; + &__header { + width: 100%; + height: 40px; + align-items: center; + padding: 0px; + & h3 { + font-size: 28px; + margin-bottom: 20px; + letter-spacing: -1px; + margin-right: 10px; + color: $bright-cerulean; + } + } + &__scroll { + width: 100%; + direction: rtl; + overflow-x: scroll; + &::-webkit-scrollbar { + display: none; + width: 0px; + } + } +} diff --git a/src/views/Home/HomeSlider/index.scss b/src/views/Home/HomeSlider/index.scss index d0461c4..c51c4e1 100644 --- a/src/views/Home/HomeSlider/index.scss +++ b/src/views/Home/HomeSlider/index.scss @@ -1,15 +1,15 @@ -.mobile-home-slider{ +.mobile-home-slider { width: 100%; padding: 2px 0px 0px; margin: 0px 0px 10px; position: relative; - .rec-arrow-left{ - top : calc(50% - 22px) !important; + .rec-arrow-left { + top: calc(50% - 22px) !important; right: -12px !important; } - - .rec-arrow-right{ - top : calc(50% - 22px) !important; + + .rec-arrow-right { + top: calc(50% - 22px) !important; left: -12px !important; } } @@ -19,19 +19,17 @@ padding: 2px 0px 0px; margin: 20px 0px 10px; position: relative; - .rec-arrow-left{ - top : calc(50% - 22px) !important; + .rec-arrow-left { + top: calc(50% - 22px) !important; right: 5px !important; } - - .rec-arrow-right{ - top : calc(50% - 22px) !important; + + .rec-arrow-right { + top: calc(50% - 22px) !important; left: 5px !important; } } - - .rec-dot_active { background-color: green !important; color: white !important; @@ -48,38 +46,38 @@ background-color: grey; margin: 2px !important; box-shadow: 0px 0px 0px rgba(100, 100, 100, 1); - &:focus{ + &:focus { box-shadow: 0px 0px 0px rgba(100, 100, 100, 1); } } } -.rec-slider-container{ - margin : 0px !important; +.rec-slider-container { + margin: 0px !important; } -.rec-arrow{ - position : absolute !important; +.rec-arrow { + position: absolute !important; z-index: 100; background-color: inherit !important; box-shadow: none !important; border: 0px !important; color: grey !important; - &:focus{ + &:focus { color: grey !important; } - &:disabled{ + &:disabled { color: black !important; + display: none !important; } - &:enabled{ + &:enabled { color: grey; } - &:hover{ + &:hover { color: white; } } -.rec-slider-container{ +.rec-slider-container { border-radius: 10px; } - diff --git a/src/views/Home/HomeStatic/Flex/index.js b/src/views/Home/HomeStatic/Flex/index.js index d8056eb..dca49c5 100644 --- a/src/views/Home/HomeStatic/Flex/index.js +++ b/src/views/Home/HomeStatic/Flex/index.js @@ -16,12 +16,14 @@ export default function Flex(props) { margin: 5, borderRadius: 10, color: data.color, + filter: data.link === "/chatroom" ? "grayscale(90%)" : "", }; return (

{data.title}

diff --git a/src/views/Home/HomeStatic/Simple/index.js b/src/views/Home/HomeStatic/Simple/index.js index 0e914a1..5491b6f 100644 --- a/src/views/Home/HomeStatic/Simple/index.js +++ b/src/views/Home/HomeStatic/Simple/index.js @@ -12,7 +12,9 @@ export default function Simple(props) { const { data } = props; const parentStyle = { // backgroundImage: `url('${data.imageUrl}')`, - background: `url('${`https://dnvn.ir/api/v1/file/${data.fileId}`}')`, + background: data.fileId + ? `url('${`https://dnvn.ir/api/v1/file/${data.fileId}`}')` + : "", flex: data.flex, backgroundRepeat: "no-repeat", backgroundSize: "100% 100%", diff --git a/src/views/Home/HomeStatic/Vitrin/index.js b/src/views/Home/HomeStatic/Vitrin/index.js index 8ae27f9..f6b485e 100644 --- a/src/views/Home/HomeStatic/Vitrin/index.js +++ b/src/views/Home/HomeStatic/Vitrin/index.js @@ -23,7 +23,8 @@ export default function Vitrin(props) { }; return ( -
@@ -36,7 +37,7 @@ export default function Vitrin(props) { مشاهده بیشتر
-
+ ); } @@ -44,7 +45,7 @@ const Item = (props) => { const { data } = props; return ( this.setState({ dropdown: false })} > + 25 امتیاز ) : ( @@ -65,6 +67,19 @@ class NavbarDrawer extends Component { {this.state.dropdown ? (
+ +
+ +
اضافه کردن کاربر
+ {/* {item.message &&
{item.message}
} */} +
+ {this.props.users.map((item, i) => ( ))} @@ -103,15 +118,7 @@ export default NavbarDrawer; NavbarDrawer.defaultProps = { users: [ { - id: 0, - firstName: "محمدرضا", - lastName: "خراسانی", - title: "استاد علوم تجربی", - image: user1, - status: 0, - }, - { - id: 0, + id: 1, firstName: "اکبر", lastName: "خراسانی", title: "استاد علوم تجربی", @@ -129,7 +136,7 @@ NavbarDrawer.defaultProps = { }, { name: "واقعیت افزوده", - link: "/", + link: "/ar", icon: واقعیت افزوده, toast: "", message: "", @@ -142,9 +149,9 @@ NavbarDrawer.defaultProps = { message: "", }, { - name: "کتاب الکترونیک", - link: "/activation", - icon: کتاب الکترونیک, + name: "کتاب‌های من", + link: "/mybooks", + icon: کتاب‌های من, toast: "", message: "", }, @@ -164,25 +171,25 @@ NavbarDrawer.defaultProps = { }, { name: "پیام رسان", - link: "/chatroom", - icon: بلاگ, + link: "/", + icon: پیام رسان, toast: "", message: "", }, { - name: "ویرایش مشخصات", - link: "/profile", - icon: ویرایش مشخصات, + name: "پشتیبانی", + link: "/support", + icon: پشتیبانی, toast: "", - message: "4 پیام", + message: "", + // onClick: this.props.logout, }, { - name: "گزارش ایراد", - link: "/", - icon: گزارش ایراد, + name: "ویرایش مشخصات", + link: "/profile", + icon: ویرایش مشخصات, toast: "", - message: "", - // onClick: this.props.logout, + message: "4 پیام", }, { name: "خروج", diff --git a/src/views/Home/Navbar/Mobile/NavbarDrawer/NavbarDrawer.scss b/src/views/Home/Navbar/Mobile/NavbarDrawer/NavbarDrawer.scss index fa37e44..3274ad5 100644 --- a/src/views/Home/Navbar/Mobile/NavbarDrawer/NavbarDrawer.scss +++ b/src/views/Home/Navbar/Mobile/NavbarDrawer/NavbarDrawer.scss @@ -11,6 +11,9 @@ text-align: right !important; direction: rtl; padding: 30px 0px 10px 0px; + a { + text-decoration: none; + } &__header { height: 60px; background-color: white; diff --git a/src/views/Home/SingleBlog/index.js b/src/views/Home/SingleBlog/index.js index a1cef59..7370f1c 100644 --- a/src/views/Home/SingleBlog/index.js +++ b/src/views/Home/SingleBlog/index.js @@ -20,15 +20,18 @@ export default class SingleBlog extends Component {

{data.title}

-

{data.subTitle}

- - {data.buttonText} +

{data.text}

+ + بیشتر
- {data.fileId ? ( + {data.id ? ( {data.title} ) : null} diff --git a/src/views/MyBooks/index.js b/src/views/MyBooks/index.js index 22d9d42..abf8c0f 100644 --- a/src/views/MyBooks/index.js +++ b/src/views/MyBooks/index.js @@ -18,7 +18,7 @@ const maxMobileSize = 550; const fontSize = { mobile: { - h1: window.innerWidth > maxMobileSize ? 24 : window.innerWidth / 17, + h1: window.innerWidth > maxMobileSize ? 24 : window.innerWidth / 20, a: window.innerHeight > maxMobileSize ? 15 : window.innerWidth / 30, }, }; @@ -74,31 +74,6 @@ const Item = (props) => {

{data.title}

-
- - کتاب دیجیتال - {/* {!data.status.digital ? ( - افزودن به سبد خرید - ) : null} */} - - - واقعیت افزوده - {/* {!data.status.ar ? ( - افزودن به سبد خرید - ) : null} */} - -
); }; diff --git a/src/views/NewProfile/index.js b/src/views/NewProfile/index.js new file mode 100644 index 0000000..22ce5f1 --- /dev/null +++ b/src/views/NewProfile/index.js @@ -0,0 +1,557 @@ +import React, { Component } from "react"; +import { user } from "~/Redux/actions"; +import { connect } from "react-redux"; + +import Select from "../Auth/Profile/Select/index"; +import Input from "../Auth/Profile/Input/index"; +import TextArea from "../Auth/Profile/TextArea/index"; +import Upload from "../Auth/Profile/Upload/index"; +import Gender from "../Auth/Profile/GenderSwitch/index"; +import Birthdate from "../Auth/Profile/Birthdate/index"; +import MultipleSelector from "../Auth/Profile/MultipleSelector/index"; +import Loader from "~/components/Loader/index"; +import Document from "../Auth/Profile/Document/index"; + +import logo from "~/assets/icons/logo.png"; +import pic from "~/assets/images/pic.png"; + +import "../Auth/Profile/index.scss"; + +const maxDesktopSize = 1250; +const maxMobileSize = 550; + +const fontSize = { + desktop: { + h1: window.innerWidth > maxDesktopSize ? 25 : window.innerWidth / 55, + p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 90, + }, + mobile: { + h1: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 18, + p: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 28, + }, +}; + +const toastMessages = { + firstName: "نام وارد شده صحیح نیست!", + lastName: "نام خانوادگی وارد شده صحیح نیست!", + username: "نام کاربری صحیح نیست.", +}; + +class NewProfile extends Component { + state = { + render: false, + file: null, + docFileIds: "", + firstName: "", + lastName: "", + password: "", + username: "", + address: "", + email: "", + gender: "دختر", + userRoleId: "دانش آموز", + nationalId: "", + provinceId: "", + phone: "", + cityId: "", + zoneId: "", + schoolId: "", + postalCode: "", + gradeId: [], + validation: { + firstName: "", + lastName: "", + username: "", + email: "", + postalCode: "", + nationalId: "", + schoolId: "", + }, + }; + + componentDidMount() { + // this.props.getProfile(); + } + + onChange = (name, value) => { + if (name === "gardeId" && this.state.userRoleId === "معلم") { + this.setState((prevState) => ({ + gradeId: [...prevState.gradeId, value], + })); + } + if (name === "userRoleId") { + this.setState({ + gradeId: [], + [name]: value, + }); + } else { + this.setState({ + [name]: value, + }); + } + }; + + 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, + }; + await setProfile(data); + }; + + forcePersian = (txt) => { + let yas = txt; + yas = yas.replace(/`/g, ""); + yas = yas.replace(/0/g, ""); + yas = yas.replace(/1/g, ""); + yas = yas.replace(/2/g, ""); + yas = yas.replace(/3/g, ""); + yas = yas.replace(/4/g, ""); + yas = yas.replace(/5/g, ""); + yas = yas.replace(/6/g, ""); + yas = yas.replace(/7/g, ""); + yas = yas.replace(/8/g, ""); + yas = yas.replace(/9/g, ""); + yas = yas.replace(/0/g, ""); + yas = yas.replace(/q/g, ""); + yas = yas.replace(/w/g, ""); + yas = yas.replace(/e/g, ""); + yas = yas.replace(/r/g, ""); + yas = yas.replace(/t/g, ""); + yas = yas.replace(/y/g, ""); + yas = yas.replace(/u/g, ""); + yas = yas.replace(/i/g, ""); + yas = yas.replace(/o/g, ""); + yas = yas.replace(/p/g, ""); + yas = yas.replace(/\[/g, ""); + yas = yas.replace(/\]/g, ""); + yas = yas.replace(/a/g, ""); + yas = yas.replace(/s/g, ""); + yas = yas.replace(/d/g, ""); + yas = yas.replace(/f/g, ""); + yas = yas.replace(/g/g, ""); + yas = yas.replace(/h/g, ""); + yas = yas.replace(/j/g, ""); + yas = yas.replace(/k/g, ""); + yas = yas.replace(/l/g, ""); + yas = yas.replace(/\;/g, ""); + yas = yas.replace(/\'/g, ""); + yas = yas.replace(/z/g, ""); + yas = yas.replace(/x/g, ""); + yas = yas.replace(/c/g, ""); + yas = yas.replace(/v/g, ""); + yas = yas.replace(/b/g, ""); + yas = yas.replace(/n/g, ""); + yas = yas.replace(/m/g, ""); + yas = yas.replace(/\,/g, ""); + yas = yas.replace(/\./g, ""); + yas = yas.replace(/\//g, ""); + yas = yas.replace(/~/g, " "); + yas = yas.replace(/Q/g, ""); + yas = yas.replace(/W/g, ""); + yas = yas.replace(/E/g, ""); + yas = yas.replace(/R/g, ""); + yas = yas.replace(/T/g, ""); + yas = yas.replace(/Y/g, ""); + yas = yas.replace(/U/g, ""); + yas = yas.replace(/I/g, ""); + yas = yas.replace(/O/g, ""); + yas = yas.replace(/P/g, ""); + yas = yas.replace(/A/g, ""); + yas = yas.replace(/S/g, ""); + yas = yas.replace(/G/g, ""); + yas = yas.replace(/H/g, ""); + yas = yas.replace(/J/g, ""); + yas = yas.replace(/K/g, ""); + yas = yas.replace(/L/g, ""); + yas = yas.replace(/Z/g, ""); + yas = yas.replace(/X/g, ""); + yas = yas.replace(/B/g, ""); + yas = yas.replace(/N/g, ""); + yas = yas.replace(/M/g, ""); + yas = yas.replace(/\?/g, ""); + return yas; + }; + + render() { + const { user, profile } = this.props; + return ( + <> + {window.innerWidth > 1000 ? ( +
+
+

حساب کاربری

+

+ لطفا مشخصات خود را به صورت کامل نمایید. +

+
this.onSubmit(e)} + > +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ {/*
+ +
*/} +
+
+
+ +
+ {this.state.userRoleId === "دانش آموز" ? ( +
+ +
+ ) : null} + +
+ +
+
+ +
+ ) : null} + {this.state.userRoleId === "معلم" ? ( +
+ +
+ ) : null} +
+ +
+
+ + +
+
+ + ); + } +} + +export default Support;