Skip to content

Commit

Permalink
Merge pull request #273 from dinphy/develop
Browse files Browse the repository at this point in the history
feature:优化用户评论信息输入框,用户设置保存
  • Loading branch information
kingwrcy authored Feb 13, 2025
2 parents 0f4e41e + a685005 commit 4d2c74e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
15 changes: 10 additions & 5 deletions front/components/CommentBox.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<template>
<div class="px-4 py-2 flex flex-col gap-2 mt-2" v-if="currentCommentBox === pid">
<div class="relative">
<UTextarea :rows="3" autofocus :placeholder="replyTo ? `回复给${replyTo}` : ''" v-model="state.content"/>
<div class="animate-bounce absolute right-2 bottom-1 cursor-pointer text-xl select-none" @click="toggleEmoji">😊
<UTextarea :rows="4" autofocus :placeholder="replyTo ? `回复给${replyTo}` : ''" v-model="state.content"/>
<div class="flex gap-2 absolute right-3 bottom-2">
<UIcon v-if="!global.userinfo.token" class="text-[#9fc84a] w-6 h-6 cursor-pointer" name="i-carbon-user-avatar" @click="toggleUser"/>
<UIcon class="text-[#9fc84a] w-6 h-6 cursor-pointer select-none" name="i-carbon-face-satisfied" @click="toggleEmoji"/>
<UButton class="cursor-pointer text-xs" color="white" @click="comment">发送</UButton>
</div>
</div>
<Emoji v-if="emojiShow" @selected="emojiSelected"/>
<div class="flex gap-1">
<div v-if="userShow" class="flex gap-1">
<template v-if="!global.userinfo.token">
<UInput placeholder="姓名" v-model="state.username"/>
<UInput placeholder="网站" v-model="state.website"/>
<UInput placeholder="邮箱" v-model="state.email"/>
</template>
<UButton color="white" @click="comment">发布评论</UButton>
</div>
</div>
</template>
Expand Down Expand Up @@ -40,6 +42,7 @@ const localCommentUserinfo = useStorage('localCommentUserinfo', {
website: "",
email: "",
})
const userShow = ref(false)
const emojiShow = ref(false)
const currentCommentBox = useState('currentCommentBox')
const sysConfig = useState<SysConfigVO>('sysConfig')
Expand Down Expand Up @@ -88,7 +91,9 @@ const doComment = async (token?: string) => {
memoChangedEvent.emit(props.memoId)
}
const toggleUser = () => {
userShow.value = !userShow.value
}
const toggleEmoji = () => {
emojiShow.value = !emojiShow.value
}
Expand Down
4 changes: 1 addition & 3 deletions front/components/MemoEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
<div class="w-full" @contextmenu.prevent="onContextMenu">
<div class="relative">
<UTextarea ref="contentRef" v-model="state.content" :rows="8" autoresize padded autofocus/>
<div class="animate-bounce absolute right-2 bottom-1 cursor-pointer text-xl select-none" @click="toggleEmoji">
😊
</div>
<UIcon class="text-[#9fc84a] w-6 h-6 animate-bounce absolute right-2 bottom-1 cursor-pointer select-none" name="i-carbon-face-satisfied" @click="toggleEmoji"/>
</div>

<Emoji v-if="emojiShow" @selected="emojiSelected" @close="emojiShow=false"/>
Expand Down
2 changes: 1 addition & 1 deletion front/pages/user/settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const reload = async () => {
const save = async () => {
await useMyFetch('/user/saveProfile', state)
toast.success("保存成功")
await reload()
location.reload()
}
const uploadAvatarUrl = async (files: FileList) => {
Expand Down

0 comments on commit 4d2c74e

Please sign in to comment.