This commit is contained in:
2026-05-08 00:50:18 +08:00
parent e4e5c5192b
commit 350b9a94a1
3 changed files with 22 additions and 10 deletions
+5
View File
@@ -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();
});
+7
View File
@@ -9,4 +9,11 @@ export default defineConfig({
'@': resolve(__dirname, 'src'),
},
},
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
},
},
},
});
+10 -10
View File
@@ -12,16 +12,16 @@ import { User } from '@/entities/user.entity';
TypeOrmModule.forFeature([User]),
JwtModule.registerAsync({
imports: [ConfigModule],
useFactory: (configService: ConfigService) => ({
secret: configService.get<string>('jwt.secret') || 'dev_secret_key',
signOptions: {
expiresIn: Number(
configService
.get<string>('jwt.expiresIn')
?.replace(/[^0-9]/g, '') || '7200',
),
},
}),
useFactory: (configService: ConfigService) => {
const expiresIn = configService.get<string>('jwt.expiresIn') || '2h';
console.log('[AuthModule] JWT expiresIn config:', expiresIn);
return {
secret: configService.get<string>('jwt.secret') || 'dev_secret_key',
signOptions: {
expiresIn: expiresIn as any,
},
};
},
inject: [ConfigService],
}),
],