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