mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
refactor(projects): 完善路由配置
This commit is contained in:
@ -2,14 +2,14 @@
|
||||
<div class="p-10px">
|
||||
<data-card :loading="loading" />
|
||||
<nav-card :loading="loading" />
|
||||
<router-link :to="EnumRoutePaths['dashboard-workbench']">workbench</router-link>
|
||||
<router-link :to="EnumRoutePath['dashboard-workbench']">workbench</router-link>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { DataCard, NavCard } from './components';
|
||||
import { EnumRoutePaths } from '@/enum';
|
||||
import { EnumRoutePath } from '@/enum';
|
||||
|
||||
const loading = ref(true);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2>工作台</h2>
|
||||
<router-link :to="EnumRoutePaths['dashboard-analysis']">analysis</router-link>
|
||||
<router-link :to="EnumRoutePath['dashboard-analysis']">analysis</router-link>
|
||||
<n-button @click="removeCurrent">去除</n-button>
|
||||
</div>
|
||||
</template>
|
||||
@ -9,7 +9,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { NButton } from 'naive-ui';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { EnumRoutePaths } from '@/enum';
|
||||
import { EnumRoutePath } from '@/enum';
|
||||
import { RouteNameMap } from '@/router';
|
||||
|
||||
const router = useRouter();
|
||||
|
@ -1,25 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<h3>System</h3>
|
||||
<n-button>
|
||||
<router-link to="/home">home</router-link>
|
||||
</n-button>
|
||||
<n-switch :value="true" />
|
||||
<n-button @click="showModal = true">来吧</n-button>
|
||||
<n-modal v-model:show="showModal">
|
||||
<n-card style="width: 600px" title="模态框" :bordered="false" size="huge">
|
||||
<template #header-extra>噢!</template>
|
||||
内容
|
||||
<template #footer>尾部</template>
|
||||
</n-card>
|
||||
</n-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { NButton, NSwitch, NModal, NCard } from 'naive-ui';
|
||||
|
||||
const showModal = ref(false);
|
||||
</script>
|
||||
<style scoped></style>
|
@ -28,19 +28,21 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { NForm, NFormItem, NInput, NSpace, NCheckbox, NButton, useMessage } from 'naive-ui';
|
||||
import { NForm, NFormItem, NInput, NSpace, NCheckbox, NButton, useNotification } from 'naive-ui';
|
||||
import type { FormInst } from 'naive-ui';
|
||||
import { EnumLoginModule } from '@/enum';
|
||||
import { useRouterChange } from '@/hooks';
|
||||
import { useRouterChange, useRouteParam } from '@/hooks';
|
||||
import { setToken, toLoginRedirectUrl } from '@/utils';
|
||||
import { OtherLogin } from '../common';
|
||||
|
||||
const { toLogin } = useRouterChange();
|
||||
const message = useMessage();
|
||||
const { toLogin, toHome } = useRouterChange();
|
||||
const { loginRedirectUrl } = useRouteParam();
|
||||
const notification = useNotification();
|
||||
|
||||
const formRef = ref<(HTMLElement & FormInst) | null>(null);
|
||||
const model = reactive({
|
||||
phone: '',
|
||||
pwd: ''
|
||||
phone: '15170283876',
|
||||
pwd: '123456'
|
||||
});
|
||||
const rules = {
|
||||
phone: {
|
||||
@ -62,9 +64,17 @@ function handleSubmit(e: MouseEvent) {
|
||||
|
||||
formRef.value.validate(errors => {
|
||||
if (!errors) {
|
||||
message.success('验证成功');
|
||||
} else {
|
||||
message.error('验证失败');
|
||||
setToken('temp-token');
|
||||
if (loginRedirectUrl.value) {
|
||||
toLoginRedirectUrl(loginRedirectUrl.value);
|
||||
} else {
|
||||
toHome();
|
||||
}
|
||||
|
||||
notification.success({
|
||||
title: '登录成功!',
|
||||
content: '欢迎回来,Soybean!'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
import type { Ref } from 'vue';
|
||||
import { useCreateContext } from '@/hooks';
|
||||
import { LoginModuleType } from '@/interface';
|
||||
|
||||
interface ShareState {
|
||||
activeModule: Ref<LoginModuleType>;
|
||||
handleLoginModule(module: LoginModuleType): void;
|
||||
}
|
||||
|
||||
const { useContext, useProvider } = useCreateContext<ShareState>();
|
||||
|
||||
export function useLoginContext() {
|
||||
return {
|
||||
useContext,
|
||||
useProvider
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user