This commit is contained in:
进进啊
2022-04-11 22:00:36 +08:00
parent e2db5842d3
commit 6be56d44d7
8 changed files with 112 additions and 102 deletions

View File

@@ -1,54 +1,58 @@
<template> <template>
<view class="answer-root"> <view class="answer-root">
<view class="container" v-if="wordData.wordName"> <view class="container" >
<view v-for="(item,index) in wordData" :key="wordData._id" >
<view v-if="index == currentIndex">
<!-- 题目选项卡模块开始 --> <!-- 题目选项卡模块开始 -->
<view class="answer-box" > <view class="answer-box" >
<view class="title"> <view class="title" >
<text class="left-title">单选题难度等级{{wordData.level}}</text> <text class="left-title">单选题难度等级{{item.difficulty}}</text>
<text class="right-condition"> <text class="right-condition">
<text>{{pageSize}}</text> <text>{{index+1}}</text>
<text>/{{pageNum}}</text> <text>/{{pageNum}}</text>
</text> </text>
</view> </view>
<view class="content"> <view class="content">
<view>{{wordData.wordName}}</view> <view>{{item.wordName}}</view>
<view> <view class="read">
<text>音标{{wordData.phonetic}}</text> <text>音标{{item.phonetic}}</text>
<text>读音{{wordData.pronunciation}} </text> <text>读音{{item.pronunciation}}
</view> <image src="../../static/icon/listen.png" mode="widthFix"></image>
</view> </text>
<view class="select-item"> </view>
<text v-for="(item,index) in wordData.options" :key="item.itemId" </view>
:class="{'isSelected':index == selectIndex}" <!-- <view class="select-item">
@click="getSelectedItem(item,index)">{{item.itemId}} {{item.itemContent}}</text> <text v-for="(item,index) in wordData.options" :key="item.itemId"
:class="{'isSelected':index == selectIndex}"
</view> @click="getSelectedItem(item,index)">{{item.itemId}} {{item.itemContent}}</text>
</view> -->
</view> </view>
<!-- 题目选项卡模块结束 --> <!-- 题目选项卡模块结束 -->
<!-- 翻页按钮模块开始 -->
<!-- 翻页按钮模块开始 --> <view class="page-btn">
<view class="page-btn"> <view class="btn">
<view class="btn"> <button type="default" @tap="previous(index)" v-if="currentIndex > 2">
<button type="default" @tap="previous" v-if="pageSize != 1"> 上一题
上一题 </button>
</button> <button type="default" @tap="next(index)" v-if="currentIndex < 11">
<button type="default" @tap="next" v-if="pageSize != 10"> 下一题
下一题 </button>
</button> <button type="default" @tap="messageToggle('error')" v-if="currentIndex == 11">
<button type="default" @tap="messageToggle('error')" v-if="pageSize == 10"> 提交
提交 </button>
</button> </view>
</view>
<!-- 翻页按钮模块结束 -->
</view>
</view> </view>
</view>
<!-- 翻页按钮模块结束 -->
</view> </view>
<view class="noData" v-else-if="!wordData.worName">
<text>暂无数据~</text>
</view>
<view> <view>
<!-- 提示窗示例 --> <!-- 提示窗示例 -->
@@ -66,9 +70,10 @@
return { return {
selectIndex: -1, selectIndex: -1,
pageSize: 1, pageSize: 1,
pageNum: 10, pageNum: 10,
currentIndex:0,
level: '', level: '',
wordData:{}, wordData:[],
type: 'center', type: 'center',
msgType: 'success', msgType: 'success',
messageText: '这是一条成功提示', messageText: '这是一条成功提示',
@@ -78,30 +83,31 @@
}, },
methods: { methods: {
// 获取当前选中的选项 // 获取当前选中的选项
getSelectedItem(item, itemIndex) { // getSelectedItem(item, itemIndex) {
this.selectIndex = itemIndex // this.selectIndex = itemIndex
if (item.right) { // if (item.right) {
console.log('选择正确') // console.log('选择正确')
} // }
console.log(item, '选中的项') // console.log(item, '选中的项')
}, // },
// 获取上一题 // 获取上一题
previous() { previous(index) {
if (this.pageSize > 1) { // if (this.pageSize > 1) {
this.pageSize-- // this.pageSize--
} // }
this.currentIndex--;
console.log('回到上一题') console.log('回到上一题',this.currentIndex,index)
}, },
// 获取下一题 // 获取下一题
next() { next(index) {
if (this.pageSize < 10) { // if (this.pageSize < 10) {
this.pageSize++ // this.pageSize++
} // }
this.getApiQuestionData() this.currentIndex++;
console.log('跳转到下一题') // this.getApiQuestionData()
console.log('跳转到下一题',index)
}, },
// 提交成功获取的信息 // 提交成功获取的信息
messageToggle(type) { messageToggle(type) {
@@ -128,10 +134,8 @@
name:'provideQuestion', name:'provideQuestion',
data:{level:this.level,pageSize:this.pageSize} data:{level:this.level,pageSize:this.pageSize}
}) })
if(result.data[0] != undefined){ this.wordData = result.data
this.wordData = result.data[0].wordData console.log('题目数据获取',result.data)
console.log('题目数据获取',result.data[0])
}
}catch(e){ }catch(e){
console.error(e) console.error(e)
@@ -200,7 +204,13 @@
} }
} }
.content { .content {
.read{
image{
width: 40rpx;
height: 40rpx;
}
}
view { view {
min-height: 100rpx; min-height: 100rpx;
display: flex; display: flex;

View File

@@ -30,9 +30,6 @@
},{ },{
id:'6', id:'6',
text:'六级词汇难度' text:'六级词汇难度'
},{
id:'7',
text:'七级词汇难度'
}] }]
} }
}, },
@@ -69,7 +66,10 @@
border: 2rpx solid #4CD964; border: 2rpx solid #4CD964;
&:nth-child(1){ &:nth-child(1){
margin-top: 30rpx; margin-top: 30rpx;
} }
// &:nth-child(n+1){
// opacity: 0.5;
// }
&:nth-child(odd){ &:nth-child(odd){
background: linear-gradient(135deg,#43cbff,#9708cc); background: linear-gradient(135deg,#43cbff,#9708cc);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

View File

@@ -1,4 +1,4 @@
## 0.0.22021-04-16 ## 0.0.22021-04-16
- 修改插件package信息 - 修改插件package信息
## 0.0.12021-03-15 ## 0.0.12021-03-15
- 初始化项目 - 初始化项目

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,9 @@
{ {
"name": "uni-config-center", "name": "uni-config-center",
"version": "0.0.2", "version": "0.0.2",
"description": "配置中心", "description": "配置中心",
"main": "index.js", "main": "index.js",
"keywords": [], "keywords": [],
"author": "DCloud", "author": "DCloud",
"license": "Apache-2.0" "license": "Apache-2.0"
} }

File diff suppressed because one or more lines are too long

View File

@@ -1,16 +1,16 @@
{ {
"name": "uni-id", "name": "uni-id",
"version": "3.3.13", "version": "3.3.13",
"description": "uni-id for uniCloud", "description": "uni-id for uniCloud",
"main": "index.js", "main": "index.js",
"homepage": "https://uniapp.dcloud.io/uniCloud/uni-id", "homepage": "https://uniapp.dcloud.io/uniCloud/uni-id",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://gitee.com/dcloud/uni-id.git" "url": "git+https://gitee.com/dcloud/uni-id.git"
}, },
"author": "", "author": "",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center" "uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
} }
} }