Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024年的一些功能和更新 #88

Open
wants to merge 87 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
284a5da
[fix] 优化动画效果逻辑
VecHK Dec 25, 2023
8bde401
[add] 支持手机访问
VecHK Dec 25, 2023
08a203d
[adjust] 优化提交按钮的UI
VecHK Dec 25, 2023
a80ab77
[adjust] '感谢你的参与'改为'大感谢'
VecHK Dec 26, 2023
806e9f8
[improve] WaitingInputFrame 采用钩子写法
VecHK Dec 26, 2023
360e518
[improve] loading-wrapper 包装为组件
VecHK Dec 26, 2023
8f1beb2
[fix] CI Warning
VecHK Dec 26, 2023
24195e4
[add] “听说你在下周参加投票”,这个“下周”不要硬编码,要依据相册的时间来说
VecHK Dec 26, 2023
a9b72ff
[add] 无人参赛的时候,对话要有点不同
VecHK Dec 26, 2023
a47cdcb
[fix] equalYearMonthDay 没有考虑到时区的问题
VecHK Dec 27, 2023
35a453d
[fix] 关屏效果异常的问题
VecHK Dec 27, 2023
0a05846
[improve] 优化写法 & 删除 SubmissionContextValue 的定义
VecHK Dec 27, 2023
6d4ec09
[fix] shuffleArray 排序偏差
VecHK Dec 27, 2023
ed15556
[add] 相片列表页要能显示投稿数
VecHK Dec 28, 2023
ac9df95
[improve] FailureLayout 也要考虑出现加载失败的情况,这时候就不要考虑什么字体美观度了,能显示出错误信息才重要
VecHK Dec 29, 2023
e348313
[improve] use nullish operator
VecHK Dec 29, 2023
a76f878
[improve] update eslint/typescript-eslint
VecHK Dec 29, 2023
4af500a
[fix] dart-sass warning
VecHK Dec 29, 2023
d132d56
update lockfile
VecHK Dec 29, 2023
a1dec72
upgrade react-scripts
VecHK Dec 29, 2023
d12d92c
[fix] 投票后投票按钮仍然显示的问题
VecHK Dec 31, 2023
8d4704a
[improve] sortByIDList move to utils/common
VecHK Dec 31, 2023
9b9d447
[improve] utils
VecHK Jan 1, 2024
d0f3a21
[add] 投稿文字说明
VecHK Jan 1, 2024
e52dfe1
[improve] useMeasure move to src/hooks/
VecHK Jan 1, 2024
de8c2a3
[improve] 更精确一些的模块导入
VecHK Jan 1, 2024
2ef795c
[fix] 不显示ConfirmVote的问题
VecHK Jan 1, 2024
2d48c72
[adjust] 提交投票按钮改为拟物风格
VecHK Jan 1, 2024
6b6c2bb
[fix] showClassName & hideClassName 写混的问题
VecHK Jan 1, 2024
70bdd20
[adjust] ConfirmQQ 的切换逻辑
VecHK Jan 1, 2024
934e513
[fix] useMeasure 要考虑异步操作的情况
VecHK Jan 1, 2024
543c059
[fix] 图片说明文字框里全是数字时无法断开的问题
VecHK Jan 1, 2024
a64d08b
[fix] usePhotoBox 中使用钩子导致出错的问题
VecHK Jan 1, 2024
b7f878b
[fix] PhototBox 的编排没有考虑到margin-bottom的问题
VecHK Jan 1, 2024
0696419
[adjust] 回滚回以前的布局算法,现在的死循环
VecHK Jan 2, 2024
6fd58ae
[adjust] 回滚回以前的布局算法,现在的死循环
VecHK Jan 2, 2024
174af26
[adjust] 重写瀑布流布局逻辑
VecHK Jan 2, 2024
434312c
[fix] 消除瀑布流闪烁的问题
VecHK Jan 2, 2024
0e2285f
[improve] 优化自适应布局
VecHK Jan 2, 2024
68f74c4
[improve] 重写计算布局的逻辑
VecHK Jan 2, 2024
f4a15fc
[improve] src/components/PhotoStream -> src/components/Waterfall
VecHK Jan 2, 2024
bc7fa6b
[improve] 优化写法
VecHK Jan 2, 2024
8dba782
[fix] Waterfail 空列表时的占位组件的高度
VecHK Jan 4, 2024
1237399
[fix] 【成员投票情况页】在筛选后点击设置重投所选定的成员不正确的问题
VecHK Jan 4, 2024
3c03f05
[adjust] 成员投票情况页 总人数、已投、未投 的按钮改成文字按钮
VecHK Jan 4, 2024
9575f3f
[fix] typo
VecHK Jan 4, 2024
d4137f9
[fix] smartisan TNT CSS Color Module Level 4 bug report by @DieMoe233
VecHK Jan 4, 2024
41c950e
[adjust] 大于2100屏幕宽度的布局调整
VecHK Jan 5, 2024
769732d
[add] vote button 'cannot vote' effect
VecHK Jan 5, 2024
9c932f0
[improve] DRY
VecHK Jan 5, 2024
f83c6fa
hideVoteButton -> show_vote_button
VecHK Jan 5, 2024
1c78906
[imrpove] DRY
VecHK Jan 5, 2024
f77acd2
[fix] photo loading priority
VecHK Jan 5, 2024
2acaca8
[improve] variable renaming
VecHK Jan 5, 2024
95f83e9
show_vote_button 的动画效果导致瀑布流重排的问题无法解决,禁用之
VecHK Jan 5, 2024
93a9b4b
[improve] update eslintrc
VecHK Jan 6, 2024
bb79fa0
[add] avif/webp support & upload image can specify a custom dimension
VecHK Jan 6, 2024
0007c3f
[improve] add 'default_supported_formats' config
VecHK Jan 6, 2024
428e811
[fix] CI failure
VecHK Jan 6, 2024
0d0ffd9
[fix] CI failure
VecHK Jan 6, 2024
f7e65ff
[fix] CI failure
VecHK Jan 6, 2024
56c4a12
[add] custom avatar image thumb size
VecHK Jan 6, 2024
9c48a4b
[adjust] width rename to thumb_size
VecHK Jan 6, 2024
b82d2d2
[add] auto create thumb/src directory when app's env is 'unitest'
VecHK Jan 6, 2024
74dcb76
[add] better refresh thumb api
VecHK Jan 7, 2024
31460a6
[add] 删除相片时除了删除数据库条目,也要清除硬盘中的图像
VecHK Jan 7, 2024
7a64639
[add] 更新了相片后删去旧相片的原图(同样,进行更新操作时也是要这么处理)
VecHK Jan 7, 2024
1c60363
[fix] CI failure
VecHK Jan 7, 2024
568c3b8
[fix] 图片加载顺序不对的问题
VecHK Jan 7, 2024
8462e2c
[add] Dashboard Home statistic
VecHK Jan 8, 2024
75a8ab0
[fix] ESLint warning
VecHK Jan 8, 2024
0599582
[add] error handle
VecHK Jan 8, 2024
d439721
[add] auto clean unused image
VecHK Jan 9, 2024
554e18e
[add] cancel auto clean unused image and set to API
VecHK Jan 9, 2024
26d9321
[adjust] statistic.src_storage & statistic.thumb_storage
VecHK Jan 9, 2024
90632f4
[upgrade] upgrade react react-dom react-transition-group
VecHK Jan 9, 2024
efa05f1
Bump follow-redirects from 1.15.3 to 1.15.4 in /front
dependabot[bot] Jan 9, 2024
2b25a97
[add] use ReactDOM.createRoot instead ReactDOM.render
VecHK Jan 10, 2024
4d94c9d
[improve] usePhotoLoadingPriority 使用 requestAnimationFrame 一直维护加载优先级
VecHK Jan 12, 2024
c4bbb18
[improve] 优化瀑布流布局算法
VecHK Jan 13, 2024
65e7368
[adjust] 重新实现extendColumns
VecHK Jan 14, 2024
d238803
[adjust] 调整 extendColumns()
VecHK Jan 16, 2024
ff64333
[fix] extendColumns
VecHK Jan 16, 2024
a70cbfa
[fix] 大幅消除抖动
VecHK Jan 18, 2024
c14d2ab
Merge pull request #93 from TorzoClub/dependabot/npm_and_yarn/front/f…
VecHK Jan 21, 2024
7f90ddc
Bump follow-redirects from 1.15.3 to 1.15.5 in /dashboard
dependabot[bot] Jan 21, 2024
6be772d
Merge pull request #94 from TorzoClub/dependabot/npm_and_yarn/dashboa…
VecHK Jan 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dashboard/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
ENV = 'production'

# base api
VUE_APP_BASE_API = 'https://pache.blog/torzo-gallery-server/api/'
VUE_APP_BASE_API = 'https://pache.blog/torzo-gallery-server/'
2 changes: 1 addition & 1 deletion dashboard/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module.exports = {
'no-extend-native': 2,
'no-extra-bind': 2,
'no-extra-boolean-cast': 2,
'no-extra-parens': [2, 'functions'],
'no-extra-parens': [0],
'no-fallthrough': 2,
'no-floating-decimal': 2,
'no-func-assign': 2,
Expand Down
35 changes: 25 additions & 10 deletions dashboard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
},
"dependencies": {
"axios": "0.21.1",
"element-ui": "^2.15.4",
"element-ui": "^2.15.14",
"js-cookie": "2.2.0",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"pad-left": "^2.1.0",
"path-to-regexp": "2.4.0",
"uuid": "^9.0.1",
"vue": "2.6.10",
"vue-router": "3.0.6",
"vuex": "3.1.0"
Expand Down
20 changes: 18 additions & 2 deletions dashboard/src/api/image.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
import request from '@/utils/request'

export const refreshThumbs = () =>
export const __AVATAR_THUMB_SIZE__ = 128

export const refreshThumb = (src, thumb_size) =>
request({
url: `admin/image/refresh-thumb`,
method: 'POST',
timeout: 0,
data: { src, thumb_size },
})

export const getAllAvailablePhoto = () =>
request({
url: 'admin/image/refresh-thumb',
url: `admin/image/available-photo`,
method: 'GET',
timeout: 0,
})

export const requestCleanUnusedImage = () =>
request({
url: `admin/image/clean-unused`,
method: 'POST',
})
7 changes: 7 additions & 0 deletions dashboard/src/api/statistic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import request from '@/utils/request'

export const getStatistic = () =>
request({
url: `admin/statistic`,
method: 'GET',
})
19 changes: 15 additions & 4 deletions dashboard/src/components/UploadImageBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
drag
:name="uploadName"
:headers="headers"
:action="uploadUrl"
:action="upload_url"
:show-file-list="false"
:on-error="uploadError"
:on-progress="uploadProgress"
Expand Down Expand Up @@ -137,9 +137,9 @@
default: ''
},

uploadUrl: {
type: String,
default: `${process.env.VUE_APP_BASE_API}admin/image/upload`
thumbSize: {
type: Number,
default: 0
},

previewUrl: {
Expand All @@ -161,6 +161,17 @@
percent: 0
}),

computed: {
upload_url() {
const base_url = `${process.env.VUE_APP_BASE_API}admin/image/upload`
if (this.thumbSize !== 0) {
return `${base_url}?thumb_size=${this.thumbSize}`
} else {
return base_url
}
}
},

methods: {
resetUploading() {
this.uploading = false
Expand Down
7 changes: 4 additions & 3 deletions dashboard/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

Expand All @@ -29,9 +29,10 @@ if (process.env.NODE_ENV === 'production') {
}

// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui,按如下方式声明
// Vue.use(ElementUI)
Vue.use(ElementUI)
console.log('ElementUI', ElementUI)

Vue.config.productionTip = false

Expand Down
14 changes: 14 additions & 0 deletions dashboard/src/mixins/operate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default {
methods: {
async $operate(property, fn) {
if (this[property] !== true) {
this[property] = true
try {
await fn()
} finally {
this[property] = false
}
}
}
}
}
111 changes: 111 additions & 0 deletions dashboard/src/views/dashboard/components/refresh-thumbs.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<template>
<div>
<ElProgress
v-if="processing"
:percentage="percentage"
:color="color"
/>
<ElButton
v-else-if="showButton"
size="small"
type="primary"
icon="el-icon-refresh"
@click="processing || refreshThumbsConfirm()"
>刷新缩略图</ElButton>
</div>
</template>

<script>
import { refreshThumb, getAllAvailablePhoto, __AVATAR_THUMB_SIZE__ } from '@/api/image'
import { getList as getMemberList } from '@/api/member'

const initProgress = () => ({ total: 0, success: 0, failure: 0 })

export default {
props: {
showButton: { type: Boolean, default: true }
},

data: () => ({
...initProgress(),
processing: false,
show_progress: false,
}),

computed: {
color() { return (this.failure > 0) ? '#e6a23c' : '#409eff' },
current() { return this.success + this.failure },
percentage() {
return (this.total === 0) ? 0 : Math.ceil(
100 * (this.current / this.total)
)
},
},

watch: {
processing(val) {
if (val === true) {
this.show_progress = true
}
}
},

methods: {
async refreshThumbs() {
Object.assign(this, initProgress())

const [photos, members] = await Promise.all([
getAllAvailablePhoto(), getMemberList()
])

const task_list = [
...photos.map(p => (
[`相片(id=${p.id})`, p.src]
)),
...members.map(m => (
[`成员头像(id=${m.id})`, m.avatar_src, __AVATAR_THUMB_SIZE__]
))
]

this.total = task_list.length

for (const [name, ...args] of task_list) {
try {
await refreshThumb(...args)
this.success = this.success + 1
} catch (err) {
this.failure = this.failure + 1
this.$emit('warning', `${name}的缩略图生成失败`, err)
}
}
},
async refreshThumbsConfirmProcessing() {
if (this.processing === false) {
try {
this.processing = true
await this.refreshThumbs()
if (this.failure === 0) {
this.$emit('success', `所有缩略图已刷新`)
}
} catch (err) {
this.$emit('error', '刷新缓存失败', err)
} finally {
this.processing = false
}
}
},
}
}
</script>

<style lang="scss" scoped>
.dashboard {
&-container {
margin: 30px;
}
&-text {
font-size: 30px;
line-height: 46px;
}
}
</style>
Loading
Loading