Skip to content

Commit

Permalink
Merge branch 'main' into issue-67-新增nav菜单
Browse files Browse the repository at this point in the history
  • Loading branch information
yizhankui authored Jan 27, 2023
2 parents 822398d + b53c6a8 commit 629ff9d
Show file tree
Hide file tree
Showing 35 changed files with 1,866 additions and 904 deletions.
Binary file modified backend/.tmp/data.db
Binary file not shown.
10 changes: 5 additions & 5 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
},
"devDependencies": {},
"dependencies": {
"@strapi/plugin-documentation": "^4.5.6",
"@strapi/plugin-graphql": "^4.5.6",
"@strapi/plugin-i18n": "4.5.6",
"@strapi/plugin-users-permissions": "4.5.6",
"@strapi/strapi": "4.5.6",
"@strapi/plugin-documentation": "^4.6.0",
"@strapi/plugin-graphql": "^4.6.0",
"@strapi/plugin-i18n": "4.6.0",
"@strapi/plugin-users-permissions": "4.6.0",
"@strapi/strapi": "4.6.0",
"better-sqlite3": "^8.0.1",
"strapi-plugin-navigation": "^2.2.3",
"strapi-plugin-transformer": "^2.2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
},
"x-generation-date": "2023-01-26T05:03:19.417Z"
"x-generation-date": "2023-01-27T08:40:22.000Z"
},
"x-strapi-config": {
"path": "/documentation",
Expand Down
2 changes: 1 addition & 1 deletion frontend/assets/themes.ts

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions frontend/components/Articles/Item.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<script setup lang="ts">
const props = defineProps({
uname: String,
name: String,
duration: String,
title: String,
desc: String,
summary: String,
tags: {
type: Array,
default: () => [],
default: (): string[] => [],
},
topicHeat: {
type: Array,
default: (): number[] => [0, 0, 0],
},
postID: String,
cover: String,
})
const enteredtopicHeat: (string | number)[] = props.topicHeat.map((item) => {
const value = item as number
Expand All @@ -22,10 +23,10 @@ const enteredtopicHeat: (string | number)[] = props.topicHeat.map((item) => {

<template>
<li class="focus:text-slate-500 flex justify-between items-center py-4 transition-all bg-white hover:bg-gray-50 b-b b-grey all-cursor-pointer">
<NuxtLink class="flex-auto pl-5 truncate" :to="`/${uname}`" style="flex: 1">
<NuxtLink class="flex-auto pl-5 truncate" :to="`/${name}`" style="flex: 1">
<div class="flex items-center all-px-4 pr-4" style="font-size: 13px;">
<span class="border-r-1 pl-0">{{ uname }}</span>
<span class="text-gray-500 border-r-1">{{ duration }}</span>
<span class="border-r-1 pl-0">{{ name }}</span>
<span class="text-gray-500 border-r-1">{{ duration }}</span>
<div class="flex">
<div v-for="(tag, index) in tags" :key="index" class="al-px-0 px-0 text-gray-500 items-center flex">
<span class="px-0 text-gray-500">{{ tag }}</span>
Expand All @@ -38,7 +39,7 @@ const enteredtopicHeat: (string | number)[] = props.topicHeat.map((item) => {
{{ title }}
</div>
<div class="truncate pt-4 text-slate-500" style="font-size: 13px;">
{{ desc }}
{{ summary }}
</div>
</div>
<div class="flex all-flex all-items-center all-text-slate-700" style="font-size: 13px;">
Expand All @@ -58,7 +59,8 @@ const enteredtopicHeat: (string | number)[] = props.topicHeat.map((item) => {
</NuxtLink>
<div class="px-4">
<nuxt-img
src="/og-image.png"
:src="cover"
:alt="summary"
width="120"
height="80"
loading="lazy"
Expand Down
10 changes: 7 additions & 3 deletions frontend/components/Articles/Link.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
<script setup lang="ts">
const artlistPath = useArtlistPath()
</script>

<template>
<div all-px-7 all-my-4 flex all-cursor-pointer>
<NuxtLink
to="/"
:to="`${artlistPath === '' ? '/' : artlistPath}`"
:class="`${
$route.query.sort ? 'text-gray-500' : 'text-[#007fff]'
} border-r-1 focus:text-[#007fff] hover:text-[#007fff]`"
>
推荐
</NuxtLink>
<NuxtLink
to="/?sort=newest"
:to="`${artlistPath}?sort=newest`"
:class="`${
$route.query.sort === 'newest' ? 'text-[#007fff]' : 'text-gray-500'
} border-r-1 focus:text-[#007fff] hover:text-[#007fff]`"
>
最新
</NuxtLink>
<NuxtLink
to="/?sort=three_days_hottest"
:to="`${artlistPath}?sort=three_days_hottest`"
:class="`${
($route.query.sort && $route.query.sort?.indexOf('hottest') !== -1) ? 'text-[#007fff]' : 'text-gray-500'
} border-r-1 focus:text-[#007fff] hover:text-[#007fff]`"
Expand Down
33 changes: 20 additions & 13 deletions frontend/components/Articles/index.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
<script setup lang="ts">
const route = useRoute()
watchEffect(() => {
// TODO: 请求数据
})
let pagenum = 0
const isLoading = useState('isLoading', () => false)
const initialItem = await useFetchPostData()
const artlistData = useArtlist(initialItem)
const artlistData = useArtlist(await useFetchPostData())
const addArtListItem = () => {
if (useScrollBottom()) {
const timer = setTimeout(async () => {
if (useScrollBottom()) {
pagenum++
const newItem = await useFetchPostData()
artlistData.value.push(...newItem)
const type = route.path.replace('/', '')
const sort = route.query?.sort as string | undefined
const newArtlistData = await useFetchPostData(type, sort, pagenum)
artlistData.value.push(...newArtlistData)
}
clearTimeout(timer)
}, 1000)
}
}
let EmployeeWindow
watchEffect(() => {
const type = route.path.replace('/', '')
const sort = route.query?.sort as string | undefined
isLoading.value = true
useFetchPostData(type, sort).then((data) => {
artlistData.value = data
isLoading.value = false
})
}, { flush: 'post' })
onMounted(() => {
EmployeeWindow = window as any
const EmployeeWindow = window as any
EmployeeWindow.addEventListener('scroll', addArtListItem)
})
onUnmounted(() => {
EmployeeWindow = window as any
const EmployeeWindow = window as any
EmployeeWindow.removeEventListener('scroll', addArtListItem) // 页面离开后销毁监听事件
})
</script>
Expand All @@ -36,10 +42,11 @@ onUnmounted(() => {
<ArticlesLink />
<UnoSelect />
</div>
<ul v-if="!isLoading && artlistData">
<ul v-if="!isLoading">
<ArticlesItem
v-for="items in artlistData" :key="items.uname" :uname="items.uname" :duration="items.duration"
:title="items.title" :desc="items.desc" :tags="items.tags" :topic-heat="items.topicHeat"
v-for="items in artlistData" :key="items.id" :name="items.name" :duration="items.duration"
:title="items.title" :summary="items.summary" :tags="items.tagIds" :topic-heat="items.topicHeat"
:cover="items.cover"
/>
</ul>
<ArticlesSkeleton v-else />
Expand Down
112 changes: 112 additions & 0 deletions frontend/components/ArticlesContent/End.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<script setup>
const props = defineProps({
type: {
type: Object,
},
tag: {
type: Object,
},
})
</script>

<template lang="">
<div class="article-end">
<div class="tag-list-box">
<div class="tag-list">
<div class="tag-list-title">
分类:
</div>
<a href="/frontend" target="_blank" rel="" class="item category-item"><span class="tag-title">{{ props.type.type }}</span></a>
</div>
<div class="tag-list">
<div class="tag-list-title">
标签:
</div>
<div class="tag-list-container">
<a href="/tag/%E5%89%8D%E7%AB%AF" target="_blank" rel="" class="item tag-item"><span v-for="(item, index) in props.tag.data" :key="index" class="tag-title">{{ item.tag }}</span></a>
</div>
</div>
</div>
</div>
</template>

<style scoped>
.main-area .article-end {
padding-top: 10px;
border-radius: 0 0 4px 4px;
padding-bottom: 3.33rem;
}
.main-area > {
border-radius: 4px;
background-color: #fff;
padding-left: 2.67rem;
padding-right: 2.67rem;
box-sizing: border-box;
}
.tag-list-box {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
margin-bottom: -12px;
}
.tag-list-box {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
margin-bottom: -12px;
}
.tag-list-box .tag-list:first-child:not(:last-child) {
margin-right: 2.67rem;
flex-shrink: 0;
}
.tag-list-box .tag-list {
display: flex;
font-size: 1.167rem;
line-height: 2.286;
}
.tag-list-box .tag-list .tag-list-title {
flex-shrink: 0;
margin-right: 8px;
font-size: 14px;
color: #515767;
}
.tag-list-box .tag-list .item.category-item {
background-color: #f2f3f5;
color: #515767;
}
.tag-list-box .tag-list .item {
display: flex;
align-items: center;
margin: 0 0.667rem 1rem 0;
padding: 0 1rem;
border-radius: 4px;
transition: background-color 0.15s linear;
}
.tag-list-box .tag-list .tag-title {
white-space: nowrap;
line-height: 2.667rem;
}
.tag-list-box .tag-list .tag-list-container {
display: flex;
flex-wrap: wrap;
}
.tag-list-box .tag-list .item.tag-item {
background-color: #eaf2ff;
color: #1e80ff;
}
.tag-list-box .tag-list .item {
display: flex;
align-items: center;
margin: 0 0.667rem 1rem 0;
padding: 0 1rem;
border-radius: 4px;
transition: background-color 0.15s linear;
}
.tag-list-box .tag-list .item.tag-item:hover {
background-color: rgba(30, 128, 255, 0.16);
}
.tag-list-box .tag-list .item.category-item:hover {
background-color: #e4e6eb;
}
</style>
Loading

0 comments on commit 629ff9d

Please sign in to comment.