이수빈

test update

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
\ No newline at end of file
[1202/001140.204:ERROR:directory_reader_win.cc(43)] FindFirstFile: 지정된 경로를 찾을 수 없습니다. (0x3)
[1202/005241.162:ERROR:directory_reader_win.cc(43)] FindFirstFile: 지정된 경로를 찾을 수 없습니다. (0x3)
[{"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\App.js":"1","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\Home.js":"2","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\test.js":"3","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\index.js":"4"},{"size":450,"mtime":1606585705558,"results":"5","hashOfConfig":"6"},{"size":493,"mtime":1606590087333,"results":"7","hashOfConfig":"6"},{"size":2796,"mtime":1606623443075,"results":"8","hashOfConfig":"6"},{"size":238,"mtime":1606589880919,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"pqxpq",{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\App.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\Home.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\test.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\index.js",[]]
\ No newline at end of file
[{"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\App.js":"1","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\Home.js":"2","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\test.js":"3","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\index.js":"4"},{"size":450,"mtime":1606821338165,"results":"5","hashOfConfig":"6"},{"size":493,"mtime":1606821338174,"results":"7","hashOfConfig":"6"},{"size":5504,"mtime":1606845175132,"results":"8","hashOfConfig":"6"},{"size":238,"mtime":1606589880919,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"pqxpq",{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"14","messages":"15","errorCount":0,"warningCount":8,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\App.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\Home.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\test.js",["18","19","20","21","22","23","24","25"],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\index.js",[],{"ruleId":"26","severity":1,"message":"27","line":1,"column":17,"nodeType":"28","messageId":"29","endLine":1,"endColumn":26},{"ruleId":"26","severity":1,"message":"30","line":38,"column":8,"nodeType":"28","messageId":"29","endLine":38,"endColumn":22},{"ruleId":"26","severity":1,"message":"31","line":69,"column":8,"nodeType":"28","messageId":"29","endLine":69,"endColumn":22},{"ruleId":"26","severity":1,"message":"32","line":107,"column":9,"nodeType":"28","messageId":"29","endLine":107,"endColumn":18},{"ruleId":"26","severity":1,"message":"33","line":107,"column":20,"nodeType":"28","messageId":"29","endLine":107,"endColumn":40},{"ruleId":"26","severity":1,"message":"34","line":108,"column":9,"nodeType":"28","messageId":"29","endLine":108,"endColumn":18},{"ruleId":"26","severity":1,"message":"35","line":108,"column":20,"nodeType":"28","messageId":"29","endLine":108,"endColumn":40},{"ruleId":"26","severity":1,"message":"36","line":146,"column":7,"nodeType":"28","messageId":"29","endLine":146,"endColumn":31},"no-unused-vars","'useEffect' is defined but never used.","Identifier","unusedVar","'questions_cool' is assigned a value but never used.","'questions_warm' is assigned a value but never used.","'score_w_s' is assigned a value but never used.","'setScore_warm_spring' is assigned a value but never used.","'score_w_a' is assigned a value but never used.","'setScore_warm_autumn' is assigned a value but never used.","'handlePersonalScore_cool' is assigned a value but never used."]
\ No newline at end of file
......
......@@ -21,3 +21,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# folder
node_modules/
......
......@@ -12182,6 +12182,15 @@
"whatwg-fetch": "^3.4.1"
}
},
"react-console": {
"version": "1.0.0-rc.2",
"resolved": "https://registry.npmjs.org/react-console/-/react-console-1.0.0-rc.2.tgz",
"integrity": "sha512-3fxT5x07GImC+1DOGtn8FBwwBgdNrp+HWbVBBcVe/iC5ilFEZWQm2lY8jh+2SYWiJ74TrTSQy909ouGzzeTOYg==",
"requires": {
"react-is": "^16.13.1",
"react-reconciler": "^0.25.1"
}
},
"react-dev-utils": {
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-11.0.1.tgz",
......@@ -12287,6 +12296,28 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
},
"react-reconciler": {
"version": "0.25.1",
"resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.25.1.tgz",
"integrity": "sha512-R5UwsIvRcSs3w8n9k3tBoTtUHdVhu9u84EG7E5M0Jk9F5i6DA1pQzPfUZd6opYWGy56MJOtV3VADzy6DRwYDjw==",
"requires": {
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1",
"prop-types": "^15.6.2",
"scheduler": "^0.19.1"
},
"dependencies": {
"scheduler": {
"version": "0.19.1",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.1.tgz",
"integrity": "sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==",
"requires": {
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1"
}
}
}
},
"react-refresh": {
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz",
......
......@@ -7,6 +7,7 @@
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.2.2",
"react": "^17.0.1",
"react-console": "^1.0.0-rc.2",
"react-dom": "^17.0.1",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
......
import React, { useState } from 'react';
import './test.css';
import React, { useEffect,useState } from 'react'; //리액트 불러오기
import console from 'react-console'; //리액트 콘솔_크롬으로 실행
import './test.css';//test.css 불러오기
const Test = ( { history } ) =>
{
......@@ -33,59 +33,134 @@ const Test = ( { history } ) =>
{ answerText: '아니오', isCorrect: false }
],
},
];
]; //웜,쿨 파악
const [currentQuestion, setCurrentQuestion] = useState(0);
const [showScore, setShowScore] = useState(false);
const [score_c, setScore_cool] = useState(0);
const [score_w, setScore_warm] = useState(0);
const [score, setPersonal] = useState(0);
var isTrue = 0;
const questions_cool = [
{
questionText: '머리카락 색이 검정에 가깝다',
answerOptions: [
{ answerText: '예', isCorrect: true },
{ answerText: '아니오', isCorrect: false }
],
},
{
questionText: '피부에 붉은 기가 많다',
answerOptions: [
{ answerText: '예', isCorrect: true },
{ answerText: '아니오', isCorrect: false }
],
},
{
questionText: '손목 혈관 색이 초록색이다',
answerOptions: [
{ answerText: '예', isCorrect: false },
{ answerText: '아니오', isCorrect: true }
],
},
{
questionText: '햇볕에 장시간 있으면 피부가 붉어진다',
answerOptions: [
{ answerText: '예', isCorrect: true },
{ answerText: '아니오', isCorrect: false }
],
},
]; //여름쿨톤, 겨울쿨톤 파악
const handleAnswerOptionClick = (isCorrect) => {
const questions_warm = [
{
questionText: '머리카락 색이 검정에 가깝다',
answerOptions: [
{ answerText: '예', isCorrect: true },
{ answerText: '아니오', isCorrect: false }
],
},
{
questionText: '피부에 붉은 기가 많다',
answerOptions: [
{ answerText: '예', isCorrect: true },
{ answerText: '아니오', isCorrect: false }
],
},
{
questionText: '손목 혈관 색이 초록색이다',
answerOptions: [
{ answerText: '예', isCorrect: false },
{ answerText: '아니오', isCorrect: true }
],
},
{
questionText: '햇볕에 장시간 있으면 피부가 붉어진다',
answerOptions: [
{ answerText: '예', isCorrect: true },
{ answerText: '아니오', isCorrect: false }
],
},
]; //봄웜톤, 가을웜톤 파악
const [currentQuestion, setCurrentQuestion] = useState(0); //현재 문제 번호 [변수, 함수]
const [showScore, setShowScore] = useState(false); //결과 보여줄까?
const [score_c, setScore_cool] = useState(0); //쿨톤 점수 -> 웜,쿨 리스트에서 사용
const [score_w, setScore_warm] = useState(0); //웜톤 점수 -> 웜,쿨 리스트에서 사용
const [score_c_s, setScore_cool_summer] = useState(0);
const [score_c_w, setScore_cool_winter] = useState(0);
const [score_w_s, setScore_warm_spring] = useState(0);
const [score_w_a, setScore_warm_autumn] = useState(0);
const [score, setPersonal] = useState(""); //퍼스널컬러 결과
const handleAnswerOptionClick = (isCorrect) => { //main 함수 1_웜쿨 검사
if (isCorrect) {
setScore_cool(score_c + 1); //c,c,w,w
handlePersonalScore(score_c,score_w);
}
else{
setScore_warm(score_w + 1);
handlePersonalScore(score_c,score_w);
setScore_cool(score_c + 1);
setScore_cool_summer(score_c_s + 1);
console.log('c' + score_c);
}
else{
setScore_warm(score_w + 1);
setScore_cool_winter(score_c_w + 1);
console.log('w' + score_w);
} ///웜,쿨 if문으로 점수 올리기
const nextQuestion = currentQuestion + 1;
if (nextQuestion < questions.length) {
setCurrentQuestion(nextQuestion); //0,0 -> 0,1 -> 1,2 -> 2,3
} else if(nextQuestion === questions.length){
handlePersonalScore(score_c,score_w);
setCurrentQuestion(nextQuestion);
}
else{
isTrue = 1;
if(isTrue===1)
{
setShowScore(true);
}
setShowScore(true); //questions 끝나면 점수 보여줄까? true -> className='score-section'
}
};
const handlePersonalScore = (score_c,score_w) => {
if(score_c>score_w){
setPersonal('cool');
}
else if(score_c<score_w){
setPersonal('warm');
}
else{
setPersonal('restart');
}
}; //함수1 끝.
const handlePersonalScore = (score_c,score_w) =>{ //함수2_웜,쿨 점수로 결과 구하기
if(score_c>score_w){
setPersonal('cool');
}
else if(score_c<score_w){
setPersonal('warm');
}
else{
setPersonal('restart');
}
}; //함수2 끝.
const handlePersonalScore_cool = (score_c_s,score_c_w) =>{ //함수3_여쿨, 겨쿨 점수로 결과 구하기
if(score_c_s>score_c_w){
setPersonal('summer cool');
}
else if(score_c_s<score_c_w){
setPersonal('winter cool');
}
else{
setPersonal('restart');
}
}; //함수3 끝.
return (
<div className='app'>
{showScore ? (
{showScore ? (
<span className='score-section'>
You scored {score_c}{score_w}{score} out of {questions.length}
You scored {score} out of {questions.length}
<button onClick={() => handlePersonalScore(score_c,score_w)}>result</button>
</span>
) : (
<>
......