|
@@ -3,7 +3,7 @@
|
|
<div class="issue">
|
|
<div class="issue">
|
|
<div class="main">
|
|
<div class="main">
|
|
<div class="top">
|
|
<div class="top">
|
|
- <h2 v-if="flag === 'tow'">趣味问答</h2>
|
|
|
|
|
|
+ <h2 v-if="flag === 'tow'">{{ Mylangue ? "趣味课题" : "Quiz" }}</h2>
|
|
<h2 v-else> </h2>
|
|
<h2 v-else> </h2>
|
|
<i class="el-icon-close" @click="$emit('close')"></i>
|
|
<i class="el-icon-close" @click="$emit('close')"></i>
|
|
</div>
|
|
</div>
|
|
@@ -13,11 +13,18 @@
|
|
<div class="renwen"></div>
|
|
<div class="renwen"></div>
|
|
</div>
|
|
</div>
|
|
<div class="begin_right">
|
|
<div class="begin_right">
|
|
- <p>欢迎来到</p>
|
|
|
|
- <p>大理洱海科普教育中心趣味问答小游戏,</p>
|
|
|
|
- <p>您将随机抽取二十道题进行作答,</p>
|
|
|
|
- <p>答对十二题及以上为闯关成功!</p>
|
|
|
|
- <div class="btnn" @click="beginTopic">开始答题</div>
|
|
|
|
|
|
+ <template v-if="Mylangue">
|
|
|
|
+ <p>欢迎来到</p>
|
|
|
|
+ <p>大理洱海科普教育中心趣味问答小游戏,</p>
|
|
|
|
+ <p>您将随机抽取二十道题进行作答,</p>
|
|
|
|
+ <p>答对十二题及以上为闯关成功!</p>
|
|
|
|
+ </template>
|
|
|
|
+ <p v-else>
|
|
|
|
+ You will be given a random selection of 20 questions to answer, and
|
|
|
|
+ if you answer 12 questions correctly or above, you will be declared
|
|
|
|
+ a winner.
|
|
|
|
+ </p>
|
|
|
|
+ <div class="btnn" @click="beginTopic">{{Mylangue?'开始答题':'Start'}}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- 答题页面 -->
|
|
<!-- 答题页面 -->
|
|
@@ -28,49 +35,71 @@
|
|
topic[topicInd].correct
|
|
topic[topicInd].correct
|
|
}}
|
|
}}
|
|
</p>
|
|
</p>
|
|
- <ul class="topic_con">
|
|
|
|
- <li v-for="(item, index) in topic[topicInd].answer" :key="index">
|
|
|
|
- <div class="case" @click="select(index, item.id)">
|
|
|
|
|
|
+ <!-- 答对或答错之后的页面颜色变化 -->
|
|
|
|
+ <ul class="topic_con" v-if="caseErr">
|
|
|
|
+ <li
|
|
|
|
+ v-for="(item, index) in topic[topicInd].answer"
|
|
|
|
+ :key="index"
|
|
|
|
+ :class="{
|
|
|
|
+ cuoWu: caseABC === item.id,
|
|
|
|
+ zhengQue: item.id === topic[topicInd].correct,
|
|
|
|
+ }"
|
|
|
|
+ >
|
|
|
|
+ <div class="case">
|
|
<!-- 选中了之后的显示 -->
|
|
<!-- 选中了之后的显示 -->
|
|
- <div v-show="caseInd === index"></div>
|
|
|
|
|
|
+ <div></div>
|
|
</div>
|
|
</div>
|
|
<span :class="{ active: caseInd === index }">{{
|
|
<span :class="{ active: caseInd === index }">{{
|
|
item.id + "、" + item.txt
|
|
item.id + "、" + item.txt
|
|
}}</span>
|
|
}}</span>
|
|
</li>
|
|
</li>
|
|
</ul>
|
|
</ul>
|
|
|
|
+ <!-- 答题--选择答案 -->
|
|
|
|
+ <ul class="topic_con" v-else>
|
|
|
|
+ <li
|
|
|
|
+ v-for="(item, index) in topic[topicInd].answer"
|
|
|
|
+ :key="index"
|
|
|
|
+ :class="{ xuanze: caseInd === index }"
|
|
|
|
+ >
|
|
|
|
+ <div class="case" @click="select(index, item.id)">
|
|
|
|
+ <!-- 选中了之后的显示 -->
|
|
|
|
+ <div></div>
|
|
|
|
+ </div>
|
|
|
|
+ <span
|
|
|
|
+ @click="select(index, item.id)"
|
|
|
|
+ :class="{ active: caseInd === index }"
|
|
|
|
+ >{{ item.id + "、" + item.txt }}</span
|
|
|
|
+ >
|
|
|
|
+ </li>
|
|
|
|
+ </ul>
|
|
</div>
|
|
</div>
|
|
<!-- 下面的按钮 -->
|
|
<!-- 下面的按钮 -->
|
|
- <div class="topic_btn" @click="nextTi" v-if="caseErr">下一题</div>
|
|
|
|
- <div class="topic_btn" @click="btnOk" v-else>确 定</div>
|
|
|
|
-
|
|
|
|
- <!-- 答错之后的提示 -->
|
|
|
|
- <!-- <div class="error" v-if="caseErr">
|
|
|
|
- <p>对不起,您答错了</p>
|
|
|
|
- <p>正确答案:</p>
|
|
|
|
- <p>{{ caseErrTxt }}</p>
|
|
|
|
- <div class="errBtn" @click="nextTi">下一题</div>
|
|
|
|
- </div> -->
|
|
|
|
|
|
+ <div class="topic_btn" @click="nextTi" v-if="caseErr">
|
|
|
|
+ {{ topicInd < 20 ? `${Mylangue?'下一题':'Next'}` : `${Mylangue?'完成问答':'accomplish'}` }}
|
|
|
|
+ </div>
|
|
|
|
+ <div class="topic_btn" @click="btnOk" v-else>{{Mylangue?'确 定':'Confirm'}}</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- 答对通关 -->
|
|
<!-- 答对通关 -->
|
|
<div class="topicDui" v-if="flag === 'three'">
|
|
<div class="topicDui" v-if="flag === 'three'">
|
|
<img class="tini" src="@/assets/img/win.png" alt="" />
|
|
<img class="tini" src="@/assets/img/win.png" alt="" />
|
|
<div>
|
|
<div>
|
|
- <p>您的得分:{{ cunot + "0" }}</p>
|
|
|
|
- <p>分享海报,传播洱海的美丽文化!</p>
|
|
|
|
- <img src="share/shareM.png" alt="" v-if="isMobile"/>
|
|
|
|
- <img src="share/share.png" alt="" v-else/>
|
|
|
|
- <a class="btnn" href="share/shareM.png" download v-if="isMobile">保存海报</a>
|
|
|
|
- <a class="btnn" href="share/share.png" download v-else>保存海报</a>
|
|
|
|
|
|
+ <p>{{Mylangue?'您的得分:':'Your Score:'}}{{ cunot + "0" }}</p>
|
|
|
|
+ <p>{{Mylangue?'分享海报,传播洱海的美丽文化!':"Share this poster to spread the word about Erhai's rich culture."}}</p>
|
|
|
|
+ <img src="share/shareM.png" alt="" v-if="isMobile" />
|
|
|
|
+ <img src="share/share.png" alt="" v-else />
|
|
|
|
+ <a class="btnn" href="share/shareM.png" download v-if="isMobile"
|
|
|
|
+ >保存海报</a
|
|
|
|
+ >
|
|
|
|
+ <a class="btnn" href="share/share.png" download v-else>{{Mylangue?'保存海报':'Save the poster'}}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- 答错失败 -->
|
|
<!-- 答错失败 -->
|
|
<div class="topicCuo" v-if="flag === 'four'">
|
|
<div class="topicCuo" v-if="flag === 'four'">
|
|
<img src="@/assets/img/lose.png" alt="" />
|
|
<img src="@/assets/img/lose.png" alt="" />
|
|
- <p>您的得分:{{ cunot + "0" }}</p>
|
|
|
|
- <p>失败乃兵家常事,大侠请重头再来</p>
|
|
|
|
- <div @click="beginTopic()">重新开始</div>
|
|
|
|
|
|
+ <p>{{Mylangue?'您的得分:':'Your Score:'}}{{ cunot + "0" }}</p>
|
|
|
|
+ <p>{{Mylangue?'失败乃兵家常事,大侠请重头再来':'Try again!'}}</p>
|
|
|
|
+ <div @click="beginTopic()">{{Mylangue?'重新开始':'Restart'}}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -92,8 +121,7 @@ export default {
|
|
cunot: 0, //用来记录答对的题目个数
|
|
cunot: 0, //用来记录答对的题目个数
|
|
caseInd: null, //用来控制选择的样式
|
|
caseInd: null, //用来控制选择的样式
|
|
caseABC: null, //用来记录当前选择的答案,进行判断
|
|
caseABC: null, //用来记录当前选择的答案,进行判断
|
|
- caseErr: false, //答错了显示的弹窗
|
|
|
|
- caseErrTxt: "", //答错了显示的正确答案
|
|
|
|
|
|
+ caseErr: "", //点击确定判断答对了还是错了'zhengQue'--答对;'cuoWu'--答错
|
|
};
|
|
};
|
|
},
|
|
},
|
|
//监听属性 类似于data概念
|
|
//监听属性 类似于data概念
|
|
@@ -107,19 +135,10 @@ export default {
|
|
// 最后一题
|
|
// 最后一题
|
|
if (this.topicInd === 19 && this.cunot >= 12) {
|
|
if (this.topicInd === 19 && this.cunot >= 12) {
|
|
this.flag = "three";
|
|
this.flag = "three";
|
|
- this.topic.forEach((v) => {
|
|
|
|
- let temp = "";
|
|
|
|
- v.answer.forEach((p) => {
|
|
|
|
- if (p.id === v.correct) temp = p.txt;
|
|
|
|
- });
|
|
|
|
- v.title += "---" + temp;
|
|
|
|
- });
|
|
|
|
} else if (this.topicInd === 19 && this.cunot < 12) {
|
|
} else if (this.topicInd === 19 && this.cunot < 12) {
|
|
this.flag = "four";
|
|
this.flag = "four";
|
|
}
|
|
}
|
|
-
|
|
|
|
- this.caseInd = null;
|
|
|
|
- this.caseErr = false;
|
|
|
|
|
|
+ this.caseErr = "";
|
|
if (this.topicInd < 20) this.topicInd++;
|
|
if (this.topicInd < 20) this.topicInd++;
|
|
}, //选择题目
|
|
}, //选择题目
|
|
select(index, id) {
|
|
select(index, id) {
|
|
@@ -128,44 +147,23 @@ export default {
|
|
},
|
|
},
|
|
//点击确定
|
|
//点击确定
|
|
btnOk() {
|
|
btnOk() {
|
|
- // 最后一题
|
|
|
|
- if (this.topicInd === 19 && this.cunot >= 12) {
|
|
|
|
- this.flag = "three";
|
|
|
|
- this.topic.forEach((v) => {
|
|
|
|
- let temp = "";
|
|
|
|
- v.answer.forEach((p) => {
|
|
|
|
- if (p.id === v.correct) temp = p.txt;
|
|
|
|
- });
|
|
|
|
- v.title += "---" + temp;
|
|
|
|
- });
|
|
|
|
- return;
|
|
|
|
- } else if (this.topicInd === 19 && this.cunot < 12) {
|
|
|
|
- this.flag = "four";
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (this.caseInd === null) return this.$message.warning("未选择答案");
|
|
|
|
-
|
|
|
|
|
|
+ if (this.caseInd === null) return this.$message.warning(`${this.Mylangue?'未选择答案':'No Answer is Selected'}`);
|
|
if (this.topic[this.topicInd].correct === this.caseABC) {
|
|
if (this.topic[this.topicInd].correct === this.caseABC) {
|
|
// console.log('答对了');
|
|
// console.log('答对了');
|
|
- this.caseInd = null;
|
|
|
|
- if (this.topicInd < 20) this.topicInd++;
|
|
|
|
|
|
+ this.caseErr = "zhengQue";
|
|
this.cunot++;
|
|
this.cunot++;
|
|
} else {
|
|
} else {
|
|
// console.log('答错了');
|
|
// console.log('答错了');
|
|
- this.caseErr = true;
|
|
|
|
- // this.topic[this.topicInd].answer.forEach((v) => {
|
|
|
|
- // if (v.id === this.topic[this.topicInd].correct)
|
|
|
|
- // this.caseErrTxt = v.id + "、" + v.txt;
|
|
|
|
- // });
|
|
|
|
|
|
+ this.caseErr = "cuoWu";
|
|
}
|
|
}
|
|
|
|
+ this.caseInd = null;
|
|
},
|
|
},
|
|
// 点击开始答题
|
|
// 点击开始答题
|
|
beginTopic() {
|
|
beginTopic() {
|
|
this.caseInd = null;
|
|
this.caseInd = null;
|
|
this.cunot = 0;
|
|
this.cunot = 0;
|
|
this.topicInd = 0;
|
|
this.topicInd = 0;
|
|
- this.caseErr = false;
|
|
|
|
|
|
+ this.caseErr = "";
|
|
this.flag = "tow";
|
|
this.flag = "tow";
|
|
this.getTopic();
|
|
this.getTopic();
|
|
},
|
|
},
|
|
@@ -190,7 +188,7 @@ export default {
|
|
},
|
|
},
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
created() {
|
|
created() {
|
|
- console.log('题目长度',questions.length);
|
|
|
|
|
|
+ // console.log('题目长度',questions.length);
|
|
},
|
|
},
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
mounted() {},
|
|
mounted() {},
|
|
@@ -318,18 +316,33 @@ export default {
|
|
margin: 3px;
|
|
margin: 3px;
|
|
width: 20px;
|
|
width: 20px;
|
|
height: 20px;
|
|
height: 20px;
|
|
- background-color: #fff;
|
|
|
|
|
|
+ background-color: transparent;
|
|
border-radius: 50%;
|
|
border-radius: 50%;
|
|
}
|
|
}
|
|
- .correct{
|
|
|
|
- background-color: #50ffa2;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
& > span {
|
|
& > span {
|
|
font-size: 18px;
|
|
font-size: 18px;
|
|
}
|
|
}
|
|
- .active {
|
|
|
|
- // color: #50ffa2;
|
|
|
|
|
|
+ }
|
|
|
|
+ .xuanze {
|
|
|
|
+ .case {
|
|
|
|
+ & > div {
|
|
|
|
+ background-color: #fff;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .cuoWu {
|
|
|
|
+ .case {
|
|
|
|
+ & > div {
|
|
|
|
+ background-color: #FF5050;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .zhengQue {
|
|
|
|
+ .case {
|
|
|
|
+ & > div {
|
|
|
|
+ background-color: #50FFA2;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|