diff --git a/pages/answer-detail/answer-detail.vue b/pages/answer-detail/answer-detail.vue
index 2fc1d4f..06200a5 100644
--- a/pages/answer-detail/answer-detail.vue
+++ b/pages/answer-detail/answer-detail.vue
@@ -15,34 +15,33 @@
{{item.wordName}}
-
{{itemOptions}}
+ @click="getSelectedItem(itemOptions,index)"
+ :class="{'isSelected': mySelectArr[index] == itemOptions}"
+ > {{itemOptions}}
+
-
@@ -57,7 +56,7 @@
-
@@ -68,51 +67,98 @@
export default {
data() {
return {
- selectIndex: -1,
+ selectIndexArr: [],
pageSize: 1,
pageNum: 10,
- currentIndex:0,
+ currentIndex:0,
+ score:0,
level: '',
- wordData:[],
+ wordData:[],
+ selectItem:'',
type: 'center',
msgType: 'success',
messageText: '这是一条成功提示',
- value: '',
- resultDialog: '您的成绩合格!'
+ value: '',
+ // 我的答案
+ mySelectArr:[],
+ // 正确答案
+ rightSelectArr:[],
+ testRes:'',
+ resultDialog: '您的成绩合格!',
+ confirmText:'',
+ difficultLevel:0,
};
},
methods: {
- // 获取当前选中的选项
- getSelectedItem(item, itemIndex) {
- this.selectIndex = itemIndex
- if (item.right) {
- console.log('选择正确')
- }
- console.log(item, '选中的项')
+ // 获取当前选中的选项并存到数组中
+ getSelectedItem(item, index) {
+ this.mySelectArr[index] = item
+ this.$set(this.mySelectArr,this.mySelectArr[index],item)
+
+ console.log('当前的选项',this.mySelectArr[index])
},
// 获取上一题
- previous(index) {
- // if (this.pageSize > 1) {
- // this.pageSize--
- // }
+ previous(index,source) {
this.currentIndex--;
- console.log('回到上一题',this.currentIndex,index)
+ console.log('回到上一题',source)
},
// 获取下一题
- next(index) {
+ next(index,source) {
this.currentIndex++;
- console.log('跳转到下一题',index)
+ console.log('跳转到下一题',source)
},
// 提交成功获取的信息
- messageToggle(type) {
+ messageToggle(type) {
+ for(let i = 0;i=60 && this.difficultLevel < 6){
+ this.difficultLevel++
+ this.testRes = '恭喜及格!'
+ this.confirmText = '继续下一难度'
+ }else if(this.score>=60 && this.difficultLevel == 6){
+ this.difficultLevel++
+ this.testRes = '恭喜及格!'
+ this.confirmText = '去加强巩固'
+
+ }else{
+ this.testRes = '不及格哦!'
+ this.confirmText = '去背单词'
+ }
this.msgType = type
- this.$refs.alertDialog.open()
+ this.$refs.alertDialog.open()
+ // console.log('你的分数为',this.score)
},
//确认提交
- dialogConfirm() {
- console.log('点击确认')
+ dialogConfirm() {
+ if(this.score<60){
+ uni.switchTab({
+ url:"../recitation/index"
+ })
+ }else if(this.score >= 60){
+ console.log(this.difficultLevel,'当前难度等级')
+ if(this.difficultLevel <= 6){
+ uni.navigateTo({
+ url:"../answer-detail/answer-detail?wordId=" + this.difficultLevel,
+ })
+ }else if(this.difficultLevel){
+ uni.navigateTo({
+ url:"../answer-detail/answer-detail?wordId=1",
+ })
+ }
+
+
+ }
+ // console.log('点击确认')
+
this.$refs.alertDialog.open()
},
// 关闭提交窗口
@@ -130,8 +176,13 @@
name:'provideQuestion',
data:{level:this.level,pageSize:this.pageSize}
})
- this.wordData = result.data
- console.log('题目数据获取',result)
+ this.wordData = result.resData
+ this.wordData.forEach(item=>{
+ this.rightSelectArr.push(item.means)
+ })
+
+ console.log('题目数据获取',result)
+ console.log('正确答案',this.rightSelectArr)
}catch(e){
console.error(e)
@@ -143,9 +194,10 @@
},
onLoad(option) {
- this.level = option.wordId;
+ this.level = option.wordId;
+ this.difficultLevel = option.wordId;
this.getApiQuestionData()
- console.log('获取到', this.level)
+ console.log('当前难度等级:', this.level)
}
}
diff --git a/uniCloud-aliyun/cloudfunctions/provideQuestion/index.js b/uniCloud-aliyun/cloudfunctions/provideQuestion/index.js
index 7a359cb..e9f086a 100644
--- a/uniCloud-aliyun/cloudfunctions/provideQuestion/index.js
+++ b/uniCloud-aliyun/cloudfunctions/provideQuestion/index.js
@@ -34,7 +34,8 @@ exports.main = async (event, context) => {
}
})
- // 打乱题目选项
+ // 打乱题目选项
+ let resData = [];
data.forEach((item, index) => {
if (item.options) {
item.options.sort(() => {
@@ -45,8 +46,13 @@ exports.main = async (event, context) => {
item.options[1] = `B. ${item.options[1]}`
item.options[2] = `C. ${item.options[2]}`
item.options[3] = `D. ${item.options[3]}`
+ }
+ if(index<10){
+ resData.push(item)
+
}
- })
+ })
+
console.log('选项列表', optionData)
console.log('入参:页码+难度', event, res)
@@ -54,6 +60,6 @@ exports.main = async (event, context) => {
return {
code: 200,
msg: 'success',
- data,
+ resData,
}
};