feat(practice): 添加安全知识学习页面并更新路由配置- 将视频页面重命名为实践练习页面
- 更新页面配置文件路径及标题为“安全知识学习”- 新增 CMS 网站字段 onWxCheck 控制页面内容展示逻辑 - 根据 onWxCheck 字段值切换显示视频或试题组件 - 在 study 页面中将导航链接指向新的 practice 页面 - 移除旧的 video 配置文件 - 引入 Questions 组件用于展示安全知识题目 - 调用 configWebsiteField 接口获取页面控制参数 - 保留原有视频播放功能并在 onWxCheck为 '0' 时显示
This commit is contained in:
@@ -53,4 +53,5 @@ export interface Config {
|
||||
email?: string;
|
||||
loginTitle?: string;
|
||||
sysLogo?: string;
|
||||
onWxCheck?: string;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export default defineAppConfig({
|
||||
"location",
|
||||
"query",
|
||||
"fence",
|
||||
"video/video",
|
||||
"practice/practice",
|
||||
"exam/exam",
|
||||
"bx/bx",
|
||||
"bx/bx-add",
|
||||
|
||||
3
src/hjm/practice/practice.config.ts
Normal file
3
src/hjm/practice/practice.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '安全知识学习'
|
||||
})
|
||||
@@ -5,6 +5,9 @@ import {useRouter} from '@tarojs/taro'
|
||||
import {getCmsArticle} from "@/api/cms/cmsArticle";
|
||||
import {CmsArticle} from "@/api/cms/cmsArticle/model";
|
||||
import {View} from '@tarojs/components'
|
||||
import {Config} from "@/api/cms/cmsWebsiteField/model";
|
||||
import {configWebsiteField} from "@/api/cms/cmsWebsiteField";
|
||||
import Questions from "@/components/Questions";
|
||||
|
||||
/**
|
||||
* 文章终极列表
|
||||
@@ -12,6 +15,7 @@ import {View} from '@tarojs/components'
|
||||
*/
|
||||
const VideoForm = () => {
|
||||
const {params} = useRouter();
|
||||
const [config, setConfig] = useState<Config>()
|
||||
const [item, setItem] = useState<CmsArticle>()
|
||||
const [source, setSource] = useState({
|
||||
src: '',
|
||||
@@ -31,6 +35,9 @@ const VideoForm = () => {
|
||||
}
|
||||
|
||||
const reload = () => {
|
||||
configWebsiteField().then(data => {
|
||||
setConfig(data)
|
||||
})
|
||||
getCmsArticle(Number(params.id)).then(data => {
|
||||
setItem(data)
|
||||
Taro.setNavigationBarTitle({
|
||||
@@ -48,22 +55,34 @@ const VideoForm = () => {
|
||||
reload()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className={'px-3 mt-4 mb-10'}>
|
||||
<div className={'flex flex-col justify-between items-center bg-white rounded-lg p-2'}>
|
||||
<Video
|
||||
source={source}
|
||||
options={options}
|
||||
onPlay={play}
|
||||
onPause={pause}
|
||||
onPlayEnd={playend}
|
||||
style={{ height: '163px' }}
|
||||
/>
|
||||
</div>
|
||||
<View className={'content text-gray-700 text-sm py-4 text-center'}>
|
||||
观看完视频后开始考试!
|
||||
|
||||
if (config?.onWxCheck === '1') {
|
||||
console.log(config?.onWxCheck, 'config?.onWxCheckconfig?.onWxCheckconfig?.onWxCheck')
|
||||
return (
|
||||
<View className={'mt-3'}>
|
||||
<Questions/>
|
||||
</View>
|
||||
</div>
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
if (config?.onWxCheck === '0')
|
||||
return (
|
||||
<div className={'px-3 mt-4 mb-10'}>
|
||||
<div className={'flex flex-col justify-between items-center bg-white rounded-lg p-2'}>
|
||||
<Video
|
||||
source={source}
|
||||
options={options}
|
||||
onPlay={play}
|
||||
onPause={pause}
|
||||
onPlayEnd={playend}
|
||||
style={{height: '163px'}}
|
||||
/>
|
||||
</div>
|
||||
<View className={'content text-gray-700 text-sm py-4 text-center'}>
|
||||
观看完视频后开始考试!
|
||||
</View>
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
export default VideoForm
|
||||
@@ -1,3 +0,0 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '观看视频'
|
||||
})
|
||||
@@ -59,7 +59,7 @@ const Study = () => {
|
||||
!monthTaskCompleted && list?.map((item, index) => {
|
||||
return (
|
||||
<div key={index} className={'flex flex-col justify-between items-center bg-white rounded-lg p-2'}
|
||||
onClick={() => Taro.navigateTo({url: `/hjm/video/video?id=${item.articleId}`})}>
|
||||
onClick={() => Taro.navigateTo({url: `/hjm/practice/practice?id=${item.articleId}`})}>
|
||||
<Image src={item.image} height={200}/>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user