Browse Source

feat: ifLogin

0225263 4 months ago
parent
commit
66fc26d0da

+ 71 - 67
src/app/app-routing.module.ts

@@ -1,69 +1,73 @@
-import { NgModule } from '@angular/core';
-import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
-// 引用路由守卫
-import { authGuard } from 'src/modules/user/auth.guard';
+import { NgModule } from '@angular/core';
+import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
+// 引用路由守卫
+import { authGuard } from 'src/modules/user/auth.guard';
+
+const routes: Routes = [
+  {
+    path: '',
+    loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
+  },
+  {
+    path: 'tab4',
+    loadChildren: () => import('./tab4/tab4.module').then( m => m.Tab4PageModule)
+  },
+  {
+    path: 'feedback',
+    loadChildren: () => import('./feedback/feedback.module').then( m => m.FeedbackPageModule)
+  },
+  {
+    path: 'settings',
+    loadChildren: () => import('./settings/settings.module').then( m => m.SettingsPageModule)
+  },
+  // {
+  //   path: 'login',
+  //   loadChildren: () => import('./login/login.module').then( m => m.LoginPageModule)
+  // },
+  {
+    path: 'edit-profile',
+    loadChildren: () => import('./edit-profile/edit-profile.module').then( m => m.EditProfilePageModule)
+  },
+  {
+    path: 'notification-settings',
+    loadChildren: () => import('./notification-settings/notification-settings.module').then( m => m.NotificationSettingsPageModule)
+  },
+  {
+    path: 'privacy',
+    loadChildren: () => import('./privacy/privacy.module').then( m => m.PrivacyPageModule)
+  },
+
+  {
+    path: 'theme-settings',
+    loadChildren: () => import('./theme-settings/theme-settings.module').then( m => m.ThemeSettingsPageModule)
+  },
+  {
+    path: 'language-settings',
+    loadChildren: () => import('./language-settings/language-settings.module').then( m => m.LanguageSettingsPageModule)
+  },
+    // 添加:
+      {
+        path: 'user',
+        loadChildren: () => import('../modules/user/user.module').then(m => m.UserModule)
+      },
+    {
+      path: 'following',
+      loadChildren: () => import('./following/following.module').then( m => m.FollowingPageModule)
+    },
+    {
+      path: 'follower',
+      loadChildren: () => import('./follower/follower.module').then( m => m.FollowerPageModule)
+    },
  {
+    path: 'creator',
+    loadChildren: () => import('./creator/creator.module').then( m => m.CreatorPageModule)
+  }
 
 
-const routes: Routes = [
-  {
-    path: '',
-    loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
-  },
-  {
-    path: 'tab4',
-    loadChildren: () => import('./tab4/tab4.module').then( m => m.Tab4PageModule)
-  },
-  {
-    path: 'feedback',
-    loadChildren: () => import('./feedback/feedback.module').then( m => m.FeedbackPageModule)
-  },
-  {
-    path: 'settings',
-    loadChildren: () => import('./settings/settings.module').then( m => m.SettingsPageModule)
-  },
-  // {
-  //   path: 'login',
-  //   loadChildren: () => import('./login/login.module').then( m => m.LoginPageModule)
-  // },
-  {
-    path: 'edit-profile',
-    loadChildren: () => import('./edit-profile/edit-profile.module').then( m => m.EditProfilePageModule)
-  },
-  {
-    path: 'notification-settings',
-    loadChildren: () => import('./notification-settings/notification-settings.module').then( m => m.NotificationSettingsPageModule)
-  },
-  {
-    path: 'privacy',
-    loadChildren: () => import('./privacy/privacy.module').then( m => m.PrivacyPageModule)
-  },
-
-  {
-    path: 'theme-settings',
-    loadChildren: () => import('./theme-settings/theme-settings.module').then( m => m.ThemeSettingsPageModule)
-  },
-  {
-    path: 'language-settings',
-    loadChildren: () => import('./language-settings/language-settings.module').then( m => m.LanguageSettingsPageModule)
-  },
-    // 添加:
-      {
-        path: 'user',
-        loadChildren: () => import('../modules/user/user.module').then(m => m.UserModule)
-      },
-    {
-      path: 'following',
-      loadChildren: () => import('./following/following.module').then( m => m.FollowingPageModule)
-    },
-    {
-      path: 'follower',
-      loadChildren: () => import('./follower/follower.module').then( m => m.FollowerPageModule)
-    }
-
-];
-@NgModule({
-  imports: [
-    RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
-  ],
-  exports: [RouterModule]
-})
+
+];
+@NgModule({
+  imports: [
+    RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
+  ],
+  exports: [RouterModule]
+})
 export class AppRoutingModule {}
 export class AppRoutingModule {}

+ 17 - 0
src/app/creator/creator-routing.module.ts

@@ -0,0 +1,17 @@
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+
+import { CreatorPage } from './creator.page';
+
+const routes: Routes = [
+  {
+    path: '',
+    component: CreatorPage
+  }
+];
+
+@NgModule({
+  imports: [RouterModule.forChild(routes)],
+  exports: [RouterModule],
+})
+export class CreatorPageRoutingModule {}

+ 20 - 0
src/app/creator/creator.module.ts

@@ -0,0 +1,20 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import { IonicModule } from '@ionic/angular';
+
+import { CreatorPageRoutingModule } from './creator-routing.module';
+
+import { CreatorPage } from './creator.page';
+
+@NgModule({
+  imports: [
+    CommonModule,
+    FormsModule,
+    IonicModule,
+    CreatorPageRoutingModule
+  ],
+  declarations: [CreatorPage]
+})
+export class CreatorPageModule {}

+ 13 - 0
src/app/creator/creator.page.html

@@ -0,0 +1,13 @@
+<ion-header [translucent]="true">
+  <ion-toolbar>
+    <ion-title>creator</ion-title>
+  </ion-toolbar>
+</ion-header>
+
+<ion-content [fullscreen]="true">
+  <ion-header collapse="condense">
+    <ion-toolbar>
+      <ion-title size="large">creator</ion-title>
+    </ion-toolbar>
+  </ion-header>
+</ion-content>

+ 0 - 0
src/app/creator/creator.page.scss


+ 17 - 0
src/app/creator/creator.page.spec.ts

@@ -0,0 +1,17 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { CreatorPage } from './creator.page';
+
+describe('CreatorPage', () => {
+  let component: CreatorPage;
+  let fixture: ComponentFixture<CreatorPage>;
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(CreatorPage);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 15 - 0
src/app/creator/creator.page.ts

@@ -0,0 +1,15 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+  selector: 'app-creator',
+  templateUrl: './creator.page.html',
+  styleUrls: ['./creator.page.scss'],
+})
+export class CreatorPage implements OnInit {
+
+  constructor() { }
+
+  ngOnInit() {
+  }
+
+}

+ 2 - 2
src/app/feedback/feedback.page.html

@@ -1,9 +1,9 @@
 <ion-header [translucent]="true">
 <ion-header [translucent]="true">
-  <ion-toolbar>
+  <ion-toolbar style="height: 60px">
     <ion-buttons slot="start">
     <ion-buttons slot="start">
       <ion-back-button defaultHref="/tabs/tab4"></ion-back-button>
       <ion-back-button defaultHref="/tabs/tab4"></ion-back-button>
     </ion-buttons>
     </ion-buttons>
-    <ion-title style="font-size:30px">反馈</ion-title>
+    <ion-title style="font-size:25px" >反馈</ion-title>
   </ion-toolbar>
   </ion-toolbar>
 </ion-header>
 </ion-header>
 
 

+ 3 - 0
src/app/feedback/feedback.page.scss

@@ -0,0 +1,3 @@
+// ion-header {
+//   --min-height: 80px !important; /* 设置 header 的最小高度为 80px,你可以根据需要调整高度 */
+// }

+ 8 - 12
src/app/tab4/tab4.page.html

@@ -1,5 +1,5 @@
 <ion-header [translucent]="true">
 <ion-header [translucent]="true">
-  <ion-toolbar>
+  <ion-toolbar >
     <!-- <ion-title>我的</ion-title> -->
     <!-- <ion-title>我的</ion-title> -->
     <ion-buttons slot="end">
     <ion-buttons slot="end">
       <ion-button (click)="openFeedbackPage()">
       <ion-button (click)="openFeedbackPage()">
@@ -18,7 +18,8 @@
 
 
 <ion-content>
 <ion-content>
 
 
-    <ion-card-content>
+    <ion-card-content class="user-info" style="background-image: url('https://img-baofun.zhhainiao.com/fs/418d45e9ae341aa1760e2368d166dc3c.jpg');">
+      
       <ion-avatar style="margin-left:15px;margin-top:15px; transform:scale(1.8)">
       <ion-avatar style="margin-left:15px;margin-top:15px; transform:scale(1.8)">
         <img src="https://ionicframework.com/docs/img/demos/avatar.svg" alt="User Avatar">
         <img src="https://ionicframework.com/docs/img/demos/avatar.svg" alt="User Avatar">
       </ion-avatar>
       </ion-avatar>
@@ -50,29 +51,24 @@
     </ion-col>
     </ion-col>
   </ion-row>
   </ion-row>
 </ion-grid>
 </ion-grid>
+    
     <ion-card-content>
     <ion-card-content>
-    <ion-segment scrollable>
-    <ion-segment-button value="creators">
+    <ion-segment-button value="creators" (click)="openLogin2Page()">
       <ion-icon name="color-palette-outline"></ion-icon>
       <ion-icon name="color-palette-outline"></ion-icon>
       创作者中心
       创作者中心
     </ion-segment-button>
     </ion-segment-button>
-    <ion-segment-button value="circles">
+    <ion-segment-button value="circles" (click)="openLogin2Page()">
       <ion-icon name="chatbubbles-outline"></ion-icon>
       <ion-icon name="chatbubbles-outline"></ion-icon>
       我的圈子
       我的圈子
     </ion-segment-button>
     </ion-segment-button>
-    <ion-segment-button value="my-orders">
+    <ion-segment-button value="my-orders" (click)="openLogin2Page()">
       <ion-icon name="receipt-outline"></ion-icon>
       <ion-icon name="receipt-outline"></ion-icon>
       我的订单
       我的订单
     </ion-segment-button>
     </ion-segment-button>
-    <ion-segment-button value="decor-assistant">
-      <ion-icon name="hammer-outline"></ion-icon>
-      装修助手
-    </ion-segment-button>
-    <ion-segment-button value="apply-verification">
+    <ion-segment-button value="apply-verification" (click)="openLogin2Page()">
       <ion-icon name="shield-checkmark-outline"></ion-icon>
       <ion-icon name="shield-checkmark-outline"></ion-icon>
       申请认证
       申请认证
     </ion-segment-button>
     </ion-segment-button>
-  </ion-segment>
     </ion-card-content>
     </ion-card-content>
   </ion-card>
   </ion-card>
   
   

+ 15 - 4
src/app/tab4/tab4.page.scss

@@ -16,12 +16,12 @@ ion-card {
     font-weight: bold;
     font-weight: bold;
   }
   }
   
   
-  ion-button {
-    margin: 15px;
-  }
+  // ion-button {
+  //   margin: 15px;
+  // }
 
 
 ion-segment-button {
 ion-segment-button {
- 
+  width:100px;
   font-size: 15px; /* 设置按钮字体大小为20px,让按钮整体看起来更大 */
   font-size: 15px; /* 设置按钮字体大小为20px,让按钮整体看起来更大 */
   padding: 10px 0px; /* 设置按钮内边距,增加按钮的大小 */
   padding: 10px 0px; /* 设置按钮内边距,增加按钮的大小 */
 }
 }
@@ -60,3 +60,14 @@ ion-col {
     color: #999;
     color: #999;
   }
   }
 }
 }
+
+.user-info {
+  background-size: cover;
+  background-position: center;
+  background-repeat: no-repeat;
+  display: flex;
+  // align-items: center;
+  // justify-content: center;
+  height: 150px; /* 设置容器高度 */
+  position: relative;
+}

+ 9 - 0
src/app/tab4/tab4.page.ts

@@ -77,6 +77,15 @@ export class Tab4Page implements OnInit {
     this.navCtrl.navigateForward('/user/login');
     this.navCtrl.navigateForward('/user/login');
   }
   }
 
 
+  openLogin2Page() {
+    //按钮
+    if (this.user?.id) {
+    this.router.navigate(['/creator']); // 如果已登录,跳转到 creator 页面
+  } else {
+    this.navCtrl.navigateForward('/user/login'); // 如果未登录,跳转到 login 页面
+  }
+  }
+
   openFollowingPage(){
   openFollowingPage(){
     //打开关注页面
     //打开关注页面
     this.router.navigate(['/following']);
     this.router.navigate(['/following']);

+ 2 - 2
src/modules/user/login/login.page.html

@@ -1,6 +1,6 @@
 <ion-header [translucent]="true">
 <ion-header [translucent]="true">
-  <ion-toolbar>
-    <ion-title>登录/注册</ion-title>
+  <ion-toolbar style="height: 60px">
+    <!-- <ion-title style="fofont-size: 25px">登录/注册</ion-title> -->
   </ion-toolbar>
   </ion-toolbar>
 </ion-header>
 </ion-header>