mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
refactor(projects): remove enum
This commit is contained in:
@ -23,11 +23,11 @@
|
||||
</n-button>
|
||||
<div class="flex-y-center justify-between">
|
||||
<n-button class="flex-1" :block="true" @click="toLoginModule('code-login')">
|
||||
{{ EnumLoginModule['code-login'] }}
|
||||
{{ loginModuleLabels['code-login'] }}
|
||||
</n-button>
|
||||
<div class="w-12px"></div>
|
||||
<n-button class="flex-1" :block="true" @click="toLoginModule('register')">
|
||||
{{ EnumLoginModule.register }}
|
||||
{{ loginModuleLabels.register }}
|
||||
</n-button>
|
||||
</div>
|
||||
</n-space>
|
||||
@ -38,7 +38,7 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue';
|
||||
import type { FormInst, FormRules } from 'naive-ui';
|
||||
import { EnumLoginModule } from '@/enum';
|
||||
import { loginModuleLabels } from '@/constants';
|
||||
import { useAuthStore } from '@/store';
|
||||
import { useRouterPush } from '@/composables';
|
||||
import { formRules } from '@/utils';
|
||||
|
@ -28,7 +28,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import type { Component } from 'vue';
|
||||
import { EnumLoginModule } from '@/enum';
|
||||
import { loginModuleLabels } from '@/constants';
|
||||
import { useThemeStore } from '@/store';
|
||||
import { useAppInfo } from '@/composables';
|
||||
import { getColorPalette, mixColor } from '@/utils';
|
||||
@ -36,7 +36,7 @@ import { BindWechat, CodeLogin, LoginBg, PwdLogin, Register, ResetPwd } from './
|
||||
|
||||
interface Props {
|
||||
/** 登录模块分类 */
|
||||
module: EnumType.LoginModuleKey;
|
||||
module: UnionKey.LoginModule;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
@ -45,17 +45,17 @@ const theme = useThemeStore();
|
||||
const { title } = useAppInfo();
|
||||
|
||||
interface LoginModule {
|
||||
key: EnumType.LoginModuleKey;
|
||||
label: EnumLoginModule;
|
||||
key: UnionKey.LoginModule;
|
||||
label: string;
|
||||
component: Component;
|
||||
}
|
||||
|
||||
const modules: LoginModule[] = [
|
||||
{ key: 'pwd-login', label: EnumLoginModule['pwd-login'], component: PwdLogin },
|
||||
{ key: 'code-login', label: EnumLoginModule['code-login'], component: CodeLogin },
|
||||
{ key: 'register', label: EnumLoginModule.register, component: Register },
|
||||
{ key: 'reset-pwd', label: EnumLoginModule['reset-pwd'], component: ResetPwd },
|
||||
{ key: 'bind-wechat', label: EnumLoginModule['bind-wechat'], component: BindWechat }
|
||||
{ key: 'pwd-login', label: loginModuleLabels['pwd-login'], component: PwdLogin },
|
||||
{ key: 'code-login', label: loginModuleLabels['code-login'], component: CodeLogin },
|
||||
{ key: 'register', label: loginModuleLabels.register, component: Register },
|
||||
{ key: 'reset-pwd', label: loginModuleLabels['reset-pwd'], component: ResetPwd },
|
||||
{ key: 'bind-wechat', label: loginModuleLabels['bind-wechat'], component: BindWechat }
|
||||
];
|
||||
|
||||
const activeModule = computed(() => {
|
||||
|
@ -34,7 +34,7 @@
|
||||
<script setup lang="ts">
|
||||
import { watch } from 'vue';
|
||||
import type { SelectOption } from 'naive-ui';
|
||||
import { EnumUserRole } from '@/enum';
|
||||
import { userRoleOptions } from '@/constants';
|
||||
import { useAppStore, useAuthStore } from '@/store';
|
||||
import { usePermission } from '@/composables';
|
||||
|
||||
@ -42,18 +42,7 @@ const app = useAppStore();
|
||||
const auth = useAuthStore();
|
||||
const { hasPermission } = usePermission();
|
||||
|
||||
interface RoleList {
|
||||
label: string;
|
||||
value: keyof typeof EnumUserRole;
|
||||
}
|
||||
|
||||
const roleList: RoleList[] = [
|
||||
{ label: EnumUserRole.super, value: 'super' },
|
||||
{ label: EnumUserRole.admin, value: 'admin' },
|
||||
{ label: EnumUserRole.user, value: 'user' }
|
||||
];
|
||||
|
||||
const options: SelectOption[] = roleList as unknown as SelectOption[];
|
||||
const options: SelectOption[] = userRoleOptions;
|
||||
|
||||
watch(
|
||||
() => auth.userInfo.userRole,
|
||||
|
@ -34,8 +34,8 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, reactive, watch } from 'vue';
|
||||
import type { FormInst, FormItemRule } from 'naive-ui';
|
||||
import { formRules, createRequiredFormRule } from '@/utils';
|
||||
import { genderOptions, userStatusOptions } from '@/constants';
|
||||
import { formRules, createRequiredFormRule } from '@/utils';
|
||||
|
||||
export interface Props {
|
||||
/** 弹窗可见性 */
|
||||
|
@ -33,9 +33,9 @@ import { reactive, ref } from 'vue';
|
||||
import type { Ref } from 'vue';
|
||||
import { NButton, NPopconfirm, NSpace, NTag } from 'naive-ui';
|
||||
import type { DataTableColumns, PaginationProps } from 'naive-ui';
|
||||
import { genderLabels, userStatusLabels } from '@/constants';
|
||||
import { fetchUserList } from '@/service';
|
||||
import { useBoolean, useLoading } from '@/hooks';
|
||||
import { genderLabels, userStatusLabels } from '@/constants';
|
||||
import TableActionModal from './components/table-action-modal.vue';
|
||||
import type { ModalType } from './components/table-action-modal.vue';
|
||||
import ColumnSetting from './components/column-setting.vue';
|
||||
|
Reference in New Issue
Block a user