Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/info-dsm/INFO_v1_FrontEnd i…
Browse files Browse the repository at this point in the history
…nto #29-CreateNotice
  • Loading branch information
drainxc committed Dec 1, 2022
2 parents 5994b7c + e2f7699 commit 240aa4c
Show file tree
Hide file tree
Showing 26 changed files with 1,128 additions and 951 deletions.
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<div id="modal"></div>
<div id="applicant"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
83 changes: 60 additions & 23 deletions src/components/api/company/requesrResistration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,51 @@ import { useQuery } from "@tanstack/react-query";
import axios from "axios";
import { BaseUrl } from "../../../../export/base";
import { Notice } from "../../../common/notice";
const token =
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxNiIsInR5cGUiOiJhY2Nlc3MiLCJpYXQiOjE2Njg1NTg0OTIsImV4cCI6MTY2ODY0NDg5Mn0.0rFN6RNL2HcGNNL9-QW1BEfsNMaC2fQ20-dgN0GaUSU";
export const getListProps = () => {
// eslint-disable-next-line react-hooks/rules-of-hooks
return useQuery(["datas"], async () => {
let res;
let ad;
let arr = [];
await axios
.all([
axios.get(BaseUrl + "/notice/technology/list", {
axios.get(BaseUrl + "/notice/technology", {
headers: {
Authorization: `Bearer ${sessionStorage.getItem("accessToken")}`,
},
}),
axios.get(BaseUrl + "/notice/language/list", {
axios.get(BaseUrl + "/notice/language", {
headers: {
Authorization: `Bearer ${sessionStorage.getItem("accessToken")}`,
},
}),
axios.get(BaseUrl + "/notice/certificate/list", {
axios.get(BaseUrl + "/notice/certificate", {
headers: {
Authorization: `Bearer ${sessionStorage.getItem("accessToken")}`,
},
}),
axios.get(BaseUrl + "/notice/classification", {
headers: {
Authorization: `Bearer ${sessionStorage.getItem("accessToken")}`,
},
}),
])
.then(
axios.spread((res1, res2, res3) => {
axios.spread((res1, res2, res3, res4) => {
const data1 = res1.data;
const data2 = res2.data;
const data3 = res3.data;
res = [data1, data2, data3];
const data4 = res4.data;
res = [data1, data2, data3, data4];
console.log(res);
arr = [
{
bigClassification:
res[3][0].bigClassification.bigClassificationName,
smallClassification: [res[3][0].name],
},
];
let count = 0;
ad = new Array(3)
.fill(0)
.map((e, i) => new Array(res[i].length).fill({ skill: 0 }));
Expand All @@ -45,10 +59,45 @@ export const getListProps = () => {
for (let i = 0; i < ad[2].length; i++) {
ad[2][i].skill = res[2][i].certificateName;
}
for (let i = 1; i < res[3].length; i++) {
count = arr.findIndex(
(el) =>
el.bigClassification ===
res[3][i].bigClassification.bigClassificationName
);
if (count === undefined) {
arr.push({
bigclassification:
res[3][i].bigClassification.bigClassificationName,
smallClassification: [res[3][i].name],
});
} else {
arr[count].smallClassification.push(res[3][i].name);
}
}
})
);
return ad;
console.log([...ad, arr]);
return [...ad, arr];
});
};
export const InterviewProcess = async () => {
let arr;
await axios({
method: "get",
url: BaseUrl + "/notice/interview",
headers: {
Authorization: `Bearer ${sessionStorage.getItem("accessToken")}`,
},
}).then((res) => {
const data = res.data;
arr = new Array(data.length).fill({ skill: "", request: "" });
arr = arr.map((item, i) => {
return { skill: data[i].meaning, request: data[i].process };
});
});

return arr;
};
export const postNotice = (arr, ad) => {
let formData = new FormData();
Expand All @@ -65,7 +114,7 @@ export const postNotice = (arr, ad) => {
url: BaseUrl + "/notice",
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
Authorization: `Bearer ${sessionStorage.getItem("accessToken")}`,
"Content-Type": "multipart/form-data",
"Access-Control-Allow-Origin": "*",
},
Expand All @@ -88,20 +137,8 @@ export const getMyList = () => {
})
.then((response) => {
const data = response.data;
let arr = new Array(data.length)
.fill(0)
.map((e, i) =>
new Array(
data[i].data.notice.recruitmentBusinessResponse.length
).fill("")
);
let arr2 = new Array(data.length)
.fill(0)
.map((e, i) =>
new Array(
data[i].data.notice.recruitmentBusinessResponse.length
).fill("")
);
let arr = new Array(data.length).fill(0);
let arr2 = new Array(data.length).fill(0);
let count = [];
for (let i = 0; i < data.length; i++) {
let temp = 0;
Expand Down
61 changes: 13 additions & 48 deletions src/components/api/teacher/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { useQuery } from "@tanstack/react-query";
import axios from "axios";
import { BaseUrl } from "../../../export/base";
import { Notice } from "../../common/notice";
const token =
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIyNSIsInR5cGUiOiJhY2Nlc3MiLCJpYXQiOjE2Njg1NTUwMDgsImV4cCI6MTY2ODY0MTQwOH0.DjQe-bca6O9JA7__pyIsLBxDaiiqzRR885ZlWERGvc0";
export const getBoardList = async (id) => {
const { data } = await axios({
method: "get",
Expand All @@ -25,7 +23,7 @@ export const noticeRequest = async (method, path, query, message) => {
url: BaseUrl + path,
params: { noticeId: query },
headers: {
Authorization: `Bearer ${token}`,
Authorization: `Bearer ${sessionStorage.getItem("accessToken")}`,
},
})
.then((res) => {
Expand All @@ -50,56 +48,24 @@ export const postNoticeRequest = async (idx, path) => {
}).then((response) => {
const data = response.data;
console.log(data);
let arr = new Array(data.content.length)
.fill(0)
.map((e, i) =>
new Array(data.content[i].recruitmentBusinessResponse.length).fill("")
);
let arr2 = new Array(data.content.length)
.fill(0)
.map((e, i) =>
new Array(data.content[i].recruitmentBusinessResponse.length).fill("")
);
let as = new Array(data.content.length).fill(0);
let ad = new Array(data.content.length).fill(0);
let count = [];
for (let i = 0; i < data.content.length; i++) {
let temp = 0;
for (
let j = 0;
j < data.content[i].recruitmentBusinessResponse.length;
j++
) {
arr[i][j] =
data.content[i].recruitmentBusinessResponse[
j
].classificationResponse.bigClassification.bigClassificationName;
arr2[i][j] =
data.content[i].recruitmentBusinessResponse[
j
].classificationResponse.name;
temp =
temp +
data.content[i].recruitmentBusinessResponse[j].numberOfEmployee;
}
as[i] =
data.content[
i
].classificationResponse.bigClassification.bigClassification;
ad[i] = data.content[i].classificationResponse.name;
temp = data.content[i].numberOfEmployee;
count.push({
total: temp,
name: data.content[i].company.companyName,
id: data.content[i].noticeId,
num: data.content[i].company.companyNumber,
});
}
const ad = arr.map((item) =>
item.filter((e, i, ar) => {
return ar.findIndex((el) => e === el) === i;
})
);
const as = arr2.map((item) =>
item.filter((e, i, ar) => {
return ar.findIndex((el) => e === el) === i;
})
);
for (let i = 0; i < data.content.length; i++) {
as[i] = as[i].join();
ad[i] = ad[i].join();
}
res = {
count,
as,
Expand Down Expand Up @@ -175,13 +141,12 @@ export const getUseCompanyInfo = (id) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
return useQuery(["companyInfo", id], () => getCompanyInfo(id));
};
export const getUserCompany = async (id, idx) => {
export const getUserCompany = async (companyNum, id, status) => {
const { data } = await axios({
url: BaseUrl + "/hire/apply/" + id,
url: BaseUrl + `/applies/${companyNum}/${id}`,
method: "get",
params: {
idx: idx,
size: 5,
status: status,
},
headers: {
Authorization: `Bearer ${sessionStorage.getItem("accessToken")}`,
Expand Down
9 changes: 8 additions & 1 deletion src/components/common/header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ import styled from "styled-components";
import { useNavigate } from "react-router-dom";
const Header = (props) => {
const { title, description } = props;
const navigate = useNavigate();
const menu = [
{ menu: "회사" },
{ menu: "모집공고" },
{ menu: "개발팀" },
{ menu: "취업현황" },
{ menu: "내 정보" },
{ menu: "Support" },
];
return (
<>
<HeaderImg>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { StyledLink } from "../../../../../style/theme";

import ImageProps from "./Status";
const ResistrationList = ({ data }) => {
console.log(data);
return (
<>
<Ul>
Expand Down
Loading

0 comments on commit 240aa4c

Please sign in to comment.