End.js 1.39 KB
Newer Older
JeongYeonwoo's avatar
JeongYeonwoo committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React from 'react'
import './End.css'
import tr from './img/img_end.jpg';


// import { Link } from 'react-router-dom';

function End() {
    let a = []
    for (let i = 0; i < 3; i++) {
        if (localStorage.getItem('' + (i + 1)) === localStorage.getItem('정답' + (i + 1))) {
            a[i] = 1
            localStorage.setItem('채점' + (i + 1), 'O')
        }
        else {
            a[i] = 0
            localStorage.setItem('채점' + (i + 1), 'X')
        }
    }

    return (
        <>
            <div className="card" >
                <div className='card-header'>
                    -채점표-
                <div className='card-body'>
                        <h3 className='card-title'>이름 : {localStorage.getItem('name')}</h3>


                        <p className='card-text'>Quiz 1 : {localStorage.getItem('채점1')}</p>
                        <p className='card-text'>Quiz 2 : {localStorage.getItem('채점2')}</p>
                        <p className='card-text'>Quiz 3 : {localStorage.getItem('채점3')}</p>
                        <p className='card-text'>Total Score : {a[0] + a[1] + a[2]}</p>
                    </div>
                    <div style={{ marginTop: '100px' }} className="Box text-center">
                        <img src={tr} alt="수고" />

                    </div>
                </div>
            </div>
        </>

    )
}

export default End;