AI智能解答
//
// let item = {
// q: q,
// a: [
// "A 单次",
// "B 一年多次",
// "C 两次一年",
// "D 两年一次",
// ],
// answer: "B",
// };
// let item1 = {
// q: "以下哪国不属于亚洲国家",
// a: ["A 美国", "B 中国", "C 俄罗斯", "D 法国"],
// answer: "A",
// };
// quiz.push(item);
// quiz.push(item1);
// console.log(quiz);
// return quiz;
// };
changeQuizFlag = () => {
this.setState({
quizFlag: true,
});
this.setLocalStorage();
};
setLocalStorage = () => {
var quiz = this.state.quiz;
try {
localStorage.setItem("quizKey", JSON.stringify(quiz));
} catch (err) {
console.log(err);
}
};
getLocalStorage = () => {
var quiz = JSON.parse(localStorage.getItem("quizKey"));
if (quiz == null || quiz.length < 1) {
var quiz = this.state.quiz;
}
this.setState({
quiz: quiz,
});
};
hasLocalStorage = () => {
if (localStorage.getItem("quizKey")) {
console.log("has quiz");
this.getLocalStorage();
} else {
console.log("no quiz");
this.setLocalStorage();
}
};
//提交题目
submitQuestion = () => {
const { currentIndex, selectedOptions, question, quiz } = this.state;
var arr = [...quiz];
let anwserArr = question.a;
let userSelection = "";
arr[currentIndex].answer = selectedOptions;
arr[currentIndex].fValue = anwserArr[selectedOptions];
selectedOptions == 0
? (userSelection = anwserArr[0])
: selectedOptions == 1
? (userSelection = anwserArr[1])
: selectedOptions == 2
? (userSelection = anwserArr[2])
: selectedOptions == 3
? (userSelection = anwserArr[3])
: console.log("no anwser");
arr[currentIndex].userSelection = userSelection;
this.setState({
quiz: arr,
});
console.log(arr);
this.nextOption();
};
nextOption = () => {
if (this.state.quiz.length - 1 > this.state.currentIndex) {
this.setState({
currentIndex: this.state.currentIndex + 1,
selectedOptions: -1,
});
} else {
this.setState({
quizFlag: false,
currentIndex: 0,
selectedOptions: -1,
});
}
};
onOptionsChange = (e) => {
// console.log(e.target.value);
this.setState({
selectedOptions: e.target.value,
});
};
sliderEvt = (e) => {
this.setState({
currentIndex: e.target.value,
selectedOptions: -1,
});
};
whichAnswer = (fValue, userSelection) => {
let arr = [...this.state.quiz];
let flag = userSelection == fValue ? "green" : "red";
return (
{userSelection}:{arr[this.state.currentIndex].answer ==
arr[this.state.currentIndex].selectedOptions
? "correct"
: "incorrect"}
);
};
handleQuizFlag = () => {
if (this.state.quizFlag === false) {
return ;
} else {
return (
style={{
textAlign: "center",
height: "500px",
overflowY: "scroll",
}}
>
{this.state.quiz.length > 1 && (
<>
{this.state.currentIndex + 1}. {this.state.question.q}
A: {this.state.question.a[0]}
B: {this.state.question.a[1]}
C: {this.state.question.a[2]}
D: {this.state.question.a[3]}
type="radio"
name="g1"
value="0"
onChange={this.onOptionsChange}
checked={this.state.selectedOptions == 0}
/>
type="radio"
name="g1"
value="1"
onChange={this.onOptionsChange}
checked={this.state.selectedOptions == 1}
/>
type="radio"
name="g1"
value="2"
onChange={this.onOptionsChange}
checked={this.state.selectedOptions == 2}
/>
type="radio"
name="g1"
value="3"
onChange={this.onOptionsChange}
checked={this.state.selectedOptions == 3}
/>
>
)}
{this.state.currentIndex >= 0 && (
)}
);
}
};
render() {
return (
style={{
width: "90%",
backgroundColor: "#444",
margin: "10px auto",
padding: "5px",
}}
>
newQ={this.state.newQuestion}
onChange={this.qOnchange}
onBlur={this.qOnBlur}
onclick={this.changeQuizFlag}
qOnclick={this.addQuestionToQuiz}
btn={this.state.btnDisabled}
q={this.state.q}
a={this.state.a}
aOnchange={this.aOnchange}
aOnClick={this.aOnClick}
/>
{this.hasLocalStorage()}
{this.handleQuizFlag()}
{this.state.quiz.length > 0 && (
type="range"
defaultValue="0"
min="0"
max={this.state.quiz.length - 1}
value={this.state.currentIndex}
onChange={this.sliderEvt}
>
)}
);
}
}
export default Quiz;
// 1: 增加a的选项;
// 2: 保存quiz到localstorage
// 3: 选择答案提交答案
// 4: click按钮时候改变state
// 5: 改变max
// 6: 显示本题的答案
// 7: 错误显示为红色,正确显示绿色。
// 8: 总结题目,测验按
2019年国家公务员考试具体日期无法准确判断,但从历年情况分析,大概在11月底,2018年是特殊年份,安排在12月10日。综合来看,2019年国家公务员考试时间大概在2018年11月底到12月初。2018国家公务员考试笔试答题时间:
公务员考试的分数不是高考。达到一定分数就可以录取。公务员考试能不能进面试,要看同岗位其他人的分数。你将按照1: 3的总成绩进入面试。如果某个职位有3个考生,你的笔试成绩排第10名,那么无论你考多少分,都进不了面试。
考生在所选考区的考试机构网站进行网上报名和缴费。未按时参加报名确认和缴费的,视为自动放弃考试。一般情况下,报考人员缴费后,网上报名系统提示缴费成功,即考试缴费成功。
申请人返回网上报名系统,发现缴费状态仍为未缴费。可能是因为银行和网上报名系统的通讯延迟。请先检查您的帐户余额以便付款。如果发现费用被扣了,就不要再交了。第二天上午10: 00后可登录网上报名系统查询缴费情况。