|
1 | 1 | <template>
|
2 | 2 | <div class="px-4 py-2 flex flex-col gap-2 mt-2" v-if="currentCommentBox === pid">
|
3 | 3 | <div class="relative">
|
4 |
| - <UTextarea :rows="3" autofocus :placeholder="replyTo ? `回复给${replyTo}` : ''" v-model="state.content"/> |
5 |
| - <div class="animate-bounce absolute right-2 bottom-1 cursor-pointer text-xl select-none" @click="toggleEmoji">😊 |
| 4 | + <UTextarea :rows="4" autofocus :placeholder="replyTo ? `回复给${replyTo}` : ''" v-model="state.content"/> |
| 5 | + <div class="flex gap-2 absolute right-3 bottom-2"> |
| 6 | + <UIcon v-if="!global.userinfo.token" class="text-[#9fc84a] w-6 h-6 cursor-pointer" name="i-carbon-user-avatar" @click="toggleUser"/> |
| 7 | + <UIcon class="text-[#9fc84a] w-6 h-6 cursor-pointer select-none" name="i-carbon-face-satisfied" @click="toggleEmoji"/> |
| 8 | + <UButton class="cursor-pointer text-xs" color="white" @click="comment">发送</UButton> |
6 | 9 | </div>
|
7 | 10 | </div>
|
8 | 11 | <Emoji v-if="emojiShow" @selected="emojiSelected"/>
|
9 |
| - <div class="flex gap-1"> |
| 12 | + <div v-if="userShow" class="flex gap-1"> |
10 | 13 | <template v-if="!global.userinfo.token">
|
11 | 14 | <UInput placeholder="姓名" v-model="state.username"/>
|
12 | 15 | <UInput placeholder="网站" v-model="state.website"/>
|
13 | 16 | <UInput placeholder="邮箱" v-model="state.email"/>
|
14 | 17 | </template>
|
15 |
| - <UButton color="white" @click="comment">发布评论</UButton> |
16 | 18 | </div>
|
17 | 19 | </div>
|
18 | 20 | </template>
|
@@ -40,6 +42,7 @@ const localCommentUserinfo = useStorage('localCommentUserinfo', {
|
40 | 42 | website: "",
|
41 | 43 | email: "",
|
42 | 44 | })
|
| 45 | +const userShow = ref(false) |
43 | 46 | const emojiShow = ref(false)
|
44 | 47 | const currentCommentBox = useState('currentCommentBox')
|
45 | 48 | const sysConfig = useState<SysConfigVO>('sysConfig')
|
@@ -88,7 +91,9 @@ const doComment = async (token?: string) => {
|
88 | 91 | memoChangedEvent.emit(props.memoId)
|
89 | 92 | }
|
90 | 93 |
|
91 |
| -
|
| 94 | +const toggleUser = () => { |
| 95 | + userShow.value = !userShow.value |
| 96 | +} |
92 | 97 | const toggleEmoji = () => {
|
93 | 98 | emojiShow.value = !emojiShow.value
|
94 | 99 | }
|
|
0 commit comments