|
|
@@ -10,7 +10,7 @@
|
|
|
<!-- 轮播 -->
|
|
|
<Carousel v-bind="carouselConfig" class="main-header-box small carousel-light">
|
|
|
<Slide
|
|
|
- v-for="(item, key) in newsData.content.value"
|
|
|
+ v-for="(item, key) in carouselData.content.value"
|
|
|
:key="key"
|
|
|
class="main-header-box small"
|
|
|
>
|
|
|
@@ -22,6 +22,191 @@
|
|
|
</template>
|
|
|
</Carousel>
|
|
|
|
|
|
+ <!-- 主要内容 -->
|
|
|
+ <div class="main-content">
|
|
|
+ <div class="container">
|
|
|
+ <!-- 通知公告和热点新闻 -->
|
|
|
+ <div class="row">
|
|
|
+
|
|
|
+ <div class="col col-sm-12 col-md-6 col-lg-6 notices-list">
|
|
|
+ <div class="section-title">
|
|
|
+ <div class="d-flex flex-row align-items-center">
|
|
|
+ <h2 id="notices-button" @click="currentTab = 'notices'" :class="{'active': currentTab === 'notices'}" class="button icon">通知公告</h2>
|
|
|
+ <h2 id="hot-news-button" @click="currentTab = 'hot'" :class="{'active': currentTab === 'hot'}" class="button icon">热点新闻</h2>
|
|
|
+ </div>
|
|
|
+ <router-link :to="currentTab === 'notices' ?
|
|
|
+ `/channel/${notices.content.value?.channel_id}` :
|
|
|
+ `/channel/${hot.content.value?.channel_id}`"
|
|
|
+ class="section-more">
|
|
|
+ 查看更多 <Icon name="material-symbols-light:chevron-right" />
|
|
|
+ </router-link>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div v-if="currentTab === 'notices'" id="notices-list" class="notices-content">
|
|
|
+ <SimplePageContentLoader :loader="notices" :showEmpty="!notices.content.value?.items?.length">
|
|
|
+ <div v-for="notice in notices.content.value?.items" :key="notice.id" class="notice-item">
|
|
|
+ <div>
|
|
|
+ <router-link :to="'/page/' + notice.id" class="notice-title">{{ notice.title }}</router-link>
|
|
|
+ <p>{{ notice.description }}</p>
|
|
|
+ </div>
|
|
|
+ <span class="notice-publishtime">{{ DataDateUtils.formatDate(new Date(notice.publishtime * 1000), 'yyyy-MM-dd') }}</span>
|
|
|
+ </div>
|
|
|
+ </SimplePageContentLoader>
|
|
|
+ </div>
|
|
|
+ <div v-if="currentTab === 'hot'" id="hot-news-list" class="news-content">
|
|
|
+ <SimplePageContentLoader :loader="hot" :showEmpty="!hot.content.value?.items?.length">
|
|
|
+ <div v-for="item in hot.content.value?.items" :key="item.id" class="news-item">
|
|
|
+ <router-link :to="'/page/' + item.id" class="title">{{ item.title }}</router-link>
|
|
|
+ <span class="publishtime">{{ DataDateUtils.formatDate(new Date(item.publishtime * 1000), 'yyyy-MM-dd') }}</span>
|
|
|
+ </div>
|
|
|
+ </SimplePageContentLoader>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="col col-sm-12 col-md-6 col-lg-6">
|
|
|
+ <Carousel v-bind="carouselConfig">
|
|
|
+ <Slide
|
|
|
+ v-for="(item, key) in recommendArticles.content.value"
|
|
|
+ :key="key"
|
|
|
+ class="featured-image bg-secondary"
|
|
|
+ :style="{ 'background-image': `url(${item.image})`, 'background-size': 'cover' }"
|
|
|
+ >
|
|
|
+ <router-link :to="'/page/' + item.id">
|
|
|
+ <img :src="item.image" :alt="item.desc || item.title" style="width: 100%; height: 100%; object-fit: contain;">
|
|
|
+ <div class="caption">
|
|
|
+ <h3>{{ item.title }}</h3>
|
|
|
+ <p>{{ item.desc || '' }}</p>
|
|
|
+ </div>
|
|
|
+ </router-link>
|
|
|
+ </Slide>
|
|
|
+ <template #addons>
|
|
|
+ <Navigation />
|
|
|
+ <Pagination />
|
|
|
+ </template>
|
|
|
+ </Carousel>
|
|
|
+ <div class="d-flex flex-row justify-content-between">
|
|
|
+ <a href="http://cpc.people.com.cn/GB/67481/448544/index.html" class="w-50">
|
|
|
+ <img src="https://wlj.xm.gov.cn/ztzl/202211/W020221213510920336898.jpg" class="mt-3" style="width: 100%; height:130px;object-fit:cover;" />
|
|
|
+ </a>
|
|
|
+ <a href="https://www.12371.cn/special/xxzd/" class="w-50">
|
|
|
+ <img src="@/assets/images/xuexi.png" class="mt-3" style="width: 100%; height:130px;object-fit:cover;" />
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 工作动态和党建工作 -->
|
|
|
+ <div class="row mt-lg-3 mt-md-2 mt-sm-2">
|
|
|
+
|
|
|
+ <div class="col col-sm-12 col-md-5 col-lg-5">
|
|
|
+ <div class="main-box fill">
|
|
|
+ <div class="section-title">
|
|
|
+ <h2><i class="fa fa-flag"></i> 党建工作</h2>
|
|
|
+ <router-link :to="`/channel/${partyBuilding.content.value?.channel_id}`" class="section-more">查看更多 <Icon name="material-symbols-light:chevron-right" /></router-link>
|
|
|
+ </div>
|
|
|
+ <div class="news-content">
|
|
|
+ <SimplePageContentLoader :loader="partyBuilding" :showEmpty="!partyBuilding.content.value?.items?.length">
|
|
|
+ <div v-for="item in partyBuilding.content.value?.items" :key="item.id" class="news-item">
|
|
|
+ <router-link :to="'/page/' + item.id" class="title">{{ item.title }}</router-link>
|
|
|
+ <span class="publishtime">{{ DataDateUtils.formatDate(new Date(item.publishtime * 1000), 'yyyy-MM-dd') }}</span>
|
|
|
+ </div>
|
|
|
+ </SimplePageContentLoader>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="col col-sm-12 col-md-5 col-lg-5">
|
|
|
+ <div class="main-box fill">
|
|
|
+ <div class="section-title">
|
|
|
+ <h2><i class="fa fa-refresh"></i> 工作动态</h2>
|
|
|
+ <router-link :to="`/channel/${workUppublishtimes.content.value?.channel_id}`" class="section-more">查看更多 <Icon name="material-symbols-light:chevron-right" /></router-link>
|
|
|
+ </div>
|
|
|
+ <div class="news-content">
|
|
|
+ <SimplePageContentLoader :loader="workUppublishtimes" :showEmpty="!workUppublishtimes.content.value?.items?.length">
|
|
|
+ <div v-for="uppublishtime in workUppublishtimes.content.value?.items" :key="uppublishtime.id" class="news-item">
|
|
|
+ <router-link :to="'/page/' + uppublishtime.id" class="title">{{ uppublishtime.title }}</router-link>
|
|
|
+ <span class="publishtime">{{ DataDateUtils.formatDate(new Date(uppublishtime.publishtime * 1000), 'yyyy-MM-dd') }}</span>
|
|
|
+ </div>
|
|
|
+ </SimplePageContentLoader>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="col col-sm-12 col-md-2 col-lg-2">
|
|
|
+
|
|
|
+ <Carousel v-bind="carouselConfig">
|
|
|
+ <Slide
|
|
|
+ v-for="(item, key) in carousel2Data.content.value"
|
|
|
+ :key="key"
|
|
|
+ class="featured-image bg-secondary"
|
|
|
+ :style="{ 'background-image': `url(${item.image})`, 'background-size': 'cover' }"
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ :src="item.image" style="width: 100%; height: 100%; object-fit: contain;"
|
|
|
+ @click="handleImageClick(item.image)"
|
|
|
+ >
|
|
|
+ </Slide>
|
|
|
+ <template #addons>
|
|
|
+ <Navigation />
|
|
|
+ <Pagination />
|
|
|
+ </template>
|
|
|
+ </Carousel>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <hr class="main-hr" />
|
|
|
+
|
|
|
+ <!-- 精彩推荐 -->
|
|
|
+ <div class="featured-section main-box">
|
|
|
+ <div class="section-title">
|
|
|
+ <h2 class="icon">精彩推荐</h2>
|
|
|
+ <!-- <a href="#" class="section-more">查看更多 <Icon name="material-symbols-light:chevron-right" /></a> -->
|
|
|
+ </div>
|
|
|
+ <div class="featured-grid">
|
|
|
+ <SimplePageContentLoader :loader="featured" :showEmpty="!featured.content.value?.items?.length">
|
|
|
+ <div v-for="item in featured.content.value?.items" :key="item.id" class="featured-card">
|
|
|
+ <router-link :to="'/page/' + item.id">
|
|
|
+ <img :src="item.image" :alt="item.desc || item.title">
|
|
|
+ <p>{{ item.title }}</p>
|
|
|
+ </router-link>
|
|
|
+ </div>
|
|
|
+ </SimplePageContentLoader>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 公共服务 -->
|
|
|
+ <div class="services-section">
|
|
|
+ <img class="title" src="@/assets/images/box-service.png" alt="公共服务">
|
|
|
+ <div class="services-grid">
|
|
|
+
|
|
|
+ <div class="service-card">
|
|
|
+ <img class="icon" src="@/assets/images/icon-explore.png">
|
|
|
+ <h3>志愿者招募</h3>
|
|
|
+ <a href="#" class="service-link">
|
|
|
+ <i class="fa fa-solid fa-chevron-right"></i>
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="service-card">
|
|
|
+ <img class="icon" src="@/assets/images/icon-join.png">
|
|
|
+ <h3>活动报名</h3>
|
|
|
+ <a href="#" class="service-link">
|
|
|
+ <i class="fa fa-solid fa-chevron-right"></i>
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="service-card">
|
|
|
+ <img class="icon" src="@/assets/images/icon-contract.png">
|
|
|
+ <h3>联系咨询通道</h3>
|
|
|
+ <a href="#" class="service-link">
|
|
|
+ <i class="fa fa-solid fa-chevron-right"></i>
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -32,15 +217,79 @@ import { useRouter } from 'vue-router';
|
|
|
import { useSSrSimpleDataLoader } from '@/composeable/SimpleDataLoader';
|
|
|
import { DataDateUtils } from '@imengyu/js-request-transform';
|
|
|
import { ScrollRect } from '@imengyu/vue-scroll-rect';
|
|
|
+import CarouselItem1 from '@/assets/images/board1/1.jpg';
|
|
|
+import CarouselItem2 from '@/assets/images/board1/2.jpg';
|
|
|
+import CarouselItem3 from '@/assets/images/board1/3.jpg';
|
|
|
+import CarouselItem4 from '@/assets/images/board1/4.jpg';
|
|
|
+import CarouselItem5 from '@/assets/images/board1/5.jpg';
|
|
|
|
|
|
const carouselConfig = {
|
|
|
itemsToShow: 1,
|
|
|
wrapAround: true,
|
|
|
autoPlay: 5000,
|
|
|
}
|
|
|
-const newsData = await useSSrSimpleDataLoader('news', async () => {
|
|
|
- throw new Error('newsData is not implemented');
|
|
|
+const carouselData = await useSSrSimpleDataLoader('carousel', async () => {
|
|
|
+ const res = await $fetch(`/api/carousel`);
|
|
|
+ if (!res.status)
|
|
|
+ throw new Error(res.message);
|
|
|
+ return res.data;
|
|
|
+});
|
|
|
+const carousel2Data = await useSSrSimpleDataLoader('carousel2', async () => {
|
|
|
+ return [
|
|
|
+ { image: CarouselItem1, title: 'carousel item 1' },
|
|
|
+ { image: CarouselItem2, title: 'carousel item 2' },
|
|
|
+ { image: CarouselItem3, title: 'carousel item 3' },
|
|
|
+ { image: CarouselItem4, title: 'carousel item 4' },
|
|
|
+ { image: CarouselItem5, title: 'carousel item 5' },
|
|
|
+ ];
|
|
|
+});
|
|
|
+
|
|
|
+const currentTab = ref('notices');
|
|
|
+
|
|
|
+const recommendArticles = await useSSrSimpleDataLoader('recommendArticles', async () => {
|
|
|
+ const res = await $fetch(`/api/article/recommend`, { query: { page: 1, pageSize: 6 } });
|
|
|
+ if (!res.status)
|
|
|
+ throw new Error(res.message);
|
|
|
+ return res.data;
|
|
|
+});
|
|
|
+const notices = await useSSrSimpleDataLoader('notices', async () => {
|
|
|
+ const res = await $fetch(`/api/article/byChannelName?channelName=新闻公告`);
|
|
|
+ if (!res.status)
|
|
|
+ throw new Error(res.message);
|
|
|
+ return res.data;
|
|
|
});
|
|
|
+// 工作动态数据
|
|
|
+const workUppublishtimes = await useSSrSimpleDataLoader('workUppublishtimes', async () => {
|
|
|
+ const res = await $fetch(`/api/article/byChannelName?channelName=工作动态`);
|
|
|
+ if (!res.status)
|
|
|
+ throw new Error(res.message);
|
|
|
+ return res.data;
|
|
|
+});
|
|
|
+// 党建工作数据
|
|
|
+const partyBuilding = await useSSrSimpleDataLoader('partyBuilding', async () => {
|
|
|
+ const res = await $fetch(`/api/article/byChannelName?channelName=党建工作`);
|
|
|
+ if (!res.status)
|
|
|
+ throw new Error(res.message);
|
|
|
+ return res.data;
|
|
|
+});
|
|
|
+// 热点新闻数据
|
|
|
+const hot = await useSSrSimpleDataLoader('hot', async () => {
|
|
|
+ const res = await $fetch(`/api/article/byChannelName?channelName=热门新闻`);
|
|
|
+ if (!res.status)
|
|
|
+ throw new Error(res.message);
|
|
|
+ return res.data;
|
|
|
+});
|
|
|
+// 精彩推荐数据
|
|
|
+const featured = await useSSrSimpleDataLoader('featured', async () => {
|
|
|
+ const res = await $fetch(`/api/article/byChannelName?channelName=热门新闻`);
|
|
|
+ if (!res.status)
|
|
|
+ throw new Error(res.message);
|
|
|
+ return res.data;
|
|
|
+});
|
|
|
+
|
|
|
+function handleImageClick(image: string) {
|
|
|
+ window.open(image, '_blank');
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|