parent
975d787694
commit
1bfe0c3272
15 changed files with 492 additions and 186 deletions
@ -0,0 +1,31 @@ |
||||
import proxy from "../proxy"; |
||||
const book = { |
||||
list: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("book/list", data, { dispatch }), |
||||
info: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("book/info", data, { dispatch }), |
||||
update: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.put("book/update", data); |
||||
await proxy.get("book/list", data2, { dispatch }); |
||||
}, |
||||
add: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.post("book/add", data); |
||||
await proxy.get("book/list", data2, { dispatch }); |
||||
}, |
||||
del: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.delete("book/delete", data); |
||||
await proxy.get("book/list", data2, { dispatch }); |
||||
}, |
||||
}; |
||||
|
||||
export default book; |
@ -0,0 +1,28 @@ |
||||
const initialState = { |
||||
loading: false, |
||||
error: null, |
||||
list: null, |
||||
info: null, |
||||
}; |
||||
export default function book(state = initialState, action) { |
||||
let { type, data } = action; |
||||
switch (type) { |
||||
case "book/list": |
||||
return { ...state, loading: false, list: data, error: null }; |
||||
case "book/info": |
||||
return { ...state, loading: false, list: null, info: data, error: null }; |
||||
case "book/update": |
||||
return { ...state, loading: false, error: null }; |
||||
case "book/add": |
||||
return { ...state, loading: false, error: null }; |
||||
case "book/delete": |
||||
return { ...state, loading: false, error: null }; |
||||
/////////////
|
||||
case "loading": |
||||
return { ...state, loading: true }; |
||||
case "error": |
||||
return { ...state, loading: false, error: data.message }; |
||||
default: |
||||
return state; |
||||
} |
||||
} |
@ -0,0 +1,35 @@ |
||||
import React, { Component } from "react"; |
||||
|
||||
import "./index.scss"; |
||||
export default function QRImage(props) { |
||||
const list = props.data.fileIds.split(","); |
||||
console.log(list); |
||||
return ( |
||||
<> |
||||
{window.innerWidth < 1000 ? ( |
||||
(list.length === 1 ? ( |
||||
<div className="mobile-qr-image d-flex"> |
||||
<img |
||||
className="mobile-qr-image__single" |
||||
src={`https://dnvn.ir/api/v1/file/${list[0]}`} |
||||
/> |
||||
</div> |
||||
) : null, |
||||
list.length !== 2 ? ( |
||||
<div className="mobile-qr-image d-flex"> |
||||
<img |
||||
className="mobile-qr-image__two" |
||||
src={`https://dnvn.ir/api/v1/file/${list[0]}`} |
||||
/> |
||||
<img |
||||
className="mobile-qr-image__two" |
||||
src={`https://dnvn.ir/api/v1/file/${list[1]}`} |
||||
/> |
||||
</div> |
||||
) : null) |
||||
) : ( |
||||
<p>reza</p> |
||||
)} |
||||
</> |
||||
); |
||||
} |
@ -0,0 +1,13 @@ |
||||
.mobile-qr-image { |
||||
width: 100%; |
||||
justify-content: space-between; |
||||
&__single { |
||||
width: 100%; |
||||
border-radius: 10px; |
||||
height: 200px; |
||||
} |
||||
&__two { |
||||
width: 49%; |
||||
height: 150px; |
||||
} |
||||
} |
Loading…
Reference in new issue