diff --git a/apps/miniapp/src/pages/mine/index.vue b/apps/miniapp/src/pages/mine/index.vue index 89e5d7d..d91ac03 100644 --- a/apps/miniapp/src/pages/mine/index.vue +++ b/apps/miniapp/src/pages/mine/index.vue @@ -69,6 +69,11 @@ const sellerStore = useSellerStore(); const userInfo = computed(() => userStore.userInfo); onShow(() => { + // 未登录时跳转到登录页 + if (!userStore.isLoggedIn()) { + uni.navigateTo({ url: '/pages/login/index' }); + return; + } // 刷新用户信息 userStore.fetchUserInfo(); }); diff --git a/apps/miniapp/vite.config.ts b/apps/miniapp/vite.config.ts index ec6bdb1..8930366 100644 --- a/apps/miniapp/vite.config.ts +++ b/apps/miniapp/vite.config.ts @@ -9,4 +9,11 @@ export default defineConfig({ '@': resolve(__dirname, 'src'), }, }, + css: { + preprocessorOptions: { + scss: { + api: 'modern-compiler', + }, + }, + }, }); diff --git a/apps/server/src/modules/auth/auth.module.ts b/apps/server/src/modules/auth/auth.module.ts index 2fd6f77..0d96e78 100644 --- a/apps/server/src/modules/auth/auth.module.ts +++ b/apps/server/src/modules/auth/auth.module.ts @@ -12,16 +12,16 @@ import { User } from '@/entities/user.entity'; TypeOrmModule.forFeature([User]), JwtModule.registerAsync({ imports: [ConfigModule], - useFactory: (configService: ConfigService) => ({ - secret: configService.get('jwt.secret') || 'dev_secret_key', - signOptions: { - expiresIn: Number( - configService - .get('jwt.expiresIn') - ?.replace(/[^0-9]/g, '') || '7200', - ), - }, - }), + useFactory: (configService: ConfigService) => { + const expiresIn = configService.get('jwt.expiresIn') || '2h'; + console.log('[AuthModule] JWT expiresIn config:', expiresIn); + return { + secret: configService.get('jwt.secret') || 'dev_secret_key', + signOptions: { + expiresIn: expiresIn as any, + }, + }; + }, inject: [ConfigService], }), ],