|
|
|
@ -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);
|
|
|
|
|