成就等界面接口调整

This commit is contained in:
2025-10-31 19:13:21 +08:00
parent 9ad9507a72
commit 16754b527e
61 changed files with 4748 additions and 592 deletions

View File

@@ -1,27 +1,56 @@
<template>
<div class="article-card">
<div class="article-card" @click="handleClick">
<div class="article-image">
<div class="image-placeholder"></div>
<img v-if="resource?.coverImage" :src="FILE_DOWNLOAD_URL + resource.coverImage" :alt="resource.title" />
<div v-else class="image-placeholder"></div>
<div class="article-tag">精选文章</div>
</div>
<div class="article-content">
<h3 class="article-title">新时代中国特色社会主义发展历程</h3>
<h3 class="article-title">{{ resource?.title || '标题' }}</h3>
<p class="article-desc">
习近平新时代中国特色社会主义思想是当代中国马克思主义二十一世纪马克思主义是中华文化和中国精神的时代精华其核心要义与实践要求内涵丰富意义深远
{{ resource?.summary || '暂无简介' }}
</p>
<div class="article-footer">
<div class="meta-tag">
<el-icon><Document /></el-icon>
<span>热门文章</span>
</div>
<span class="view-count">2.1w次浏览</span>
<span class="view-count">{{ formatViewCount(resource?.viewCount || 0) }}</span>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue';
import { useRouter } from 'vue-router';
import { Document } from '@element-plus/icons-vue';
import type { ResourceRecommendVO } from '@/types';
import { FILE_DOWNLOAD_URL } from '@/config';
const props = defineProps<{
resource?: ResourceRecommendVO;
}>();
const router = useRouter();
// 格式化浏览量
function formatViewCount(count: number): string {
if (count < 1000) {
return `${count}次浏览`;
} else if (count < 10000) {
return `${(count / 1000).toFixed(1)}k次浏览`;
} else {
return `${(count / 10000).toFixed(1)}w次浏览`;
}
}
// 点击卡片
function handleClick() {
if (props.resource?.resourceID) {
router.push(`/article/show?articleId=${props.resource.resourceID}`);
}
}
</script>
<style lang="scss" scoped>
@@ -47,6 +76,12 @@ import { Document } from '@element-plus/icons-vue';
overflow: hidden;
flex-shrink: 0;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
.image-placeholder {
width: 100%;
height: 100%;

View File

@@ -1,22 +1,55 @@
<template>
<div class="ideological-card">
<div class="ideological-card" @click="handleClick">
<div class="card-image">
<div class="image-placeholder"></div>
<img v-if="resource?.coverImage" :src="FILE_DOWNLOAD_URL + resource.coverImage" :alt="resource.title" />
<div v-else class="image-placeholder"></div>
</div>
<div class="date-box">
<div class="day">10</div>
<div class="month">2025.10</div>
<div class="date-box" v-if="publishDate">
<div class="day">{{ publishDate.day }}</div>
<div class="month">{{ publishDate.month }}</div>
</div>
<div class="card-content">
<h3 class="card-title">学校召开"习近平新时代中国特色社会主义思想概论"课程集体备课会</h3>
<h3 class="card-title">{{ resource?.title || '标题' }}</h3>
<p class="card-desc">
深入贯彻习近平总书记关于思政课建设的重要论述持续推进思政课教学改革创新
{{ resource?.summary || '暂无简介' }}
</p>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue';
import { useRouter } from 'vue-router';
import type { ResourceRecommendVO } from '@/types';
import { FILE_DOWNLOAD_URL } from '@/config';
const props = defineProps<{
resource?: ResourceRecommendVO;
}>();
const router = useRouter();
// 格式化发布日期
const publishDate = computed(() => {
if (!props.resource?.publishTime) return null;
const date = new Date(props.resource.publishTime);
const day = date.getDate();
const year = date.getFullYear();
const month = date.getMonth() + 1;
return {
day: day.toString(),
month: `${year}.${month.toString().padStart(2, '0')}`
};
});
// 点击卡片
function handleClick() {
if (props.resource?.resourceID) {
router.push(`/article/show?articleId=${props.resource.resourceID}`);
}
}
</script>
<style lang="scss" scoped>
@@ -42,6 +75,12 @@
flex-shrink: 0;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
.image-placeholder {
width: 100%;
height: 100%;
@@ -59,9 +98,8 @@
}
.date-box {
position: absolute;
top: calc(57.55% - 3.5em);
left: 5.7%;
margin: 0 5.7%;
transform: translateY(-50%);
width: 18.75%;
aspect-ratio: 1 / 1;
background: #C62828;
@@ -73,7 +111,6 @@
gap: 0.3em;
padding: 0.4em 0.3em;
box-sizing: border-box;
z-index: 10;
.day {
font-family: 'PingFang SC';
@@ -97,7 +134,7 @@
}
.card-content {
padding: 17.4% 5.7% 5.7% 5.7%;
padding: 0 5.7% 5.7% 5.7%;
flex: 1;
display: flex;
flex-direction: column;

View File

@@ -645,8 +645,7 @@ defineExpose({
<style lang="scss" scoped>
// 路由页面模式样式
.article-page-view {
min-height: 100vh;
background: #f5f7fa;
// background: #f5f7fa;
padding-bottom: 60px;
}
@@ -675,7 +674,7 @@ defineExpose({
padding: 40px 24px;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
// box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.error-container {