|
@@ -11,19 +11,62 @@ import { logo } from '../../../core/libs/svgs'
|
|
import { getBanner, getContent } from '../../../core/libs/requests'
|
|
import { getBanner, getContent } from '../../../core/libs/requests'
|
|
import Article from '../components/article.vue'
|
|
import Article from '../components/article.vue'
|
|
import { Content } from '../../../core/libs/models'
|
|
import { Content } from '../../../core/libs/models'
|
|
|
|
+import { isBoolean } from 'wot-design-uni/components/common/util'
|
|
|
|
|
|
const id = ref()
|
|
const id = ref()
|
|
const type = ref()
|
|
const type = ref()
|
|
|
|
+const bannerHome = ref<{
|
|
|
|
+ coverVideoImage: string
|
|
|
|
+ name: string
|
|
|
|
+ playCount: number
|
|
|
|
+ url: string
|
|
|
|
+ indexPromotionalVideoImage: string
|
|
|
|
+ detailsType: string
|
|
|
|
+ id: string | number
|
|
|
|
+ details: string
|
|
|
|
+ createTime: string | number
|
|
|
|
+}>({
|
|
|
|
+ coverVideoImage: '',
|
|
|
|
+ name: '',
|
|
|
|
+ url: '',
|
|
|
|
+ indexPromotionalVideoImage: '',
|
|
|
|
+ detailsType: '',
|
|
|
|
+ id: 0,
|
|
|
|
+ details: '',
|
|
|
|
+ createTime: 0,
|
|
|
|
+ playCount: 0,
|
|
|
|
+})
|
|
|
|
+const detailArticle = computed(() => {
|
|
|
|
+ if (type.value === 'banner') {
|
|
|
|
+ return {
|
|
|
|
+ isBanner: true,
|
|
|
|
+ ...data.value,
|
|
|
|
+ }
|
|
|
|
+ } else if (type.value === 'home-banner') {
|
|
|
|
+ return {
|
|
|
|
+ isBanner: true,
|
|
|
|
+ title: bannerHome.value.name,
|
|
|
|
+ contentDetail: bannerHome.value.details,
|
|
|
|
+ createTime: bannerHome.value.createTime.toString(),
|
|
|
|
+ viewsCount: bannerHome.value.playCount,
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ return {
|
|
|
|
+ isBanner: false,
|
|
|
|
+ ...data.value,
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+})
|
|
const request = ref<() => Promise<IResData<Partial<Content>>>>()
|
|
const request = ref<() => Promise<IResData<Partial<Content>>>>()
|
|
const { data, run } = useRequest(() => request.value(), { initialData: {} })
|
|
const { data, run } = useRequest(() => request.value(), { initialData: {} })
|
|
-const formatData = (res) =>{
|
|
|
|
- return {
|
|
|
|
- data:{
|
|
|
|
- isBanner: true,
|
|
|
|
- title: res.name,
|
|
|
|
- contentDetail: res.bannerDetailsContent
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+const formatData = (res) => {
|
|
|
|
+ return {
|
|
|
|
+ data: {
|
|
|
|
+ isBanner: true,
|
|
|
|
+ title: res.name,
|
|
|
|
+ contentDetail: res.bannerDetailsContent,
|
|
|
|
+ },
|
|
|
|
+ }
|
|
}
|
|
}
|
|
onLoad(async (query: { id: string; type?: 'banner'; data?: string }) => {
|
|
onLoad(async (query: { id: string; type?: 'banner'; data?: string }) => {
|
|
id.value = query.id
|
|
id.value = query.id
|
|
@@ -45,16 +88,12 @@ onLoad(async (query: { id: string; type?: 'banner'; data?: string }) => {
|
|
},
|
|
},
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- }else if(type.value === 'home-banner'){
|
|
|
|
- let res = JSON.parse(query.data)
|
|
|
|
- console.log(res)
|
|
|
|
- request.value = () => {
|
|
|
|
- return {
|
|
|
|
- isBanner: true,
|
|
|
|
- title: res.name,
|
|
|
|
- contentDetail: res.bannerDetailsContent
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ } else if (type.value === 'home-banner') {
|
|
|
|
+ console.log('home-banner', JSON.parse(query.data))
|
|
|
|
+ bannerHome.value = JSON.parse(query.data)
|
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
|
+ title: bannerHome.value.name,
|
|
|
|
+ })
|
|
} else {
|
|
} else {
|
|
request.value = () => getContent({ id: id.value })
|
|
request.value = () => getContent({ id: id.value })
|
|
}
|
|
}
|
|
@@ -70,12 +109,12 @@ onShareTimeline(() => ({
|
|
<template>
|
|
<template>
|
|
<div class="flex-grow bg-white">
|
|
<div class="flex-grow bg-white">
|
|
<Article
|
|
<Article
|
|
- :isBanner="data.isBanner"
|
|
|
|
- :title="data?.title"
|
|
|
|
|
|
+ :isBanner="detailArticle.isBanner"
|
|
|
|
+ :title="detailArticle?.title"
|
|
:author="{ name: '筑巢荟' }"
|
|
:author="{ name: '筑巢荟' }"
|
|
- :content="data?.contentDetail"
|
|
|
|
- :createAt="data?.createTime"
|
|
|
|
- :viewNum="data?.viewsCount || 0"
|
|
|
|
|
|
+ :content="detailArticle?.contentDetail"
|
|
|
|
+ :createAt="detailArticle?.createTime"
|
|
|
|
+ :viewNum="detailArticle?.viewsCount || 0"
|
|
>
|
|
>
|
|
<template #avatar><wd-img width="28" height="28" :src="logo"></wd-img></template>
|
|
<template #avatar><wd-img width="28" height="28" :src="logo"></wd-img></template>
|
|
</Article>
|
|
</Article>
|