Skip to content

Commit 062b30a

Browse files
authored
Merge pull request #16 from besscroft/dev
v0.1.3
2 parents 346e19c + 87d4dfb commit 062b30a

File tree

9 files changed

+384
-336
lines changed

9 files changed

+384
-336
lines changed

components/Waterfall.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<script setup lang="ts">
2+
import { breakpointsTailwind, useBreakpoints } from '@vueuse/core'
3+
4+
const breakpoints = useBreakpoints(breakpointsTailwind)
5+
const smAndLarger = breakpoints.greaterOrEqual('md')
6+
27
const props = defineProps({
38
loading: Boolean,
49
handleButton: Boolean,
@@ -42,14 +47,14 @@ onUnmounted(() => {
4247
<Waterfall
4348
v-if="dataList && dataList?.length > 0"
4449
:list="dataList"
45-
:gutter="12"
50+
:gutter="smAndLarger ? 12 : 4"
4651
:hasAroundGutter="true"
4752
:crossOrigin="false"
4853
:backgroundColor="isDark ? '#121212' : '#FFFFFF'"
4954
:breakpoints="{
5055
9999: { rowPerView: 4 },
56+
1280: { rowPerView: 3 },
5157
1024: { rowPerView: 2 },
52-
768: { rowPerView: 1 },
5358
}"
5459
>
5560
<template #item="{ item }">

layouts/none.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { isMobile } = useDevice()
44

55
<template>
66
<div h-full>
7-
<div style="min-height: calc(100vh - 3.5rem);">
7+
<div h-full>
88
<slot />
99
</div>
1010
<ClientOnly v-if="!isMobile">

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,35 @@
1414
"typecheck": "vue-tsc --noEmit"
1515
},
1616
"devDependencies": {
17-
"@antfu/eslint-config": "^2.4.5",
17+
"@antfu/eslint-config": "^2.4.6",
1818
"@element-plus/nuxt": "^1.0.7",
19-
"@iconify-json/carbon": "^1.1.26",
19+
"@iconify-json/carbon": "^1.1.27",
2020
"@nuxtjs/color-mode": "^3.3.2",
2121
"@nuxtjs/device": "^3.1.1",
2222
"@pinia-plugin-persistedstate/nuxt": "^1.2.0",
2323
"@pinia/nuxt": "^0.5.1",
24-
"@sentry/node": "^7.87.0",
24+
"@sentry/node": "^7.91.0",
2525
"@sentry/profiling-node": "^1.3.2",
26-
"@sentry/vue": "^7.87.0",
26+
"@sentry/vue": "^7.91.0",
2727
"@unocss/eslint-config": "^0.58.0",
2828
"@unocss/nuxt": "^0.58.0",
29-
"@vite-pwa/nuxt": "^0.3.5",
29+
"@vite-pwa/nuxt": "^0.3.6",
3030
"@vueuse/nuxt": "^10.7.0",
3131
"aplayer": "^1.10.1",
3232
"consola": "^3.2.3",
33-
"element-plus": "^2.4.3",
34-
"eslint": "^8.55.0",
33+
"element-plus": "^2.4.4",
34+
"eslint": "^8.56.0",
3535
"nuxt": "^3.8.2",
3636
"pinia": "^2.1.7",
3737
"typescript": "^5.3.3",
38-
"vue-tsc": "^1.8.25"
38+
"vue-tsc": "^1.8.26"
3939
},
4040
"dependencies": {
4141
"@formkit/auto-animate": "^0.8.1",
4242
"@nuxt/ui": "^2.11.1",
43-
"aws-sdk": "^2.1518.0",
43+
"aws-sdk": "^2.1524.0",
4444
"crypto-js": "^4.2.0",
45-
"exifreader": "^4.17.0",
45+
"exifreader": "^4.19.1",
4646
"jsonwebtoken": "^9.0.2",
4747
"postgres": "^3.4.3",
4848
"vue-waterfall-plugin-next": "^2.3.1"

pages/admin/index.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const dataHandle = async () => {
1717
Authorization: `${user.tokenName} ${user.token}`,
1818
},
1919
})
20-
console.log(data)
2120
dataInfo.value = data
2221
} catch (e) {
2322
console.log(e)

pages/admin/upload.vue

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ definePageMeta({
269269
</el-select>
270270
</div>
271271
<el-upload
272-
class="upload-demo"
273272
drag
274273
:limit="1"
275274
:http-request="onRequestUpload"
@@ -286,15 +285,6 @@ definePageMeta({
286285
<div class="el-upload__text">
287286
点击或者拖动图片到该区域来上传,关闭图片可重置
288287
</div>
289-
<template #tip>
290-
<div mt-4>
291-
<UAlert
292-
description="同类别同名文件会被覆盖,支持大多数图片类型。受限于部署平台限制,如 Vercel,可能只允许免费用户传递 6M 内文件..."
293-
:avatar="{ src: '/112962239_p0.jpg' }"
294-
title="噔噔!"
295-
/>
296-
</div>
297-
</template>
298288
</el-upload>
299289
<div v-if="fileUrl" space-y-2>
300290
<p break-words text-green-400>图片地址:{{ fileUrl }}</p>

pages/login.vue

Lines changed: 53 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script setup lang="ts">
2+
import type { FormError, FormSubmitEvent } from '#ui/types'
23
import { appName } from '~/constants'
34
45
interface ModelType {
@@ -15,7 +16,18 @@ const loginForm = reactive<ModelType>({
1516
password: '',
1617
})
1718
18-
const handleSubmitClick = async () => {
19+
const validate = (state: any): FormError[] => {
20+
const errors = []
21+
if (!state.username) {
22+
errors.push({ path: 'username', message: '用户名必填!' })
23+
}
24+
if (!state.password) {
25+
errors.push({ path: 'password', message: '密码必填!' })
26+
}
27+
return errors
28+
}
29+
30+
async function handleSubmitClick(event: FormSubmitEvent<any>) {
1931
loading.value = true
2032
try {
2133
const { token, tokenName } = await $fetch('/api/login', {
@@ -27,84 +39,68 @@ const handleSubmitClick = async () => {
2739
router.push('/admin')
2840
if (token) {
2941
toast.add({ title: '登录成功!', timeout: 2000 })
30-
} else {
42+
}
43+
else {
3144
toast.add({ title: '登录失败!', timeout: 2000, color: 'red' })
3245
}
33-
} catch (e) {
46+
}
47+
catch (e) {
3448
toast.add({ title: '登录失败!', timeout: 2000, color: 'red' })
35-
} finally {
36-
loading.value = false
3749
}
38-
}
39-
40-
const keyDown = (e) => {
41-
if (e.keyCode === 13 || e.keyCode === 100) {
42-
handleSubmitClick()
50+
finally {
51+
loading.value = false
4352
}
4453
}
4554
46-
onMounted(() => {
47-
window.addEventListener('keydown', keyDown)
48-
})
49-
50-
onUnmounted(() => {
51-
window.removeEventListener('keydown', keyDown, false)
52-
})
53-
5455
definePageMeta({
5556
layout: 'none',
5657
})
5758
</script>
5859

5960
<template>
60-
<div bg-white dark:bg-gray-900 w-full>
61-
<div flex justify-center h-screen>
62-
<div hidden bg-cover lg:block class="lg:w-2/3" style="background-image: url('/fufu.jpg')">
63-
<div flex items-center h-full px-20 bg-gray-900 bg-opacity-40>
64-
<div>
65-
<h2 text-4xl text-white>旅行足迹</h2>
66-
67-
<p text-sm text-gray-300 mt-4>
68-
鹤鸣工作室出品,一款基于 Nuxt3 构建的⌈相片集⌋。
69-
</p>
61+
<div flex items-center justify-center w-full h-full style="background-image: url('/fufu.jpg'); background-size: cover;"
62+
md:grid md:grid-cols-10 md:gap-4
63+
>
64+
<div md:col-span-5></div>
65+
<div
66+
h-108 w-full mx-2 md:max-w-xl bg-white dark:bg-black rounded-md shadow-md md:col-span-4
67+
>
68+
<div h-full flex flex-col items-center>
69+
<div flex items-center justify-center justify-between w-full px-4 mt-4>
70+
<div text-left>
71+
<div i-carbon-arrow-left cursor-pointer @click="router.push('/')" />
7072
</div>
73+
<ClientOnly>
74+
<div text-right>
75+
<DarkToggle />
76+
</div>
77+
</ClientOnly>
7178
</div>
72-
</div>
73-
74-
<div flex items-center w-full max-w-md px-6 mx-auto class="lg:w-2/6">
75-
<div flex-1>
76-
<div text-center>
77-
<h2 text-4xl text-center text-gray-700 dark:text-white>{{ appName || '旅行足迹' }}</h2>
7879

79-
<p mt-3 text-gray-500 dark:text-gray-300>登录你的帐号</p>
80-
</div>
80+
<h2 text-center text-3xl mt-4>
81+
{{ appName || '旅行足迹' }}
82+
</h2>
8183

82-
<div mt-8>
83-
<div>
84-
<label for="account" block mb-2 text-sm text-gray-600 dark:text-gray-200>帐号</label>
85-
<input type="account" v-model="loginForm.username" name="account" id="account" block w-full px-4 py-2 mt-2 text-gray-700 placeholder-gray-400 bg-white border border-gray-200 rounded-md dark:placeholder-gray-600 dark:bg-gray-900 dark:text-gray-300 dark:border-gray-700 focus:border-blue-400 dark:focus:border-blue-400 focus:ring-blue-400 focus:outline-none focus:ring focus:ring-opacity-40 />
86-
</div>
84+
<UForm :validate="validate" :state="loginForm" class="space-y-6 w-2/3 mt-6" @submit="handleSubmitClick">
85+
<UFormGroup label="用户名" name="username">
86+
<UInput v-model="loginForm.username" />
87+
</UFormGroup>
8788

88-
<div mt-6>
89-
<div flex justify-between mb-2>
90-
<label for="password" font-ark text-sm text-gray-600 dark:text-gray-200>密码</label>
91-
</div>
89+
<UFormGroup label="密码" name="password">
90+
<UInput v-model="loginForm.password" type="password" />
91+
</UFormGroup>
9292

93-
<input type="password" v-model="loginForm.password" name="password" id="password" block w-full px-4 py-2 mt-2 text-gray-700 placeholder-gray-400 bg-white border border-gray-200 rounded-md dark:placeholder-gray-600 dark:bg-gray-900 dark:text-gray-300 dark:border-gray-700 focus:border-blue-400 dark:focus:border-blue-400 focus:ring-blue-400 focus:outline-none focus:ring focus:ring-opacity-40 />
94-
</div>
93+
<UButton type="submit" color="white" :loading="loading">
94+
登录
95+
</UButton>
96+
</UForm>
9597

96-
<div mt-6>
97-
<el-button
98-
:loading="loading"
99-
@click="handleSubmitClick"
100-
w-full px-4 py-2 tracking-wide text-white transition-colors duration-200 transform bg-blue-500 rounded-md hover:bg-blue-400 focus:outline-none focus:bg-blue-400 focus:ring focus:ring-blue-300 focus:ring-opacity-50
101-
type="primary"
102-
>登录</el-button>
103-
</div>
104-
</div>
105-
</div>
98+
<p text-sm text-gray-400 mt-4>
99+
鹤鸣工作室出品,一款基于 Nuxt3 构建的⌈相片集⌋。
100+
</p>
106101
</div>
107102
</div>
103+
<div md:col-span-1></div>
108104
</div>
109105
</template>
110106

plugins/sentry.client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default defineNuxtPlugin((nuxtApp) => {
2020

2121
// Configure this whole part as you need it!
2222

23-
tracesSampleRate: 0.2, // Change in prod
23+
tracesSampleRate: 0.5, // Change in prod
2424

2525
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
2626
tracePropagationTargets: ['https://kamera.heming.dev'],

plugins/sentry.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ export default defineNuxtPlugin((nuxtApp) => {
1616
new ProfilingIntegration(),
1717
],
1818
// Performance Monitoring
19-
tracesSampleRate: 0.2,
19+
tracesSampleRate: 0.5,
2020
// Set sampling rate for profiling - this is relative to tracesSampleRate
21-
profilesSampleRate: 0.2,
21+
profilesSampleRate: 0.5,
2222
})
2323

2424
nuxtApp.hooks.hook('error', (error) => {

0 commit comments

Comments
 (0)