diff --git a/index.html b/index.html
index c3ff205..d6df0d5 100644
--- a/index.html
+++ b/index.html
@@ -1,20 +1,20 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages.json b/pages.json
index e2cdd65..25f554d 100644
--- a/pages.json
+++ b/pages.json
@@ -10,7 +10,7 @@
"path" : "pages/recitation/index",
"style" :
{
- "navigationBarTitleText": "",
+ "navigationBarTitleText": "单词背诵",
"enablePullDownRefresh": false
}
diff --git a/pages/answer-detail/answer-detail.vue b/pages/answer-detail/answer-detail.vue
index 57632be..2926196 100644
--- a/pages/answer-detail/answer-detail.vue
+++ b/pages/answer-detail/answer-detail.vue
@@ -15,18 +15,18 @@
{{item.wordName}}
-
+
+
+
+ {{itemOptions}}
-
@@ -34,13 +34,13 @@
-
@@ -83,13 +83,13 @@
},
methods: {
// 获取当前选中的选项
- // getSelectedItem(item, itemIndex) {
- // this.selectIndex = itemIndex
- // if (item.right) {
- // console.log('选择正确')
- // }
- // console.log(item, '选中的项')
- // },
+ getSelectedItem(item, itemIndex) {
+ this.selectIndex = itemIndex
+ if (item.right) {
+ console.log('选择正确')
+ }
+ console.log(item, '选中的项')
+ },
// 获取上一题
previous(index) {
@@ -205,10 +205,15 @@ this.currentIndex++;
}
.content {
- .read{
- image{
- width: 40rpx;
- height: 40rpx;
+ .read{
+ display: flex;
+ align-items: center;
+
+ image{
+ // line-height: 36rpx;
+ vertical-align:middle;
+ width: 36rpx;
+ height: 36rpx;
}
}
view {
diff --git a/pages/recitation/index.vue b/pages/recitation/index.vue
index 2e676dd..880c89a 100644
--- a/pages/recitation/index.vue
+++ b/pages/recitation/index.vue
@@ -1,6 +1,61 @@
-
+
+
+
+
+
+
+
+
+ 背单词 (词汇难度:{{item.difficulty}})
+
+ {{index+1}}
+ /{{pageNum}}
+
+
+
+ {{item.wordName}}
+
+ 音标:{{item.phonetic}}
+ 读音:{{item.pronunciation}}
+
+
+
+
+
+ {{item.means}}
+
+
+
+
+
+
+
+
+
+ 上一个单词
+
+
+ 下一个单词
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -8,15 +63,212 @@
export default {
data() {
return {
-
- }
+ selectIndex: -1,
+ pageSize: 1,
+ pageNum: 3155,
+ currentIndex:0,
+ level: '',
+ wordData:[],
+ type: 'center',
+ msgType: 'success',
+ messageText: '这是一条成功提示',
+ value: '',
+ resultDialog: '您的成绩合格!'
+ };
},
methods: {
+
+ // 获取上一题
+ previous(index) {
+ // if (this.pageSize > 1) {
+ // this.pageSize--
+ // }
+ this.currentIndex--;
+ console.log('回到上一题',this.currentIndex,index)
+ },
+
+ // 获取下一题
+ next(index) {
+ // if (this.pageSize < 10) {
+ // this.pageSize++
+ // }
+this.currentIndex++;
+ // this.getApiQuestionData()
+ console.log('跳转到下一题',index)
+ },
+ // 提交成功获取的信息
+ messageToggle(type) {
+ this.msgType = type
+ this.$refs.alertDialog.open()
+ },
+ //确认提交
+ dialogConfirm() {
+ console.log('点击确认')
+ this.$refs.alertDialog.open()
+ },
+ // 关闭提交窗口
+ dialogClose() {
+ uni.switchTab({
+ url: "../../pages/home/index"
+ })
+ console.log('点击关闭')
+ },
+ // 调用云函数获取数据
+ async getApiQuestionData(){
+ try{
+ const {result} = await uniCloud.callFunction({
+ name:'provideQuestion',
+ data:{level:this.level,pageSize:this.pageSize}
+ })
+ this.wordData = result.data
+ console.log('题目数据获取',result.data)
+
+ }catch(e){
+ console.error(e)
+ //TODO handle the exception
+ }
+
+
+ }
+
+ },
+ onLoad(option) {
+ this.level = option.wordId;
+ this.getApiQuestionData()
+ console.log('获取到', this.level)
}
}
+ }
+
+ .answer-root {
+ position: relative;
+ top: 60rpx;
+
+ .answer-box {
+ word-wrap: break-word;
+ word-break: break-all;
+ box-sizing: border-box;
+ padding: 30rpx;
+ border-radius: 20rpx;
+ width: 100%;
+ box-shadow: 5px 4px 20px rgba(0, 0, 0, 0.16);
+ background-color: #FFFFFF;
+
+ .title {
+ display: flex;
+ align-items: center;
+ box-sizing: border-box;
+ padding-bottom: 20rpx;
+ justify-content: space-between;
+ width: 100%;
+ border-bottom: 2rpx solid #eeeeee;
+
+ .left-title {
+ font-weight: bolder;
+ padding: 0 20rpx;
+ border-left: 8rpx solid #007AFF;
+ }
+
+ .right-condition {
+ text {
+ &:nth-child(1) {
+ font-size: 40rpx;
+ font-weight: bold;
+ margin: 0 6rpx;
+ }
+
+ &:nth-child(2) {
+ color: gray;
+ }
+ }
+ }
+ }
+
+ .content {
+ .read{
+ display: flex;
+ align-items: center;
+
+ image{
+ // line-height: 36rpx;
+ vertical-align:middle;
+ width: 36rpx;
+ height: 36rpx;
+ }
+ }
+ view {
+ min-height: 100rpx;
+ display: flex;
+ align-items: center;
+
+ &:nth-child(1) {
+ font-size: 40rpx;
+ font-weight: bold;
+ }
+
+ &:nth-child(2) {
+ display: flex;
+ align-items: center;
+ font-size: 28rpx;
+
+ text {
+ flex: 1;
+ }
+ }
+ }
+ }
+
+ .select-item {
+ text {
+ min-height: 100rpx;
+ margin: 20rpx 0;
+
+ &:nth-child(4) {
+ margin-bottom: 0;
+ }
+
+ border: 2rpx solid #dee1e6;
+ border-radius: 8rpx;
+ padding: 0 20rpx;
+ background-color: #f2f5f8;
+ display: block;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ }
+
+ .isSelected {
+ border: 2rpx solid #007AFF;
+ background-color: rgba(52, 152, 219, 0.3)
+ }
+
+ }
+
+ }
+ }
+
+ .page-btn {
+ margin: 30px;
+
+ .btn {
+ display: flex;
+
+ button {
+ box-shadow: 0 2px 5px 0 rgba(50, 50, 105, 0.15), 0 1px 1px 0 rgba(0, 0, 0, 0.05);
+ }
+
+ }
+
+ }
+ .noData{
+ font-size: 30rpx;
+ text-align: center;
+ }
+
diff --git a/uniCloud-aliyun/cloudfunctions/provideQuestion/index.js b/uniCloud-aliyun/cloudfunctions/provideQuestion/index.js
index 674ae57..564c6f6 100644
--- a/uniCloud-aliyun/cloudfunctions/provideQuestion/index.js
+++ b/uniCloud-aliyun/cloudfunctions/provideQuestion/index.js
@@ -3,13 +3,19 @@ const db = uniCloud.database();
exports.main = async (event, context) => {
//event为客户端上传的参数
// const count = await db.collection('questionList').count()
- // 根据level字段返回不同的数据
- let res = await db.collection('allWordList').where({
- difficulty:event.level
- }).limit(10).get()
+ // 根据level字段随机返回不同的数据
+ let res = await db.collection('allWordList').aggregate().match({
+ difficulty: event.level
+ }).sample({
+ size: 10
+ }).addFields({
+ 'options':["$means",'B. v.爬升,上升.n.爬升率,上升率;上升距离','C adv.不变地;经常地;坚持不懈地','D n.积云;组合,集结;累积;形成']
+ }).end()
+
+ // let resMeans = await db.collection('allWordList').where({})
let data = res.data
- console.log('入参:页码+难度', event,res)
-
+ console.log('入参:页码+难度', event, res)
+
// let res
//返回数据给客户端
return {