update:智控台可设置允许用户自由注册 (#809)

* update:修复默认模型没有修改到模版配置的bug

* update:智控台可设置允许用户自由注册
This commit is contained in:
hrz
2025-04-15 13:03:29 +08:00
committed by GitHub
parent 4bf950574c
commit e00da5d8d2
18 changed files with 186 additions and 147 deletions
+9 -19
View File
@@ -38,7 +38,7 @@
</div>
<div
style="font-weight: 400;font-size: 14px;text-align: left;color: #5778ff;display: flex;justify-content: space-between;margin-top: 20px;">
<div style="cursor: pointer;" @click="goToRegister">新用户注册</div>
<div v-if="allowUserRegister" style="cursor: pointer;" @click="goToRegister">新用户注册</div>
</div>
</div>
<div class="login-btn" @click="login">登录</div>
@@ -61,12 +61,18 @@
import Api from '@/apis/api';
import VersionFooter from '@/components/VersionFooter.vue';
import { getUUID, goToPage, showDanger, showSuccess } from '@/utils';
import { mapState } from 'vuex';
export default {
name: 'login',
components: {
VersionFooter
},
computed: {
...mapState({
allowUserRegister: state => state.pubConfig.allowUserRegister
})
},
data() {
return {
activeName: "username",
@@ -77,13 +83,12 @@ export default {
captchaId: ''
},
captchaUuid: '',
captchaUrl: '',
version: ''
captchaUrl: ''
}
},
mounted() {
this.fetchCaptcha();
this.getSystemVersion();
this.$store.dispatch('fetchPubConfig');
},
methods: {
fetchCaptcha() {
@@ -148,21 +153,6 @@ export default {
goToRegister() {
goToPage('/register')
},
getSystemVersion() {
const storedVersion = sessionStorage.getItem('systemVersion');
if (storedVersion) {
this.version = storedVersion;
return;
}
Api.user.getPubConfig(({ data }) => {
if (data.code === 0 && data.data.version) {
this.version = data.data.version;
sessionStorage.setItem('systemVersion', data.data.version);
}
});
}
}
}
</script>
+14
View File
@@ -82,12 +82,18 @@
import Api from '@/apis/api';
import VersionFooter from '@/components/VersionFooter.vue';
import { getUUID, goToPage, showDanger, showSuccess } from '@/utils';
import { mapState } from 'vuex';
export default {
name: 'register',
components: {
VersionFooter
},
computed: {
...mapState({
allowUserRegister: state => state.pubConfig.allowUserRegister
})
},
data() {
return {
form: {
@@ -101,6 +107,14 @@ export default {
}
},
mounted() {
this.$store.dispatch('fetchPubConfig').then(() => {
if (!this.allowUserRegister) {
showDanger('当前不允许普通用户注册');
setTimeout(() => {
goToPage('/login');
}, 1500);
}
});
this.fetchCaptcha();
},
methods: {