diff --git a/backend/app/api/v1/auth.go b/backend/app/api/v1/auth.go index 54184cf31..981957b5c 100644 --- a/backend/app/api/v1/auth.go +++ b/backend/app/api/v1/auth.go @@ -167,6 +167,15 @@ func (b *BaseApi) InitUserInfo(c *gin.Context) { helper.SuccessWithData(c, nil) } +// @Tags Auth +// @Summary Check System isDemo +// @Description 判断是否为demo环境 +// @Success 200 +// @Router /auth/demo [get] +func (b *BaseApi) CheckIsDemo(c *gin.Context) { + helper.SuccessWithData(c, global.CONF.System.IsDemo) +} + func saveLoginLogs(c *gin.Context, err error) { var logs model.LoginLog if err != nil { diff --git a/backend/router/ro_app.go b/backend/router/ro_app.go index 1278e341a..66bc9e251 100644 --- a/backend/router/ro_app.go +++ b/backend/router/ro_app.go @@ -16,7 +16,7 @@ func (a *AppRouter) InitAppRouter(Router *gin.RouterGroup) { baseApi := v1.ApiGroupApp.BaseApi { appRouter.POST("/sync", baseApi.SyncApp) - appRouter.POST("/checkupdate", baseApi.GetAppListUpdate) + appRouter.GET("/checkupdate", baseApi.GetAppListUpdate) appRouter.POST("/search", baseApi.SearchApp) appRouter.GET("/:key", baseApi.GetApp) appRouter.GET("/detail/:appId/:version", baseApi.GetAppDetail) diff --git a/backend/router/ro_base.go b/backend/router/ro_base.go index 9c3ff57c3..c57666ad6 100644 --- a/backend/router/ro_base.go +++ b/backend/router/ro_base.go @@ -17,5 +17,6 @@ func (s *BaseRouter) InitBaseRouter(Router *gin.RouterGroup) { baseRouter.GET("/status", baseApi.CheckIsFirstLogin) baseRouter.POST("/init", baseApi.InitUserInfo) baseRouter.POST("/logout", baseApi.LogOut) + baseRouter.GET("/demo", baseApi.CheckIsDemo) } } diff --git a/frontend/src/api/modules/app.ts b/frontend/src/api/modules/app.ts index 3d1a01492..0b39fee46 100644 --- a/frontend/src/api/modules/app.ts +++ b/frontend/src/api/modules/app.ts @@ -7,7 +7,7 @@ export const SyncApp = () => { }; export const GetAppListUpdate = () => { - return http.post('apps/checkupdate', {}); + return http.get('apps/checkupdate'); }; export const SearchApp = (req: App.AppReq) => { diff --git a/frontend/src/api/modules/auth.ts b/frontend/src/api/modules/auth.ts index 23b7e0514..f3808da86 100644 --- a/frontend/src/api/modules/auth.ts +++ b/frontend/src/api/modules/auth.ts @@ -28,6 +28,11 @@ export const loginStatus = () => { export const checkIsFirst = () => { return http.get('/auth/status'); }; + export const initUser = (params: Login.InitUser) => { return http.post(`/auth/init`, params); }; + +export const checkIsDemo = () => { + return http.get('/auth/demo'); +}; diff --git a/frontend/src/views/login/components/login-form.vue b/frontend/src/views/login/components/login-form.vue index b0c892722..dc1b47200 100644 --- a/frontend/src/views/login/components/login-form.vue +++ b/frontend/src/views/login/components/login-form.vue @@ -158,6 +158,11 @@ +
+ + {{ $t('commons.login.username') }}:demo {{ $t('commons.login.password') }}:1panel + +
@@ -167,7 +172,7 @@ import { ref, reactive, onMounted } from 'vue'; import { useRouter } from 'vue-router'; import type { ElForm } from 'element-plus'; -import { loginApi, getCaptcha, mfaLoginApi, checkIsFirst, initUser } from '@/api/modules/auth'; +import { loginApi, getCaptcha, mfaLoginApi, checkIsFirst, initUser, checkIsDemo } from '@/api/modules/auth'; import { GlobalStore } from '@/store'; import { MenuStore } from '@/store/modules/menu'; import i18n from '@/lang'; @@ -180,6 +185,7 @@ const menuStore = MenuStore(); const errAuthInfo = ref(false); const errCaptcha = ref(false); const errMfaInfo = ref(false); +const isDemo = ref(false); const isFirst = ref(); @@ -315,6 +321,11 @@ const checkStatus = async () => { } }; +const checkIsSystemDemo = async () => { + const res = await checkIsDemo(); + isDemo.value = res.data; +}; + function checkPassword(rule: any, value: any, callback: any) { if (registerForm.password !== registerForm.rePassword) { return callback(new Error(i18n.global.t('commons.rule.rePassword'))); @@ -325,6 +336,7 @@ function checkPassword(rule: any, value: any, callback: any) { onMounted(() => { document.title = globalStore.themeConfig.panelName; checkStatus(); + checkIsSystemDemo(); document.onkeydown = (e: any) => { e = window.event || e; if (e.keyCode === 13) { @@ -351,15 +363,11 @@ onMounted(() => { } .login-title { - // margin-top: 50px; font-size: 30px; letter-spacing: 0; text-align: center; color: #646a73; margin-bottom: 30px; - // @media only screen and (max-width: 1280px) { - // margin-top: 20px; - // } } .no-border { :deep(.el-input__wrapper) { @@ -421,5 +429,12 @@ onMounted(() => { height: 45px; margin-top: 10px; } + + .demo { + text-align: center; + span { + color: red; + } + } } diff --git a/frontend/src/views/login/index.vue b/frontend/src/views/login/index.vue index 9508daf25..428570c8b 100644 --- a/frontend/src/views/login/index.vue +++ b/frontend/src/views/login/index.vue @@ -55,19 +55,10 @@ const getStatus = async () => { statusCode.value = 1; }; -// watch( -// () => screenWidth.value, -// (newVal) => { -// console.log() -// }, -// ); - onMounted(() => { getStatus(); - // 屏幕适配 screenWidth.value = document.body.clientWidth; window.onresize = () => { - //屏幕尺寸变化就重新赋值 return (() => { screenWidth.value = document.body.clientWidth; })(); @@ -118,8 +109,6 @@ onMounted(() => { } .login-title { - // margin-top: 10%; - // margin-right: 15%; margin-left: 10%; span:first-child { color: $primary-color; @@ -138,11 +127,9 @@ onMounted(() => { } } .login-container { - // margin-left: 15%; margin-top: 40px; padding: 40px 0; width: 390px; - // height: 422px; box-sizing: border-box; background-color: rgba(255, 255, 255, 0.55); border-radius: 4px;