parent
bf324de62f
commit
668d336f24
|
|
@ -198,6 +198,40 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"root": "pages/train-books",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"path": "index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "培训课件"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "detail",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "培训课件"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"root": "pages/examination",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"path": "index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "培训考试"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "detail",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "培训考试"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
<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>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<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-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-group>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
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 next = () => {
|
||||||
|
if (index < total) {
|
||||||
|
index.value++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const prev = () => {
|
||||||
|
if (index > 0) {
|
||||||
|
index.value--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const submit = () => {
|
||||||
|
http.post(`/train/examinations/${info.id}/answer`).then(res => {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<CuNavbar title="培训考试"></CuNavbar>
|
||||||
|
<MescrollItem :top="88" :i="0" apiUrl="/train/examinations">
|
||||||
|
<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>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</MescrollItem>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { http } from '@/utils/index'
|
||||||
|
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
|
||||||
|
)
|
||||||
|
|
||||||
|
const detail = (item) => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/examination/detail?id=${item.id}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<CuNavbar></CuNavbar>
|
||||||
|
<!-- 文章 -->
|
||||||
|
<template v-if="info.type == 1">
|
||||||
|
<view class="h-400rpx">
|
||||||
|
<uv-image width="100%" height="100%" :src="info.cover_image" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<!-- 视频 -->
|
||||||
|
<template v-if="info.type == 2">
|
||||||
|
<video class="w-full" :src="info.video" />
|
||||||
|
</template>
|
||||||
|
<view class="p-base space-y-10rpx">
|
||||||
|
<view class="font-500 text-30rpx">{{ info.title }}</view>
|
||||||
|
<view class="text-hex-999999">{{ info.description }}</view>
|
||||||
|
<view class="text-hex-999 text-right">{{
|
||||||
|
timeFormat(info.created_at)
|
||||||
|
}}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<template v-if="info.type == 3">
|
||||||
|
<view class="p-base space-y-8rpx">
|
||||||
|
<view
|
||||||
|
v-for="item in info.files"
|
||||||
|
class="flex card-shadow bg-white rounded-19rpx p-base"
|
||||||
|
:key="item.id"
|
||||||
|
>
|
||||||
|
<view class="line-clamp-1 flex-1">
|
||||||
|
{{ item.name }}{{ item.name }}{{ item.name }}
|
||||||
|
</view>
|
||||||
|
<view @click="downloadFile(item.url)">
|
||||||
|
<uv-icon size="40rpx" name="download"></uv-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 富文本 -->
|
||||||
|
<template v-if="info.content">
|
||||||
|
<uv-divider />
|
||||||
|
<view>
|
||||||
|
<uv-parse :content="info.content"></uv-parse>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import CuNavbar from '@/components/cu-navbar/index'
|
||||||
|
import { http } from '@/utils/request'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { timeFormat } from '@climblee/uv-ui/libs/function'
|
||||||
|
|
||||||
|
const id = ref('')
|
||||||
|
const info = ref({})
|
||||||
|
onLoad((options) => {
|
||||||
|
id.value = options.id
|
||||||
|
http.get(`/train/books/${id.value}`).then((res) => {
|
||||||
|
info.value = res
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const downloadFile = (url) => {
|
||||||
|
uni.downloadFile({
|
||||||
|
url: url, // 文件的URL
|
||||||
|
success: function (res) {
|
||||||
|
console.log('下载成功', res)
|
||||||
|
// 在这里可以处理文件下载后的操作,比如保存到本地、读取文件内容等
|
||||||
|
},
|
||||||
|
fail: function (err) {
|
||||||
|
console.log('下载失败', err)
|
||||||
|
// 在这里可以处理文件下载失败的情况,比如重新下载、提示用户等
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<CuNavbar title="培训课件"></CuNavbar>
|
||||||
|
<uv-sticky bgColor="#fff">
|
||||||
|
<uv-tabs
|
||||||
|
height="44"
|
||||||
|
:activeStyle="{ color: '#ee2c37' }"
|
||||||
|
:scrollable="true"
|
||||||
|
:current="tabIndex"
|
||||||
|
lineColor="#ee2c37"
|
||||||
|
:list="tabList"
|
||||||
|
@change="tabChange"
|
||||||
|
></uv-tabs>
|
||||||
|
</uv-sticky>
|
||||||
|
|
||||||
|
<MescrollItem
|
||||||
|
v-for="(item, key) in tabList"
|
||||||
|
:key="item.id"
|
||||||
|
:ref="`mescrollItem${item.id}`"
|
||||||
|
:top="88"
|
||||||
|
:i="key"
|
||||||
|
:index="tabIndex"
|
||||||
|
apiUrl="/train/books"
|
||||||
|
:params="{ category_id: item.id }"
|
||||||
|
>
|
||||||
|
<template v-slot="{ list }">
|
||||||
|
<view class="space-y-15rpx mt-base">
|
||||||
|
<template v-for="subItem in list" :key="subItem.id">
|
||||||
|
<view
|
||||||
|
class="card-shadow bg-white rounded-19rpx p-base space-y-10rpx"
|
||||||
|
@click="detail(subItem.id)"
|
||||||
|
>
|
||||||
|
<view class="flex">
|
||||||
|
<view
|
||||||
|
v-if="subItem.cover_image"
|
||||||
|
class="flex rounded-8rpx overflow-hidden"
|
||||||
|
>
|
||||||
|
<uv-image
|
||||||
|
:src="subItem.cover_image"
|
||||||
|
width="160rpx"
|
||||||
|
height="160rpx"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="ml-12rpx flex-1 flex flex-col justify-between space-y-10rpx"
|
||||||
|
>
|
||||||
|
<view class="text-26rpx font-500 line-clamp-2">{{
|
||||||
|
subItem.title
|
||||||
|
}}</view>
|
||||||
|
<view class="text-24rpx text-hex-999999">{{
|
||||||
|
subItem.description
|
||||||
|
}}</view>
|
||||||
|
<view class="text-22rpx text-hex-999999 text-right">{{
|
||||||
|
timeFormat(subItem.created_at)
|
||||||
|
}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</MescrollItem>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { http } from '@/utils/request'
|
||||||
|
import CuNavbar from '@/components/cu-navbar/index'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { onPageScroll, onReachBottom, onShow } from '@dcloudio/uni-app'
|
||||||
|
import useMescrollMore from '@/uni_modules/mescroll-uni/hooks/useMescrollMore.js'
|
||||||
|
import MescrollItem from '@/components/mescroll-api/more.vue'
|
||||||
|
import { timeFormat } from '@climblee/uv-ui/libs/function'
|
||||||
|
|
||||||
|
const mescrollItems = ref([])
|
||||||
|
|
||||||
|
const { tabIndex, getMescroll, scrollToLastY } = useMescrollMore(
|
||||||
|
mescrollItems,
|
||||||
|
onPageScroll,
|
||||||
|
onReachBottom
|
||||||
|
)
|
||||||
|
let tabList = ref([])
|
||||||
|
http
|
||||||
|
.get('/keywords', { params: { parent_key: 'book_category' } })
|
||||||
|
.then((res) => {
|
||||||
|
tabList.value = res
|
||||||
|
})
|
||||||
|
|
||||||
|
const tabChange = ({ index }) => {
|
||||||
|
tabIndex.value = index
|
||||||
|
scrollToLastY()
|
||||||
|
}
|
||||||
|
|
||||||
|
const detail = (id) => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/train-books/detail?id=${id}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue