Skip to content

Commit

Permalink
Merge pull request #29 from besscroft/dev
Browse files Browse the repository at this point in the history
v0.3.3
  • Loading branch information
besscroft authored Jan 20, 2024
2 parents cdadde7 + fdce525 commit d3ccf23
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default antfu(
'curly': 'off',
'@typescript-eslint/brace-style': 'off',
'no-mixed-operators': 'off',
'style/brace-style': 'off',
},
},
unocss.configs.flat,
Expand Down
2 changes: 1 addition & 1 deletion layouts/admin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const mdAndLarger = breakpoints.greaterOrEqual('md')
<template>
<div>
<Header />
<div style="min-height: calc(100vh - 7rem);" pb-14>
<div style="min-height: calc(100vh - 7rem);">
<slot />
</div>
<ClientOnly>
Expand Down
6 changes: 5 additions & 1 deletion pages/admin/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ const dataHandle = async () => {
onBeforeMount(async () => {
await dataHandle()
})
definePageMeta({
layout: 'admin',
})
</script>

<template>
<div p2 md:p8 grid grid-cols-1 gap-4 sm:grid-cols-2 sm:gap-8 md:grid-cols-3 md:gap-12>
<div p2 md:p8 grid grid-cols-1 gap-4 sm:grid-cols-2 sm:gap-8 md:grid-cols-3 md:gap-12 pb-20 md:pb-2>
<el-card>
<div flex flex-col h-48 p2 space-y-4>
<span font-light>照片数据</span>
Expand Down
12 changes: 6 additions & 6 deletions pages/admin/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,6 @@ const tagTitleHandle = (type: string) => {
return photosList.find(item => type === item.url.replace('/', ''))?.title
}
onBeforeMount(async () => {
await dataHandle()
})
onBeforeMount(() => {
if (photosList) {
photosList?.forEach((photo: any) => {
Expand All @@ -187,6 +183,10 @@ onBeforeMount(() => {
}
})
onMounted(async () => {
await dataHandle()
})
definePageMeta({
layout: 'admin',
})
Expand All @@ -204,11 +204,11 @@ definePageMeta({
:value="item.value"
/>
</el-select>
<div i-carbon-rotate-360 cursor-pointer @click="dataHandle" />
<el-button round :loading="loading" @click="dataHandle"> 刷新 </el-button>
</div>
<el-table
:data="dataList"
v-loading="loading"
:data="dataList"
stripe
height="calc(100vh - 16rem)"
>
Expand Down
17 changes: 13 additions & 4 deletions pages/admin/upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ async function onRequestUpload(option: any) {
imgData.url = url
}
} catch (e) {
toast.add({ title: '图片上传/解析失败!', timeout: 2000, color: 'red' })
if (e?.status === 413) {
toast.add({ title: '上传文件大小超出限制!', timeout: 2000, color: 'red' })
} else {
toast.add({ title: '图片上传/解析失败!', timeout: 2000, color: 'red' })
}
option.file.abort()
}
}
Expand Down Expand Up @@ -258,7 +262,7 @@ definePageMeta({
:value="item.value"
/>
</el-select>
<el-button round v-if="fileUrl" :loading="loading" @click="submit"> 保存 </el-button>
<el-button v-if="fileUrl" round :loading="loading" @click="submit"> 保存 </el-button>
</div>
<div v-if="mountSelectShow && mountOptions.length > 0" flex items-center justify-center pb-2>
<el-select v-model="imgData.mountPath" m-2 placeholder="请选择挂载目录">
Expand All @@ -282,11 +286,16 @@ definePageMeta({
accept="image/jpg, image/jpeg, image/png, image/tiff, image/heic, image/heif, image/webp, image/avif"
>
<div flex justify-center items-center p2>
<svg h-8 w-8 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32"><path d="M11 18l1.41 1.41L15 16.83V29h2V16.83l2.59 2.58L21 18l-5-5l-5 5z" fill="currentColor"></path><path d="M23.5 22H23v-2h.5a4.5 4.5 0 0 0 .36-9H23l-.1-.82a7 7 0 0 0-13.88 0L9 11h-.86a4.5 4.5 0 0 0 .36 9H9v2h-.5A6.5 6.5 0 0 1 7.2 9.14a9 9 0 0 1 17.6 0A6.5 6.5 0 0 1 23.5 22z" fill="currentColor"></path></svg>
<svg size-8 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32"><path d="M11 18l1.41 1.41L15 16.83V29h2V16.83l2.59 2.58L21 18l-5-5l-5 5z" fill="currentColor"></path><path d="M23.5 22H23v-2h.5a4.5 4.5 0 0 0 .36-9H23l-.1-.82a7 7 0 0 0-13.88 0L9 11h-.86a4.5 4.5 0 0 0 .36 9H9v2h-.5A6.5 6.5 0 0 1 7.2 9.14a9 9 0 0 1 17.6 0A6.5 6.5 0 0 1 23.5 22z" fill="currentColor"></path></svg>
</div>
<div class="el-upload__text">
点击或者拖动图片到该区域来上传,关闭图片可重置
点击或者拖动图片到该区域来上传
</div>
<template #tip>
<div class="el-upload__tip">
点击图片右上角关闭图片重置上传;Vercel 等平台 Free 订阅限制上传大小 6M。
</div>
</template>
</el-upload>
<div v-if="fileUrl" space-y-2>
<p break-words text-green-400>图片地址:{{ fileUrl }}</p>
Expand Down

1 comment on commit d3ccf23

@vercel
Copy link

@vercel vercel bot commented on d3ccf23 Jan 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.