Compare commits

..

No commits in common. '7e15974ea6327b9545df1a1ee05cffb9daa520f5' and '19616d56c5f84c12ba11fdbf6e182392b794b5fd' have entirely different histories.

  1. 90
      src/pages/questionBank/components/Question.vue

@ -120,16 +120,16 @@
</view> </view>
<view class="text-center flex jc-c ai-c" style="flex-direction: column;" @tap="toCollect"> <view class="text-center flex jc-c ai-c" style="flex-direction: column;" @tap="toCollect">
<u-icon name="star-fill" v-if="collectList.includes(questionList[topicIndex].questionId)" <u-icon name="star-fill" v-if="collectList.includes(questionList[topicIndex].questionId)"
color="rgb(249,236,141)" size="20"></u-icon> color="rgb(249,236,141)" size="24"></u-icon>
<u-icon name="star" v-else size="20"></u-icon> <u-icon name="star" v-else size="24"></u-icon>
<text class="cor-666">{{collectList.includes(questionList[topicIndex].questionId)?'已收藏':'收藏'}}</text> <text class="cor-666">{{collectList.includes(questionList[topicIndex].questionId)?'已收藏':'收藏'}}</text>
</view> </view>
<view class="text-center"> <view class="text-center">
<view style="color: #00B74F;">{{type=='exam'?rightList.length:storageRightList.length}}</view> <view style="color: #00B74F;">{{rightList.length}}</view>
<text class="cor-666">答对</text> <text class="cor-666">答对</text>
</view> </view>
<view class="text-center"> <view class="text-center">
<view style="color: #FF6E02;">{{type=='exam'?wrongList.length:storageWrongList.length}}</view> <view style="color: #FF6E02;">{{wrongList.length}}</view>
<text class="cor-666">答错</text> <text class="cor-666">答错</text>
</view> </view>
<view class="text-center" @tap="popupShow=!popupShow"> <view class="text-center" @tap="popupShow=!popupShow">
@ -212,16 +212,16 @@
</view> </view>
<view class="text-center flex jc-c ai-c" style="flex-direction: column;" @tap="toCollect"> <view class="text-center flex jc-c ai-c" style="flex-direction: column;" @tap="toCollect">
<u-icon name="star-fill" v-if="collectList.includes(questionList[topicIndex].questionId)" <u-icon name="star-fill" v-if="collectList.includes(questionList[topicIndex].questionId)"
color="rgb(249,236,141)" size="20"></u-icon> color="rgb(249,236,141)" size="24"></u-icon>
<u-icon name="star" v-else size="20"></u-icon> <u-icon name="star" v-else size="24"></u-icon>
<text class="cor-666">{{collectList.includes(questionList[topicIndex].questionId)?'已收藏':'收藏'}}</text> <text class="cor-666">{{collectList.includes(questionList[topicIndex].questionId)?'已收藏':'收藏'}}</text>
</view> </view>
<view class="text-center"> <view class="text-center">
<view style="color: #00B74F;">{{type=='exam'?rightList.length:storageRightList.length}}</view> <view style="color: #00B74F;">{{rightList.length}}</view>
<text class="cor-666">答对</text> <text class="cor-666">答对</text>
</view> </view>
<view class="text-center"> <view class="text-center">
<view style="color: #FF6E02;">{{type=='exam'?wrongList.length:storageWrongList.length}}</view> <view style="color: #FF6E02;">{{wrongList.length}}</view>
<text class="cor-666">答错</text> <text class="cor-666">答错</text>
</view> </view>
<view class="text-center" @tap="popupShow=!popupShow"> <view class="text-center" @tap="popupShow=!popupShow">
@ -232,17 +232,15 @@
</view> </view>
</view> </view>
<view class="flex ai-c jc-fs p14" style="flex-wrap: wrap;max-height: 400px;overflow-y: scroll;"> <view class="flex ai-c jc-fs p14" style="flex-wrap: wrap;max-height: 400px;overflow-y: scroll;">
<view v-for="(item,index) of questionList" :key="item.questionId" style="width:20%;position: relative;" class="flex ai-c jc-c" <view v-for="(item,index) of questionList" :key="item.questionId" style="width:20%;" class="flex ai-c jc-c"
@tap="chooseQueston(index)"> @tap="chooseQueston(index)">
<view class="tCircle mb10" :class="{ <view class="tCircle mb10" :class="{
'active':index == topicIndex, 'active':index == topicIndex,
'success':type=='exam'?rightList.includes(item.questionId):storageRightList.includes(item.questionId), 'success':rightList.includes(item.questionId),
'error':type=='exam'?wrongList.includes(item.questionId):storageWrongList.includes(item.questionId) 'error':wrongList.includes(item.questionId)
}"> }">
{{index+1}} {{index+1}}
</view> </view>
<u-icon name="star-fill" v-if="collectList.includes(item.questionId)" style="position: absolute;right: 5px;top:-3px"
color="rgb(249,236,141)" size="24"></u-icon>
</view> </view>
</view> </view>
</view> </view>
@ -336,8 +334,6 @@
tCurrent: 0, tCurrent: 0,
index: 0, index: 0,
qIndex: 0, qIndex: 0,
storageRightList:storage.get(`rightList_subject${this.subject}`) || [],
storageWrongList: storage.get(`wrongList_subject${this.subject}`) || [],
rightList: [], rightList: [],
wrongList: [], wrongList: [],
collectList: storage.get(`collectList_subject${this.subject}`) || [], collectList: storage.get(`collectList_subject${this.subject}`) || [],
@ -411,8 +407,8 @@
if (this.tCurrent != 1) { if (this.tCurrent != 1) {
this.originArray = JSON.stringify(this.questionList) this.originArray = JSON.stringify(this.questionList)
} }
// const falseList = storage.get(`wrongList_subject${this.subject}`) || [] const falseList = storage.get(`wrongList_subject${this.subject}`) || []
// const trueList = storage.get(`rightList_subject${this.subject}`) || [] const trueList = storage.get(`rightList_subject${this.subject}`) || []
if (this.tCurrent !== 1) { if (this.tCurrent !== 1) {
const arr1 = this.questionList[this.topicIndex].clickAnswer.split('') const arr1 = this.questionList[this.topicIndex].clickAnswer.split('')
const arr2 = this.questionList[this.topicIndex].trueAnswer.split('') const arr2 = this.questionList[this.topicIndex].trueAnswer.split('')
@ -422,18 +418,18 @@
if (!this.rightList.includes(this.questionList[this.topicIndex].questionId)) { if (!this.rightList.includes(this.questionList[this.topicIndex].questionId)) {
this.rightList.push(this.questionList[this.topicIndex].questionId) this.rightList.push(this.questionList[this.topicIndex].questionId)
} }
if (!this.storageRightList.includes(this.questionList[this.topicIndex].questionId)) { if (!trueList.includes(this.questionList[this.topicIndex].questionId)) {
this.storageRightList.push(this.questionList[this.topicIndex].questionId) trueList.push(this.questionList[this.topicIndex].questionId)
storage.set(`rightList_subject${this.subject}`, this.storageRightList) storage.set(`rightList_subject${this.subject}`, trueList)
} }
if (this.wrongList.includes(this.questionList[this.topicIndex].questionId)) { if (this.wrongList.includes(this.questionList[this.topicIndex].questionId)) {
const wIndex = this.wrongList.indexOf(this.questionList[this.topicIndex].questionId) const wIndex = this.wrongList.indexOf(this.questionList[this.topicIndex].questionId)
this.wrongList.splice(wIndex, 1) this.wrongList.splice(wIndex, 1)
} }
if (this.storageWrongList.includes(this.questionList[this.topicIndex].questionId)) { if (falseList.includes(this.questionList[this.topicIndex].questionId)) {
const wIndex = this.storageWrongList.indexOf(this.questionList[this.topicIndex].questionId) const wIndex = falseList.indexOf(this.questionList[this.topicIndex].questionId)
this.storageWrongList.splice(wIndex, 1) falseList.splice(wIndex, 1)
storage.set(`wrongList_subject${this.subject}`, this.storageWrongList) storage.set(`wrongList_subject${this.subject}`, falseList)
} }
// //
if (this.topicIndex < this.questionList.length - 1) { if (this.topicIndex < this.questionList.length - 1) {
@ -459,14 +455,14 @@
if (!this.wrongList.includes(this.questionList[this.topicIndex].questionId)) { if (!this.wrongList.includes(this.questionList[this.topicIndex].questionId)) {
this.wrongList.push(this.questionList[this.topicIndex].questionId) this.wrongList.push(this.questionList[this.topicIndex].questionId)
} }
if (!this.storageWrongList.includes(this.questionList[this.topicIndex].questionId)) { if (!falseList.includes(this.questionList[this.topicIndex].questionId)) {
this.storageWrongList.push(this.questionList[this.topicIndex].questionId) falseList.push(this.questionList[this.topicIndex].questionId)
storage.set(`wrongList_subject${this.subject}`, this.storageWrongList) storage.set(`wrongList_subject${this.subject}`, falseList)
} }
if (this.storageRightList.includes(this.questionList[this.topicIndex].questionId)) { if (trueList.includes(this.questionList[this.topicIndex].questionId)) {
const rIndex = this.storageRightList.indexOf(this.questionList[this.topicIndex].questionId) const rIndex = trueList.indexOf(this.questionList[this.topicIndex].questionId)
this.storageRightList.splice(rIndex, 1) trueList.splice(rIndex, 1)
storage.set(`rightList_subject${this.subject}`, this.storageRightList) storage.set(`rightList_subject${this.subject}`, trueList)
} }
} }
} }
@ -678,8 +674,8 @@
}, },
// //
answerQues(op, index) { answerQues(op, index) {
// const falseList = storage.get(`wrongList_subject${this.subject}`) || [] const falseList = storage.get(`wrongList_subject${this.subject}`) || []
// const trueList = storage.get(`rightList_subject${this.subject}`) || [] const trueList = storage.get(`rightList_subject${this.subject}`) || []
if (!this.questionList[this.topicIndex].clickAnswer) { if (!this.questionList[this.topicIndex].clickAnswer) {
this.questionList[this.topicIndex].optionList[index].chooseOption = this.questionList[this.topicIndex].optionList[index].chooseOption =
`${this.questionList[this.topicIndex].optionList[index].chooseOption?this.questionList[this.topicIndex].optionList[index].chooseOption:''}${op}` `${this.questionList[this.topicIndex].optionList[index].chooseOption?this.questionList[this.topicIndex].optionList[index].chooseOption:''}${op}`
@ -712,18 +708,18 @@
if (!this.rightList.includes(this.questionList[this.topicIndex].questionId)) { if (!this.rightList.includes(this.questionList[this.topicIndex].questionId)) {
this.rightList.push(this.questionList[this.topicIndex].questionId) this.rightList.push(this.questionList[this.topicIndex].questionId)
} }
if (!this.storageRightList.includes(this.questionList[this.topicIndex].questionId)) { if (!trueList.includes(this.questionList[this.topicIndex].questionId)) {
this.storageRightList.push(this.questionList[this.topicIndex].questionId) trueList.push(this.questionList[this.topicIndex].questionId)
storage.set(`rightList_subject${this.subject}`, this.storageRightList) storage.set(`rightList_subject${this.subject}`, trueList)
} }
if (this.wrongList.includes(this.questionList[this.topicIndex].questionId)) { if (this.wrongList.includes(this.questionList[this.topicIndex].questionId)) {
const wIndex = this.wrongList.indexOf(this.questionList[this.topicIndex].questionId) const wIndex = this.wrongList.indexOf(this.questionList[this.topicIndex].questionId)
this.wrongList.splice(wIndex, 1) this.wrongList.splice(wIndex, 1)
} }
if (this.storageWrongList.includes(this.questionList[this.topicIndex].questionId)) { if (falseList.includes(this.questionList[this.topicIndex].questionId)) {
const wIndex = this.storageWrongList.indexOf(this.questionList[this.topicIndex].questionId) const wIndex = falseList.indexOf(this.questionList[this.topicIndex].questionId)
this.storageWrongList.splice(wIndex, 1) falseList.splice(wIndex, 1)
storage.set(`wrongList_subject${this.subject}`, this.storageWrongList) storage.set(`wrongList_subject${this.subject}`, falseList)
} }
// //
if (this.topicIndex < this.questionList.length - 1) { if (this.topicIndex < this.questionList.length - 1) {
@ -749,14 +745,14 @@
if (!this.wrongList.includes(this.questionList[this.topicIndex].questionId)) { if (!this.wrongList.includes(this.questionList[this.topicIndex].questionId)) {
this.wrongList.push(this.questionList[this.topicIndex].questionId) this.wrongList.push(this.questionList[this.topicIndex].questionId)
} }
if (!this.storageWrongList.includes(this.questionList[this.topicIndex].questionId)) { if (!falseList.includes(this.questionList[this.topicIndex].questionId)) {
this.storageWrongList.push(this.questionList[this.topicIndex].questionId) falseList.push(this.questionList[this.topicIndex].questionId)
storage.set(`wrongList_subject${this.subject}`, this.storageWrongList) storage.set(`wrongList_subject${this.subject}`, falseList)
} }
if (this.storageRightList.includes(this.questionList[this.topicIndex].questionId)) { if (trueList.includes(this.questionList[this.topicIndex].questionId)) {
const rIndex = this.storageRightList.indexOf(this.questionList[this.topicIndex].questionId) const rIndex = trueList.indexOf(this.questionList[this.topicIndex].questionId)
this.storageRightList.splice(rIndex, 1) trueList.splice(rIndex, 1)
storage.set(`rightList_subject${this.subject}`, this.storageRightList) storage.set(`rightList_subject${this.subject}`, trueList)
} }
} }
} }

Loading…
Cancel
Save