Browse Source

分类题

master
unknown 2 weeks ago
parent
commit
83990f1bcf
  1. 28
      config/api.js
  2. 10
      pages/exercises/brushQuestions/brushQuestions.vue
  3. 3
      pages/exercises/categoryExercises/categoryExercises.vue
  4. 6
      pages/exercises/chapter/chapter.vue
  5. 41
      pages/exercises/queTypeExercises/queTypeExercises.vue
  6. 10
      store/modules/car.js

28
config/api.js

@ -23,8 +23,6 @@ export const logOut = (data={}) => http.post('member/auth/logout', data, {custom
export const getQuestionApi = (data) => http.post('questionBank/getQuestion', data,)
// 添加反馈
export const questionCommentAdd = (data) => http.post('questionComment/add', data,)
// 添加|取消 收藏 错题
export const questionWrongColle = (data) => http.post('questionWrong/dealCollection', data,)
// 通知
export const indexNoticeApi = (subject) => http.get('idex/notice-'+subject, )
// 轮播图
@ -38,8 +36,30 @@ export const logOut = (data={}) => http.post('member/auth/logout', data, {custom
// 分类学习父级id
export const columnFid = (data) => http.get(`idex/${data.type}-column-${data.stepType}-${data.carType}`, )
// 添加|取消 收藏 错题
export const questionWrongColle = (data) => http.post('questionWrong/dealCollection', data,)
// 删除
export const deleteWrongOrCol = (data) => http.post('questionWrong/deleteWrongOrCol', data,)
// 我的错题
export const myWrongQuestion = (data) => http.post('questionWrong/myWrongQuestion', data,)
// 点击错题与收藏时,显示错题|收藏下 子菜单
export const questionSubmenu = (data) => http.post('questionWrong/submenu', data,)
// 点击错题|收藏 下的某个知识点的题目列表
export const findQuestionList = (data) => http.post('questionWrong/findQuestionList', data,)
// 我的学习--天数、错题、收藏、考试记录、合格率
export const mystudy = (carType) => http.get(`mystudy/mystudy-${carType}`, )
// 模拟考试科目1或者4考试首页
export const questionExam = (data) => http.get(`questionExam/exam-${data.stepType}-${data.carType}`, )
// 模拟考试科目1或者4考试成绩单
export const examTranscript = (data) => http.get(`questionExam/examTranscript-${stepType}-${carType}`, )
// 开始考试
export const startExam = (data) => http.post('questionExam/startExam', data,)
// 交卷,模拟考试保存接口
export const startExamDo = (data) => http.post('questionExam/saveExam.do', data,)
// 考试结果页
export const examId = (data) => http.post(`questionExam/result-${examId}`, data,)

10
pages/exercises/brushQuestions/brushQuestions.vue

@ -13,7 +13,7 @@
<view class="con padding">
<view class="h1_row">
<text class="tag" :class="{red: questionBank.types==2, blue: questionBank.types==3}">{{types[questionBank.types-1]}}</text>
<text class="h1">{{ questionBank.title}}</text>
<text class="h1" @click="speak(questionBank.title)">{{ questionBank.title}}</text>
</view>
<view class="imgBox" style="width: 100%;padding: 0 0 30rpx 0;" v-if="questionBank.img">
<image :src="questionBank.img" mode="widthFix"></image>
@ -131,6 +131,11 @@
</template>
<script setup>
function speak(text) {
const speech = new SpeechSynthesisUtterance(text); //
window.speechSynthesis.speak(speech); //
}
import { startQuestionApi, submitAnswerResultApi, getQuestionApi, questionCommentAdd } from '@/config/api.js'
import { debounce } from '@/uni_modules/uview-plus';
import {
@ -216,7 +221,8 @@
types: usecarStore.carInfo.types,
sift: usecarStore.carInfo.sift,
contentType: usecarStore.carInfo.contentType,
knowType: usecarStore.carInfo.knowType
knowType: usecarStore.carInfo.knowType,
chapter: usecarStore.carInfo.chapter,
}
const {data: res} = await startQuestionApi(obj)
uni.hideLoading()

3
pages/exercises/categoryExercises/categoryExercises.vue

@ -25,6 +25,9 @@
url: '/pages/exercises/brushQuestions/brushQuestions'
})
}
let dataList = ref([])
async function columnFidFn() {
dataList.value = []

6
pages/exercises/chapter/chapter.vue

@ -1,7 +1,7 @@
<template>
<view class="content">
<view class="ul padding">
<view class="li" v-for="(item,index) in dataList" :key="index" @click="goPage(index)">
<view class="li" v-for="(item,index) in dataList" :key="index" @click="goPage(item)">
<view class="num" :style="{background: colorArr[index]}">{{index+1}}</view>
<view class="rightTxt">
<view class="h1">{{ item.name }}</view>
@ -24,7 +24,7 @@
let usecarStore = carStore()
import { columnFid, columnPid } from '@/config/api.js'
function goPage(item) {
usecarStore.setCar('knowType', item.param)
usecarStore.setCar('chapter', item.param)
uni.navigateTo({
url: '/pages/exercises/brushQuestions/brushQuestions'
})
@ -39,7 +39,7 @@
}
const {data: res} = await columnFid(obj)
for(let i=0; i<res.length; i++) {
res[i].percentage = (item.total / item.already) * 100%
res[i].percentage = (res[i].total / res[i].already) * 100%
dataList.value.push(res[i])
}
console.log(dataList.value)

41
pages/exercises/queTypeExercises/queTypeExercises.vue

@ -1,7 +1,7 @@
<template>
<view class="content">
<view class="ul padding">
<view class="li" v-for="(item,index) in tabData" :key="index" @click="goPage(index)">
<view class="li" v-for="(item,index) in dataList" :key="index" @click="goPage(item)">
<view class="num" :style="{background: colorArr[index]}">{{index+1}}</view>
<view class="rightTxt">
<view class="h1">{{ item.name }}</view>
@ -9,8 +9,7 @@
<view class="proccess">
<up-line-progress :percentage="80" height="8" activeColor="#3776FF" :showText="false"></up-line-progress>
</view>
<view class="rate">{{ item.num1 }}/{{ item.num2 }}</view>
<view class="rate">正确率 {{ item.acc }}</view>
<view class="rate">{{ item.already }}/ {{item.total}}</view>
</view>
</view>
</view>
@ -20,21 +19,35 @@
<script setup>
import { ref } from 'vue'
const colorArr = ref([
'#3776FF', '#64C76C', '#8484FF', '#F05C1C', '#FDD650', '#6FD568', '#52C1D0'
])
const tabData = ref([
{name: '单选题', num1: '60', num2: '260', acc: '100%'},
{name: '多选题', num1: '60', num2: '260', acc: '100%'},
{name: '判断题', num1: '60', num2: '260', acc: '100%'},
{name: '文本题', num1: '60', num2: '260', acc: '100%'},
{name: '图片题', num1: '60', num2: '260', acc: '100%'},
])
function goPage(index) {
import carStore from '@/store/modules/car.js'
let usecarStore = carStore()
import { columnFid, columnPid } from '@/config/api.js'
function goPage(item) {
usecarStore.setCar('types', item.param)
uni.navigateTo({
url: '/pages/exercises/brushQuestions/brushQuestions'
})
}
let dataList = ref([])
async function columnFidFn() {
dataList.value = []
let obj = {
type: '2',
stepType: usecarStore.carInfo.stepType,
carType: usecarStore.carInfo.carType
}
const {data: res} = await columnFid(obj)
for(let i=0; i<res.length; i++) {
res[i].percentage = (res[i].total / res[i].already) * 100%
dataList.value.push(res[i])
}
console.log(dataList.value)
}
columnFidFn()
const colorArr = ['#3776FF', '#64C76C', '#8484FF', '#F05C1C', '#FDD650', '#6FD568', '#52C1D0']
</script>
<style lang="scss" scoped>

10
store/modules/car.js

@ -8,16 +8,24 @@ const carStore = defineStore(
carType: 'car',//车型
stepType: '1',//科目几
carTypeName: '小车',
types: '',//题型
contentType: '',//图片还是文字
sift: '0', //是否精选
volume: '0', //是否是密卷
knowType: '',//分类
chapter: '',//章节
types: '',//题型
},
webLink: 'https://www.baidu.com/'
}),
actions: {
setCar(key, value) {
// 类型只选一个
let arr = ['knowType', 'chapter', 'types']
if(arr.includes(key)) {
arr.forEach(item=>{
this.carInfo[item] = ''
})
}
this.carInfo[key] = value
},
}

Loading…
Cancel
Save