Browse Source

新增首页、更新登录逻辑

warrior 4 months ago
parent
commit
d54da00af9

+ 19 - 0
package-lock.json

@@ -22,6 +22,7 @@
         "@ionic/core": "^8.4.0",
         "parse": "^5.3.0",
         "rxjs": "~7.8.0",
+        "swiper": "^11.1.14",
         "tslib": "^2.3.0",
         "zone.js": "~0.14.3"
       },
@@ -11710,6 +11711,24 @@
         "url": "https://github.com/sponsors/ljharb"
       }
     },
+    "node_modules/swiper": {
+      "version": "11.1.14",
+      "resolved": "https://registry.npmmirror.com/swiper/-/swiper-11.1.14.tgz",
+      "integrity": "sha512-VbQLQXC04io6AoAjIUWuZwW4MSYozkcP9KjLdrsG/00Q/yiwvhz9RQyt0nHXV10hi9NVnDNy1/wv7Dzq1lkOCQ==",
+      "funding": [
+        {
+          "type": "patreon",
+          "url": "https://www.patreon.com/swiperjs"
+        },
+        {
+          "type": "open_collective",
+          "url": "http://opencollective.com/swiper"
+        }
+      ],
+      "engines": {
+        "node": ">= 4.7.0"
+      }
+    },
     "node_modules/symbol-observable": {
       "version": "4.0.0",
       "resolved": "https://registry.npmmirror.com/symbol-observable/-/symbol-observable-4.0.0.tgz",

+ 1 - 0
package.json

@@ -24,6 +24,7 @@
     "@ionic/core": "^8.4.0",
     "parse": "^5.3.0",
     "rxjs": "~7.8.0",
+    "swiper": "^11.1.14",
     "tslib": "^2.3.0",
     "zone.js": "~0.14.3"
   },

BIN
projects/live-app/public/img/live.png


BIN
projects/live-app/public/img/more.png


BIN
projects/live-app/public/img/search.png


BIN
projects/live-app/public/img/我的.png


BIN
projects/live-app/public/img/排名.png


BIN
projects/live-app/public/img/消息.png


BIN
projects/live-app/public/img/首页.png


+ 7 - 1
projects/live-app/src/app/app.routes.ts

@@ -1,11 +1,17 @@
 import { Routes,mapToCanActivate } from '@angular/router';
+import { TabsComponent } from '../moduls/home/tabs/tabs.component';
 import { AuthGuard } from '../services/auth.guard';
 
 export const routes: Routes = [
   { path: '', redirectTo:'login', pathMatch: "full",}, // 默认跳转到 ''
   {
     path: 'login',
-    // canActivate: mapToCanActivate([superAuthGuard]),
     loadComponent:()=> import('../moduls/login/login.component').then((mod) => mod.LoginComponent),
   },
+  {
+    path: 'tabs', //教材评审组成员
+    component: TabsComponent,
+    canActivate: mapToCanActivate([AuthGuard]),
+    loadChildren: () =>import('../moduls/home/home.module').then((mod) => mod.HomeRoutingModule),
+  },
 ];

+ 1 - 1
projects/live-app/src/app/components/totas/totas.component.ts

@@ -16,10 +16,10 @@ export class TotasComponent implements OnInit {
   @Input('duration') duration:number = 1500//通知内容
   
   openTotas(message:string,type?:string,duration?:number){
+    this.isToastOpen = false
     this.message = message
     this.type = type || 'undefined'
     this.duration = duration || 1500
-    this.isToastOpen = false
     this.isToastOpen = true
   }
   closeTotas(){

+ 2 - 0
projects/live-app/src/index.html

@@ -6,6 +6,8 @@
   <base href="/">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="icon" type="image/x-icon" href="favicon.ico">
+  <script type="module" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>
+  <script nomodule src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script>
 </head>
 <body>
   <app-root></app-root>

+ 2 - 1
projects/live-app/src/main.ts

@@ -1,6 +1,7 @@
 import { bootstrapApplication } from '@angular/platform-browser';
 import { appConfig } from './app/app.config';
 import { AppComponent } from './app/app.component';
-
+import { register as registerSwiperElements } from 'swiper/element/bundle';
+registerSwiperElements()
 bootstrapApplication(AppComponent, appConfig)
   .catch((err) => console.error(err));

+ 10 - 1
projects/live-app/src/moduls/home/home.module.ts

@@ -1,7 +1,16 @@
 import { NgModule } from '@angular/core';
 import { RouterModule, Routes } from '@angular/router';
+import { HomeComponent } from './home/home.component';
 const routes: Routes = [
-
+  {
+    path: '',
+    redirectTo:'home',
+    pathMatch: "full",
+  },
+  {
+    path: 'home', //首页
+    component: HomeComponent,
+  },
 ]
 @NgModule({
   imports: [RouterModule.forChild(routes)],

+ 53 - 0
projects/live-app/src/moduls/home/home/home.component.html

@@ -0,0 +1,53 @@
+<ion-content class="content">
+  <div class="header">
+    <div class="top">
+      <ion-segment
+        [scrollable]="true"
+        (ionChange)="segmentChanged($event)"
+        layout="icon-bottom"
+        value="recommend"
+        mode="md"
+      >
+        <ion-segment-button value="recommend" class="tabs">
+          <ion-label>关注</ion-label>
+        </ion-segment-button>
+        <ion-segment-button value="store" class="tabs">
+          <ion-label>推荐</ion-label>
+        </ion-segment-button>
+        <ion-segment-button value="device" class="tabs">
+          <ion-label>新人</ion-label>
+        </ion-segment-button>
+        <ion-segment-button value="star3" class="tabs">
+          <ion-label>三星</ion-label>
+        </ion-segment-button>
+        <ion-segment-button value="star4" class="tabs">
+          <ion-label>三星</ion-label>
+        </ion-segment-button>
+        <ion-segment-button value="star6" class="tabs">
+          <ion-label>三星</ion-label>
+        </ion-segment-button>
+      </ion-segment>
+      <div class="more">
+        <img src="/img/more.png" alt="" />
+        <img src="/img/search.png" alt="" />
+      </div>
+    </div>
+  </div>
+  <div class="banner">
+    <!-- <swiper-container (swiper)="onSwiper($event)" class="swiper" [delay]="1000" [speed]="500" [loop]="true">
+      @for (item of banner; track $index) {
+      <swiper-slide>
+        <img [src]="item?.get('image')" alt="" />
+      </swiper-slide>
+      }
+    </swiper-container> -->
+    <div class="swiper mySwiper">
+      <div class="swiper-wrapper">
+        @for (item of banner; track $index) {
+        <div class="swiper-slide"> <img [src]="item?.get('image')" alt="" /></div>
+        }
+      </div>
+      <div class="swiper-pagination"></div>
+    </div>
+  </div>
+</ion-content>

+ 67 - 0
projects/live-app/src/moduls/home/home/home.component.scss

@@ -0,0 +1,67 @@
+.content {
+  .header {
+    padding: 10px;
+    background: #fd6f6a;
+    height: 150px;
+    border-radius: 0 0 50px 50px;
+    .top {
+      display: flex;
+      .search {
+        --background: #353c4d;
+        --cancel-button-color: #cccccc;
+        --color: #cccccc;
+      }
+      ion-segment {
+        justify-content: start;
+        padding: 0 3.2vw;
+        position: sticky;
+        top: 0;
+        background: #fd6f6a;
+      }
+      ion-segment-button {
+        color: white;
+        --indicator-color: white;
+      }
+      .more {
+        width: 100px;
+        margin: 0 10px;
+        display: flex;
+        align-items: center;
+        justify-content: space-around;
+        img {
+          width: 20px;
+          height: 20px;
+        }
+      }
+    }
+  }
+  .banner {
+    height: 160px;
+    width: calc(100% - 20px);
+    padding: 10px;
+    margin-top: -100px;
+    img {
+      width: 100%;
+      height: 150px;
+      object-fit: cover;
+    }
+  }
+}
+.swiper {
+  width: 100%;
+  height: 160px;
+  .swiper-slide {
+    text-align: center;
+    font-size: 18px;
+    background: #fff;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    img {
+      display: block;
+      width: 100%;
+      height: 100%;
+      object-fit: cover;
+    }
+  }
+}

+ 28 - 0
projects/live-app/src/moduls/home/home/home.component.spec.ts

@@ -0,0 +1,28 @@
+/* tslint:disable:no-unused-variable */
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { By } from '@angular/platform-browser';
+import { DebugElement } from '@angular/core';
+
+import { HomeComponent } from './home.component';
+
+describe('HomeComponent', () => {
+  let component: HomeComponent;
+  let fixture: ComponentFixture<HomeComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ HomeComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(HomeComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 61 - 0
projects/live-app/src/moduls/home/home/home.component.ts

@@ -0,0 +1,61 @@
+import { Component, CUSTOM_ELEMENTS_SCHEMA, OnInit } from '@angular/core';
+import * as Parse from 'parse';
+import { IonicModule } from '@ionic/angular';
+import { Router } from '@angular/router';
+import { AuthService } from '../../../services/auth.service';
+import { Swiper } from 'swiper';
+
+@Component({
+  selector: 'app-home',
+  templateUrl: './home.component.html',
+  styleUrls: ['./home.component.scss'],
+  standalone: true,
+  imports: [IonicModule],
+  // schemas: [CUSTOM_ELEMENTS_SCHEMA],
+})
+export class HomeComponent implements OnInit {
+  active: String = 'recommend';
+  banner: Array<Parse.Object> = [];
+  pageSwiper: Swiper | undefined | any;
+
+  constructor(private router: Router, public authServ: AuthService) {}
+
+  ngOnInit() {
+    this.refresh();
+  }
+  async refresh() {
+    let query = new Parse.Query('Banner');
+    query.equalTo('company', this.authServ.company);
+    query.descending('index');
+    query.equalTo('isEnabled', true);
+    let banner = await query.find();
+    this.banner = banner;
+    setTimeout(() => {
+      this.initSwiperTimeEvent()
+    }, 0);
+  }
+  initSwiperTimeEvent() {
+    // 初始化轮播图
+   let swiper = new Swiper(".mySwiper", {
+      loop: true, // 循环模式选项
+      observer: false,//修改swiper自己或子元素时,自动初始化swiper
+      observeParents: true,//修改swiper的父元素时,自动初始化swiper
+      autoplay:{ 
+        delay:1500,
+      }, 
+      pagination: {
+        el: ".swiper-pagination",
+      },
+    });
+    swiper.on('slideChange', function (event:any) {
+      console.log(event);
+    });
+  }
+  segmentChanged(e: any) {
+    let { value } = e.detail;
+    this.active = value;
+  }
+  toSearchb() {
+    this.router.navigate(['metapunk/searchbar']);
+  }
+}

+ 46 - 0
projects/live-app/src/moduls/home/tabs/tabs.component.html

@@ -0,0 +1,46 @@
+<div class="tabs">
+  @for (item of option; track $index) {
+  <div
+    class="buttom {{ $index == 2 ? 'center' : '' }}"
+    (click)="goTabPage($index, item.url)"
+  >
+    <img
+      class="icon-img {{ $index == 2 ? 'box-icon' : '' }}"
+      src="{{ $index == active ? item.active : item.src }}"
+      alt=""
+    />
+    <ion-label [style.color]="active == $index ? '#FD7884' : '#808080'">{{
+      item.name
+    }}</ion-label>
+  </div>
+  }
+</div>
+
+<ion-tabs>
+  <ion-tab-bar style="height: 0vw" slot="bottom">
+    <ion-tab-button tab="home">
+      <ion-icon name="home-outline"></ion-icon>
+      <ion-label>首页</ion-label>
+    </ion-tab-button>
+
+    <ion-tab-button tab="center">
+      <ion-icon name="ban-outline"></ion-icon>
+      <ion-label>消息</ion-label>
+    </ion-tab-button>
+
+    <ion-tab-button tab="center">
+      <ion-icon name="ban-outline"></ion-icon>
+      <ion-label>直播</ion-label>
+    </ion-tab-button>
+
+    <ion-tab-button tab="center">
+      <ion-icon name="ban-outline"></ion-icon>
+      <ion-label>排名</ion-label>
+    </ion-tab-button>
+
+    <ion-tab-button tab="my">
+      <ion-icon name="person"></ion-icon>
+      <ion-label>我的</ion-label>
+    </ion-tab-button>
+  </ion-tab-bar>
+</ion-tabs>

+ 43 - 0
projects/live-app/src/moduls/home/tabs/tabs.component.scss

@@ -0,0 +1,43 @@
+.tabs {
+  position:fixed;
+  width:100%;
+  bottom:0vw;
+  z-index:100;
+
+  display         : flex;
+  justify-content : space-evenly;
+  height          : 13.3333vw;
+  background-color: #fff;
+  color           : #808080;
+  box-shadow: rgba(17, 17, 26, 0.1) 0px -1px 0px;
+  border-radius: 10px 10px 0 0;
+  .buttom {
+    display        : flex;
+    flex-direction : column;
+    align-items    : center;
+    justify-content: space-evenly;
+    font-size      : 3.2vw;
+    font-family    : Source Han Sans CN;
+    font-weight    : 400;
+
+    .icon-img {
+      width : 5.3333vw;
+      height: 5.3333vw;
+    }
+  }
+
+  .center {
+    margin-top: -10.6667vw;
+    z-index   : 99;
+    // img{
+    //   width: 60px;
+    //   height: 52px;
+    // }
+    .box-icon {
+      width : 16vw !important;
+      height: 16vw !important;
+      border-radius: 50%;
+      box-shadow: 0 1.3333vw 4vw -1.3333vw rgb(251 251 251 / 50%);
+    }
+  }
+}

+ 28 - 0
projects/live-app/src/moduls/home/tabs/tabs.component.spec.ts

@@ -0,0 +1,28 @@
+/* tslint:disable:no-unused-variable */
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { By } from '@angular/platform-browser';
+import { DebugElement } from '@angular/core';
+
+import { TabsComponent } from './tabs.component';
+
+describe('TabsComponent', () => {
+  let component: TabsComponent;
+  let fixture: ComponentFixture<TabsComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ TabsComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(TabsComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 136 - 0
projects/live-app/src/moduls/home/tabs/tabs.component.ts

@@ -0,0 +1,136 @@
+import { Component, ViewChild, Input } from '@angular/core';
+import { ChangeDetectorRef } from '@angular/core';
+import { Router, RouterOutlet } from '@angular/router';
+import * as Parse from 'parse';
+import { IonicModule } from '@ionic/angular';
+
+// 全局消息服务和JIM插件
+import { OnInit } from '@angular/core';
+// import { MessageService } from './chat/message.service';
+import { AlertController } from '@ionic/angular';
+
+@Component({
+  selector: 'live-tabs',
+  templateUrl: 'tabs.component.html',
+  styleUrls: ['tabs.component.scss'],
+  standalone: true,
+  imports: [RouterOutlet, IonicModule],
+})
+export class TabsComponent implements OnInit {
+  @Input('tabsOption') tabsOption: any = {};
+  // @ViewChild('tabs',{static:true}) tabs;
+  constructor(
+    private router: Router,
+    private CDR: ChangeDetectorRef,
+    public alertController: AlertController
+  ) {}
+
+  option: any = [
+    {
+      src: '/img/首页.png',
+      active: '/img/首页.png',
+      url: 'tabs/home',
+      name: '首页',
+    },
+    {
+      src: '/img/消息.png',
+      active: '/img/消息.png',
+      url: 'tabs/home',
+      name: '消息',
+    },
+    {
+      src: '/img/live.png',
+      active: '/img/live.png',
+      url: 'tabs/home',
+      name: '直播',
+    },
+    {
+      src: '/img/排名.png',
+      active: '/img/排名.png',
+      url: 'tabs/center',
+      name: '排名',
+    },
+    {
+      src: '/img/我的.png',
+      active: '/img/我的.png',
+      url: 'tabs/my',
+      name: '我的',
+    },
+  ];
+  show: any;
+  active: number = 0;
+
+  public ngOnInit() {
+    this.presentAlert();
+  }
+
+  async presentAlert() {
+    let profile = localStorage.getItem('profile');
+    if (profile) {
+      return;
+    }
+    let uid = Parse.User.current() && Parse.User.current()?.id;
+    let query = new Parse.Query('Profile');
+    query.equalTo('user', uid);
+    query.equalTo('isCross', true);
+    let res = await query.first();
+    if (res && res.id) {
+      localStorage.setItem('profile', res.id);
+      return;
+    }
+    // const alert = await this.alertController.create({
+    //   cssClass: 'my-custom-class',
+    //   header: '实名认证',
+    //   message: '根据相关法律法规要求,请先完成实名!',
+    //   buttons: [
+    //     {
+    //       text: '取消',
+    //       role: 'cancel',
+    //       cssClass: 'secondary',
+    //       handler: (blah) => {
+    //         console.log('Confirm Cancel: blah');
+    //       },
+    //     },
+    //     {
+    //       text: '去认证',
+    //       handler: () => {
+    //         this.router.navigate(['real']);
+    //       },
+    //     },
+    //   ],
+    // });
+    // await alert.present();
+  }
+
+  allowNavi: boolean = true;
+  goTabPage(index: number, route: string) {
+    if (this.allowNavi == false) {
+      return;
+    }
+    this.active = index;
+    if (('temp' + route).indexOf('http') > 0) {
+      window.location.href = route;
+      console.log('temp' + route);
+    } else {
+      let r = route;
+      let params: any = {};
+      if (r.split(';').length > 1) {
+        // 若存在;参数,则拼接参数对象params
+        for (let index = 1; index < r.split(';').length; index++) {
+          let key = r.split(';')[index].split('=')[0];
+          let val = r.split(';')[index].split('=')[1];
+          params[key] = val;
+        }
+        // 此时路由为数组第一个
+        route = r.split(';')[0];
+      }
+      console.log(route);
+
+      this.router.navigate([route, params]);
+    }
+    this.allowNavi = false;
+    setTimeout(() => {
+      this.allowNavi = true;
+    }, 1000);
+  }
+}

+ 0 - 22
projects/live-app/src/moduls/login/login.component.ts

@@ -133,7 +133,6 @@ export class LoginComponent implements OnInit {
     if (!String(mobile).match(a)) {
       const toast = await this.toastController.create({
         message: "请填写正确手机号",
-        color: "danger",
         duration: 1000,
       });
       toast.present();
@@ -149,7 +148,6 @@ export class LoginComponent implements OnInit {
         this.totas?.openTotas('用户手机号不存在,请先注册','warning')
         // const toast = await this.toastController.create({
         //   message: "用户手机号不存在,请先注册",
-        //   color: "danger",
         //   duration: 1000,
         // });
         // toast.present();
@@ -192,7 +190,6 @@ export class LoginComponent implements OnInit {
     if (!String(this.loginInfo.mobile).match(a)) {
       const toast = await this.toastController.create({
         message: "请填写正确手机号",
-        color: "danger",
         duration: 1000,
       });
       toast.present();
@@ -202,7 +199,6 @@ export class LoginComponent implements OnInit {
       if (this.loginInfo.password == '' || this.loginInfo.password.trim == '') {
         const toast = await this.toastController.create({
           message: "请填密码",
-          color: "danger",
           duration: 1000,
         });
         toast.present();
@@ -213,7 +209,6 @@ export class LoginComponent implements OnInit {
       }).catch(async err=>{
         const toast = await this.toastController.create({
           message: err,
-          color: "danger",
           duration: 1000,
         });
         toast.present();
@@ -222,7 +217,6 @@ export class LoginComponent implements OnInit {
       if (!this.loginInfo.code) {
         const toast = await this.toastController.create({
           message: "请填写有效验证码",
-          color: "danger",
           duration: 1000,
         });
         toast.present();
@@ -233,7 +227,6 @@ export class LoginComponent implements OnInit {
       }).catch(async err=>{
         const toast = await this.toastController.create({
           message: err,
-          color: "danger",
           duration: 1000,
         });
         toast.present();
@@ -265,7 +258,6 @@ export class LoginComponent implements OnInit {
     if (!String(this.reset.mobile).match(a)) {
       const toast = await this.toastController.create({
         message: "请填写正确手机号",
-        color: "danger",
         duration: 1000,
       });
       toast.present();
@@ -274,7 +266,6 @@ export class LoginComponent implements OnInit {
     if (this.reset.code == undefined || this.reset.code == '') {
       const toast = await this.toastController.create({
         message: "请输入验证码",
-        color: "danger",
         duration: 1000,
       });
       toast.present();
@@ -283,7 +274,6 @@ export class LoginComponent implements OnInit {
     if (this.reset.password == undefined || this.reset.password.trim() == "") {
       const toast = await this.toastController.create({
         message: "请输入密码",
-        color: "danger",
         duration: 1000,
       });
       toast.present();
@@ -292,7 +282,6 @@ export class LoginComponent implements OnInit {
     if (this.reset.password.length < 6 || this.reset.password.length.length > 20) {
       const toast = await this.toastController.create({
         message: "密码长度不得小于6位或大于20位",
-        color: "danger",
         duration: 1000,
       });
       toast.present();
@@ -301,7 +290,6 @@ export class LoginComponent implements OnInit {
     if (this.reset.confirmPassword == undefined || this.reset.confirmPassword.trim() == "") {
       const toast = await this.toastController.create({
         message: "请确认密码",
-        color: "danger",
         duration: 1000,
       });
       toast.present();
@@ -310,7 +298,6 @@ export class LoginComponent implements OnInit {
     if (this.reset.password.trim() != this.reset.confirmPassword.trim()) {
       const toast = await this.toastController.create({
         message: "两次输入密码不一致",
-        color: "danger",
         duration: 1000,
       });
       toast.present();
@@ -329,7 +316,6 @@ export class LoginComponent implements OnInit {
         catchError(async (e) => { // 显示报错
           const toast = await this.toastController.create({
             message: e.message,
-            color: "danger",
             duration: 1000,
           });
           toast.present();
@@ -348,7 +334,6 @@ export class LoginComponent implements OnInit {
         } else {
           const toast = await this.toastController.create({ // 接口返回的错误,提示用户
             message: res.mess,
-            color: "danger",
             duration: 1000,
           });
           toast.present();
@@ -393,7 +378,6 @@ export class LoginComponent implements OnInit {
     if (this.registerInfo.code == undefined || this.registerInfo.code == '') {
       const toast = await this.toastController.create({
         message: "请输入验证码",
-        color: "danger",
         duration: 1000,
       });
       toast.present();
@@ -402,7 +386,6 @@ export class LoginComponent implements OnInit {
     if (this.registerInfo.password == undefined || this.registerInfo.password.trim() == "") {
       const toast = await this.toastController.create({
         message: "请输入密码",
-        color: "danger",
         duration: 1000,
       });
       toast.present();
@@ -411,7 +394,6 @@ export class LoginComponent implements OnInit {
     if (this.registerInfo.password.length < 6 || this.registerInfo.password.length.length > 20) {
       const toast = await this.toastController.create({
         message: "密码长度不得小于6位或大于20位",
-        color: "danger",
         duration: 1000,
       });
       toast.present();
@@ -420,7 +402,6 @@ export class LoginComponent implements OnInit {
     if (this.registerInfo.confirmPassword == undefined || this.registerInfo.confirmPassword.trim() == "") {
       const toast = await this.toastController.create({
         message: "请确认密码",
-        color: "danger",
         duration: 1000,
       });
       toast.present();
@@ -429,7 +410,6 @@ export class LoginComponent implements OnInit {
     if (this.registerInfo.password.trim() != this.registerInfo.confirmPassword.trim()) {
       const toast = await this.toastController.create({
         message: "两次输入密码不一致",
-        color: "danger",
         duration: 1000,
       });
       toast.present();
@@ -478,7 +458,6 @@ export class LoginComponent implements OnInit {
         catchError(async (e) => { // 显示报错
           const toast = await this.toastController.create({
             message: e.message,
-            color: "danger",
             duration: 1000,
           });
           toast.present();
@@ -505,7 +484,6 @@ export class LoginComponent implements OnInit {
         } else {
           const toast = await this.toastController.create({ // 接口返回的错误,提示用户
             message: res.mess,
-            color: "danger",
             duration: 1000,
           });
           toast.present();

+ 6 - 5
projects/live-app/src/services/auth.service.ts

@@ -9,7 +9,7 @@ import { Router } from '@angular/router';
 export class AuthService {
   isLoggedIn = false;
   company:string = localStorage.getItem('company') || 'Qje9D4bqol'
-  redirectUrl: string = 'home';
+  redirectUrl: string = 'tabs';
   constructor(private router: Router) {}
   authMobile(
     mobile: string,
@@ -29,12 +29,13 @@ export class AuthService {
       })
         .then((authData) => {
           console.log(authData);
-          if (authData && authData.id) {
-            let sessionToken = authData.get('sessionToken');
-            Parse.User.become(sessionToken)
+          if (authData) {
+            // let sessionToken = authData.get('sessionToken');
+            Parse.User.become(authData)
               .then(async (data) => {
                 console.log(data);
-                this.redirectUrl = this.redirectUrl ? this.redirectUrl : 'home';
+                this.redirectUrl = this.redirectUrl ? this.redirectUrl : 'tabs';
+                this.router.navigate([this.redirectUrl])
                 resolve(data);
               })
               .catch((err) => {

+ 3 - 0
projects/live-app/src/styles.scss

@@ -1,4 +1,7 @@
 /* You can add global styles to this file, and also import other style files */
+@import 'swiper/scss';
+@import 'swiper/scss/navigation';
+@import 'swiper/scss/pagination';
 *{
   margin: 0;
 }