

230302 김동준 QnA 목록 조회 추가
@b9644ae4325b2f44b5ec3a3e50621ab4467b9778
--- client/views/pages/callcenter/QuestionSelect.jsx
+++ client/views/pages/callcenter/QuestionSelect.jsx
... | ... | @@ -1,4 +1,4 @@ |
1 |
-import React from "react"; |
|
1 |
+import React, {useState } from "react"; |
|
2 | 2 |
import Button from "../../component/Button.jsx"; |
3 | 3 |
import Table from "../../component/Table.jsx"; |
4 | 4 |
import QnAModal from "../../component/QnAModal.jsx"; |
... | ... | @@ -16,7 +16,47 @@ |
16 | 16 |
const closeModal = () => { |
17 | 17 |
setModalOpen(false); |
18 | 18 |
}; |
19 |
+ |
|
20 |
+ const [qnalist, setQnaList] = useState(); |
|
19 | 21 |
|
22 |
+ const [state, setState] = useState(); |
|
23 |
+ const [title, setTitle] = useState(); |
|
24 |
+ const [username, setUsername] = useState(); |
|
25 |
+ const [datetime, setDatetime] = useState(); |
|
26 |
+ |
|
27 |
+ //-------- 페이징 작업 설정 시작 --------// |
|
28 |
+ const limit = 15; // 페이지당 보여줄 공지 개수 |
|
29 |
+ const [page, setPage] = React.useState(1); //page index |
|
30 |
+ const offset = (page - 1) * limit; //게시물 위치 계산 |
|
31 |
+ const [myQnaTotal, setMyQnaTotal] = React.useState(0); //최대길이 넣을 변수 |
|
32 |
+ |
|
33 |
+ //qna 조회 |
|
34 |
+ const getQnaList = () => { |
|
35 |
+ fetch("/qna/qnaSelectList.json", { |
|
36 |
+ method: "POST", |
|
37 |
+ headers: { |
|
38 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
39 |
+ }, |
|
40 |
+ body: JSON.stringify({ |
|
41 |
+ |
|
42 |
+ qna_state : state, |
|
43 |
+ qna_title : title, |
|
44 |
+ qna_insert_user_id : username, |
|
45 |
+ qna_insert_datetime : datetime |
|
46 |
+ |
|
47 |
+ }), |
|
48 |
+ }).then((response) => response.json()).then((data) => { |
|
49 |
+ |
|
50 |
+ console.log(data); |
|
51 |
+ setQnaList(data); |
|
52 |
+ setMyQnaTotal(data.length); |
|
53 |
+ |
|
54 |
+ |
|
55 |
+ }).catch((error) => { |
|
56 |
+ console.log('getSelectSeniorList() /user/selectUserList.json error : ', error); |
|
57 |
+ }); |
|
58 |
+ }; |
|
59 |
+ |
|
20 | 60 |
//게시판 |
21 | 61 |
const thead = [ |
22 | 62 |
"No", |
... | ... | @@ -67,7 +107,14 @@ |
67 | 107 |
/> |
68 | 108 |
</div> |
69 | 109 |
</div> |
70 |
- <Table className="equipment-detail" head={thead} contents={content} contentKey={key} /> |
|
110 |
+ <Table |
|
111 |
+ className="equipment-detail" |
|
112 |
+ head={thead} |
|
113 |
+ contents={content} |
|
114 |
+ contentKey={key} |
|
115 |
+ view={"qna"} |
|
116 |
+ offset={offset} |
|
117 |
+ limit={limit}/> |
|
71 | 118 |
</div> |
72 | 119 |
</main> |
73 | 120 |
); |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?