dev
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
@@ -9,4 +9,11 @@ export default defineConfig({
|
||||
'@': resolve(__dirname, 'src'),
|
||||
},
|
||||
},
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
api: 'modern-compiler',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -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],
|
||||
}),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user