Skip to content

Commit 96a0e4b

Browse files
committed
Merge branch 'main' of github.com:1Panel-dev/MaxKB
2 parents d59aac4 + 12eb777 commit 96a0e4b

File tree

7 files changed

+49
-29
lines changed

7 files changed

+49
-29
lines changed

.github/workflows/build-and-push.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ jobs:
6060
else
6161
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
6262
fi
63-
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache \
63+
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
64+
--build-arg DOCKER_IMAGE_TAG=${{ github.event.inputs.dockerImageTag }} --build-arg BUILD_AT=$(TZ=Asia/Shanghai date +'%Y-%m-%dT%H:%M') --build-arg GITHUB_COMMIT=${GITHUB_SHA::8} --no-cache \
6465
${DOCKER_IMAGE_TAGS} .
6566
- name: Set up QEMU
6667
uses: docker/setup-qemu-action@v3
@@ -115,9 +116,9 @@ jobs:
115116
else
116117
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
117118
fi
118-
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache \
119+
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
120+
--build-arg DOCKER_IMAGE_TAG=${{ github.event.inputs.dockerImageTag }} --build-arg BUILD_AT=$(TZ=Asia/Shanghai date +'%Y-%m-%dT%H:%M') --build-arg GITHUB_COMMIT=${GITHUB_SHA::8} --no-cache \
119121
${DOCKER_IMAGE_TAGS} .
120-
env
121122
- name: Set up QEMU
122123
uses: docker/setup-qemu-action@v3
123124
- name: Set up Docker Buildx

installer/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ RUN cd ui && \
88
rm -rf ./node_modules
99

1010
FROM ghcr.io/1panel-dev/maxkb-python-pg:python3.11.8-pg15.3
11+
ARG DOCKER_IMAGE_TAG=dev
12+
ARG BUILD_AT
13+
ARG GITHUB_COMMIT
14+
ENV MAXKB_VERSION ${DOCKER_IMAGE_TAG} (build at ${BUILD_AT}, commit: ${GITHUB_COMMIT})
1115
# 创建工作目录
1216
RUN mkdir -p /opt/maxkb/app && mkdir -p /opt/maxkb/model && mkdir -p /opt/maxkb/conf
1317
# 拷贝项目

ui/src/api/user.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ const getUserList: (email_or_username: string, loading?: Ref<boolean>) => Promis
124124
return get('/user/list', { email_or_username }, loading)
125125
}
126126

127+
/**
128+
* 获取version
129+
*/
130+
const getVersion: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => {
131+
return get('/profile', undefined, loading)
132+
}
133+
127134
export default {
128135
login,
129136
register,
@@ -134,5 +141,6 @@ export default {
134141
sendEmailToCurrent,
135142
resetCurrentUserPassword,
136143
logout,
137-
getUserList
144+
getUserList,
145+
getVersion
138146
}

ui/src/layout/components/top-bar/avatar/AboutDialog.vue

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,18 @@
3131
<span>论坛求助</span>
3232
</div>
3333
</el-card>
34-
<div class="text-center">当前版本号:{{ PackageJSON.version }}</div>
3534
</div>
36-
<!-- <ul class="about-ui">
37-
<li class="flex mb-16">
38-
<span class="label text-right">授权数量:</span><span class="text-center">-</span>
39-
</li>
40-
<li class="flex mb-16">
41-
<span class="label text-right">过期时间:</span><span class="text-center">-</span>
42-
</li>
43-
<li class="flex mb-16">
44-
<span class="label text-right">版本:</span><span class="text-center">-</span>
45-
</li>
46-
<li class="flex">
47-
<span class="label text-right">版本号:</span
48-
><span class="text-center">{{ PackageJSON.version }}</span>
49-
</li>
50-
</ul> -->
35+
<div class="text-center">版本号:{{ version }}</div>
5136
</el-dialog>
5237
</template>
5338
<script setup lang="ts">
5439
import { ref } from 'vue'
55-
import PackageJSON from '../../../../../package.json'
40+
import useStore from '@/stores'
5641
const defaultTitle = import.meta.env.VITE_APP_TITLE
5742
43+
const { user } = useStore()
44+
const version = user.version
45+
5846
const aboutDialogVisible = ref(false)
5947
6048
const open = () => {
@@ -69,9 +57,10 @@ defineExpose({ open })
6957
</script>
7058
<style lang="scss" scope>
7159
.about-dialog {
72-
padding: 0;
60+
padding: 0 0 24px 0;
7361
border-radius: 4px;
7462
width: 600px;
63+
font-weight: 400;
7564
.el-dialog__header {
7665
background: var(--app-header-bg-color);
7766
margin-right: 0;
@@ -92,11 +81,11 @@ defineExpose({ open })
9281
height: 59px;
9382
}
9483
.about-ui {
95-
padding: 24px;
9684
width: 360px;
9785
margin: 0 auto;
9886
font-weight: 400;
9987
font-size: 16px;
88+
margin-top: 24px;
10089
.label {
10190
width: 180px;
10291
text-align: left;

ui/src/stores/modules/user.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ export interface userStateTypes {
66
userType: number // 1 系统操作者 2 对话用户
77
userInfo: User | null
88
token: any
9+
version?: string
910
}
1011

1112
const useUserStore = defineStore({
1213
id: 'user',
1314
state: (): userStateTypes => ({
1415
userType: 1,
1516
userInfo: null,
16-
token: ''
17+
token: '',
18+
version: ''
1719
}),
1820
actions: {
1921
getToken(): String | null {
@@ -42,9 +44,17 @@ const useUserStore = defineStore({
4244
changeUserType(num: number) {
4345
this.userType = num
4446
},
47+
48+
async asyncGetVersion() {
49+
return UserApi.getVersion().then((ok) => {
50+
this.version = ok.data?.version || '-'
51+
})
52+
},
53+
4554
async profile() {
4655
return UserApi.profile().then((ok) => {
4756
this.userInfo = ok.data
57+
this.asyncGetVersion()
4858
})
4959
},
5060

ui/src/views/user-manage/component/UserDialog.vue

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<el-input
1313
v-model="userForm.username"
1414
placeholder="请输入用户名"
15-
maxlength="64"
15+
maxlength="20"
1616
show-word-limit
1717
>
1818
</el-input>
@@ -73,8 +73,16 @@ const userForm = ref<any>({
7373
})
7474
7575
const rules = reactive({
76-
username: [{ required: true, message: '请输入用户名' }],
77-
email: [{ required: true, message: '请输入邮箱' }],
76+
username: [
77+
{ required: true, message: '请输入用户名', trigger: 'blur' },
78+
{
79+
min: 6,
80+
max: 20,
81+
message: '长度在 6 到 20 个字符',
82+
trigger: 'blur'
83+
}
84+
],
85+
email: [{ required: true, message: '请输入邮箱', trigger: 'blur' }],
7886
password: [
7987
{
8088
required: true,
@@ -102,8 +110,8 @@ watch(dialogVisible, (bool) => {
102110
phone: '',
103111
nick_name: ''
104112
}
105-
userFormRef.value?.clearValidate()
106113
isEdit.value = false
114+
userFormRef.value?.clearValidate()
107115
}
108116
})
109117

ui/src/views/user-manage/component/UserPwdDialog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ watch(dialogVisible, (bool) => {
9999
password: '',
100100
re_password: ''
101101
}
102-
userFormRef.value?.clearValidate()
103102
}
104103
})
105104
106105
const open = (data: any) => {
107106
userId.value = data.id
108107
dialogVisible.value = true
108+
userFormRef.value?.clearValidate()
109109
}
110110
111111
const submit = async (formEl: FormInstance | undefined) => {

0 commit comments

Comments
 (0)