unknown 1 month ago
parent
commit
0d72bbfdfb
  1. 2
      config/api.js
  2. 3
      pages/exercises/brushQuestions/brushQuestions.vue
  3. 32
      pages/exercises/categoryExercises/categoryExercises.vue
  4. 50
      pages/exercises/chapter/chapter.vue
  5. 26
      pages/exercises/theoryStudy/theoryStudy.vue
  6. 1
      store/modules/car.js

2
config/api.js

@ -36,7 +36,7 @@ export const logOut = (data={}) => http.post('member/auth/logout', data, {custom
// 分类学习了级 // 分类学习了级
export const columnPid = (pid) => http.get(`idex/column-${pid}`, ) export const columnPid = (pid) => http.get(`idex/column-${pid}`, )
// 分类学习父级id // 分类学习父级id
export const columnFid = (data) => http.get(`idex/column-${data.type}-${data.stepType}-${data.carType}`, )
export const columnFid = (data) => http.get(`idex/${data.type}-column-${data.stepType}-${data.carType}`, )

3
pages/exercises/brushQuestions/brushQuestions.vue

@ -215,7 +215,8 @@
volume: usecarStore.carInfo.volume, volume: usecarStore.carInfo.volume,
types: usecarStore.carInfo.types, types: usecarStore.carInfo.types,
sift: usecarStore.carInfo.sift, sift: usecarStore.carInfo.sift,
contentType: usecarStore.carInfo.contentType
contentType: usecarStore.carInfo.contentType,
knowType: usecarStore.carInfo.knowType
} }
const {data: res} = await startQuestionApi(obj) const {data: res} = await startQuestionApi(obj)
uni.hideLoading() uni.hideLoading()

32
pages/exercises/categoryExercises/categoryExercises.vue

@ -1,13 +1,13 @@
<template> <template>
<view class="content padding"> <view class="content padding">
<view class="con" v-for="(item,index) in 5" :key="index">
<view class="h5">交通信息</view>
<view class="con" v-for="(item,index) in dataList" :key="index">
<view class="h5">{{ item.name }}</view>
<view class="ul"> <view class="ul">
<view class="li" v-for="(item,index) in 6" :key="index" @click="goPage">
<view class="li" v-for="(item2,index) in item.pidList" :key="index" @click="goPage(item2)">
<view class="icon"> <view class="icon">
<!-- <image src="../../../static/images/avatarbg.png" mode=""></image> -->
<image :src="item2.cover" mode=""></image>
</view> </view>
<view class="text">交通信号</view>
<view class="text">{{ item2.name }}</view>
</view> </view>
</view> </view>
</view> </view>
@ -15,24 +15,37 @@
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'
import carStore from '@/store/modules/car.js' import carStore from '@/store/modules/car.js'
let usecarStore = carStore() let usecarStore = carStore()
import { columnFid, columnPid } from '@/config/api.js' import { columnFid, columnPid } from '@/config/api.js'
function goPage() {
function goPage(item) {
usecarStore.setCar('knowType', item.param)
uni.navigateTo({ uni.navigateTo({
url: '/pages/exercises/brushQuestions/brushQuestions' url: '/pages/exercises/brushQuestions/brushQuestions'
}) })
} }
let dataList = ref([])
async function columnFidFn() { async function columnFidFn() {
dataList.value = []
let obj = { let obj = {
type: '3', type: '3',
stepType: usecarStore.carInfo.stepType, stepType: usecarStore.carInfo.stepType,
carType: usecarStore.carInfo.carType carType: usecarStore.carInfo.carType
} }
const {data: res} = columnFid(obj)
const {data: res} = await columnFid(obj)
for(let i=0; i<res.length; i++) {
res[i].pidList = await columnPidFn(res[i].id)
dataList.value.push(res[i])
}
console.log(dataList.value)
} }
columnFidFn() columnFidFn()
async function columnPidFn(pid) {
const {data: res} = await columnPid(pid)
return res
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -65,7 +78,7 @@
width: 68rpx; width: 68rpx;
height: 68rpx; height: 68rpx;
background: #EF8F4C; background: #EF8F4C;
box-shadow: 0px 2rpx 5rpx 0px rgba(239,143,76,0.5);
// box-shadow: 0px 2rpx 5rpx 0px rgba(239,143,76,0.5);
border-radius: 26rpx; border-radius: 26rpx;
} }
@ -73,6 +86,7 @@
font-weight: 500; font-weight: 500;
margin-top: 20rpx; margin-top: 20rpx;
font-size: 28rpx; font-size: 28rpx;
white-space: nowrap;
} }
} }
} }

50
pages/exercises/chapter/chapter.vue

@ -1,16 +1,16 @@
<template> <template>
<view class="content"> <view class="content">
<view class="ul padding"> <view class="ul padding">
<view class="li" v-for="(item,index) in 7" :key="index" @click="goPage(index)">
<view class="li" v-for="(item,index) in dataList" :key="index" @click="goPage(index)">
<view class="num" :style="{background: colorArr[index]}">{{index+1}}</view> <view class="num" :style="{background: colorArr[index]}">{{index+1}}</view>
<view class="rightTxt"> <view class="rightTxt">
<view class="h1">安全行车常识</view>
<view class="h1">{{ item.name }}</view>
<view class="flex"> <view class="flex">
<view class="proccess"> <view class="proccess">
<up-line-progress :percentage="80" height="8" activeColor="#3776FF" :showText="false"></up-line-progress>
<up-line-progress :percentage="item.percentage" height="8" activeColor="#3776FF" :showText="false"></up-line-progress>
</view> </view>
<view class="rate">60/260</view>
<view class="rate">正确率 100%</view>
<view class="rate">{{ item.already }}/ {{item.total}}</view>
<!-- <view class="rate">正确率 100%</view> -->
</view> </view>
</view> </view>
</view> </view>
@ -18,20 +18,37 @@
</view> </view>
</template> </template>
<script>
export default {
data() {
return {
colorArr: ['#3776FF', '#64C76C', '#8484FF', '#F05C1C', '#FDD650', '#6FD568', '#52C1D0']
<script setup>
import { ref } from 'vue'
import carStore from '@/store/modules/car.js'
let usecarStore = carStore()
import { columnFid, columnPid } from '@/config/api.js'
function goPage(item) {
usecarStore.setCar('knowType', item.param)
uni.navigateTo({
url: '/pages/exercises/brushQuestions/brushQuestions'
})
} }
},
methods: {
goPage(index) {
console.log(index)
this.$goPage('/pages/exercises/brushQuestions/brushQuestions')
let dataList = ref([])
async function columnFidFn() {
dataList.value = []
let obj = {
type: '4',
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 = (item.total / item.already) * 100%
dataList.value.push(res[i])
} }
console.log(dataList.value)
} }
columnFidFn()
const colorArr = ['#3776FF', '#64C76C', '#8484FF', '#F05C1C', '#FDD650', '#6FD568', '#52C1D0']
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -42,7 +59,7 @@
.li { .li {
width: 100%; width: 100%;
display: flex; display: flex;
padding: 30rpx 0;
padding: 30rpx 0 0 0;
border-bottom: 1px solid #F4F4F4; border-bottom: 1px solid #F4F4F4;
.num { .num {
height: 34rpx; height: 34rpx;
@ -63,6 +80,7 @@
} }
.rightTxt { .rightTxt {
padding-left: 20rpx; padding-left: 20rpx;
margin-bottom: 30rpx;
} }
.flex { .flex {
.proccess { .proccess {

26
pages/exercises/theoryStudy/theoryStudy.vue

@ -36,12 +36,12 @@
<view class="centerComl"> <view class="centerComl">
<view class="ctItem" @click="goAndSetCar"> <view class="ctItem" @click="goAndSetCar">
<view class="txt">顺序练习</view> <view class="txt">顺序练习</view>
<view class="txt">0/1700</view>
<view class="txt">{{adCount.orderAlready }}/{{ adCount.orderAlready }}</view>
</view> </view>
<!-- $goPage('/pages/vip/vipEntry/vipEntry') --> <!-- $goPage('/pages/vip/vipEntry/vipEntry') -->
<view class="ctItem" @click="$noDoFn"> <view class="ctItem" @click="$noDoFn">
<view class="txt">精选试题</view> <view class="txt">精选试题</view>
<view class="txt">0/1700</view>
<view class="txt">{{adCount.siftAlready }}/{{ adCount.siftTotal }}</view>
</view> </view>
</view> </view>
<view class="iconComl"> <view class="iconComl">
@ -88,6 +88,7 @@
</template> </template>
<script setup> <script setup>
console.log(Number.MAX_VALUE, '最大值')
import { ref } from 'vue' import { ref } from 'vue'
import { questbanktypeApi, indexNoticeApi, indexAdApi, indexAdCount, examProcessInfo} from '@/config/api.js' import { questbanktypeApi, indexNoticeApi, indexAdApi, indexAdCount, examProcessInfo} from '@/config/api.js'
import carStore from '@/store/modules/car.js' import carStore from '@/store/modules/car.js'
@ -116,15 +117,16 @@
const leftItem = ref([ const leftItem = ref([
{name: '分类学习', icon: new URL('@/static/images/theory/theoryIcon1.png', import.meta.url).href, url: '/pages/exercises/categoryExercises/categoryExercises'}, {name: '分类学习', icon: new URL('@/static/images/theory/theoryIcon1.png', import.meta.url).href, url: '/pages/exercises/categoryExercises/categoryExercises'},
{name: '章节练习', icon: new URL('@/static/images/theory/theoryIcon7.png', import.meta.url).href, url: '/pages/exercises/chapter/chapter'}, {name: '章节练习', icon: new URL('@/static/images/theory/theoryIcon7.png', import.meta.url).href, url: '/pages/exercises/chapter/chapter'},
{name: '题型练习', icon: new URL('@/static/images/theory/theoryIcon6.png', import.meta.url).href, url: '/pages/exercises/queTypeExercises/queTypeExercises'},
{name: '精选试题', icon: new URL('@/static/images/theory/theoryIcon9.png', import.meta.url).href, url: '/pages/exercises/brushQuestions/brushQuestions'}, {name: '精选试题', icon: new URL('@/static/images/theory/theoryIcon9.png', import.meta.url).href, url: '/pages/exercises/brushQuestions/brushQuestions'},
{name: '考前密卷', icon: new URL('@/static/images/theory/theoryIcon11.png', import.meta.url).href, url: '/pages/exercises/brushQuestions/brushQuestions'},
]) ])
const rightItem = ref([ const rightItem = ref([
{name: '题型练习', icon: new URL('@/static/images/theory/theoryIcon6.png', import.meta.url).href, url: '/pages/exercises/queTypeExercises/queTypeExercises'},
{name: '错题收藏', icon: new URL('@/static/images/theory/theoryIcon8.png', import.meta.url).href, url: '/pages/exercises/wrongQuestion/wrongQuestion'}, {name: '错题收藏', icon: new URL('@/static/images/theory/theoryIcon8.png', import.meta.url).href, url: '/pages/exercises/wrongQuestion/wrongQuestion'},
{name: '仿真考试', icon: new URL('@/static/images/theory/theoryIcon10.png', import.meta.url).href, url: '/pages/exercises/beforeExam/beforeExam'}, {name: '仿真考试', icon: new URL('@/static/images/theory/theoryIcon10.png', import.meta.url).href, url: '/pages/exercises/beforeExam/beforeExam'},
{name: '我的学习', icon: new URL('@/static/images/theory/theoryIcon12.png', import.meta.url).href, url: '/pages/exercises/myStudy/myStudy'}, {name: '我的学习', icon: new URL('@/static/images/theory/theoryIcon12.png', import.meta.url).href, url: '/pages/exercises/myStudy/myStudy'},
{name: '考前密卷', icon: new URL('@/static/images/theory/theoryIcon11.png', import.meta.url).href, url: '/pages/exercises/brushQuestions/brushQuestions'},
]) ])
const bottomItem = ref([ const bottomItem = ref([
@ -137,6 +139,7 @@
function changeTab(num) { function changeTab(num) {
currentTab.value = num currentTab.value = num
usecarStore.setCar('stepType', num) usecarStore.setCar('stepType', num)
upDataFn()
} }
// //
function goAndSetCar() { function goAndSetCar() {
@ -161,6 +164,16 @@
} }
questbanktypeFn() questbanktypeFn()
async function upDataFn() {
uni.showLoading({
title: '正在加载...'
})
await indexNotice()
await indexAd()
await indexAdCountFn()
uni.hideLoading()
}
// //
const nodes = ref('') const nodes = ref('')
async function indexNotice() { async function indexNotice() {
@ -181,12 +194,13 @@
indexAd() indexAd()
// //
let adCount = ref()
async function indexAdCountFn() { async function indexAdCountFn() {
const {data:res} = await indexAdCount({subject: usecarStore.carInfo.stepType, carType: usecarStore.carInfo.carType}) const {data:res} = await indexAdCount({subject: usecarStore.carInfo.stepType, carType: usecarStore.carInfo.carType})
console.log(res)
adCount.value = res
} }
// indexAdCountFn()
indexAdCountFn()
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

1
store/modules/car.js

@ -12,6 +12,7 @@ const carStore = defineStore(
contentType: '',//图片还是文字 contentType: '',//图片还是文字
sift: '0', //是否精选 sift: '0', //是否精选
volume: '0', //是否是密卷 volume: '0', //是否是密卷
knowType: '',//分类
}, },
webLink: 'https://www.baidu.com/' webLink: 'https://www.baidu.com/'
}), }),

Loading…
Cancel
Save