parent
bef6694e80
commit
b0d1127a6f
|
|
@ -1,23 +1,36 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="items-center justify-between">
|
<CuNavbar title="培训考试"></CuNavbar>
|
||||||
<view>{{ index }}/{{ total }}</view>
|
<uv-sticky bgColor="#fff">
|
||||||
<view>
|
<view class="flex items-center justify-between h-90rpx px-base">
|
||||||
<view v-if="index > 0" @click="prev">上一题</view>
|
<view>{{ index }}/{{ total }}</view>
|
||||||
<view v-if="index < total" @click="next">下一题</view>
|
<view>
|
||||||
<view v-if="index >= total" @click="submit">提交</view>
|
<view v-if="index > 0" @click="prev">上一题</view>
|
||||||
|
<view v-if="index < total" @click="next">下一题</view>
|
||||||
|
<view v-if="index >= total" @click="submit">提交</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</uv-sticky>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<template v-for="(item, key) in list" :key="key">
|
<template v-for="(item, key) in list" :key="key">
|
||||||
<view v-show="key == index" class="item">
|
<view v-show="key == index" class="item">
|
||||||
<view class="title">({{ item.cate_name }}){{ item.title }}</view>
|
<view class="title">({{ item.cate_name }}){{ item.title }}</view>
|
||||||
<view class="options">
|
<view class="options">
|
||||||
<u-checkbox-group v-if="item.cate == 1">
|
<u-checkbox-group v-if="item.cate == 1">
|
||||||
<u-checkbox v-for="(option, optionKey) in item.options" :key="optionKey" :label="option.text" :name="optionKey" />
|
<u-checkbox
|
||||||
|
v-for="(option, optionKey) in item.options"
|
||||||
|
:key="optionKey"
|
||||||
|
:label="option.text"
|
||||||
|
:name="optionKey"
|
||||||
|
/>
|
||||||
</u-checkbox-group>
|
</u-checkbox-group>
|
||||||
<u-radio-group v-if="item.cate == 2">
|
<u-radio-group v-if="item.cate == 2">
|
||||||
<u-radio v-for="(option, optionKey) in item.options" :key="optionKey" :label="option.text" :name="optionKey" />
|
<u-radio
|
||||||
|
v-for="(option, optionKey) in item.options"
|
||||||
|
:key="optionKey"
|
||||||
|
:label="option.text"
|
||||||
|
:name="optionKey"
|
||||||
|
/>
|
||||||
</u-radio-group>
|
</u-radio-group>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -26,43 +39,43 @@
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { http } from '@/utils/request'
|
import CuNavbar from '@/components/cu-navbar/index'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { http } from '@/utils/request'
|
||||||
import { ref } from 'vue'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const info = ref({})
|
const info = ref({})
|
||||||
// 考题记录
|
// 考题记录
|
||||||
const list = ref([])
|
const list = ref([])
|
||||||
// 总题数
|
// 总题数
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
// 序号
|
// 序号
|
||||||
const index = ref(0)
|
const index = ref(0)
|
||||||
// 只读模式
|
// 只读模式
|
||||||
const readonly = ref(true)
|
const readonly = ref(true)
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
http.get(`/train/examinations/${options.id}`).then(res => {
|
http.get(`/train/examinations/${options.id}`).then((res) => {
|
||||||
if (res.finished_at) {
|
if (res.finished_at) {
|
||||||
readonly = false
|
readonly = false
|
||||||
}
|
}
|
||||||
info.value = res
|
info.value = res
|
||||||
list.value = res.content
|
list.value = res.content
|
||||||
total.value = res.content.length
|
total.value = res.content.length
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const next = () => {
|
const next = () => {
|
||||||
if (index < total) {
|
if (index < total) {
|
||||||
index.value++
|
index.value++
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const prev = () => {
|
}
|
||||||
if (index > 0) {
|
const prev = () => {
|
||||||
index.value--
|
if (index > 0) {
|
||||||
}
|
index.value--
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
http.post(`/train/examinations/${info.id}/answer`).then(res => {
|
http.post(`/train/examinations/${info.id}/answer`).then((res) => {})
|
||||||
})
|
}
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -5,11 +5,21 @@
|
||||||
<template v-slot="{ list }">
|
<template v-slot="{ list }">
|
||||||
<view class="space-y-15rpx p-base">
|
<view class="space-y-15rpx p-base">
|
||||||
<template v-for="item in list" :key="item.id">
|
<template v-for="item in list" :key="item.id">
|
||||||
<view class="card-shadow bg-white rounded-19rpx p-base space-y-10rpx" @click="detail(item)">
|
<view
|
||||||
<view class="text-30rpx">{{ item.name }}</view>
|
class="card-shadow space-y-10rpx bg-white rounded-19rpx p-base space-y-10rpx"
|
||||||
<view class="flex items-center justify-between">
|
@click="detail(item)"
|
||||||
<view class="text-30rpx">发布日期: {{ item.examination.published_at }}</view>
|
>
|
||||||
<view class="text-30rpx">{{ item.mark == null ? item.mark : '未完成' }}</view>
|
<view class="text-30rpx">{{ item.examination.name }}</view>
|
||||||
|
<view
|
||||||
|
class="flex items-center justify-between text-24rpx text-hex-999999"
|
||||||
|
>
|
||||||
|
<view class=""
|
||||||
|
>发布日期:
|
||||||
|
{{ timeFormat(item.examination.published_at) }}</view
|
||||||
|
>
|
||||||
|
<view class="">{{
|
||||||
|
item.mark != null ? item.mark : '未完成'
|
||||||
|
}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -20,18 +30,13 @@
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { http } from '@/utils/index'
|
import { http } from '@/utils/request'
|
||||||
import CuNavbar from '@/components/cu-navbar/index'
|
import CuNavbar from '@/components/cu-navbar/index'
|
||||||
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
|
import MescrollItem from '@/components/mescroll-api/one'
|
||||||
import MescrollItem from '@/components/mescroll-api/more.vue'
|
import { onPageScroll, onReachBottom, onLoad } from '@dcloudio/uni-app'
|
||||||
|
import useMescrollComp from '@/uni_modules/mescroll-uni/hooks/useMescrollComp.js'
|
||||||
const mescrollItem = ref('')
|
import { timeFormat } from '@climblee/uv-ui/libs/function/index'
|
||||||
|
const { mescrollItem } = useMescrollComp(onPageScroll, onReachBottom)
|
||||||
const { getMescroll, scrollToLastY } = useMescrollMore(
|
|
||||||
mescrollItem,
|
|
||||||
onPageScroll,
|
|
||||||
onReachBottom
|
|
||||||
)
|
|
||||||
|
|
||||||
const detail = (item) => {
|
const detail = (item) => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|
|
||||||
|
|
@ -97,12 +97,12 @@ const opList = [
|
||||||
{
|
{
|
||||||
icon: "account",
|
icon: "account",
|
||||||
title: "培训课件",
|
title: "培训课件",
|
||||||
url: ""
|
url: "/pages/train-books/index"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "twitte",
|
icon: "twitte",
|
||||||
title: "培训考试",
|
title: "培训考试",
|
||||||
url: ""
|
url: "/pages/examination/index"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue