update 16 files قثئخرث رهیثخ

master
amir hosein gorji 3 years ago
parent abd56f9e06
commit d24fcdbd7f
  1. 1
      src/Redux/proxy.js
  2. 5
      src/Redux/reducers/public.js
  3. 2
      src/Redux/reducers/userProduct.js
  4. 17
      src/views/Cart/Table/index.js
  5. 1
      src/views/Checkout/Table/index.js
  6. 28
      src/views/Home/Footer/index.js
  7. 6
      src/views/Home/index.js
  8. 7
      src/views/Product/AddToCart/index.js
  9. 10
      src/views/Product/index.js
  10. 4
      src/views/Products/List/index.js
  11. 24
      src/views/Products/Product/index.js
  12. 36
      src/views/QRScan/Input/index.js
  13. 1
      src/views/QRScan/LastQr/index.js
  14. 127
      src/views/QRScan/Modal/index.js
  15. 54
      src/views/QRScan/Modal/index.scss
  16. 38
      src/views/QRScan/index.js

@ -46,6 +46,7 @@ class Proxy {
dispatch = dispatch || (() => {}); dispatch = dispatch || (() => {});
dispatch({ type: `${url.split("/")[0]}/loading` }); dispatch({ type: `${url.split("/")[0]}/loading` });
let response = await fetch(); let response = await fetch();
switch (response.status) { switch (response.status) {
case 200: case 200:
dispatch({ type: url, data: response.data.data, params }); dispatch({ type: url, data: response.data.data, params });

@ -36,11 +36,12 @@ export default function publicApi(state = initialState, action) {
case "public/homePage": case "public/homePage":
let itemsLevel; let itemsLevel;
// if (window.innerWidth > 1000) { // if (window.innerWidth > 1000) {
const jadidTarin = data.filter(
const jadidTarin = data?.filter(
(item) => item.title === "کتابهای دانوین" (item) => item.title === "کتابهای دانوین"
); );
itemsLevel = itemsLevel =
jadidTarin[0] && jadidTarin[0].data jadidTarin && jadidTarin[0] && jadidTarin[0].data
? jadidTarin[0].data ? jadidTarin[0].data
.map((item) => item.book.gradeId * 1) .map((item) => item.book.gradeId * 1)
.sort((a, b) => a - b) .sort((a, b) => a - b)

@ -18,7 +18,7 @@ export default function userProduct(state = initialState, action) {
(item) => item.condition === 2 && item.product.productType === (1 || 3) (item) => item.condition === 2 && item.product.productType === (1 || 3)
); );
const hasPhysical = const hasPhysical =
data.filter((item) => item.product.productType === 2).length > 0 data.filter((item) => item?.product?.productType === 2).length > 0
? true ? true
: false; : false;
return { return {

@ -182,6 +182,7 @@ function BasicTable(props) {
const Item = (props) => { const Item = (props) => {
const { data, pushToCart, id, route } = props; const { data, pushToCart, id, route } = props;
if (!data.product) return null;
return ( return (
<> <>
{window.innerWidth < 1000 ? ( {window.innerWidth < 1000 ? (
@ -308,25 +309,25 @@ const Item = (props) => {
</TableRow> </TableRow>
) : null} ) : null}
{window.innerWidth > 1000 ? ( {window.innerWidth > 1000 ? (
<TableRow key={data.product.book.name}> <TableRow key={data.product.book?.name}>
<TableCell align="right" component="th" scope="row"> <TableCell align="right" component="th" scope="row">
<div className="cart-item__info d-flex"> <div className="cart-item__info d-flex">
<img <img
src={`https://dnvn.ir/api/v1/file/${data.product.book.fileIds}`} src={`https://dnvn.ir/api/v1/file/${data.product?.book?.fileIds}`}
alt={data.product.book.name} alt={data.product?.book?.name}
/> />
<div className="d-flex flex-column justify-content-center"> <div className="d-flex flex-column justify-content-center">
<strong style={{ fontSize: fontSize.desktop.info.strong }}> <strong style={{ fontSize: fontSize.desktop.info.strong }}>
{`نسخه ${ {`نسخه ${
+data.product.productType === 1 ? "الکترونیکی" : "چاپی" +data.product?.productType === 1 ? "الکترونیکی" : "چاپی"
} ${data.product.book.name} `} } ${data.product?.book?.name} `}
</strong> </strong>
<p style={{ fontSize: fontSize.desktop.info.p }}> <p style={{ fontSize: fontSize?.desktop?.info.p }}>
{`پایه ${grades[data.product.book.gradeId]}`} {`پایه ${grades[data.product?.book?.gradeId]}`}
</p> </p>
<span style={{ fontSize: fontSize.desktop.info.span }}> <span style={{ fontSize: fontSize.desktop.info.span }}>
همراه با: همراه با:
{data.product.book.items || "کد فعالسازی محتوای الکترونیک"} {data.product?.book?.items || "کد فعالسازی محتوای الکترونیک"}
</span> </span>
</div> </div>
</div> </div>

@ -143,6 +143,7 @@ function BasicTable(props) {
const Item = (props) => { const Item = (props) => {
const { data, route } = props; const { data, route } = props;
if (!data.product) return null;
return ( return (
<> <>
{window.innerWidth < 1000 ? ( {window.innerWidth < 1000 ? (

@ -24,16 +24,38 @@ export default class Footer extends Component {
<div className="footer__location d-flex align-items-center mt-2"> <div className="footer__location d-flex align-items-center mt-2">
<img src={location} alt="آدرس" className="m-1" /> <img src={location} alt="آدرس" className="m-1" />
<p>آدرس: تهران، میدان فردوسی، خیابان موسوی، پلاک ۳۰</p> <p>آدرس: تهران، میدان فردوسی، خیابان موسوی، پلاک ۳۰</p>
{/* <p>شماره تماس: ۸۸۸۱۴۶۳۷-۰۲۱ </p> */}
</div> </div>
<div <div
className="d-flex align-items-center mt-1" className="d-flex align-items-center mt-1"
style={{ width: "55%", justifyContent: "space-between" }} style={{ width: "55%", justifyContent: "space-between" }}
> >
<div className="d-flex align-items-center"> <div
<span>۸۸۸۱۴۶۳۷</span> className="d-flex align-items-center"
style={{ fontName: "IRANSansNumeralLight" }}
>
<a
href="tel:58795"
style={{ textDecoration: "none", color: "white" }}
>
58795
</a>
<img src={contact} alt="تماس" className="m-1" /> <img src={contact} alt="تماس" className="m-1" />
</div> </div>
{/* <div
className="d-flex align-items-center"
style={{
fontName: "IRANSansNumeralLight",
}}
>
<a
href="tel:02188814673"
style={{ textDecoration: "none", color: "white" }}
>
021-88814673
</a>
<img src={contact} alt="تماس" className="m-1" />
</div> */}
<div className="d-flex align-items-center"> <div className="d-flex align-items-center">
<span>Info@Danovin.ir</span> <span>Info@Danovin.ir</span>
<img src={home} alt="خانه" className="m-1" /> <img src={home} alt="خانه" className="m-1" />

@ -55,10 +55,10 @@ class Home extends Component {
//componentDidupdate = this.componentDidMount(); //componentDidupdate = this.componentDidMount();
render() { render() {
const { homeData, loading } = this.props; const { homeData, loading } = this.props;
if (!loading && this.props.homeData.length === 0) if (!loading && this.props.homeData?.length === 0)
return this.componentDidMount(); return this.componentDidMount();
const mobile = window.innerWidth < 1000; const mobile = window.innerWidth < 1000;
if (loading && this.props.homeData.length === 0) if (loading && this.props.homeData?.length === 0)
return ( return (
<div <div
className="d-flex justify-content-center align-items-center" className="d-flex justify-content-center align-items-center"
@ -92,7 +92,7 @@ class Home extends Component {
> >
<Navbar page={"home"} /> <Navbar page={"home"} />
{homeData.map((item, i) => ( {homeData?.map((item, i) => (
<Identifier item={item} key={i} /> <Identifier item={item} key={i} />
))} ))}
{window.location.host.indexOf("app") > -1 ? null : <Download />} {window.location.host.indexOf("app") > -1 ? null : <Download />}

@ -64,7 +64,8 @@ function AddToCart(props) {
style={{ fontSize: 14, fontWeight: "bold", width: "100%" }} style={{ fontSize: 14, fontWeight: "bold", width: "100%" }}
className="d-flex" className="d-flex"
> >
{info.product[productType].name} {/* {info.product[productType].name} */}
{info.product[0].name}
</div> </div>
<div style={{ float: "left" }}> <div style={{ float: "left" }}>
<strong style={{ fontSize: fontSize.desktop.strong }}> <strong style={{ fontSize: fontSize.desktop.strong }}>
@ -118,7 +119,7 @@ function AddToCart(props) {
productId: productId:
page === "digital" page === "digital"
? info.product[0].id ? info.product[0].id
: info.product[1].id, : info.product[0].id,
userId: props.id, userId: props.id,
count: 1, count: 1,
}); });
@ -127,7 +128,7 @@ function AddToCart(props) {
localStorage.setItem("afterLogin", window.location.pathname); localStorage.setItem("afterLogin", window.location.pathname);
localStorage.setItem( localStorage.setItem(
"pushToCart", "pushToCart",
page === "digital" ? info.product[0].id : info.product[1].id page === "digital" ? info.product[0].id : info.product[0].id
); );
Navigate({ path: "/auth" }); Navigate({ path: "/auth" });
} }

@ -80,7 +80,7 @@ function Addbutton({ page, info, pushToCart, userId }) {
if (proxy.status()) if (proxy.status())
pushToCart({ pushToCart({
productId: productId:
page === "digital" ? info.product[0].id : info.product[1].id, page === "digital" ? info.product[0].id : info.product[0].id,
userId, userId,
count: 1, count: 1,
}); });
@ -89,7 +89,7 @@ function Addbutton({ page, info, pushToCart, userId }) {
localStorage.setItem("afterLogin", window.location.pathname); localStorage.setItem("afterLogin", window.location.pathname);
localStorage.setItem( localStorage.setItem(
"pushToCart", "pushToCart",
page === "digital" ? info.product[0].id : info.product[1].id page === "digital" ? info.product[0].id : info.product[0].id
); );
Navigate({ path: "/auth" }); Navigate({ path: "/auth" });
} }
@ -137,7 +137,7 @@ class Product extends Component {
name={ name={
page === "digital" page === "digital"
? info.product[0].name ? info.product[0].name
: info.product[1].name : info.product[0].name
} }
/> />
<header className="product__header d-flex mt-4"> <header className="product__header d-flex mt-4">
@ -155,7 +155,7 @@ class Product extends Component {
price={ price={
page === "digital" page === "digital"
? info.product[0].price ? info.product[0].price
: info.product[1].price : info.product[0].price
} }
// off={product.off} // off={product.off}
page={page} page={page}
@ -222,7 +222,7 @@ class Product extends Component {
<h3 style={{ fontSize: fontSize.mobile.h1 }}> <h3 style={{ fontSize: fontSize.mobile.h1 }}>
{page === "digital" {page === "digital"
? info.product[0].price ? info.product[0].price
: info.product[1].price}{" "} : info.product[0].price}{" "}
تومان تومان
</h3> </h3>
<div className="d-flex flex-column mt-3"> <div className="d-flex flex-column mt-3">

@ -9,7 +9,7 @@ import "./index.scss";
class List extends React.Component { class List extends React.Component {
componentDidMount() { componentDidMount() {
if (this.props.list.length === 0) this.props.getList(); if (this.props.list?.length === 0) this.props.getList();
} }
render() { render() {
@ -18,7 +18,7 @@ class List extends React.Component {
return window.innerWidth > 1000 ? ( return window.innerWidth > 1000 ? (
<div className="products-list d-flex flex-wrap"> <div className="products-list d-flex flex-wrap">
{!loading ? ( {!loading ? (
filterResult.length > 0 ? ( filterResult?.length > 0 ? (
(Array.isArray(filterResult) ? filterResult : []).map((item, i) => ( (Array.isArray(filterResult) ? filterResult : []).map((item, i) => (
<Product product={item} key={i} /> <Product product={item} key={i} />
)) ))

@ -67,7 +67,7 @@ function Product(props) {
className="mobile-products-product__links--physical d-flex justify-content-between align-items-center" className="mobile-products-product__links--physical d-flex justify-content-between align-items-center"
> >
<h2> نسخه چاپی</h2> <h2> نسخه چاپی</h2>
<span>{product.product[1].price} تومان</span> <span>{product.product[0].price} تومان</span>
</Link> </Link>
<div <div
className="mobile-products-product__links--basket d-flex" className="mobile-products-product__links--basket d-flex"
@ -75,7 +75,7 @@ function Product(props) {
onClick={() => { onClick={() => {
if (proxy.status()) if (proxy.status())
props.pushToCart({ props.pushToCart({
productId: product.product[1].id, productId: product.product[0].id,
userId: props.id, userId: props.id,
count: 1, count: 1,
}); });
@ -84,7 +84,7 @@ function Product(props) {
"afterLogin", "afterLogin",
window.location.pathname window.location.pathname
); );
localStorage.setItem("pushToCart", product.product[1].id); localStorage.setItem("pushToCart", product.product[0].id);
Navigate({ path: "/auth" }); Navigate({ path: "/auth" });
} }
}} }}
@ -92,13 +92,13 @@ function Product(props) {
<img src={basket2} alt="" width="20px" height="20px" /> <img src={basket2} alt="" width="20px" height="20px" />
</div> </div>
</div> </div>
<div className="d-flex" style={{ width: "100%", opacity: 0.3 }}> {/* <div className="d-flex" style={{ width: "100%", opacity: 0.3 }}>
<span <span
to={`/products/digital/${product.id}`} to={`/products/digital/${product.id}`}
className="mobile-products-product__links--ar d-flex justify-content-between align-items-center" className="mobile-products-product__links--ar d-flex justify-content-between align-items-center"
> >
<h2> الکترونیکی</h2> <h2> الکترونیکی</h2>
{/* <span>{product.product[0].price} تومان</span> */} {/* <span>{product.product[0].price} تومان</span>
<span> به زودی</span> <span> به زودی</span>
</span> </span>
@ -116,7 +116,7 @@ function Product(props) {
> >
<img src={basket} alt="" width="20px" height="20px" /> <img src={basket} alt="" width="20px" height="20px" />
</div> </div>
</div> </div> */}
</div> </div>
</div> </div>
) : null} ) : null}
@ -143,7 +143,7 @@ function Product(props) {
> >
<h2 style={{ fontSize: 12 }}>نسخه چاپی</h2> <h2 style={{ fontSize: 12 }}>نسخه چاپی</h2>
<span style={{ fontSize: 12 }}> <span style={{ fontSize: 12 }}>
{product.product[1].price} تومان {product.product[0].price} تومان
</span> </span>
</Link> </Link>
<div <div
@ -152,14 +152,14 @@ function Product(props) {
onClick={() => { onClick={() => {
if (proxy.status()) if (proxy.status())
props.pushToCart({ props.pushToCart({
productId: product.product[1].id, productId: product.product[0].id,
userId: props.id, userId: props.id,
count: 1, count: 1,
}); });
else { else {
toast.info("جهت ادامه فرآیند خرید وارد حساب خود شوید"); toast.info("جهت ادامه فرآیند خرید وارد حساب خود شوید");
localStorage.setItem("afterLogin", window.location.pathname); localStorage.setItem("afterLogin", window.location.pathname);
localStorage.setItem("pushToCart", product.product[1].id); localStorage.setItem("pushToCart", product.product[0].id);
Navigate({ path: "/auth" }); Navigate({ path: "/auth" });
} }
}} }}
@ -167,14 +167,14 @@ function Product(props) {
<img src={basket2} alt="" width="20px" height="20px" /> <img src={basket2} alt="" width="20px" height="20px" />
</div> </div>
</div> </div>
<div className="d-flex" style={{ width: "100%", opacity: 0.3 }}> {/* <div className="d-flex" style={{ width: "100%", opacity: 0.3 }}>
<div <div
to={`/products/digital/${product.id}`} to={`/products/digital/${product.id}`}
className="products-product--ar d-flex justify-content-between align-items-center" className="products-product--ar d-flex justify-content-between align-items-center"
> >
<h2 style={{ fontSize: 12 }}>نسخه الکترونیک</h2> <h2 style={{ fontSize: 12 }}>نسخه الکترونیک</h2>
<span style={{ fontSize: 12 }}> <span style={{ fontSize: 12 }}>
{/* {product.product[0].price} تومان */} {/* {product.product[0].price} تومان
به زودی به زودی
</span> </span>
</div> </div>
@ -192,7 +192,7 @@ function Product(props) {
> >
<img src={basket} alt="" width="20px" height="20px" /> <img src={basket} alt="" width="20px" height="20px" />
</div> </div>
</div> </div> */}
</article> </article>
) : null} ) : null}
</> </>

@ -0,0 +1,36 @@
import React, { useState } from "react";
import TextField from "@material-ui/core/TextField";
export default function FormPropsTextFields(props) {
const [value, setValue] = useState(props.defaultValue[props.name]);
const { parent, maxLength, onInput, variant, required } = props;
return (
<form noValidate autoComplete="off">
<div>
<TextField
id="outlined-basic"
className="o4input"
name={props.name}
label={props.label}
variant={variant || "outlined"}
onChange={(e) => {
parent.onChange(e.target.name, e.target.value);
}}
// defaultValue={defaultValue[props.name] || ""}
value={value || ""}
required={required}
inputProps={{ maxLength }}
onInput={(e) => setValue(onInput(e.target.value))}
/>
</div>
</form>
);
}
FormPropsTextFields.defaultProps = {
align: "right",
maxLength: "",
inputMode: "numeric",
defaultValue: "",
};

@ -4,6 +4,7 @@ import { Link } from "react-router-dom";
import "./index.scss"; import "./index.scss";
const grades = [ const grades = [
"0",
"اول", "اول",
"دوم", "دوم",
"سوم", "سوم",

@ -1,8 +1,8 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import onInput from "~/util/onInput";
import Input from "../Input/index";
import "./index.scss"; import "./index.scss";
const maxMobileSize = 550; const maxMobileSize = 550;
const fontSize = { const fontSize = {
@ -11,9 +11,21 @@ const fontSize = {
a: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 20, a: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 20,
}, },
}; };
export default class QRModal extends Component { class QRModal extends Component {
state = { pageNumber: "" };
onChange(k, v) {
this.setState({ [k]: v });
}
render() { render() {
const { tail, parent } = this.props; let { tail, parent, myList } = this.props;
let { pageNumber } = this.state;
let hasZ10 = false;
let hasO4 = false;
if (tail === "Zist10-147") {
hasO4 = myList.find((item) => +item.product.bookId === 10);
hasZ10 = myList.find((item) => +item.product.bookId === 6);
}
return ( return (
<> <>
{window.innerWidth < 1000 ? ( {window.innerWidth < 1000 ? (
@ -21,27 +33,130 @@ export default class QRModal extends Component {
<span style={{ fontSize: fontSize.mobile.span }}> <span style={{ fontSize: fontSize.mobile.span }}>
اسکن کد QR موفقیت آمیز بود. اسکن کد QR موفقیت آمیز بود.
</span> </span>
<Link style={{ fontSize: fontSize.mobile.a }} to={"/qr"}>
{hasO4 ? (
<>
<div className="o4" style={{ color: "#fff", width: "90%" }}>
<div>کتاب علوم چهارم</div>
<span style={{ marginTop: 10 }}>
لطفا شماره صفحه را وارد نمایید
</span>
<div className="d-flex" style={{ justifyContent: "center" }}>
<Input
name="pageNumber"
// label="نام"
parent={this}
defaultValue={pageNumber}
maxLength={3}
onInput={onInput.numberOnly}
/>
</div>
</div>
<div
className="d-flex"
style={{ justifyContent: "center", width: "100% " }}
>
<Link
className="button"
to={
"/qr?id=" + (pageNumber ? "oloom4-" + pageNumber : tail)
}
>
{hasZ10 ? "علوم چهارم" : "تایید"}
</Link>
{hasZ10 ? (
<Link className="button" to={"/qr?id=" + tail}>
زیست دهم
</Link>
) : null}
<button onClick={() => parent.setState({ tail: null })}>
انصراف
</button>
</div>
</>
) : (
<>
<Link
className="ok"
style={{ fontSize: fontSize.mobile.a }}
to={"/qr?id=" + tail}
>
{tail} {tail}
</Link> </Link>
<button onClick={() => parent.setState({ tail: null })}> <button onClick={() => parent.setState({ tail: null })}>
انصراف انصراف
</button> </button>
</>
)}
</div> </div>
) : ( ) : (
<div className="qr-modal d-flex flex-column justify-content-center align-items-center"> <div className="qr-modal d-flex flex-column justify-content-center align-items-center">
<span style={{ fontSize: fontSize.mobile.span }}> <span style={{ fontSize: fontSize.mobile.span }}>
اسکن کد QR موفقیت آمیز بود. اسکن کد QR موفقیت آمیز بود.
</span> </span>
<Link style={{ fontSize: fontSize.mobile.a }} to={"/qr"}> {hasO4 ? (
<>
<div className="o4" style={{ color: "#fff" }}>
<div>کتاب علوم چهارم</div>
<div className="d-flex" style={{ justifyContent: "center" }}>
<span style={{ marginTop: 10 }}>
لطفا شماره صفحه را وارد نمایید
</span>
<Input
name="pageNumber"
// label="نام"
parent={this}
defaultValue={pageNumber}
maxLength={3}
onInput={onInput.numberOnly}
/>
</div>
</div>
<div
className="d-flex"
style={{ justifyContent: "center", width: "100% " }}
>
<Link
className="button"
to={
"/qr?id=" + (pageNumber ? "oloom4-" + pageNumber : tail)
}
>
{hasZ10 ? "علوم چهارم" : "تایید"}
</Link>
{hasZ10 ? (
<Link className="button" to={"/qr?id=" + tail}>
زیست دهم
</Link>
) : null}
<button onClick={() => parent.setState({ tail: null })}>
انصراف
</button>
</div>
</>
) : (
<>
<Link
className="ok"
style={{ fontSize: fontSize.mobile.a }}
to={"/qr?id=" + tail}
>
{tail} {tail}
</Link> </Link>
<button onClick={() => parent.setState({ tail: null })}> <button onClick={() => parent.setState({ tail: null })}>
انصراف انصراف
</button> </button>
</>
)}
</div> </div>
)} )}
</> </>
); );
} }
} }
export default QRModal;
// export default connect(
// (state) => ({ myList: state.userProduct.myList || [] }),
// { getMyList: userProduct.myList }
// )(QRModal);

@ -12,7 +12,7 @@
font-family: numeralLight; font-family: numeralLight;
color: white; color: white;
} }
a { a.ok {
text-decoration: none; text-decoration: none;
width: 50%; width: 50%;
margin: 25px auto; margin: 25px auto;
@ -24,7 +24,8 @@
font-family: numeralLight; font-family: numeralLight;
border-radius: 25px; border-radius: 25px;
} }
button { button,
.button {
text-decoration: none; text-decoration: none;
width: 30%; width: 30%;
min-width: 100px; min-width: 100px;
@ -53,9 +54,9 @@
font-family: numeralLight; font-family: numeralLight;
color: white; color: white;
} }
a { a.ok {
text-decoration: none; text-decoration: none;
width: 50%; width: 40%;
margin: 25px auto; margin: 25px auto;
background-color: #00cc69; background-color: #00cc69;
border: 2px solid white; border: 2px solid white;
@ -65,11 +66,12 @@
font-family: numeralLight; font-family: numeralLight;
border-radius: 25px; border-radius: 25px;
} }
button { button,
.button {
text-decoration: none; text-decoration: none;
width: 25%; width: 25%;
max-width: 100px; max-width: 100px;
margin: 15px auto; margin: 15px;
background-color: #cc001b; background-color: #cc001b;
border: 2px solid white; border: 2px solid white;
padding: 10px 0px; padding: 10px 0px;
@ -80,6 +82,32 @@
} }
} }
.o4input {
background-color: #ffffff88;
width: 70px;
border: 0px;
border-radius: 5px;
}
.o4 {
direction: rtl;
text-decoration: none;
width: 40%;
margin: 25px auto;
background-color: #175b6d;
border: 2px solid white;
padding: 20px 0px;
text-align: center;
color: white;
font-family: numeralLight;
border-radius: 25px;
}
.o4input input:focus-visible {
border: 0px;
outline: none;
}
.button {
background-color: #00cc69 !important;
}
@keyframes qrModal { @keyframes qrModal {
0% { 0% {
left: -100vw; left: -100vw;
@ -90,3 +118,17 @@
top: 0px; top: 0px;
} }
} }
.MuiTextField-root {
border: 0;
margin: 5px;
display: flex;
font-family: numeralLight;
}
.MuiTextField-root fieldset {
border: 0;
}
.MuiTextField-root input {
direction: rtl;
text-align: right;
}

@ -9,7 +9,7 @@ import ReplayIcon from "@material-ui/icons/Replay";
import FlipCameraIosIcon from "@material-ui/icons/FlipCameraIos"; import FlipCameraIosIcon from "@material-ui/icons/FlipCameraIos";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { qr } from "~/Redux/actions"; import { qr, userProduct } from "~/Redux/actions";
import sciense_6 from "../../assets/images/sciense-6.png"; import sciense_6 from "../../assets/images/sciense-6.png";
@ -28,17 +28,19 @@ class QRScan extends Component {
state = { state = {
value: null, value: null,
facingMode: 0, facingMode: 0,
tail: null, tail: null, //"Zist10-146",
}; };
componentDidMount() {
console.log(this.props.myList);
if (!this.props.myList) this.props.getMyList({});
}
async componentDidUpdate() { async componentDidUpdate() {
if (this.state.value) { if (this.state.value) {
let tail = this.state.value.slice( let tail = this.state.value.slice(
this.state.value.lastIndexOf("/") + 1, this.state.value.lastIndexOf("/") + 1,
this.state.value.length this.state.value.length
); );
this.props.info({ tail: tail }); // if (tail.length) this.props.info({ tail: tail });
console.log(this.props.list, tail);
this.setState({ value: null, tail: tail }); this.setState({ value: null, tail: tail });
} }
} }
@ -77,12 +79,16 @@ class QRScan extends Component {
> >
<ReplayIcon style={{ fontSize: 40, color: "grey" }} /> <ReplayIcon style={{ fontSize: 40, color: "grey" }} />
</div> </div>
) : ( ) : this.state.tail === null ? (
<Scanner parent={this} /> <Scanner parent={this} />
)} ) : null}
</section> </section>
{this.state.tail === null ? null : ( {this.state.tail === null ? null : (
<Modal tail={this.state.tail} /> <Modal
tail={this.state.tail}
parent={this}
myList={this.props.myList}
/>
)} )}
</div> </div>
</div> </div>
@ -124,7 +130,11 @@ class QRScan extends Component {
)} )}
</section> </section>
{this.state.tail === null ? null : ( {this.state.tail === null ? null : (
<Modal parent={this} tail={this.state.tail} /> <Modal
parent={this}
tail={this.state.tail}
myList={this.props.myList}
/>
)} )}
{localStorage.getItem("latestQr") ? ( {localStorage.getItem("latestQr") ? (
<section className="mobile-qr-scan__lasts d-flex flex-column"> <section className="mobile-qr-scan__lasts d-flex flex-column">
@ -145,9 +155,13 @@ class QRScan extends Component {
} }
} }
export default connect((state) => ({ list: state.qr.list }), { info: qr.info })( export default connect(
QRScan (state) => ({ list: state.qr.list, myList: state.userProduct.myList }),
); {
getMyList: userProduct.myList,
info: qr.info,
}
)(QRScan);
QRScan.defaultProps = { QRScan.defaultProps = {
data: [ data: [

Loading…
Cancel
Save