warrior 1 mese fa
parent
commit
0c16ac95ba

+ 28 - 0
projects/live-app/src/modules/user/comment/comment.component.html

@@ -0,0 +1,28 @@
+<nav title="评价列表"></nav>
+<ion-content class="content">
+  <div class="comment-list">
+    @for (item of commentList; track $index) {
+    <div class="li">
+      <div class="li-user">
+        <img [src]="item?.get('user')?.get('avatar')" alt="" class="avatar" />
+        <div class="username">
+          {{ item?.get("user")?.get("nickname") }}
+        </div>
+        <div
+          class="level"
+          [style.background-color]="
+            aiChatServ.userLevelColor[item?.get('user').get('achievementCount')]
+              ?.color
+          "
+        >
+          LV{{ item?.get("user").get("achievementCount") }}
+        </div>
+      </div>
+      <div class="li-score">{{ item?.get("comment") }}</div>
+    </div>
+    }
+  </div>
+  <ion-infinite-scroll (ionInfinite)="onIonInfinite($event)">
+    <ion-infinite-scroll-content></ion-infinite-scroll-content>
+  </ion-infinite-scroll>
+</ion-content>

+ 47 - 0
projects/live-app/src/modules/user/comment/comment.component.scss

@@ -0,0 +1,47 @@
+.content {
+  // background-image: url("https://file-cloud.fmode.cn/Qje9D4bqol/20241220/b313ov054708770.png");
+  // background-repeat: no-repeat;
+  // background-position: center top;
+  // background-size: 100% 100%;
+  // height: 100%;
+  // padding-top: 2.5641vw;
+  // width: 100%;
+  // text-align: center;
+  // --background:#fff;
+  .comment-list {
+    // background-color: #47474726;
+    // border: 1px solid white;
+    // margin-top: 4px;
+    border-radius: 6px;
+    .li {
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      padding: 4px;
+      border-bottom: 1px solid #eee;
+      .li-user {
+        display: flex;
+        align-items: center;
+        .avatar {
+          width: 30px;
+          height: 30px;
+          margin-right: 4px;
+        }
+        .level {
+          margin-left: 1.5385vw;
+          text-align: center;
+          font-size: 3.0769vw;
+          border-radius: 5.1282vw;
+          padding: 0vw 1.5385vw;
+          color: #000;
+        }
+      }
+      .li-score{
+        font-size: 12px;
+        background-color: #c509ff;
+        padding: 2px 4px;
+        color: white;
+      }
+    }
+  }
+}

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

+ 64 - 0
projects/live-app/src/modules/user/comment/comment.component.ts

@@ -0,0 +1,64 @@
+import { Component, OnInit } from '@angular/core';
+import { ActivatedRoute } from '@angular/router';
+import {
+  ionicStandaloneModules,
+  LoadingController,
+} from '../../ionic-standalone.modules';
+import * as Parse from 'parse';
+import { AiChatService } from '../../../services/aichart.service';
+import { InfiniteScrollCustomEvent } from '@ionic/core';
+import { NavComponent } from '../../../app/components/nav/nav.component';
+
+@Component({
+  selector: 'app-comment',
+  templateUrl: './comment.component.html',
+  styleUrls: ['./comment.component.scss'],
+  standalone: true,
+  imports: [...ionicStandaloneModules, NavComponent],
+})
+export class CommentComponent implements OnInit {
+  rid: string = '';
+  commentList: Array<Parse.Object> = [];
+
+  constructor(
+    private activateRoute: ActivatedRoute,
+    private loadingCtrl: LoadingController,
+    public aiChatServ: AiChatService
+  ) {}
+
+  ngOnInit() {
+    this.activateRoute.paramMap.subscribe(async (params) => {
+      let rid = params.get('rid');
+      this.rid = rid;
+      this.getCommentLeng();
+    });
+  }
+
+  async getCommentLeng() {
+    const loading = await this.loadingCtrl.create({
+      message: '加载中',
+    });
+    loading.present();
+    let queryPost = new Parse.Query('DramaPostLog');
+    queryPost.equalTo('room', this.rid);
+    queryPost.notEqualTo('isDeleted', true);
+    queryPost.include('user');
+    queryPost.descending('createdAt');
+    queryPost.equalTo('isVerify', true);
+    queryPost.limit(20);
+    queryPost.skip(this.commentList.length);
+    let r = await queryPost.find();
+    this.commentList.push(...r);
+    loading.dismiss();
+    return r;
+  }
+  async onIonInfinite(ev: any) {
+    let result = await this.getCommentLeng();
+    if (result.length == 0) {
+      (ev as InfiniteScrollCustomEvent).target.disabled = true;
+    }
+    setTimeout(() => {
+      (ev as InfiniteScrollCustomEvent).target.complete();
+    }, 500);
+  }
+}

+ 45 - 0
projects/live-app/src/modules/user/gift-income/gift-income.component.html

@@ -0,0 +1,45 @@
+<nav title="礼物打赏记录"></nav>
+<ion-content class="content">
+  <div class="comment-list">
+    @for (item of giftList; track $index) {
+    <div class="li">
+      <div class="li-user">
+        <img
+          [src]="item?.get('fromUser')?.get('avatar')"
+          alt=""
+          class="avatar"
+        />
+      </div>
+      <div class="li-right">
+        <div class="li-row">
+          <div class="nickname">
+            {{ item?.get("fromUser")?.get("nickname") }}
+            <div
+              class="level"
+              [style.background-color]="
+                aiChatServ.userLevelColor[
+                  item?.get('fromUser').get('achievementCount')
+                ]?.color
+              "
+            >
+              LV{{ item?.get("fromUser").get("achievementCount") }}
+            </div>
+          </div>
+          <div class="gift">
+            <img [src]="item?.get('image')" alt="" />x{{ item?.get("index") }}
+          </div>
+        </div>
+        <div class="li-row">
+          <div class="time">
+            {{ item.createdAt | date : "yyyy-MM-dd HH:ss" }}
+          </div>
+          <div class="credit">钻石:<span style="color: red;">{{ item?.get("gold") }}</span></div>
+        </div>
+      </div>
+    </div>
+    }
+  </div>
+  <ion-infinite-scroll (ionInfinite)="onIonInfinite($event)">
+    <ion-infinite-scroll-content></ion-infinite-scroll-content>
+  </ion-infinite-scroll>
+</ion-content>

+ 71 - 0
projects/live-app/src/modules/user/gift-income/gift-income.component.scss

@@ -0,0 +1,71 @@
+.content {
+  // background-image: url("https://file-cloud.fmode.cn/Qje9D4bqol/20241220/b313ov054708770.png");
+  // background-repeat: no-repeat;
+  // background-position: center top;
+  // background-size: 100% 100%;
+  // height: 100%;
+  // padding-top: 2.5641vw;
+  // width: 100%;
+  // text-align: center;
+  // --background:#fff;
+  .comment-list {
+    // background-color: #47474726;
+    // border: 1px solid white;
+    // margin-top: 4px;
+    border-radius: 6px;
+    .li {
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      padding: 4px;
+      border-bottom: 1px solid #eee;
+      .li-user {
+        flex-shrink: 0;
+        margin-right: 4px;
+        .avatar {
+          width: 30px;
+          height: 30px;
+          margin-right: 4px;
+        }
+      }
+      .li-right {
+        flex: 1;
+        .li-row{
+          display: flex;
+          justify-content: space-between;
+          .nickname{
+            font-size: 14px;
+            display: flex;
+            align-items: center;
+          }
+          .level {
+            margin-left: 1.5385vw;
+            text-align: center;
+            font-size: 3.0769vw;
+            border-radius: 5.1282vw;
+            padding: 0vw 1.5385vw;
+            color: #000;
+          }
+          .gift {
+            display: flex;
+            align-items: center;
+            img{
+              width: 30px;
+              height: 30px;
+            }
+          }
+          .time {
+            font-size: 14px;
+            color: #676767;
+            margin-top: 1.0256vw;
+          }
+          .credit{
+            color: #676767;
+            font-size: 14px;
+          }
+        }
+
+      }
+    }
+  }
+}

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

+ 65 - 0
projects/live-app/src/modules/user/gift-income/gift-income.component.ts

@@ -0,0 +1,65 @@
+import { Component, OnInit } from '@angular/core';
+import { ActivatedRoute } from '@angular/router';
+import {
+  ionicStandaloneModules,
+  LoadingController,
+} from '../../ionic-standalone.modules';
+import * as Parse from 'parse';
+import { AiChatService } from '../../../services/aichart.service';
+import { InfiniteScrollCustomEvent } from '@ionic/core';
+import { NavComponent } from '../../../app/components/nav/nav.component';
+import { CommonModule, DatePipe } from '@angular/common';
+
+@Component({
+  selector: 'app-gift-income',
+  templateUrl: './gift-income.component.html',
+  styleUrls: ['./gift-income.component.scss'],
+  standalone: true,
+  imports: [...ionicStandaloneModules, NavComponent,CommonModule],
+  providers: [DatePipe],
+})
+export class GiftIncomeComponent implements OnInit {
+  uid: string = '';
+  giftList: Array<Parse.Object> = [];
+
+  constructor(
+    private activateRoute: ActivatedRoute,
+    private loadingCtrl: LoadingController,
+    public aiChatServ: AiChatService
+  ) {}
+
+  ngOnInit() {
+    this.activateRoute.paramMap.subscribe(async (params) => {
+      let uid = params.get('uid');
+      this.uid = uid;
+      this.getCommentLeng();
+    });
+  }
+
+  async getCommentLeng() {
+    const loading = await this.loadingCtrl.create({
+      message: '加载中',
+    });
+    loading.present();
+    let queryPost = new Parse.Query('LoveRender');
+    queryPost.equalTo('toUser', this.uid);
+    queryPost.notEqualTo('isDeleted', true);
+    queryPost.include('fromUser');
+    queryPost.descending('createdAt');
+    queryPost.limit(20);
+    queryPost.skip(this.giftList.length);
+    let r = await queryPost.find();
+    this.giftList.push(...r);
+    loading.dismiss();
+    return r;
+  }
+  async onIonInfinite(ev: any) {
+    let result = await this.getCommentLeng();
+    if (result.length == 0) {
+      (ev as InfiniteScrollCustomEvent).target.disabled = true;
+    }
+    setTimeout(() => {
+      (ev as InfiniteScrollCustomEvent).target.complete();
+    }, 500);
+  }
+}

+ 82 - 37
projects/live-app/src/modules/user/profile/profile.component.html

@@ -41,7 +41,12 @@
             }@else {
             <!-- <div class="sex">未知</div> -->
             }
-            <div [ngClass]="{ gril: profile?.get('user')?.get('sex') == '女', age: true }">
+            <div
+              [ngClass]="{
+                gril: profile?.get('user')?.get('sex') == '女',
+                age: true
+              }"
+            >
               <img
                 src="https://file-cloud.fmode.cn/Qje9D4bqol/20241109/pctmvt110807052.png"
                 alt=""
@@ -51,7 +56,7 @@
           </div>
         </div>
         <div class="user-status">
-          <span class="id">爱聊ID:{{ profile?.get('user')?.id }}</span>
+          <span class="id">爱聊ID:{{ profile?.get("user")?.id }}</span>
           <!-- @if (profile?.get('isCheck')) {
           <div class="state">
             <span class="spot"></span>
@@ -69,24 +74,28 @@
           </div>
           } -->
           @if (profile?.get('identyType') == 'anchor') {
-            <div
-              class="level"
-              [style.background-color]="
-                aiChatServ.authorLevelColor[profile?.get('user').get('completionRate')]?.color
-              "
-            >
-              LV{{ profile?.get('user').get("completionRate") }}
-            </div>
-            }@else {
-            <div
-              class="level"
-              [style.background-color]="
-                aiChatServ.userLevelColor[profile?.get('user').get('achievementCount')]?.color
-              "
-            >
-              LV{{ profile?.get('user').get("achievementCount") }}
-            </div>
-            }
+          <div
+            class="level"
+            [style.background-color]="
+              aiChatServ.authorLevelColor[
+                profile?.get('user').get('completionRate')
+              ]?.color
+            "
+          >
+            LV{{ profile?.get("user").get("completionRate") }}
+          </div>
+          }@else {
+          <div
+            class="level"
+            [style.background-color]="
+              aiChatServ.userLevelColor[
+                profile?.get('user').get('achievementCount')
+              ]?.color
+            "
+          >
+            LV{{ profile?.get("user").get("achievementCount") }}
+          </div>
+          }
         </div>
       </div>
       <div class="user-right">
@@ -139,29 +148,65 @@
         }
       </div>
     </div>
+    @if (profile?.get('identyType') == 'anchor') {
     <div class="data-row">
-      <div class="title-text">对ta的评价</div>
-      <!-- <div class="tags">
-        <span class="label assess">漂亮小姐姐</span>
-        <span class="label assess">颜值主播</span>
-        <span class="label assess">唱歌好听</span>
-        <span class="label assess">萝莉控</span>
-        <span class="label assess">声优</span>
-        <span class="label assess">喜欢日漫</span>
-        <span class="label assess">都喜欢</span>
-      </div> -->
+      <!-- <div class="title-text">对ta的评价</div> -->
       <div class="comment-room">
-        <div class="comment-title">
-          <div class="li">用户评价({{commentObj.count}})</div>
-          <div class="li">分数({{commentObj.score || '暂无评价'}})</div>
+        <div class="title-text comment-title">
+          <div class="coulum">
+            对ta的评价({{
+              commentObj.score ? commentObj.score + "分" : "暂无评价"
+            }})
+          </div>
+          <div class="coulum" (click)="tourl('/user/comment',{rid: this.room?.id})">
+            {{ commentObj.count }}条<ion-icon
+              name="chevron-forward-outline"
+            ></ion-icon>
+          </div>
+        </div>
+        <div class="comment-list">
+          @for (item of commentObj.list; track $index) {
+          <div class="li">
+            <div class="li-user">
+              <img
+                [src]="item?.get('user')?.get('avatar')"
+                alt=""
+                class="avatar"
+              />
+              <div class="username">
+                {{ item?.get("user")?.get("nickname") }}
+              </div>
+              <div
+                class="level"
+                [style.background-color]="
+                  aiChatServ.userLevelColor[
+                    item?.get('user').get('achievementCount')
+                  ]?.color
+                "
+              >
+                LV{{ item?.get("user").get("achievementCount") }}
+              </div>
+            </div>
+            <div class="li-score">{{ item?.get("comment") }}</div>
+          </div>
+          }
         </div>
       </div>
     </div>
     <div class="data-row">
-      <div class="title-text">ta的礼物墙</div>
+      <div class="title-text flex">ta的礼物墙
+        <div class="coulum" (click)="tourl('/user/income',{uid: profile?.get('user')?.id})">
+          <ion-icon
+            name="chevron-forward-outline"
+          ></ion-icon>
+        </div>
+      </div>
       <div class="gift">
         @for (item of giftList; track $index) {
-        <img [src]="item?.image" alt="" />
+        <div class="gift-card">
+          <img [src]="item?.image" alt="" />
+          <div class="gift-name">x{{ item.count }}</div>
+        </div>
         }
       </div>
     </div>
@@ -174,7 +219,7 @@
         }
       </div>
     </div>
-    } @if (uid !== currentUser?.id &&
+    } } @if (uid !== currentUser?.id &&
     !accServ.userVip?.rights?.['view-profile']) {
     <div class="view-auth">
       <ion-icon name="lock-closed"></ion-icon>
@@ -197,7 +242,7 @@
       </div>
       <div class="round live" (click)="call.toLiveContact()">
         <ion-icon name="videocam-outline"></ion-icon>
-        <div style="display: flex;flex-direction: column;">
+        <div style="display: flex; flex-direction: column">
           <span>直播通话</span>
           <span>{{ profile?.get("laborCosts") }}钻石/分</span>
         </div>

+ 68 - 12
projects/live-app/src/modules/user/profile/profile.component.scss

@@ -126,7 +126,7 @@
               // margin-left: 2.5641vw;
             }
           }
-          .level{
+          .level {
             margin-left: 1.5385vw;
             text-align: center;
             font-size: 3.0769vw;
@@ -207,11 +207,56 @@
         font-size: 3.5897vw;
         font-weight: bold;
       }
-      .comment-room{
+      .flex{
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+      }
+      .comment-room {
         font-size: 12px;
-        .comment-title{
+        .comment-title {
           display: flex;
           justify-content: space-between;
+          .coulum {
+            display: flex;
+            align-items: center;
+          }
+        }
+        .comment-list {
+          background-color: #47474726;
+          // border: 1px solid white;
+          margin-top: 4px;
+          border-radius: 6px;
+          .li {
+            display: flex;
+            align-items: center;
+            justify-content: space-between;
+            padding: 4px;
+            // border-bottom: 1px solid #eee;
+            .li-user {
+              display: flex;
+              align-items: center;
+              .avatar {
+                width: 30px;
+                height: 30px;
+                margin-right: 4px;
+              }
+              .level {
+                margin-left: 1.5385vw;
+                text-align: center;
+                font-size: 3.0769vw;
+                border-radius: 5.1282vw;
+                padding: 0vw 1.5385vw;
+                color: #000;
+              }
+            }
+            .li-score{
+              font-size: 12px;
+              background-color: #c509ff;
+              padding: 2px 4px;
+              color: white;
+            }
+          }
         }
       }
       .tags {
@@ -247,13 +292,22 @@
         grid-template-columns: repeat(5, 17.9487vw);
         justify-content: space-between;
         flex-wrap: wrap;
-        img {
-          // width: 10.2564vw;
-          height: 17.9487vw;
-          border-radius: 50%;
-          object-fit: cover;
-          margin-top: 2.5641vw;
+        .gift-card{
+          display: flex;
+          flex-direction: column;
+          align-items: center;
+          img {
+            // width: 10.2564vw;
+            height: 17.9487vw;
+            border-radius: 50%;
+            object-fit: cover;
+            margin-top: 2.5641vw;
+          }
+          .gift-name{
+            font-size: 12px;
+          }
         }
+
       }
       .album {
         display: grid;
@@ -284,13 +338,13 @@
       width: 30.7692vw;
       height: 10.2564vw;
       justify-content: center;
-      background: linear-gradient(to right, #ff4545, #5a94f9);
+      background: linear-gradient(to right, #005cff, #f931cc);
       ion-icon {
         font-size: 5.1282vw;
         margin-right: 2.5641vw;
       }
     }
-    .live{
+    .live {
       background: linear-gradient(to right, #2a0a97, #db151e);
     }
     .gift {
@@ -301,7 +355,9 @@
       border: 0.2564vw solid;
       width: 10.2564vw;
       height: 10.2564vw;
-      color: #fe454e;
+      // color: #fe454e;
+      color: #ffffff;
+      background: linear-gradient(to right, #7045ff, #f931cc);
       ion-icon {
         font-size: 7.6923vw;
       }

+ 5 - 1
projects/live-app/src/modules/user/profile/profile.component.ts

@@ -60,7 +60,7 @@ export class ProfileComponent implements OnInit {
   isFollow: boolean = false;
   giftList: any[] = []; //礼物
   isOpen: boolean = false; //打开弹窗
-  // room?: Parse.Object;
+  room?: Parse.Object;
   @ViewChild('gift') gift!: GiftModalComponent;
   // iscall: boolean = false;
   // isLiveing: boolean = false; // 是否在直播通话中
@@ -189,6 +189,7 @@ export class ProfileComponent implements OnInit {
     query.select('objectId');
     let r = await query.first();
     if(r?.id){
+      this.room = r;
       this.commentObj.score = await this.aiChatServ.getCommentScore(r?.id);
       let queryPost = new Parse.Query('DramaPostLog');
       queryPost.equalTo('room', r.id);
@@ -380,6 +381,9 @@ export class ProfileComponent implements OnInit {
   toMsg() {
     this.router.navigate(['live/chat/' + this.friends?.get('channel')]);
   }
+  tourl(url:string, params:object){
+    this.router.navigate([url,params]);
+  }
   onSendGift() {
     console.log('点击送出礼物');
     // this.liveService.get_duration()

+ 10 - 0
projects/live-app/src/modules/user/user.modules.routes.ts

@@ -9,6 +9,8 @@ import { ProfileComponent } from './profile/profile.component';
 import { ReleaseComponent } from './release/release.component';
 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';
 const routes: Routes = [
   {
     path: 'profile/:id',//主页
@@ -47,6 +49,14 @@ const routes: Routes = [
     path: 'release',//设置
     component: ReleaseComponent,
   },
+  {
+    path:'comment',
+    component:CommentComponent
+  },
+  {
+    path:'income',
+    component:GiftIncomeComponent
+  }
 ]
 @NgModule({
   imports: [RouterModule.forChild(routes)],

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

@@ -225,16 +225,12 @@ export class AiChatService {
     if (limit) {
       where = `OFFSET ${skip ?? 0} LIMIT ${limit}`;
     }
-    let sql = `SELECT lr.name,lr.image
-    FROM (
-      SELECT *,ROW_NUMBER() OVER (PARTITION BY "gift" ORDER BY "createdAt" DESC) as rn
+    let sql = `SELECT name,image,"gift",COUNT("gift")
       FROM "LoveRender"
       WHERE "toUser" = '${uid}'
       AND "isDeleted" IS NOT TRUE
-    ) lr
-    WHERE lr.rn = 1
-    ORDER BY lr."createdAt" DESC
-    ${where}
+      GROUP BY name,image,"gift"
+      ${where}
     `;
     const data: any = await this.http.customSQL(sql);
     return data.data;
@@ -450,6 +446,6 @@ export class AiChatService {
     WHERE room = '${room}'
     `
     let res: any = await this.http.customSQL(sql);
-    return res.data['ave'];
+    return res.data[0]['ave'];
   }
 }