我想在用户登录后更改我的侧边菜单,以便显示名称及其侧边菜单。我认为这段代码是可以理解的。
rootPage: any = SlidesPage;
if( SlidesPage){
this.pages = [
{ title: 'Welcome', component: SlidesPage },
{ title: 'Home', component: HomePage },
{ title: 'House & Lot', component: HousePage },
{ title: 'Condominium', component: CondoPage },
{ title: 'Apartment', component: ApartmentPage },
{ title: 'Hotel', component: HotelPage }
];
} else {
this.pages = [
{ title: 'Dashboard', component: SellerPage },
{ title: 'My Properties', component: SellerPage },
{ title: 'Properties', component: HomePage },
{ title: 'House & Lot', component: HousePage },
{ title: 'Condominium', component: CondoPage },
{ title: 'Apartment', component: ApartmentPage },
{ title: 'Hotel', component: HotelPage }
];
}
答案 0 :(得分:0)
登录时在localstorage中设置一个令牌
private void onCaptureImageResult(Intent data) {
Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
thumbnail.compress(Bitmap.CompressFormat.JPEG, 90, bytes);
File destination = new File(Environment.getExternalStorageDirectory(),
System.currentTimeMillis() + ".jpg");
FileOutputStream fo;
try {
destination.createNewFile();
fo = new FileOutputStream(destination);
fo.write(bytes.toByteArray());
fo.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Log.e("path",Environment.getExternalStorageDirectory(),
System.currentTimeMillis() + ".jpg");
}
然后在app.component.ts中的intializaApp()中检查它
this.storage.set('vAuthToken', vAuthToken);
希望这对你有所帮助!
答案 1 :(得分:0)
离子会议应用程序使用事件系统,本地令牌存储和带页面的数组,准确地显示了如何执行此操作。还有Jaydeep Kataria的代码。
刚开始一个新项目,使用离子会议模板(当然是最新的离子版)
此致
汤姆