refactor(components): 移除登录页面的注册状态获取功能
- 删除了用于获取注册状态的 isRegistrationEnabled 变量和相关 API 调用 - 移除了根据注册状态动态显示注册按钮的逻辑 - 简化了登录页面的结构,不再包含注册状态相关的代码
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
<el-form-item>
|
||||
<div class="button-group">
|
||||
<el-button type="primary" @click="handleLogin" class="login-button">安全登录</el-button>
|
||||
<el-button v-if="isRegistrationEnabled" @click="goToRegister" class="register-button">立即注册</el-button>
|
||||
<el-button @click="goToRegister" class="register-button">立即注册</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -38,14 +38,12 @@
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useUserStore } from '../stores/user';
|
||||
import { getRegistrationStatus } from '../api/CommonApi';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { User, Lock } from '@element-plus/icons-vue';
|
||||
|
||||
const router = useRouter();
|
||||
const userStore = useUserStore();
|
||||
const loginFormRef = ref(null);
|
||||
const isRegistrationEnabled = ref(true);
|
||||
|
||||
const loginForm = ref({
|
||||
username: '',
|
||||
@@ -78,16 +76,6 @@ const goToHome = () => {
|
||||
router.push('/home');
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const response = await getRegistrationStatus();
|
||||
isRegistrationEnabled.value = response.data;
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch registration status:", error);
|
||||
// 保守起见,如果获取失败则禁用注册按钮
|
||||
isRegistrationEnabled.value = false;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user