-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: 优化登陆页面特征信息 #7027
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
fix: 优化登陆页面特征信息 #7027
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,9 +33,3 @@ const loadErrInfo = () => { | |
| } | ||
| }; | ||
| </script> | ||
|
|
||
| <style scoped lang="scss"> | ||
| .container { | ||
| margin-left: 40%; | ||
| } | ||
| </style> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这段HTML和SCSS代码的差异主要在于JavaScript函数 为了修复这些错误: 对于 JavaScript 函数:
对于 SCSS 的样式规则:
请务必根据具体情况进行相应调整:比如你使用的模板引擎是 Webpack 或 Create-react-app 这样的框架,请查看对应的配置指导来解决这些问题。如果你使用的是纯静态资源管理工具像 Gulp 和 Grunt 等,则需要关注如何引入、编译 SCSS 文件等操作过程。 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,19 @@ | ||
| <template> | ||
| <div> | ||
| <div v-if="!loading"> | ||
| <div class="login-background" v-if="errStatus === ''"> | ||
| <div class="login-wrapper"> | ||
| <div :class="screenWidth > 1110 ? 'left inline-block' : ''"> | ||
| <div class="login-title"> | ||
| <span>{{ globalStore.themeConfig.title || $t('setting.description') }}</span> | ||
| <div v-if="init"> | ||
| <div v-if="errStatus === ''"> | ||
| <div class="login-background"> | ||
| <div class="login-wrapper"> | ||
| <div :class="screenWidth > 1110 ? 'left inline-block' : ''"> | ||
| <div class="login-title"> | ||
| <span>{{ globalStore.themeConfig.title || $t('setting.description') }}</span> | ||
| </div> | ||
| <img src="@/assets/images/1panel-login.png" alt="" v-if="screenWidth > 1110" /> | ||
| </div> | ||
| <img src="@/assets/images/1panel-login.png" alt="" v-if="screenWidth > 1110" /> | ||
| </div> | ||
| <div :class="screenWidth > 1110 ? 'right inline-block' : ''"> | ||
| <div class="login-container"> | ||
| <LoginForm ref="loginRef"></LoginForm> | ||
| <div :class="screenWidth > 1110 ? 'right inline-block' : ''"> | ||
| <div class="login-container"> | ||
| <LoginForm ref="loginRef"></LoginForm> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
@@ -46,45 +48,40 @@ import ErrIP from '@/components/error-message/err_ip.vue'; | |
| import ErrCode from '@/components/error-message/error_code.vue'; | ||
| import ErrDomain from '@/components/error-message/err_domain.vue'; | ||
| import ErrFound from '@/components/error-message/404.vue'; | ||
| import { ref, onMounted, watch } from 'vue'; | ||
| import { ref, onMounted } from 'vue'; | ||
| import { GlobalStore } from '@/store'; | ||
| import { getXpackSettingForTheme } from '@/utils/xpack'; | ||
| const globalStore = GlobalStore(); | ||
|
|
||
| const screenWidth = ref(null); | ||
| const errStatus = ref(''); | ||
| const loading = ref(); | ||
| const errStatus = ref('x'); | ||
| const init = ref(false); | ||
|
|
||
| const mySafetyCode = defineProps({ | ||
| code: { | ||
| type: String, | ||
| default: '', | ||
| }, | ||
| }); | ||
| watch( | ||
| () => globalStore.errStatus, | ||
| (newVal) => { | ||
| if (newVal?.startsWith('err-') || newVal?.startsWith('code-')) { | ||
| errStatus.value = newVal; | ||
| } | ||
| }, | ||
| ); | ||
|
|
||
| const getStatus = async () => { | ||
| let info = globalStore.errStatus; | ||
| if (info?.startsWith('err-') || info?.startsWith('code-')) { | ||
| errStatus.value = info; | ||
| return; | ||
| } | ||
| let code = mySafetyCode.code; | ||
| globalStore.entrance = code; | ||
| loading.value = true; | ||
| await checkIsSafety(code) | ||
| .then(() => { | ||
| loading.value = false; | ||
| let info = globalStore.errStatus; | ||
| if (info?.startsWith('err-') || info?.startsWith('code-')) { | ||
| errStatus.value = info; | ||
| init.value = true; | ||
| return; | ||
| } | ||
| errStatus.value = ''; | ||
| init.value = true; | ||
| getXpackSettingForTheme(); | ||
| }) | ||
| .catch(() => { | ||
| loading.value = false; | ||
| .catch((err) => { | ||
| errStatus.value = 'code-' + err.status; | ||
| init.value = true; | ||
| }); | ||
| }; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 在Vue项目中,我们不应该使用动态属性($props)或静态方法来处理异常状态。更推荐的方式是将业务逻辑和错误响应合并到一个类上: // components/LoginForm.vue
export default {
name: "LoginForm", // Component's name
props: {
code: String
},
mounted() {
// Error handler or logic goes here
}
}然后,在对应的组件模板中的 <login-form v-if="errStatus === ''"></login-form>`
</template>
<!-- 导入必要的CSS等文件 -->
<link rel=stylesheet href='/stylesheets/login.css'>
<!-- 添加样式表引用 -->
<script>
if (globalStore.globalStyle) {
globalStore.$styleSheet.insertRule('.my-style {\n/* your rule */\n} ', null);
}
</script>
<!-- 其他需要挂载的方法... -->
</script>
<body/>
<style scoped>
.login-container {
/* your CSS styles */
}
.right inline-block{
/* right and inline block margins can be useful for some layouts */
}
.left inline-block{
/* other margin utility classes like flex-start, center etc */
}
</style>这可以确保代码保持清晰且易于维护。 |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
该代码存在以下问题:
在
CheckIsSafety函数中,函数名为CheckIsSecurity。建议修改为:
func CheckIsSecurity(c *gin.Context) {}
并移除
h+
以上是需要进行调整的部分。