Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "naive-ui-admin",
"version": "2.0.0",
"type": "module",
"author": {
"name": "Ahjung",
"email": "735878602@qq.com",
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function sortRoute(a, b) {
}

routeModuleList.sort(sortRoute);

console.log(routeModuleList, '----wriririr');
export const RootRoute: RouteRecordRaw = {
path: '/',
name: 'Root',
Expand All @@ -45,6 +45,7 @@ export const constantRouter: RouteRecordRaw[] = [LoginRoute, RootRoute, Redirect

const router = createRouter({
history: createWebHistory(),
// routes: [...constantRouter, ...asyncRoutes],
routes: constantRouter,
strict: true,
scrollBehavior: () => ({ left: 0, top: 0 }),
Expand Down
2 changes: 2 additions & 0 deletions src/store/modules/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const useUserStore = defineStore({
async login(params: any) {
const response = await login(params);
const { result, code } = response;
console.log('login', response);
if (code === ResultEnum.SUCCESS) {
const ex = 7 * 24 * 60 * 60;
storage.set(ACCESS_TOKEN, result.token, ex);
Expand All @@ -79,6 +80,7 @@ export const useUserStore = defineStore({
// 获取用户信息
async getInfo() {
const data = await getUserInfoApi();
console.log('getInfo', data);
const { result } = data;
if (result.permissions && result.permissions.length) {
const permissionsList = result.permissions;
Expand Down
2 changes: 1 addition & 1 deletion src/views/form/stepForm/Step1.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</template>

<script lang="ts" setup>
import { ref, defineEmits } from 'vue';
import { ref } from 'vue';
import { useMessage } from 'naive-ui';

const myAccountList = [
Expand Down
2 changes: 1 addition & 1 deletion src/views/form/stepForm/Step2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</template>

<script lang="ts" setup>
import { ref, defineEmits } from 'vue';
import { ref } from 'vue';
import { useMessage } from 'naive-ui';
const form2Ref: any = ref(null);
const message = useMessage();
Expand Down
2 changes: 0 additions & 2 deletions src/views/form/stepForm/Step3.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
</template>

<script lang="ts" setup>
import { defineEmits } from 'vue';

const emit = defineEmits(['finish', 'prevStep']);
function prevStep() {
emit('prevStep');
Expand Down
5 changes: 4 additions & 1 deletion src/views/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@
const toPath = decodeURIComponent((route.query?.redirect || '/') as string);
message.success('登录成功,即将进入系统');
if (route.name === LOGIN_NAME) {
router.replace('/');
// router.replace('/');
router.isReady().then(() => {
router.push('/');
});
} else router.replace(toPath);
} else {
message.info(msg || '登录失败');
Expand Down
20 changes: 7 additions & 13 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { UserConfig, ConfigEnv } from 'vite';
import { loadEnv } from 'vite';
import { defineConfig, loadEnv } from 'vite';
import { resolve } from 'path';
import { wrapperEnv } from './build/utils';
import { createVitePlugins } from './build/vite/plugin';
import { OUTPUT_DIR } from './build/constant';
import { createProxy } from './build/vite/proxy';
import pkg from './package.json';
import { format } from 'date-fns';

const { dependencies, devDependencies, name, version } = pkg;

const __APP_INFO__ = {
Expand All @@ -18,25 +18,19 @@ function pathResolve(dir: string) {
return resolve(process.cwd(), '.', dir);
}

export default ({ command, mode }: ConfigEnv): UserConfig => {
export default defineConfig(({ command, mode }) => {
const root = process.cwd();
const env = loadEnv(mode, root);
const viteEnv = wrapperEnv(env);
const { VITE_PUBLIC_PATH, VITE_PORT, VITE_PROXY } = viteEnv;
const isBuild = command === 'build';

return {
base: VITE_PUBLIC_PATH,
esbuild: {},
resolve: {
alias: [
{
find: /\/#\//,
replacement: pathResolve('types') + '/',
},
{
find: '@',
replacement: pathResolve('src') + '/',
},
{ find: /\/#\//, replacement: pathResolve('types') + '/' },
{ find: '@', replacement: pathResolve('src') + '/' },
],
dedupe: ['vue'],
},
Expand All @@ -63,4 +57,4 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
chunkSizeWarningLimit: 2000,
},
};
};
});