Skip to content

Commit

Permalink
feat: 编辑器问题修复
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghua committed Feb 15, 2025
1 parent 6728bcb commit de1a1c7
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 14 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@

![alt text](./assets/home.png)

![alt text](./assets/expore.png)
![alt text](./assets/expore.png)

![alt text](image.png)
7 changes: 7 additions & 0 deletions backend/api/auth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@ func NewAuthApi(group fiber.Router) fiber.Router {

authApi.Post("/signin", SignIn)
authApi.Post("/verify", IsValid)
authApi.Get("/ping", ping)

return authApi
}

func ping(c *fiber.Ctx) error {
return c.JSON(fiber.Map{
"ok": true,
})
}

type SignInResult struct {
User CustomClaimsInfo `json:"user"`
Token string `json:"token"`
Expand Down
5 changes: 5 additions & 0 deletions backend/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ func NewStore(config db.DBConfig) (Store, error) {
if err != nil {
return Store{}, err
}
err = _db.Ping()
if err != nil {
log.Println("数据库连接失败")
return Store{}, err
}
log.Println("数据库连接成功")
return Store{
db: _db,
Expand Down
5 changes: 5 additions & 0 deletions src/components/Switch.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div
class="relative h-16px w-28px border-(2px solid #ececec) cursor-pointer rounded-8px before:(content-[''] absolute top-1/2 left-2px -translate-y-1/2 rounded-1/2 block w-10px h-10px bg-#808080)">
</div>
</template>
9 changes: 7 additions & 2 deletions src/ui/Explore.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@ onMounted(async () => {
memoList.value = [...memoList.value, ...data.data]
if (data?.data?.length < 10) {
isMore.value = false
observer.unobserve(loading.value)
if (loading.value) {
observer.unobserve(loading.value)
}
}
}
})
observer.observe(loading.value)
if (loading.value) {
observer.observe(loading.value)
}
})
</script>

Expand Down
22 changes: 16 additions & 6 deletions src/ui/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import dayjs from 'dayjs';
import { queryMemosByFilter, queryTags } from '../api/memo';
import { RequestCode } from '../api';
import Switch from '../components/Switch.vue';
const memosList = ref<({
id: string
Expand Down Expand Up @@ -252,14 +253,23 @@ onMounted(async () => {
</div>
<!-- 标签区域 -->
<div class="mt-16px">
<div class="text-#808080">标签集</div>
<div class="mt-8px flex gap-8px gap-row-0 flex-wrap">
<div v-for="tag in tags" @click="onTagClicked(tag.id)" :data-tagId="tag.id" :key="tag.id"
class="flex items-center cursor-pointer">
<span class="text-1em text-#808080">#</span>
<span class="ml-2px text-0.8em">{{ tag.name }}</span>
<div class="flex items-center">
<span class="text-#808080">标签集</span>
<div class="ml-auto">
<Switch />
</div>
</div>
<div class="mt-8px flex gap-8px gap-row-2px flex-wrap">
<template v-for="tag in tags" :key="tag.id">
<div :data-tagId="tag.id" @click="onTagClicked(tag.id)"
class="flex items-center cursor-pointer border-1px rounded-0.75em pl-0.5em pr-0.5em">
<span class="text-1em text-#808080">#</span>
<span class="ml-2px text-0.8em">{{ tag.name }}</span>
<span v-if="queryFilter.tags.includes(tag.id)"
class="i-lucide:x text-#acacac ml-0.3em"></span>
</div>
</template>
</div>
</div>
</div>
</div>
Expand Down
14 changes: 12 additions & 2 deletions src/ui/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ import SideNav from './side-nav/index.vue'
<!-- 侧边导航 -->
<SideNav class="w-230px shrink-0 bg-#fafafa border-r-(1px #e5e5e5) hover:(shadow-[2px_0_2px_#e5e5e5])" />
<!-- 主面板区域 -->
<div class="grow p-20px bg-#f4f4f5 overflow-auto">
<div class="grow p-20px bg-#f4f4f5 main">
<RouterView />
</div>
</template>
</template>

<style scoped>
.main {
overflow-y: auto;
}
.main::-webkit-scrollbar {
width: 0;
}
</style>
3 changes: 1 addition & 2 deletions src/ui/editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,12 @@ const onTextareaInput = () => {
onMounted(() => {
onTextareaInput()
})
</script>

<template>
<!-- 编辑器 -->
<div class=" bg-#ffffff border-(1px #ececec) shadow-[0_0_4px_#ececec] rounded-8px p-8px">
<textarea @input="onTextareaInput" :value="textValue" placeholder="此刻的想法..." ref="textarea"
<textarea @input="onTextareaInput" v-model="textValue" placeholder="此刻的想法..." ref="textarea"
class="w-full outline-none min-h-[calc(6*1.5em)]" />
<!-- 快捷键 -->
<div class="flex gap-0px items-center">
Expand Down
2 changes: 1 addition & 1 deletion uno.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ export default defineConfig({
transformers: [
transformerVariantGroup()
],
safelist: ["i-lucide:clipboard", "i-lucide:link"]
safelist: ["i-lucide:clipboard", "i-lucide:link", "i-lucide:x"]
})

0 comments on commit de1a1c7

Please sign in to comment.