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;
|
email?: string;
|
||||||
loginTitle?: string;
|
loginTitle?: string;
|
||||||
sysLogo?: string;
|
sysLogo?: string;
|
||||||
|
onWxCheck?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export default defineAppConfig({
|
|||||||
"location",
|
"location",
|
||||||
"query",
|
"query",
|
||||||
"fence",
|
"fence",
|
||||||
"video/video",
|
"practice/practice",
|
||||||
"exam/exam",
|
"exam/exam",
|
||||||
"bx/bx",
|
"bx/bx",
|
||||||
"bx/bx-add",
|
"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 {getCmsArticle} from "@/api/cms/cmsArticle";
|
||||||
import {CmsArticle} from "@/api/cms/cmsArticle/model";
|
import {CmsArticle} from "@/api/cms/cmsArticle/model";
|
||||||
import {View} from '@tarojs/components'
|
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 VideoForm = () => {
|
||||||
const {params} = useRouter();
|
const {params} = useRouter();
|
||||||
|
const [config, setConfig] = useState<Config>()
|
||||||
const [item, setItem] = useState<CmsArticle>()
|
const [item, setItem] = useState<CmsArticle>()
|
||||||
const [source, setSource] = useState({
|
const [source, setSource] = useState({
|
||||||
src: '',
|
src: '',
|
||||||
@@ -31,6 +35,9 @@ const VideoForm = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const reload = () => {
|
const reload = () => {
|
||||||
|
configWebsiteField().then(data => {
|
||||||
|
setConfig(data)
|
||||||
|
})
|
||||||
getCmsArticle(Number(params.id)).then(data => {
|
getCmsArticle(Number(params.id)).then(data => {
|
||||||
setItem(data)
|
setItem(data)
|
||||||
Taro.setNavigationBarTitle({
|
Taro.setNavigationBarTitle({
|
||||||
@@ -48,6 +55,17 @@ const VideoForm = () => {
|
|||||||
reload()
|
reload()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|
||||||
|
if (config?.onWxCheck === '1') {
|
||||||
|
console.log(config?.onWxCheck, 'config?.onWxCheckconfig?.onWxCheckconfig?.onWxCheck')
|
||||||
|
return (
|
||||||
|
<View className={'mt-3'}>
|
||||||
|
<Questions/>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config?.onWxCheck === '0')
|
||||||
return (
|
return (
|
||||||
<div className={'px-3 mt-4 mb-10'}>
|
<div className={'px-3 mt-4 mb-10'}>
|
||||||
<div className={'flex flex-col justify-between items-center bg-white rounded-lg p-2'}>
|
<div className={'flex flex-col justify-between items-center bg-white rounded-lg p-2'}>
|
||||||
@@ -57,7 +75,7 @@ const VideoForm = () => {
|
|||||||
onPlay={play}
|
onPlay={play}
|
||||||
onPause={pause}
|
onPause={pause}
|
||||||
onPlayEnd={playend}
|
onPlayEnd={playend}
|
||||||
style={{ height: '163px' }}
|
style={{height: '163px'}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<View className={'content text-gray-700 text-sm py-4 text-center'}>
|
<View className={'content text-gray-700 text-sm py-4 text-center'}>
|
||||||
@@ -65,5 +83,6 @@ const VideoForm = () => {
|
|||||||
</View>
|
</View>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
export default VideoForm
|
export default VideoForm
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
export default definePageConfig({
|
|
||||||
navigationBarTitleText: '观看视频'
|
|
||||||
})
|
|
||||||
@@ -59,7 +59,7 @@ const Study = () => {
|
|||||||
!monthTaskCompleted && list?.map((item, index) => {
|
!monthTaskCompleted && list?.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<div key={index} className={'flex flex-col justify-between items-center bg-white rounded-lg p-2'}
|
<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}/>
|
<Image src={item.image} height={200}/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user