Skip to content

Commit

Permalink
fix: author comp
Browse files Browse the repository at this point in the history
  • Loading branch information
MarleneJiang committed Jan 21, 2023
1 parent 76e91d4 commit 3077538
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 22 deletions.
Binary file modified backend/.tmp/data.db
Binary file not shown.
2 changes: 1 addition & 1 deletion backend/src/api/author/content-types/author/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"name": {
"type": "string"
},
"scr": {
"describe": {
"type": "text"
},
"img": {
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-20T13:15:17.357Z"
"x-generation-date": "2023-01-21T03:26:25.880Z"
},
"x-strapi-config": {
"path": "/documentation",
Expand Down Expand Up @@ -100,7 +100,7 @@
"name": {
"type": "string"
},
"scr": {
"describe": {
"type": "string"
},
"img": {
Expand Down Expand Up @@ -128,7 +128,7 @@
"name": {
"type": "string"
},
"scr": {
"describe": {
"type": "string"
},
"img": {
Expand Down Expand Up @@ -453,7 +453,7 @@
"name": {
"type": "string"
},
"scr": {
"describe": {
"type": "string"
},
"img": {
Expand Down Expand Up @@ -811,7 +811,7 @@
"name": {
"type": "string"
},
"scr": {
"describe": {
"type": "string"
},
"img": {
Expand Down Expand Up @@ -1136,7 +1136,7 @@
"name": {
"type": "string"
},
"scr": {
"describe": {
"type": "string"
},
"img": {
Expand Down
1 change: 1 addition & 0 deletions frontend/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ body,
height: 100vh;
margin: 0;
padding: 0;
background-color: #f4f5f5;
}
html.dark {
Expand Down
15 changes: 13 additions & 2 deletions frontend/components/Aside/author.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<script setup>
<script setup lang="ts">
interface IAuthor {
uid: string
name: string
img: string
rank: number
describe: string
}
const { data: Authors } = await useFetch('/api/authors')
</script>

Expand Down Expand Up @@ -26,7 +33,7 @@ const { data: Authors } = await useFetch('/api/authors')
</span>
</nuxt-link>
<div class="position">
{{ item.scr }}
{{ item.describe }}
</div>
</div>
</nuxt-link>
Expand Down Expand Up @@ -113,4 +120,8 @@ const { data: Authors } = await useFetch('/api/authors')
.recommend-author-block .item .link:hover {
background-color: hsla(0, 0%, 84.7%, .1);
}
.recommend-author-block {
background-color: #fff;
}
</style>
6 changes: 5 additions & 1 deletion frontend/components/Aside/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template lang="">
<div>
<div class="index-aside">
<h1 class="text-center">
这里是广告
</h1>
Expand All @@ -18,4 +18,8 @@
line-height: 1.29;
color: #333;
}
.index-aside{
width: 20rem;
}
</style>
24 changes: 12 additions & 12 deletions frontend/server/api/authors.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { useGraphql } from '~~/composables/graphql'
export default defineEventHandler(async () => {
const reqQuery = `query{
authors{
data{
id
attributes{
name
img
uid
scr
rank
authors(pagination: { page: 1, pageSize: 3 }){
data{
id
attributes{
name
describe
img
rank
uid
}
}
}
}
}
}`
}`
return (await useGraphql(reqQuery)).authors.data
})

0 comments on commit 3077538

Please sign in to comment.