From f542f68e87fc0e44eca0e3f67fecd342cfa85240 Mon Sep 17 00:00:00 2001 From: amir hosein gorji Date: Tue, 21 Sep 2021 05:56:33 +0430 Subject: [PATCH] update 2 files and delete 2 files --- src/views/MyBook/index.css | 95 ------------------------ src/views/MyBook/index.js | 135 ----------------------------------- src/views/MyBooks/index.js | 99 +++++++++++++++++++++++++ src/views/MyBooks/index.scss | 129 +++++++++++++++++++++++++++++++++ src/views/Orders/index.js | 36 +++++----- 5 files changed, 246 insertions(+), 248 deletions(-) delete mode 100644 src/views/MyBook/index.css delete mode 100644 src/views/MyBook/index.js create mode 100644 src/views/MyBooks/index.js create mode 100644 src/views/MyBooks/index.scss diff --git a/src/views/MyBook/index.css b/src/views/MyBook/index.css deleted file mode 100644 index 7fa69dc..0000000 --- a/src/views/MyBook/index.css +++ /dev/null @@ -1,95 +0,0 @@ - -.mybooks{ - width: 100%; - padding:0 5px; - margin-top: 60px; -} - -.mybooks-title{ - width: 100%; - direction: rtl; - font-size: 25px; - font-weight: bold; - color: #5DC964; -} - -.mybooks-tabs{ - width: 100%; - display: flex; - align-items: center; - direction: rtl; - margin-top: 10px; -} - -.mybooks-tabs-item{ - width: 50%; - height: 50px; - display: flex; - align-items: center; - justify-content: center; - font-size: 20px; - cursor: pointer; -} - -.mybooks-tabs-item1{ - border-radius: 0 5px 5px 0; - border: 1px solid #418f46; - background-color: white; - color: #5DC964; -} - -.mybooks-tabs-item2{ - border-radius: 5px 0px 0px 5px; - border: 1px solid #418f46; - background-color: #5DC964; - color: white; -} - -.mybooks-line{ - width: 100%; - height: 1px; - background-color: rgb(201, 199, 199); - margin-top: 15px; -} - -.mybooks-main-content{ - width: 100%; - margin-top: 15px; -} - -.mybooks-main-content-item{ - width: 100%; -} - -.mybooks-main-content-row1{ - width: 100%; - display: flex; - justify-content: space-between; - direction: ltr; - padding: 15px 0; - border-bottom: 1px solid rgb(201, 199, 199); -} - -.mybooks-main-content-row1-img-container{ - width: 25%; - height: auto; - border-radius: 5px; - overflow: hidden; -} - -.mybooks-main-content-row1-img{ - width: 100%; - height: 100%; -} - -.mybooks-main-content-row1-text{ - width: 80%; -} - -.mybooks-main-content-row1-text-name, -.mybooks-main-content-row1-text-activation-date, -.mybooks-main-content-row1-text-activation-code{ - width: 100%; - font-size: 16px; - margin-bottom: 10px; -} diff --git a/src/views/MyBook/index.js b/src/views/MyBook/index.js deleted file mode 100644 index bd0a244..0000000 --- a/src/views/MyBook/index.js +++ /dev/null @@ -1,135 +0,0 @@ -import { useState } from 'react'; -import Navbar from '../Home/Navbar'; -import './index.css'; -import moment from "jalali-moment"; - -const MyBooks2=()=>{ - - const [data, set_data] = useState([ - { - id: 291, - pid: null, - ord: null, - productId: 3, - userId: 21, - factorId: null, - authorId: null, - count: 1, - price: null, - finalPrice: null, - condition: 2, - isActive: 1, - productType: 3, - createdAt: "2021-09-16T14:01:02.180Z", - updatedAt: "2021-09-16T14:01:02.180Z", - activation_code: "2042308", - deletedAt: null, - product: { - bookId: 1, - productType: 3, - price: 0, - ARId: 228, - book: { - id: 1, - name: "علوم تجربی", - category: "دسته بندی", - text: null, - description: null, - publishYear: 1399, - pagesNum: 1, - authorName: "دکتر علی عبدالعالی", - gradeId: 6, - fileIds: "2094", - operators: null, - items: null, - sampleFileId: "2132", - categoryIds: null, - }, - }, - }, - { - id: 170, - pid: null, - ord: null, - productId: 36, - userId: 21, - factorId: null, - authorId: null, - count: 1, - price: null, - finalPrice: null, - condition: 2, - isActive: 1, - productType: 3, - createdAt: "2021-09-12T18:27:57.399Z", - updatedAt: "2021-09-12T18:27:57.399Z", - activation_code: "2042308", - deletedAt: null, - product: { - bookId: 12, - productType: 3, - price: 0, - ARId: 258, - book: { - id: 12, - name: "ریاضی", - category: "دسته بندی", - text: null, - description: null, - publishYear: 1399, - pagesNum: 1, - authorName: "دکتر علی عبدالعالی", - gradeId: 1, - fileIds: "2104", - operators: null, - items: null, - sampleFileId: "2125", - categoryIds: null, - }, - }, - }, - ]); - return ( -
- -
کتاب‌ های من
-
-
- فعال سازی شده -
-
دیجیتال
-
-
-
- {data.map((item) => ( -
-
-
- mybook-img -
-
-
- نام آیتم: {item.product.book.name} -
-
- تاریخ فعال‌سازی: {moment(item.updatedAt).format("YYYY/M/D")} -
-
- کد فعال‌سازی: {item.activation_code} -
-
-
-
- ))} -
-
- ); -} - -export default MyBooks2; \ No newline at end of file diff --git a/src/views/MyBooks/index.js b/src/views/MyBooks/index.js new file mode 100644 index 0000000..d05cb2d --- /dev/null +++ b/src/views/MyBooks/index.js @@ -0,0 +1,99 @@ +import React, { Component } from "react"; +import Navbar from "../Home/Navbar"; +import { connect } from "react-redux"; +import { userProduct } from "~/Redux/actions"; +import moment from "jalali-moment"; +import "./index.scss"; +import { Link } from "react-router-dom"; +const grades = [ + "پیش دبستان", + "اول", + "دوم", + "سوم", + "چهارم", + "پنجم", + "ششم", + "هفتم", + "هشتم", + "نهم", + "دهم", + "یازدهم", + "دوازدهم", +]; +class MyBooks extends Component { + componentDidMount() { + if (!this.props.mylist) this.props.getMyList(); + } + + render() { + const data = (this.props.myList || []).filter((e) => +e.productType === 3); + return ( +
+ +
کتاب‌ های من
+
+
+ فعال سازی شده +
+
+ دیجیتال{" "} +
+
+
+ {data.map((item) => ( +
+
+
+ mybook-img +
+
+
+ {item.product.book.name} {"پایه "} + {grades[item.product.book.gradeId]} +
+
+ تاریخ فعال‌سازی: {moment(item.updatedAt).format("YYYY/M/D")} +
+
+ کد فعال‌سازی: {item.activationCode} +
+
+ اسکن بارکد + {window.innerWidth < 1000 ? ( + + واقعیت افزوده + + ) : null} +
+
+
+
+ ))} +
+
+ ); + } +} +export default connect( + (state) => ({ + myList: state.userProduct.myList, + loading: state.loading, + }), + { + getMyList: userProduct.myList, + } +)(MyBooks); diff --git a/src/views/MyBooks/index.scss b/src/views/MyBooks/index.scss new file mode 100644 index 0000000..458ca8e --- /dev/null +++ b/src/views/MyBooks/index.scss @@ -0,0 +1,129 @@ +.mybooks { + width: 100%; + padding: 0 5px; + + max-width: 700px; + margin: auto; + margin-top: 60px; +} + +.mybooks-title { + text-align: center; + width: 100%; + direction: rtl; + font-size: 25px; + font-weight: bold; + color: #5dc964; +} + +.mybooks-tabs { + width: 100%; + display: flex; + align-items: center; + direction: rtl; + margin-top: 10px; +} + +.mybooks-tabs-item { + width: 50%; + height: 50px; + display: flex; + align-items: center; + justify-content: center; + font-size: 20px; + cursor: pointer; +} + +.mybooks-tabs-item1 { + border-radius: 0 5px 5px 0; + border: 1px solid #418f46; + background-color: white; + color: #5dc964; +} + +.mybooks-tabs-item2 { + border-radius: 5px 0px 0px 5px; + border: 1px solid #418f46; + background-color: white; + color: #5dc964; +} + +.mybooks-tabs-active { + background-color: #5dc964; + color: white; +} + +.mybooks-line { + width: 100%; + height: 1px; + background-color: rgb(201, 199, 199); + margin-top: 15px; +} + +.mybooks-main-content { + width: 100%; + margin-top: 15px; +} + +.mybooks-main-content-item { + width: 100%; + padding: 0 10px; +} + +.mybooks-main-content-row1 { + width: 100%; + display: flex; + justify-content: space-between; + direction: ltr; + padding: 15px 0; + border-bottom: 1px solid rgb(201, 199, 199); +} + +.mybooks-main-content-row1-img-container { + width: 25%; + min-width: 60px; + max-width: 100px; + width: 20%; + height: auto; + + overflow: hidden; + margin: auto auto 0 auto; +} + +.mybooks-main-content-row1-img { + width: 100%; + + border-radius: 5px; +} + +.mybooks-main-content-row1-text { + width: 80%; +} + +.mybooks-main-content-row1-text-name { + font-size: 18px; + color: #2a8f8f; + font-weight: bold; + margin-bottom: 10px; +} +.mybooks-main-content-row1-text-activation-date, +.mybooks-main-content-row1-text-activation-code { + width: 100%; + font-size: 13px; + margin-bottom: 5px; +} +.mybooks-main-content_bottoms { + margin-top: 5px; + a { + text-decoration: none; + color: aliceblue; + background-color: #5dc964; + border-radius: 5px; + padding: 5px 10px; + cursor: pointer; + } + a:hover { + color: aliceblue; + background-color: #418f46; + } +} diff --git a/src/views/Orders/index.js b/src/views/Orders/index.js index d8ec3b7..1dca636 100644 --- a/src/views/Orders/index.js +++ b/src/views/Orders/index.js @@ -52,20 +52,21 @@ class Orders extends Component { className="order-data-container-item-row1-order-status-circle" >
- {item.condition == 1 && "در حال پردازش"} - {item.condition == 2 && "ارسال شد"} - {item.condition == 3 && "لغو شد"} + { + ["پرداخت نشده", "در حال پردازش", "ارسال شد", "لغو شد"][ + item.condition + ] + }
@@ -85,12 +86,11 @@ class Orders extends Component { مبلغ : {item.payPrice}{" "} تومان - {item.offCodePrice != 0 && ( -
- تخفیف : {item.offPrice}{" "} - تومان -
- )} + +
+ تخفیف : {item.offPrice}{" "} + تومان +