|
|
@@ -12,22 +12,26 @@
|
|
|
</template> -->
|
|
|
</app-navbar>
|
|
|
</template>
|
|
|
- <section class="news-details__container" v-if="data">
|
|
|
- <h1>{{ data.title }}</h1>
|
|
|
+ <section class="news-details__container" v-if="localizedDetails">
|
|
|
+ <h1>{{ localizedDetails.title }}</h1>
|
|
|
<h4>
|
|
|
<span>{{ $t('news.source') }}</span>
|
|
|
- <img :src="getFileUrl(data.srclogo)" v-if="data.srclogo" />
|
|
|
- <span @click="openUrl(data?.srcurl)" style="color:dodgerblue" v-if="data.srcname">{{ data.srcname }}</span>
|
|
|
- <span>{{ formatDate(data.publishdate, 'YYYY-MM-DD') }}</span>
|
|
|
- <span style="margin-left: auto;">{{ $t('news.numbers') }} {{ data.hits }}</span>
|
|
|
+ <img :src="getFileUrl(localizedDetails.srclogo)" v-if="localizedDetails.srclogo" />
|
|
|
+ <span @click="openUrl(localizedDetails.srcurl)" style="color:dodgerblue"
|
|
|
+ v-if="localizedDetails.srcname">
|
|
|
+ {{ localizedDetails.srcname }}
|
|
|
+ </span>
|
|
|
+ <span>{{ formatDate(localizedDetails.publishdate, 'YYYY-MM-DD') }}</span>
|
|
|
+ <span style="margin-left: auto;">{{ $t('news.numbers') }} {{ localizedDetails.hits }}</span>
|
|
|
</h4>
|
|
|
- <HtmlContainer class="content" :context="formatHtmlString(data.context)" v-if="data.context" />
|
|
|
- <p class="footer" v-if="data.author">{{ $t('news.author') }} {{ data.author }}</p>
|
|
|
+ <HtmlContainer class="content" :context="formatHtmlString(localizedDetails.context)"
|
|
|
+ v-if="localizedDetails.context" />
|
|
|
+ <p class="footer" v-if="localizedDetails.author">{{ $t('news.author') }} {{ localizedDetails.author }}</p>
|
|
|
</section>
|
|
|
- <template v-if="dataList.length">
|
|
|
+ <template v-if="titleList.length">
|
|
|
<Divider>{{ $t('news.hotnews') }}</Divider>
|
|
|
<CellGroup class="news-details__list">
|
|
|
- <template v-for="(item, index) in dataList" :key="index">
|
|
|
+ <template v-for="(item, index) in titleList" :key="index">
|
|
|
<Cell class="article-item" title-class="article-item__title" value-class="article-item__time"
|
|
|
:title="item.title" :value="formatDate(item.publishdate, 'MM/DD')"
|
|
|
:to="{ name: 'news-detail', query: { id: item.id } }" replace />
|
|
|
@@ -42,6 +46,7 @@ import { CellGroup, Cell, Divider } from 'vant'
|
|
|
import { formatDate, getFileUrl, formatHtmlString } from '@/filters'
|
|
|
import { useNavigation } from '@mobile/router/navigation'
|
|
|
import { useRequest } from '@/hooks/request'
|
|
|
+import { useNewsContent } from '@/business/news'
|
|
|
import { queryNewTitles, queryNewContents } from '@/services/api/news'
|
|
|
import plus from '@/utils/h5plus'
|
|
|
import HtmlContainer from '@mobile/components/base/html-container/index.vue'
|
|
|
@@ -49,28 +54,25 @@ import HtmlContainer from '@mobile/components/base/html-container/index.vue'
|
|
|
const { getQueryString } = useNavigation()
|
|
|
const newsId = getQueryString('id')
|
|
|
|
|
|
-const { dataList, run } = useRequest(queryNewTitles, {
|
|
|
+const { details, localizedDetails } = useNewsContent()
|
|
|
+
|
|
|
+const { dataList: titleList, run } = useRequest(queryNewTitles, {
|
|
|
manual: true,
|
|
|
- params: {
|
|
|
+ defaultParams: {
|
|
|
pagesize: 10,
|
|
|
},
|
|
|
onSuccess: (res) => {
|
|
|
- dataList.value = res.data.filter((e) => e.id.toString() !== newsId)
|
|
|
+ titleList.value = res.data.filter((e) => e.id.toString() !== newsId)
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-const { data } = useRequest(queryNewContents, {
|
|
|
- params: {
|
|
|
+useRequest(queryNewContents, {
|
|
|
+ defaultParams: {
|
|
|
ids: newsId
|
|
|
},
|
|
|
onSuccess: (res) => {
|
|
|
- if (res.data.length) {
|
|
|
- const details = res.data[0]
|
|
|
- data.value = details
|
|
|
- run({ columnid: details.columnid })
|
|
|
- } else {
|
|
|
- run()
|
|
|
- }
|
|
|
+ details.value = res.data[0]
|
|
|
+ run({ columnid: details.value?.columnid })
|
|
|
}
|
|
|
})
|
|
|
|