Skip to content

Commit

Permalink
Merge branch 'main' of github.com:1Panel-dev/MaxKB
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohuzhang1 committed Mar 21, 2024
2 parents d59aac4 + 12eb777 commit 96a0e4b
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 29 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ jobs:
else
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
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} .
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -115,9 +116,9 @@ jobs:
else
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
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} .
env
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand Down
4 changes: 4 additions & 0 deletions installer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ RUN cd ui && \
rm -rf ./node_modules

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
# 拷贝项目
Expand Down
10 changes: 9 additions & 1 deletion ui/src/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ const getUserList: (email_or_username: string, loading?: Ref<boolean>) => Promis
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 {
login,
register,
Expand All @@ -134,5 +141,6 @@ export default {
sendEmailToCurrent,
resetCurrentUserPassword,
logout,
getUserList
getUserList,
getVersion
}
27 changes: 8 additions & 19 deletions ui/src/layout/components/top-bar/avatar/AboutDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,18 @@
<span>论坛求助</span>
</div>
</el-card>
<div class="text-center">当前版本号:{{ PackageJSON.version }}</div>
</div>
<!-- <ul class="about-ui">
<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> -->
<div class="text-center">版本号:{{ version }}</div>
</el-dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import PackageJSON from '../../../../../package.json'
import useStore from '@/stores'
const defaultTitle = import.meta.env.VITE_APP_TITLE
const { user } = useStore()
const version = user.version
const aboutDialogVisible = ref(false)
const open = () => {
Expand All @@ -69,9 +57,10 @@ defineExpose({ open })
</script>
<style lang="scss" scope>
.about-dialog {
padding: 0;
padding: 0 0 24px 0;
border-radius: 4px;
width: 600px;
font-weight: 400;
.el-dialog__header {
background: var(--app-header-bg-color);
margin-right: 0;
Expand All @@ -92,11 +81,11 @@ defineExpose({ open })
height: 59px;
}
.about-ui {
padding: 24px;
width: 360px;
margin: 0 auto;
font-weight: 400;
font-size: 16px;
margin-top: 24px;
.label {
width: 180px;
text-align: left;
Expand Down
12 changes: 11 additions & 1 deletion ui/src/stores/modules/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ export interface userStateTypes {
userType: number // 1 系统操作者 2 对话用户
userInfo: User | null
token: any
version?: string
}

const useUserStore = defineStore({
id: 'user',
state: (): userStateTypes => ({
userType: 1,
userInfo: null,
token: ''
token: '',
version: ''
}),
actions: {
getToken(): String | null {
Expand Down Expand Up @@ -42,9 +44,17 @@ const useUserStore = defineStore({
changeUserType(num: number) {
this.userType = num
},

async asyncGetVersion() {
return UserApi.getVersion().then((ok) => {
this.version = ok.data?.version || '-'
})
},

async profile() {
return UserApi.profile().then((ok) => {
this.userInfo = ok.data
this.asyncGetVersion()
})
},

Expand Down
16 changes: 12 additions & 4 deletions ui/src/views/user-manage/component/UserDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<el-input
v-model="userForm.username"
placeholder="请输入用户名"
maxlength="64"
maxlength="20"
show-word-limit
>
</el-input>
Expand Down Expand Up @@ -73,8 +73,16 @@ const userForm = ref<any>({
})
const rules = reactive({
username: [{ required: true, message: '请输入用户名' }],
email: [{ required: true, message: '请输入邮箱' }],
username: [
{ required: true, message: '请输入用户名', trigger: 'blur' },
{
min: 6,
max: 20,
message: '长度在 6 到 20 个字符',
trigger: 'blur'
}
],
email: [{ required: true, message: '请输入邮箱', trigger: 'blur' }],
password: [
{
required: true,
Expand Down Expand Up @@ -102,8 +110,8 @@ watch(dialogVisible, (bool) => {
phone: '',
nick_name: ''
}
userFormRef.value?.clearValidate()
isEdit.value = false
userFormRef.value?.clearValidate()
}
})
Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/user-manage/component/UserPwdDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ watch(dialogVisible, (bool) => {
password: '',
re_password: ''
}
userFormRef.value?.clearValidate()
}
})
const open = (data: any) => {
userId.value = data.id
dialogVisible.value = true
userFormRef.value?.clearValidate()
}
const submit = async (formEl: FormInstance | undefined) => {
Expand Down

0 comments on commit 96a0e4b

Please sign in to comment.