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

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

@ -109,7 +109,7 @@
"workbox-webpack-plugin": "5.1.4"
},
"scripts": {
"start": "node scripts/start.js",
"start": "node scripts/start.js ",
"build": "node scripts/build.js && npm run clean",
"test": "node scripts/test.js",
"clean": "find ./build -name \"*.map\" -type f -delete"

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

@ -36,11 +36,12 @@ export default function publicApi(state = initialState, action) {
case "public/homePage":
let itemsLevel;
// if (window.innerWidth > 1000) {
const jadidTarin = data.filter(
const jadidTarin = data?.filter(
(item) => item.title === "کتابهای دانوین"
);
itemsLevel =
jadidTarin[0] && jadidTarin[0].data
jadidTarin && jadidTarin[0] && jadidTarin[0].data
? jadidTarin[0].data
.map((item) => item.book.gradeId * 1)
.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)
);
const hasPhysical =
data.filter((item) => item.product.productType === 2).length > 0
data.filter((item) => item?.product?.productType === 2).length > 0
? true
: false;
return {

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

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

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

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

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

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

@ -9,7 +9,7 @@ import "./index.scss";
class List extends React.Component {
componentDidMount() {
if (this.props.list.length === 0) this.props.getList();
if (this.props.list?.length === 0) this.props.getList();
}
render() {
@ -18,7 +18,7 @@ class List extends React.Component {
return window.innerWidth > 1000 ? (
<div className="products-list d-flex flex-wrap">
{!loading ? (
filterResult.length > 0 ? (
filterResult?.length > 0 ? (
(Array.isArray(filterResult) ? filterResult : []).map((item, 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"
>
<h2> نسخه چاپی</h2>
<span>{product.product[1].price} تومان</span>
<span>{product.product[0].price} تومان</span>
</Link>
<div
className="mobile-products-product__links--basket d-flex"
@ -75,7 +75,7 @@ function Product(props) {
onClick={() => {
if (proxy.status())
props.pushToCart({
productId: product.product[1].id,
productId: product.product[0].id,
userId: props.id,
count: 1,
});
@ -84,7 +84,7 @@ function Product(props) {
"afterLogin",
window.location.pathname
);
localStorage.setItem("pushToCart", product.product[1].id);
localStorage.setItem("pushToCart", product.product[0].id);
Navigate({ path: "/auth" });
}
}}
@ -92,13 +92,13 @@ function Product(props) {
<img src={basket2} alt="" width="20px" height="20px" />
</div>
</div>
<div className="d-flex" style={{ width: "100%", opacity: 0.3 }}>
{/* <div className="d-flex" style={{ width: "100%", opacity: 0.3 }}>
<span
to={`/products/digital/${product.id}`}
className="mobile-products-product__links--ar d-flex justify-content-between align-items-center"
>
<h2> الکترونیکی</h2>
{/* <span>{product.product[0].price} تومان</span> */}
{/* <span>{product.product[0].price} تومان</span>
<span> به زودی</span>
</span>
@ -116,7 +116,7 @@ function Product(props) {
>
<img src={basket} alt="" width="20px" height="20px" />
</div>
</div>
</div> */}
</div>
</div>
) : null}
@ -143,7 +143,7 @@ function Product(props) {
>
<h2 style={{ fontSize: 12 }}>نسخه چاپی</h2>
<span style={{ fontSize: 12 }}>
{product.product[1].price} تومان
{product.product[0].price} تومان
</span>
</Link>
<div
@ -152,14 +152,14 @@ function Product(props) {
onClick={() => {
if (proxy.status())
props.pushToCart({
productId: product.product[1].id,
productId: product.product[0].id,
userId: props.id,
count: 1,
});
else {
toast.info("جهت ادامه فرآیند خرید وارد حساب خود شوید");
localStorage.setItem("afterLogin", window.location.pathname);
localStorage.setItem("pushToCart", product.product[1].id);
localStorage.setItem("pushToCart", product.product[0].id);
Navigate({ path: "/auth" });
}
}}
@ -167,14 +167,14 @@ function Product(props) {
<img src={basket2} alt="" width="20px" height="20px" />
</div>
</div>
<div className="d-flex" style={{ width: "100%", opacity: 0.3 }}>
{/* <div className="d-flex" style={{ width: "100%", opacity: 0.3 }}>
<div
to={`/products/digital/${product.id}`}
className="products-product--ar d-flex justify-content-between align-items-center"
>
<h2 style={{ fontSize: 12 }}>نسخه الکترونیک</h2>
<span style={{ fontSize: 12 }}>
{/* {product.product[0].price} تومان */}
{/* {product.product[0].price} تومان
به زودی
</span>
</div>
@ -192,7 +192,7 @@ function Product(props) {
>
<img src={basket} alt="" width="20px" height="20px" />
</div>
</div>
</div> */}
</article>
) : 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";
const grades = [
"0",
"اول",
"دوم",
"سوم",

@ -1,8 +1,8 @@
import React, { Component } from "react";
import { Link } from "react-router-dom";
import onInput from "~/util/onInput";
import Input from "../Input/index";
import "./index.scss";
const maxMobileSize = 550;
const fontSize = {
@ -11,9 +11,21 @@ const fontSize = {
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() {
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 (
<>
{window.innerWidth < 1000 ? (
@ -21,27 +33,130 @@ export default class QRModal extends Component {
<span style={{ fontSize: fontSize.mobile.span }}>
اسکن کد QR موفقیت آمیز بود.
</span>
<Link style={{ fontSize: fontSize.mobile.a }} to={"/qr"}>
{tail}
</Link>
<button onClick={() => parent.setState({ tail: null })}>
انصراف
</button>
{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}
</Link>
<button onClick={() => parent.setState({ tail: null })}>
انصراف
</button>
</>
)}
</div>
) : (
<div className="qr-modal d-flex flex-column justify-content-center align-items-center">
<span style={{ fontSize: fontSize.mobile.span }}>
اسکن کد QR موفقیت آمیز بود.
</span>
<Link style={{ fontSize: fontSize.mobile.a }} to={"/qr"}>
{tail}
</Link>
<button onClick={() => parent.setState({ tail: null })}>
انصراف
</button>
{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}
</Link>
<button onClick={() => parent.setState({ tail: null })}>
انصراف
</button>
</>
)}
</div>
)}
</>
);
}
}
export default QRModal;
// export default connect(
// (state) => ({ myList: state.userProduct.myList || [] }),
// { getMyList: userProduct.myList }
// )(QRModal);

@ -12,7 +12,7 @@
font-family: numeralLight;
color: white;
}
a {
a.ok {
text-decoration: none;
width: 50%;
margin: 25px auto;
@ -24,7 +24,8 @@
font-family: numeralLight;
border-radius: 25px;
}
button {
button,
.button {
text-decoration: none;
width: 30%;
min-width: 100px;
@ -53,9 +54,9 @@
font-family: numeralLight;
color: white;
}
a {
a.ok {
text-decoration: none;
width: 50%;
width: 40%;
margin: 25px auto;
background-color: #00cc69;
border: 2px solid white;
@ -65,11 +66,12 @@
font-family: numeralLight;
border-radius: 25px;
}
button {
button,
.button {
text-decoration: none;
width: 25%;
max-width: 100px;
margin: 15px auto;
margin: 15px;
background-color: #cc001b;
border: 2px solid white;
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 {
0% {
left: -100vw;
@ -90,3 +118,17 @@
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 { connect } from "react-redux";
import { qr } from "~/Redux/actions";
import { qr, userProduct } from "~/Redux/actions";
import sciense_6 from "../../assets/images/sciense-6.png";
@ -28,17 +28,19 @@ class QRScan extends Component {
state = {
value: null,
facingMode: 0,
tail: null,
tail: null, //"Zist10-146",
};
componentDidMount() {
console.log(this.props.myList);
if (!this.props.myList) this.props.getMyList({});
}
async componentDidUpdate() {
if (this.state.value) {
let tail = this.state.value.slice(
this.state.value.lastIndexOf("/") + 1,
this.state.value.length
);
this.props.info({ tail: tail });
console.log(this.props.list, tail);
// if (tail.length) this.props.info({ tail: tail });
this.setState({ value: null, tail: tail });
}
}
@ -77,12 +79,16 @@ class QRScan extends Component {
>
<ReplayIcon style={{ fontSize: 40, color: "grey" }} />
</div>
) : (
) : this.state.tail === null ? (
<Scanner parent={this} />
)}
) : null}
</section>
{this.state.tail === null ? null : (
<Modal tail={this.state.tail} />
<Modal
tail={this.state.tail}
parent={this}
myList={this.props.myList}
/>
)}
</div>
</div>
@ -124,7 +130,11 @@ class QRScan extends Component {
)}
</section>
{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") ? (
<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 })(
QRScan
);
export default connect(
(state) => ({ list: state.qr.list, myList: state.userProduct.myList }),
{
getMyList: userProduct.myList,
info: qr.info,
}
)(QRScan);
QRScan.defaultProps = {
data: [

Loading…
Cancel
Save