Browse Source

增加评价组件

warrior 2 weeks ago
parent
commit
8147703ebd

+ 21 - 0
projects/live-app/src/app/components/appraise/appraise.component.html

@@ -0,0 +1,21 @@
+<ion-modal
+  #modal
+  trigger="open-modal"
+  [isOpen]="liveService.isOpenEvaluate"
+  (didDismiss)="liveService.isOpenEvaluate = false"
+  [backdropDismiss]="false"
+>
+  <ng-template>
+    <ion-toolbar>
+      <ion-buttons slot="start">
+        <ion-button (click)="liveService.isOpenEvaluate = false">取消</ion-button>
+      </ion-buttons>
+      <ion-buttons slot="end">
+        <ion-button (click)="confirm()">确认</ion-button>
+      </ion-buttons>
+    </ion-toolbar>
+    <div class="wrapper">
+     
+    </div>
+  </ng-template>
+</ion-modal>

+ 7 - 0
projects/live-app/src/app/components/appraise/appraise.component.scss

@@ -0,0 +1,7 @@
+ion-modal {
+  --height: 50%;
+  --width: 89.7436vw;
+  --border-radius: 4.1026vw;
+  --box-shadow: 0 2.5641vw 3.8462vw -0.7692vw rgb(0 0 0 / 0.1),
+    0 1.0256vw 1.5385vw -1.0256vw rgb(0 0 0 / 0.1);
+}

+ 28 - 0
projects/live-app/src/app/components/appraise/appraise.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 { AppraiseComponent } from './appraise.component';
+
+describe('AppraiseComponent', () => {
+  let component: AppraiseComponent;
+  let fixture: ComponentFixture<AppraiseComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ AppraiseComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(AppraiseComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 26 - 0
projects/live-app/src/app/components/appraise/appraise.component.ts

@@ -0,0 +1,26 @@
+import { Component, OnInit } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { ionicStandaloneModules } from '../../../modules/ionic-standalone.modules';
+import { LiveService } from '../../../services/live.service';
+
+@Component({
+  selector: 'app-appraise',
+  templateUrl: './appraise.component.html',
+  styleUrls: ['./appraise.component.scss'],
+  standalone: true,
+  imports: [
+    ...ionicStandaloneModules,
+    CommonModule,
+  ],
+})
+export class AppraiseComponent implements OnInit {
+  constructor(
+    public liveService: LiveService,
+  ) { }
+
+  ngOnInit() {
+  }
+  confirm(){
+    
+  }
+}

+ 3 - 3
projects/live-app/src/app/components/gift-modal/gift-modal.component.ts

@@ -73,7 +73,7 @@ export class GiftModalComponent implements OnInit {
   async ngOnInit() {
     this.giftList = this.msgSerrvice.giftList;
     setTimeout(() => {
-      this.selectTab('all');
+      this.selectTab('all',true);
     }, 200);
   }
   async openModal() {
@@ -81,8 +81,8 @@ export class GiftModalComponent implements OnInit {
     this.wallet = await this.aiServ.getWallet(uid);
     this.isOpenGift = true;
   }
-  async selectTab(val: string) {
-    if (this.activeTab === val) return;
+  async selectTab(val: string, force?:boolean) {
+    if (this.activeTab === val && !force) return;
     this.giftList = await this.aiServ.getGift(val == 'all' ? '' : val);
     this.activeTab = val;
     this.currentGift = null;

+ 13 - 13
projects/live-app/src/modules/tabs/anthorhome/anthorhome.component.ts

@@ -11,7 +11,7 @@ import {
   ToastController,
 } from '../../ionic-standalone.modules';
 import { CommonModule, DatePipe } from '@angular/common';
-import { province } from '../../../services/address';
+import { provinceMap } from '../../../services/address';
 import { FormsModule } from '@angular/forms';
 import { InfiniteScrollCustomEvent } from '@ionic/core';
 import { MessageService } from '../../../services/message.service';
@@ -73,17 +73,17 @@ export class AnthorhomeComponent implements OnInit {
     private msgSer: MessageService,
     private datePipe: DatePipe
   ) {
-    province.unshift({
-      provinceName: '全部',
-      citys: [
-        {
-          cityName: '',
-          cityType: '',
-        },
-      ],
-    });
-    this.provinceColumns = province.map((item) => item.provinceName);
-    this.cityColumns = province[0].citys.map((item) => item.cityName);
+    // province.unshift({
+    //   provinceName: '全部',
+    //   citys: [
+    //     {
+    //       cityName: '',
+    //       cityType: '',
+    //     },
+    //   ],
+    // });
+    this.provinceColumns = provinceMap.map((item) => item.provinceName);
+    this.cityColumns = provinceMap[0].citys.map((item) => item.cityName);
   }
 
   ngOnInit() {
@@ -224,7 +224,7 @@ export class AnthorhomeComponent implements OnInit {
     switch (type) {
       case 'province':
         this.province = event.detail.value;
-        this.cityColumns = province
+        this.cityColumns = provinceMap
           .find((item) => item.provinceName === val)
           ?.citys.map((item) => item.cityName)!;
         console.log(this.cityColumns);

+ 30 - 15
projects/live-app/src/modules/tabs/home/home.component.ts

@@ -10,7 +10,7 @@ import {
   LoadingController,
 } from '../../ionic-standalone.modules';
 import { CommonModule, DatePipe } from '@angular/common';
-import { province } from '../../../services/address';
+import { provinceMap } from '../../../services/address';
 import { FormsModule } from '@angular/forms';
 import { BackgroundColorService } from '../../../services/background-color.service';
 @Component({
@@ -18,7 +18,7 @@ import { BackgroundColorService } from '../../../services/background-color.servi
   templateUrl: './home.component.html',
   styleUrls: ['./home.component.scss'],
   standalone: true,
-  imports: [...ionicStandaloneModules, CommonModule,FormsModule],
+  imports: [...ionicStandaloneModules, CommonModule, FormsModule],
   providers: [DatePipe],
 })
 export class HomeComponent implements OnInit {
@@ -58,6 +58,11 @@ export class HomeComponent implements OnInit {
       value: '五星',
       icon: 'people-outline',
     },
+    {
+      label: '海外',
+      value: '海外',
+      icon: 'people-outline',
+    },
   ];
   currentValue: string = 'recommend';
   oldCurrentValue: string = 'recommend';
@@ -94,17 +99,17 @@ export class HomeComponent implements OnInit {
     private datePipe: DatePipe,
     private backgroundColorService: BackgroundColorService
   ) {
-    province.unshift({
-      provinceName: '全部',
-      citys: [
-        {
-          cityName: '',
-          cityType: '',
-        },
-      ],
-    });
-    this.provinceColumns = province.map((item) => item.provinceName);
-    this.cityColumns = province[0].citys.map((item) => item.cityName);
+    // province.unshift({
+    //   provinceName: '全部',
+    //   citys: [
+    //     {
+    //       cityName: '',
+    //       cityType: '',
+    //     },
+    //   ],
+    // });
+    this.provinceColumns = provinceMap.map((item) => item.provinceName);
+    this.cityColumns = provinceMap[0].citys.map((item) => item.cityName);
   }
 
   ngOnInit() {
@@ -190,7 +195,7 @@ export class HomeComponent implements OnInit {
     if (!this.connectTask.onlineUserList.size) {
       await this.connectTask.getOnlieUserList('user_connect_room');
     }
-    this.userList = Array.from(this.connectTask.onlineUserList)|| [];
+    this.userList = Array.from(this.connectTask.onlineUserList) || [];
     // console.log(userList);
     switch (type) {
       case 'follow':
@@ -246,6 +251,16 @@ export class HomeComponent implements OnInit {
           city: this.city,
         });
         break;
+      case '海外':
+        data = await this.aiServ.getRooms({
+          uid: uid,
+          // users: userList,
+          star: '海外',
+          sex,
+          city: this.city,
+        });
+        break;
+
       default:
         break;
     }
@@ -330,7 +345,7 @@ export class HomeComponent implements OnInit {
     switch (type) {
       case 'province':
         this.province = event.detail.value;
-        this.cityColumns = province
+        this.cityColumns = provinceMap
           .find((item) => item.provinceName === val)
           ?.citys.map((item) => item.cityName)!;
         console.log(this.cityColumns);

+ 4 - 0
projects/live-app/src/modules/tabs/my/my.component.html

@@ -98,6 +98,10 @@
     }
   </div>
   <div class="order" [style.background-image]="'url(img/用户榜底.png)'">
+    <div class="title">
+      <div class="link">排行榜</div>
+      <div class="link" (click)="toUrl('user/ranking')">更多</div>
+    </div>
     <div class="ladder">
       <div class="top-block">
         <div class="top2">

+ 6 - 0
projects/live-app/src/modules/tabs/my/my.component.scss

@@ -308,6 +308,12 @@
         }
       }
     }
+    .title{
+      display: flex;
+      justify-content: space-between;
+      color: #7d7d7d;
+      font-size: 14px;
+    }
   }
   .setting {
     width: 92.3077vw;

+ 1 - 1
projects/live-app/src/modules/tabs/tabs.modules.routes.ts

@@ -6,7 +6,7 @@ import { HomeComponent } from './home/home.component';
 import { LiveReviewComponent } from './live-review/live-review.component';
 import { MyComponent } from './my/my.component';
 import { NoticeComponent } from './notice/notice.component';
-import { RankingComponent } from './ranking/ranking.component';
+import { RankingComponent } from '../user/ranking/ranking.component';
 import { SpaceComponent } from './space/space.component';
 const routes: Routes = [
   {

+ 1 - 0
projects/live-app/src/modules/user/profile/profile.component.html

@@ -298,3 +298,4 @@
 @if(profile?.id){
 <app-call-modal #call [profile]="profile"></app-call-modal>
 }
+<app-appraise></app-appraise>

+ 4 - 2
projects/live-app/src/modules/user/profile/profile.component.ts

@@ -20,6 +20,7 @@ import {
 import { AccountService } from '../../../services/account.service';
 import { CallModalComponent } from '../../../app/components/call-modal/call-modal.component';
 import { AvatarComponent } from '../../../app/components/avatar/avatar.component';
+import { AppraiseComponent } from '../../../app/components/appraise/appraise.component';
 
 @Component({
   selector: 'app-profile',
@@ -36,7 +37,8 @@ import { AvatarComponent } from '../../../app/components/avatar/avatar.component
     UploadComponent,
     GiftModalComponent,
     CallModalComponent,
-    AvatarComponent
+    AvatarComponent,
+    AppraiseComponent
   ],
   providers: [DatePipe],
 })
@@ -301,7 +303,7 @@ export class ProfileComponent implements OnInit {
     profileRadar?.set('isDeleted', this.isFollow);
     await profileRadar?.save();
     this.isFollow = !this.isFollow;
-    this.isFollow ? (this.numsObject.fans += 1) : (this.numsObject.fans -= 1);
+    this.isFollow ? (this.numsObject.fans = Number(this.numsObject.fans) + 1) : (this.numsObject.fans = this.numsObject.fans - 1);
   }
   onShowImg(url: string) {
     this.currenImg = url;

+ 1 - 11
projects/live-app/src/modules/tabs/ranking/ranking.component.html → projects/live-app/src/modules/user/ranking/ranking.component.html

@@ -1,14 +1,4 @@
-<ion-header [translucent]="true" class="header">
-  <ion-toolbar class="toolbar">
-    <!-- <ion-buttons slot="start">
-      <ion-icon
-        name="chevron-back-outline"
-        style="width: 6.4vw; height: 6.4vw; color: #ffffff"
-      ></ion-icon>
-    </ion-buttons> -->
-    <ion-title class="title">排名</ion-title>
-  </ion-toolbar>
-</ion-header>
+<nav title="排名"></nav>
 <ion-content class="content"> 
   <div class="order" [style.background-image]="'url(img/用户榜底.png)'">
     <div class="ladder">

+ 0 - 0
projects/live-app/src/modules/tabs/ranking/ranking.component.scss → projects/live-app/src/modules/user/ranking/ranking.component.scss


+ 0 - 0
projects/live-app/src/modules/tabs/ranking/ranking.component.spec.ts → projects/live-app/src/modules/user/ranking/ranking.component.spec.ts


+ 2 - 1
projects/live-app/src/modules/tabs/ranking/ranking.component.ts → projects/live-app/src/modules/user/ranking/ranking.component.ts

@@ -1,6 +1,7 @@
 import { Component, OnInit } from '@angular/core';
 import { IonicModule } from '@ionic/angular';
 import * as Parse from 'parse';
+import { NavComponent } from '../../../app/components/nav/nav.component';
 import { AiChatService } from '../../../services/aichart.service';
 
 @Component({
@@ -8,7 +9,7 @@ import { AiChatService } from '../../../services/aichart.service';
   templateUrl: './ranking.component.html',
   styleUrls: ['./ranking.component.scss'],
   standalone: true,
-  imports: [IonicModule],
+  imports: [IonicModule,NavComponent],
 })
 export class RankingComponent implements OnInit {
   user?: Parse.Object = Parse.User.current();

+ 6 - 1
projects/live-app/src/modules/user/user.modules.routes.ts

@@ -11,6 +11,7 @@ import { SettingComponent } from './setting/setting.component';
 import { ShareComponent } from './share/share.component';
 import { CommentComponent } from './comment/comment.component';
 import { GiftIncomeComponent } from './gift-income/gift-income.component';
+import { RankingComponent } from './ranking/ranking.component';
 const routes: Routes = [
   {
     path: 'profile/:id',//主页
@@ -56,7 +57,11 @@ const routes: Routes = [
   {
     path:'income',
     component:GiftIncomeComponent
-  }
+  },
+  {
+    path: 'ranking', //排名
+    component: RankingComponent,
+  },
 ]
 @NgModule({
   imports: [RouterModule.forChild(routes)],

+ 12 - 1
projects/live-app/src/services/address.ts

@@ -2945,4 +2945,15 @@ export const province =  [
       ],
       "provinceName": "台湾"
     }
-  ]
+]
+let provinceAdd = [...province]
+provinceAdd.unshift({
+  provinceName: '全部',
+  citys: [
+    {
+      cityName: '',
+      cityType: '',
+    },
+  ],
+});
+export const provinceMap = provinceAdd

+ 10 - 4
projects/live-app/src/services/live.service.ts

@@ -56,6 +56,9 @@ export class LiveService {
   countdown: number = 0; // 新增倒计时变量
   timer_countdown: any;
   liveLog?: Parse.Object; //直播记录
+  
+  isOpenEvaluate:boolean = false; //是否开启评价
+
   constructor(
     private http: HttpService,
     private aiServ: AiChatService,
@@ -224,7 +227,8 @@ export class LiveService {
       await this.client.publish(Object.values(this.localTracks));
     } catch (err) {
       console.log('发布本地视频失败:', err);
-      this.alertTips('发布本地视频失败', '提示', () => history.back());
+      history.back()
+      this.alertTips('发布本地视频失败', '提示');
     }
   }
   /* 订阅远程视频 */
@@ -278,6 +282,7 @@ export class LiveService {
         // if (!this.isAnchor) {
           this.client.leave();
         // }
+        history.back()
         this.alertTips('对方已离开直播间');
       }
     });
@@ -395,8 +400,8 @@ export class LiveService {
     console.log(data);
     this.surplusNumber = data.data ?? 0;
     this.countdown = this.surplusNumber; // 初始化倒计时
-    let arr = ['RECONNECTING', 'DISCONNECTED', 'DISCONNECTING'];
-    if (!arr.includes(this.connection_state as any)) {
+    let arr = ['CONNECTING', 'CONNECTED'];
+    if (arr.includes(this.connection_state as any)) {
       if (this.countdown <= 120) {
         this.alertTips('剩余通话时间不足2分钟,请及时充值');
       }
@@ -411,6 +416,7 @@ export class LiveService {
         // console.log(this.countdown);
       } else {
         clearInterval(this.timer_countdown);
+        history.back()
         this.alertTips('通话时间结束');
         this.client.leave(); // 结束通话
       }
@@ -443,7 +449,7 @@ export class LiveService {
     this.timer = setTimeout(async() => {
       await this.get_duration();
       this.getCallDuration();
-    });
+    },10000);
   }
   /* 监听音视频设备插拔 */
   monitorDevices() {