Merge branch 'main' of github.com:1Panel-dev/MaxKB

This commit is contained in:
shaohuzhang1 2024-03-21 18:33:57 +08:00
commit 96a0e4bc4c
7 changed files with 49 additions and 29 deletions

View File

@ -60,7 +60,8 @@ jobs:
else else
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest" DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
fi fi
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache \ echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
--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 \
${DOCKER_IMAGE_TAGS} . ${DOCKER_IMAGE_TAGS} .
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
@ -115,9 +116,9 @@ jobs:
else else
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest" DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
fi fi
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache \ echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
--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 \
${DOCKER_IMAGE_TAGS} . ${DOCKER_IMAGE_TAGS} .
env
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx

View File

@ -8,6 +8,10 @@ RUN cd ui && \
rm -rf ./node_modules rm -rf ./node_modules
FROM ghcr.io/1panel-dev/maxkb-python-pg:python3.11.8-pg15.3 FROM ghcr.io/1panel-dev/maxkb-python-pg:python3.11.8-pg15.3
ARG DOCKER_IMAGE_TAG=dev
ARG BUILD_AT
ARG GITHUB_COMMIT
ENV MAXKB_VERSION ${DOCKER_IMAGE_TAG} (build at ${BUILD_AT}, commit: ${GITHUB_COMMIT})
# 创建工作目录 # 创建工作目录
RUN mkdir -p /opt/maxkb/app && mkdir -p /opt/maxkb/model && mkdir -p /opt/maxkb/conf RUN mkdir -p /opt/maxkb/app && mkdir -p /opt/maxkb/model && mkdir -p /opt/maxkb/conf
# 拷贝项目 # 拷贝项目

View File

@ -124,6 +124,13 @@ const getUserList: (email_or_username: string, loading?: Ref<boolean>) => Promis
return get('/user/list', { email_or_username }, loading) return get('/user/list', { email_or_username }, loading)
} }
/**
* version
*/
const getVersion: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => {
return get('/profile', undefined, loading)
}
export default { export default {
login, login,
register, register,
@ -134,5 +141,6 @@ export default {
sendEmailToCurrent, sendEmailToCurrent,
resetCurrentUserPassword, resetCurrentUserPassword,
logout, logout,
getUserList getUserList,
getVersion
} }

View File

@ -31,30 +31,18 @@
<span>论坛求助</span> <span>论坛求助</span>
</div> </div>
</el-card> </el-card>
<div class="text-center">当前版本号{{ PackageJSON.version }}</div>
</div> </div>
<!-- <ul class="about-ui"> <div class="text-center">版本号{{ version }}</div>
<li class="flex mb-16">
<span class="label text-right">授权数量</span><span class="text-center">-</span>
</li>
<li class="flex mb-16">
<span class="label text-right">过期时间</span><span class="text-center">-</span>
</li>
<li class="flex mb-16">
<span class="label text-right">版本</span><span class="text-center">-</span>
</li>
<li class="flex">
<span class="label text-right">版本号</span
><span class="text-center">{{ PackageJSON.version }}</span>
</li>
</ul> -->
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import PackageJSON from '../../../../../package.json' import useStore from '@/stores'
const defaultTitle = import.meta.env.VITE_APP_TITLE const defaultTitle = import.meta.env.VITE_APP_TITLE
const { user } = useStore()
const version = user.version
const aboutDialogVisible = ref(false) const aboutDialogVisible = ref(false)
const open = () => { const open = () => {
@ -69,9 +57,10 @@ defineExpose({ open })
</script> </script>
<style lang="scss" scope> <style lang="scss" scope>
.about-dialog { .about-dialog {
padding: 0; padding: 0 0 24px 0;
border-radius: 4px; border-radius: 4px;
width: 600px; width: 600px;
font-weight: 400;
.el-dialog__header { .el-dialog__header {
background: var(--app-header-bg-color); background: var(--app-header-bg-color);
margin-right: 0; margin-right: 0;
@ -92,11 +81,11 @@ defineExpose({ open })
height: 59px; height: 59px;
} }
.about-ui { .about-ui {
padding: 24px;
width: 360px; width: 360px;
margin: 0 auto; margin: 0 auto;
font-weight: 400; font-weight: 400;
font-size: 16px; font-size: 16px;
margin-top: 24px;
.label { .label {
width: 180px; width: 180px;
text-align: left; text-align: left;

View File

@ -6,6 +6,7 @@ export interface userStateTypes {
userType: number // 1 系统操作者 2 对话用户 userType: number // 1 系统操作者 2 对话用户
userInfo: User | null userInfo: User | null
token: any token: any
version?: string
} }
const useUserStore = defineStore({ const useUserStore = defineStore({
@ -13,7 +14,8 @@ const useUserStore = defineStore({
state: (): userStateTypes => ({ state: (): userStateTypes => ({
userType: 1, userType: 1,
userInfo: null, userInfo: null,
token: '' token: '',
version: ''
}), }),
actions: { actions: {
getToken(): String | null { getToken(): String | null {
@ -42,9 +44,17 @@ const useUserStore = defineStore({
changeUserType(num: number) { changeUserType(num: number) {
this.userType = num this.userType = num
}, },
async asyncGetVersion() {
return UserApi.getVersion().then((ok) => {
this.version = ok.data?.version || '-'
})
},
async profile() { async profile() {
return UserApi.profile().then((ok) => { return UserApi.profile().then((ok) => {
this.userInfo = ok.data this.userInfo = ok.data
this.asyncGetVersion()
}) })
}, },

View File

@ -12,7 +12,7 @@
<el-input <el-input
v-model="userForm.username" v-model="userForm.username"
placeholder="请输入用户名" placeholder="请输入用户名"
maxlength="64" maxlength="20"
show-word-limit show-word-limit
> >
</el-input> </el-input>
@ -73,8 +73,16 @@ const userForm = ref<any>({
}) })
const rules = reactive({ const rules = reactive({
username: [{ required: true, message: '请输入用户名' }], username: [
email: [{ required: true, message: '请输入邮箱' }], { required: true, message: '请输入用户名', trigger: 'blur' },
{
min: 6,
max: 20,
message: '长度在 6 到 20 个字符',
trigger: 'blur'
}
],
email: [{ required: true, message: '请输入邮箱', trigger: 'blur' }],
password: [ password: [
{ {
required: true, required: true,
@ -102,8 +110,8 @@ watch(dialogVisible, (bool) => {
phone: '', phone: '',
nick_name: '' nick_name: ''
} }
userFormRef.value?.clearValidate()
isEdit.value = false isEdit.value = false
userFormRef.value?.clearValidate()
} }
}) })

View File

@ -99,13 +99,13 @@ watch(dialogVisible, (bool) => {
password: '', password: '',
re_password: '' re_password: ''
} }
userFormRef.value?.clearValidate()
} }
}) })
const open = (data: any) => { const open = (data: any) => {
userId.value = data.id userId.value = data.id
dialogVisible.value = true dialogVisible.value = true
userFormRef.value?.clearValidate()
} }
const submit = async (formEl: FormInstance | undefined) => { const submit = async (formEl: FormInstance | undefined) => {