Roller
diff --git a/src/components/event-description-board.vue b/src/components/event-description-board.vue index d08cfa3..b91aa34 100644 --- a/src/components/event-description-board.vue +++ b/src/components/event-description-board.vue @@ -1,25 +1,61 @@ \ No newline at end of file diff --git a/src/components/main-frame.vue b/src/components/main-frame.vue index ed81885..a5993bd 100644 --- a/src/components/main-frame.vue +++ b/src/components/main-frame.vue @@ -5,13 +5,31 @@ import {ref} from "vue"; import EventDescriptionBoard from "./event-description-board.vue"; const number=ref(0); const enable=ref(false); -const score=ref(0); +const score=ref(0.0); const sno=ref(""); const sname=ref(""); -function getStuInfo() +const eventID=ref(0); +const eventDescription=ref("") +let init=false; +let score_variation = 0.0; +function start() { - let res = fetch("http://127.0.0.1:8000/get_random_stu",{method: "GET"}); - res.then((res)=>{ + if(init) + { + fetch("http://localhost:8000/api/post/update_score",{ + method: "POST", + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + sno: sno.value, + variation: score.value - score_variation}) + }) + } + init=true; + fetch("http://127.0.0.1:8000/api/get/get_random_stu",{method: "GET"}) + .then((res)=>{ return res.json() }).then((data)=>{ // noinspection JSUnresolvedReference @@ -19,6 +37,24 @@ function getStuInfo() // noinspection JSUnresolvedReference sname.value = data.sname }) + fetch("http://localhost:8000/api/get/get_random_event",{method: "GET"}) + .then((res)=>{ + return res.json() + }).then((data)=>{ + // noinspection JSUnresolvedReference + eventID.value = data.event_id + enable.value = eventID.value !== 0; + // noinspection JSUnresolvedReference + eventDescription.value = data.event_description + }) + switch (eventID.value) { + case 1: + score_variation = 1; + break; + case 2: + score_variation = -0.5; + break; + } } @@ -27,9 +63,9 @@ function getStuInfo()
- +
- +