This commit is contained in:
进进啊
2022-04-16 15:23:28 +08:00
parent 76cad44e76
commit edc7d2bb04
4 changed files with 193 additions and 127 deletions

View File

@@ -2,6 +2,10 @@
// launchtype项可配置值为local或remote, local代表前端连本地云函数remote代表前端连云端云函数
"version": "0.0",
"configurations": [{
"app-plus" :
{
"launchtype" : "local"
},
"default" :
{
"launchtype" : "local"

View File

@@ -1,5 +1,5 @@
{
"name" : "word-pratice",
"name" : "管制员英语词汇",
"appid" : "__UNI__7D81F71",
"description" : "",
"versionName" : "1.0.0",
@@ -43,7 +43,41 @@
/* ios */
"ios" : {},
/* SDK */
"sdkConfigs" : {}
"sdkConfigs" : {
"ad" : {}
},
"icons" : {
"android" : {
"hdpi" : "unpackage/res/icons/72x72.png",
"xhdpi" : "unpackage/res/icons/96x96.png",
"xxhdpi" : "unpackage/res/icons/144x144.png",
"xxxhdpi" : "unpackage/res/icons/192x192.png"
},
"ios" : {
"appstore" : "unpackage/res/icons/1024x1024.png",
"ipad" : {
"app" : "unpackage/res/icons/76x76.png",
"app@2x" : "unpackage/res/icons/152x152.png",
"notification" : "unpackage/res/icons/20x20.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x" : "unpackage/res/icons/167x167.png",
"settings" : "unpackage/res/icons/29x29.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png"
},
"iphone" : {
"app@2x" : "unpackage/res/icons/120x120.png",
"app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x" : "unpackage/res/icons/120x120.png"
}
}
}
}
},
/* */

View File

@@ -7,7 +7,7 @@
<!-- 题目选项卡模块开始 -->
<view class="answer-box">
<view class="title">
<text class="left-title">单选题难度等级{{item.difficulty}}</text>
<text class="left-title">单选题难度等级{{item.difficulty}}</text>
<text class="right-condition">
<text>{{index+1}}</text>
<text>/{{pageNum}}</text>
@@ -121,6 +121,7 @@
this.currentIndex++;
console.log('跳转到下一题', source)
},
// 提交成功获取的信息
messageToggle(type) {
for (let i = 0; i < this.pageNum; i++) {
@@ -135,7 +136,7 @@
this.testRes = '恭喜及格!'
this.confirmText = '继续下一难度'
} else if (this.score >= 60 && this.level == 6) {
this.level = 1;
this.level++
this.testRes = '恭喜及格!'
this.confirmText = '去加强巩固'
} else {
@@ -145,33 +146,40 @@
this.msgType = type
this.$refs.alertDialog.open()
},
//右边选项
//右边选项(继续下一难度||背单词 ||加强巩固)
dialogConfirm() {
if (this.score < 60 ) {
this.resetParams(0);
this.resetParams();
uni.switchTab({
url:"../recitation/index"
})
} else if (this.score >= 60) {
} else if (this.score >= 60 && this.level <=6) {
console.log('当前难度等级',this.level)
if (this.level <= 6) {
this.resetParams(1)
} else {
this.resetParams(2)
this.resetParams()
}else if(this.score >= 60 && this.level == 7){
this.level =1;
this.resetParams()
}
}
this.setStorageData()
this.$refs.alertDialog.open()
},
// 左边选项(重新做题)
dialogClose() {
this.resetParams(0);
this.setStorageData()
// console.log('继续下一难度')
if(this.score>=60 && this.level <=6){
this.level = this.level -1;
}else if(this.level == 7){
this.level = 6;
}
this.resetParams();
console.log('重新做题')
},
// 调用云函数获取数据
async getApiQuestionData() {
uni.showLoading({
title: '加载中'
});
try {
const {
result
@@ -186,12 +194,15 @@
this.wordData.forEach(item => {
this.rightSelectArr.push(item.means)
})
this.setStorageData();
console.log('题目数据获取', result)
console.log('正确答案', this.rightSelectArr)
uni.hideLoading();
} catch (e) {
console.error(e)
uni.hideLoading();
//TODO handle the exception
}
@@ -199,16 +210,12 @@
},
// 初始化参数
resetParams(condition){
resetParams(){
this.wordData = [];
this.mySelectArr = [];
this.rightSelectArr = [];
this.currentIndex = 0;
this.score = 0;
//0=分数及格 1=不及格 2=难度到达6
if(condition == 2){
this.level = 1;
}
this.getApiQuestionData();
},
@@ -228,6 +235,7 @@
console.log('当前难度等级:', this.level)
},
onShow() {
// this.getApiQuestionData()
console.log('背单词页面显示')
// this.$forceUpdate();
@@ -340,6 +348,7 @@
}
.isSelected {
transition: all 0.2s;
border: 2rpx solid #007AFF;
background-color: rgba(52, 152, 219, 0.3)
}

View File

@@ -78,6 +78,15 @@
}
};
},
watch: {
level(newName, oldName) {
console.log('值发生变化')
this.wordData.length = 0;
this.getApiQuestionData()
// this.wordData.reverse();
},
immediate: true
},
methods: {
// 获取上一题
@@ -91,7 +100,7 @@
// 获取下一题
next(index, wordName) {
this.currentIndex++;
if (this.currentIndex % 20 == 1) {
if (this.currentIndex % 20 == 17) {
this.getApiQuestionData();
}
this.audio = this.wordData[index + 1].wordName;
@@ -101,8 +110,13 @@
// 调用云函数获取数据
async getApiQuestionData() {
this.getLevelFromStorage();
uni.showLoading({
title: '加载中'
});
try {
const {
result
} = await uniCloud.callFunction({
@@ -112,22 +126,23 @@
level: this.level
}
})
if (this.wordData)
result.res.data.forEach(e => {
this.wordData.push(e);
})
// this.wordData.reverse();
this.pageNum = result.res.total
if (this.wordData.length < 22) {
this.audio = this.wordData[0].wordName;
this.getAudioResource()
}
uni.hideLoading();
console.log('题目数据获取', this.wordData)
} catch (e) {
console.error(e)
//TODO handle the exception
}
@@ -153,9 +168,13 @@
}
},
onLoad() {
this.getApiQuestionData()
// this.getApiQuestionData()
},
onShow() {
this.getLevelFromStorage();
console.log('获取背诵题目')
}
}
</script>