update 2 files and delete 2 files

master
amir hosein gorji 3 years ago
parent c7e1de0563
commit f542f68e87
  1. 95
      src/views/MyBook/index.css
  2. 135
      src/views/MyBook/index.js
  3. 99
      src/views/MyBooks/index.js
  4. 129
      src/views/MyBooks/index.scss
  5. 28
      src/views/Orders/index.js

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

@ -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 (
<div className="mybooks">
<Navbar />
<div className="mybooks-title">کتاب های من</div>
<div className="mybooks-tabs">
<div className="mybooks-tabs-item mybooks-tabs-item1">
فعال سازی شده
</div>
<div className="mybooks-tabs-item mybooks-tabs-item2">دیجیتال</div>
</div>
<div className="mybooks-line"></div>
<div className="mybooks-main-content">
{data.map((item) => (
<div key={item.id} className="mybooks-main-content-item">
<div className="mybooks-main-content-row1">
<div className="mybooks-main-content-row1-img-container">
<img
src={`https://dnvn.ir/api/v1/file/${
item.product.book.fileIds.split(",")[0]
}`}
className="mybooks-main-content-row1-img"
alt="mybook-img"
/>
</div>
<div className="mybooks-main-content-row1-text">
<div className="mybooks-main-content-row1-text-name">
نام آیتم: {item.product.book.name}
</div>
<div className="mybooks-main-content-row1-text-activation-date">
تاریخ فعالسازی: {moment(item.updatedAt).format("YYYY/M/D")}
</div>
<div className="mybooks-main-content-row1-text-activation-code">
کد فعالسازی: {item.activation_code}
</div>
</div>
</div>
</div>
))}
</div>
</div>
);
}
export default MyBooks2;

@ -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 (
<div className="mybooks">
<Navbar />
<div className="mybooks-title">کتاب های من</div>
<div className="mybooks-tabs">
<div className="mybooks-tabs-item mybooks-tabs-item1 mybooks-tabs-active">
فعال سازی شده
</div>
<div
className="mybooks-tabs-item mybooks-tabs-item2"
style={{ opacity: 0.2 }}
>
دیجیتال{" "}
</div>
</div>
<div className="mybooks-main-content">
{data.map((item) => (
<div key={item.id} className="mybooks-main-content-item">
<div className="mybooks-main-content-row1">
<div className="mybooks-main-content-row1-img-container">
<img
src={`https://dnvn.ir/api/v1/file/${
item.product.book.fileIds.split(",")[0]
}`}
className="mybooks-main-content-row1-img"
alt="mybook-img"
/>
</div>
<div className="mybooks-main-content-row1-text d-flex justify-content-between flex-column">
<div className="mybooks-main-content-row1-text-name">
{item.product.book.name} {"پایه "}
{grades[item.product.book.gradeId]}
</div>
<div className="mybooks-main-content-row1-text-activation-date">
تاریخ فعالسازی: {moment(item.updatedAt).format("YYYY/M/D")}
</div>
<div className="mybooks-main-content-row1-text-activation-code">
کد فعالسازی: {item.activationCode}
</div>
<div className="d-flex justify-content-around mybooks-main-content_bottoms">
<Link to="/qr-scan"> اسکن بارکد</Link>
{window.innerWidth < 1000 ? (
<a
href={`https://ar.dnvn.ir/lunch?id=${item.product?.ARId}`}
target="_blank"
rel="noreferrer"
className=""
>
واقعیت افزوده
</a>
) : null}
</div>
</div>
</div>
</div>
))}
</div>
</div>
);
}
}
export default connect(
(state) => ({
myList: state.userProduct.myList,
loading: state.loading,
}),
{
getMyList: userProduct.myList,
}
)(MyBooks);

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

@ -52,20 +52,21 @@ class Orders extends Component {
className="order-data-container-item-row1-order-status-circle"
></div>
<div
style={
item.condition == 1
? { backgroundColor: "#B0F8B5", color: "#0F9420" }
: item.condition == 2
? { backgroundColor: "#B5FFFD", color: "#30C2BD" }
: item.condition == 3
? { backgroundColor: "#FDC9B6", color: "#FA4C0D" }
: null
}
style={{
color: [0, "#0F9420", "#30C2BD", "#FA4C0D"][
item.condition
],
backgroundColor: [0, "#B0F8B5", "#B5FFFD", "#FDC9B6"][
item.condition
],
}}
className="order-data-container-item-row1-order-status-text"
>
{item.condition == 1 && "در حال پردازش"}
{item.condition == 2 && "ارسال شد"}
{item.condition == 3 && "لغو شد"}
{
["پرداخت نشده", "در حال پردازش", "ارسال شد", "لغو شد"][
item.condition
]
}
</div>
</div>
</div>
@ -85,12 +86,11 @@ class Orders extends Component {
مبلغ : <span>{item.payPrice}</span>{" "}
<span className="odcir2op-unit">تومان</span>
</div>
{item.offCodePrice != 0 && (
<div className="order-data-container-item-row3-order-offcodeprice">
تخفیف : <span>{item.offPrice}</span>{" "}
<span className="odcir2oo-unit">تومان</span>
</div>
)}
</div>
<div className="order-data-container-item-row4">
<div className="order-data-container-item-row4-imgs">

Loading…
Cancel
Save