warrior 1 month ago
parent
commit
6003cffbe8

+ 13 - 1
projects/live-app/src/modules/live/link-page/link-page.component.html

@@ -18,7 +18,16 @@
       }
       <div class="profile-title">
         <div class="profile-name">{{ room?.get("user")?.get("nickname") }}</div>
-        <div class="level">LV:1</div>
+        <div
+          class="level"
+          [style.background-color]="
+            aiServ.authorLevelColor[
+              room?.get('user')?.get('completionRate') || 1
+            ]?.color
+          "
+        >
+          LV{{ room?.get("user")?.get("completionRate") || 1 }}
+        </div>
       </div>
       <ion-icon
         (click)="onCollection()"
@@ -29,6 +38,9 @@
     <div class="report" (click)="onReport($event)">
       <ion-icon name="warning-outline"></ion-icon>
     </div>
+    <!-- <div class="report" (click)="onComment($event)">
+      <ion-icon name="star-outline"></ion-icon>
+    </div> -->
     <div class="exit" (click)="endCall($event)">
       <ion-icon name="enter-outline"></ion-icon>
     </div>

+ 8 - 2
projects/live-app/src/modules/live/link-page/link-page.component.scss

@@ -14,7 +14,7 @@
     .room-data {
       background-color: rgb(0 0 0 / 40%);
       display: flex;
-      width: 41.0256vw;
+      width: 46.1538vw;
       justify-content: space-between;
       align-items: center;
       border-radius: 10.2564vw;
@@ -33,13 +33,19 @@
         flex: 1;
         .profile-name {
           font-size: 3.5897vw;
+          font-size: 3.5897vw;
+          display: -webkit-box;
+          -webkit-box-orient: vertical;
+          overflow: hidden;
+          -webkit-line-clamp: 1;
         }
         .level {
-          background-color: #cc59de;
+          // background-color: #cc59de;
           text-align: center;
           font-size: 3.0769vw;
           border-radius: 5.1282vw;
           padding: 0vw 1.5385vw;
+          color: #000;
         }
       }
       ion-icon {

+ 82 - 5
projects/live-app/src/modules/live/link-page/link-page.component.ts

@@ -33,7 +33,7 @@ import { AccountService } from '../../../services/account.service';
     SharedModule,
     GiftModalComponent,
     FlutterCompComponent,
-    AvatarComponent
+    AvatarComponent,
   ],
 })
 export class LinkPageComponent implements OnInit {
@@ -49,7 +49,7 @@ export class LinkPageComponent implements OnInit {
   disabled: boolean = false;
   showEmoji: boolean = false;
   loading: boolean = true;
-  userVip:any
+  userVip: any;
   constructor(
     public toastController: ToastController,
     private loadingCtrl: LoadingController,
@@ -93,7 +93,7 @@ export class LinkPageComponent implements OnInit {
     });
     loading.present();
     await this.getRoom();
-    this.userVip = await this.accServ.getVip(this.room?.get('user').id)
+    this.userVip = await this.accServ.getVip(this.room?.get('user').id);
     this.initSwiperTimeEvent();
     loading.dismiss();
     this.loading = false;
@@ -209,7 +209,11 @@ export class LinkPageComponent implements OnInit {
           cssClass: 'secondary',
           handler: () => {
             console.log('Confirm Cancel: blah');
-            this.onExit();
+            if (this.liveService.isAnchor) {
+              this.onExit();
+              return;
+            }
+            this.onComment();
           },
         },
       ],
@@ -291,9 +295,82 @@ export class LinkPageComponent implements OnInit {
   }
 
   ngOnDestroy(): void {
-    if(this.liveService.isAnchor){
+    if (this.liveService.isAnchor) {
       this.msgServe.setConnectState(this.currentUser?.id!, 'ONLINE');
     }
     this.msgServe.pageFun = () => {};
   }
+
+  /* 评论 */
+  async onComment() {
+    const alert = await this.alertController.create({
+      cssClass: 'my-custom-class',
+      header: '评价',
+      message: '对本次直播主播进行评价',
+      inputs: [
+        {
+          name: 'comment',
+          placeholder: '评价',
+          attributes: {
+            maxlength:20,
+          },
+        },
+        {
+          name: 'star',
+          type: 'number',
+          placeholder: '打分(1-5分)',
+          min: 1,
+          max: 5,
+        },
+      ],
+      buttons: [
+        {
+          text: '取消',
+          role: 'cancel',
+          handler: (data) => {
+            this.onExit();
+          },
+        },
+        {
+          text: '评价',
+          cssClass: 'secondary',
+          handler:async (data) => {
+            let {comment, star} = data;
+            const loading = await this.loadingCtrl.create({
+              message: '加载中',
+            });
+            loading.present();
+            star = Math.round(star)
+            if(star < 1) star = 1;
+            if(star > 5) star = 5;
+            console.log(comment, star);
+            let obj = Parse.Object.extend('DramaPostLog');
+            let postLog = new obj()
+            postLog.set('room', {
+              __type: 'Pointer',
+              className: 'Room',
+              objectId: this.room?.id,
+            });
+            postLog.set('company', {
+              __type: 'Pointer',
+              className: 'Company',
+              objectId: this.accServ?.company,
+            });
+            postLog.set('user', {
+              __type: 'Pointer',
+              className: '_User',
+              objectId: this.currentUser?.id,
+            });
+            postLog.set('type', 'comment')
+            postLog.set('credit', star)
+            postLog.set('comment',comment)
+            await postLog.save();
+            loading.dismiss();
+            this.onExit();
+          },
+        },
+      ],
+    });
+    await alert.present();
+  }
 }

+ 20 - 1
projects/live-app/src/modules/tabs/my/my.component.html

@@ -8,10 +8,29 @@
       />
       }
       <div class="user-right">
-        <div class="user-name">
+        <div class="user-nikcname">
           {{
             user.get("nickname") || user.get("mobile") || user.get("username")
           }}
+          @if (profile?.get('identyType') == 'anchor') {
+          <div
+            class="level"
+            [style.background-color]="
+              aiServ.authorLevelColor[user.get('completionRate')]?.color
+            "
+          >
+            LV{{ user.get("completionRate") }}
+          </div>
+          }@else {
+          <div
+            class="level"
+            [style.background-color]="
+              aiServ.userLevelColor[user.get('achievementCount')]?.color
+            "
+          >
+            LV{{ user.get("achievementCount") }}
+          </div>
+          }
         </div>
         <div class="user-block">
           <div class="tags">

+ 16 - 1
projects/live-app/src/modules/tabs/my/my.component.scss

@@ -14,9 +14,19 @@
       padding: 2.5641vw;
       .user-right {
         flex: 1;
-        .user-name {
+        .user-nikcname {
           font-weight: 400;
           font-size: 4.1026vw;
+          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;
+          }
         }
         .user-block {
           display: flex;
@@ -24,6 +34,7 @@
           justify-content: space-between;
           margin: 1.5385vw 0;
           font-size: 3.0769vw;
+          text-align: center;
           .tags {
             display: flex;
             align-items: center;
@@ -220,8 +231,12 @@
               .avatar {
                 width: 100%;
                 height: 100%;
+                border-radius: 50%;
               }
             }
+            .user-name {
+              text-align: center;
+            }
           }
         }
         .top1 {

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

@@ -10,6 +10,7 @@ import { AccountService } from '../../../services/account.service';
 import { ionicStandaloneModules } from '../../ionic-standalone.modules';
 import { DatePipe, CommonModule } from '@angular/common';
 import { AvatarComponent } from '../../../app/components/avatar/avatar.component';
+import { HttpService } from '../../../services/http.service';
 @Component({
   selector: 'app-my',
   templateUrl: './my.component.html',
@@ -29,8 +30,9 @@ export class MyComponent implements OnInit {
     public toastController: ToastController,
     private activateRoute: ActivatedRoute,
     private router: Router,
-    private aiServ: AiChatService,
-    private accServ: AccountService
+    public aiServ: AiChatService,
+    private accServ: AccountService,
+    private http: HttpService,
   ) {}
   tools: Array<{ icon: string; title: string; path: string }> = [
     {
@@ -93,6 +95,8 @@ export class MyComponent implements OnInit {
     if (!this.userObj.vip) {
       this.userObj.vip = await this.accServ.getVip();
     }
+    console.log(this.userObj);
+    await this.updateLevel()
     loading.dismiss();
     this.loading = false;
   }
@@ -102,7 +106,7 @@ export class MyComponent implements OnInit {
     let query = new Parse.Query('Profile');
     query.equalTo('user', user?.id);
     query.notEqualTo('isDeleted', true);
-    query.select('isCheck', 'isCross','birthdate');
+    query.select('isCheck', 'isCross','birthdate','identyType');
     this.profile = await query.first();
   }
   getAgreement() {
@@ -228,4 +232,10 @@ export class MyComponent implements OnInit {
     location.href = 'tel:4000-000-000';
     console.log('拨号');
   }
+
+  async updateLevel(){
+    let url = 'https://server.fmode.cn/api/ailiao/update/level'
+    let data = await this.http.httpRequst(url,{pid: this.profile?.id},'POST')
+    console.log(data);
+  }
 }

+ 45 - 16
projects/live-app/src/modules/user/profile/profile.component.html

@@ -21,27 +21,27 @@
             />
           </div> -->
           @if(!loading){
-            <app-avatar
-              [avatar]="profile?.get('user')?.get('avatar')"
-              style="z-index: 99"
-              frameId="profile-avatar-frame"
-              [frame]="userVip['rights']['avatar']"
-            />
+          <app-avatar
+            [avatar]="profile?.get('user')?.get('avatar')"
+            style="z-index: 99"
+            frameId="profile-avatar-frame"
+            [frame]="userVip['rights']['avatar']"
+          />
           }
           <div class="top-right-block">
             <div class="top-left-title">{{ profile?.get("name") }}</div>
-            @if (user?.get('sex') == '男') {
+            @if (profile?.get('user')?.get('sex') == '男') {
             <div class="sex">
               <ion-icon name="male-outline"></ion-icon>
             </div>
-            }@else if (user?.get('sex') == '女') {
+            }@else if (profile?.get('user')?.get('sex') == '女') {
             <div class="sex girl">
               <ion-icon name="male-female-outline"></ion-icon>
             </div>
             }@else {
             <!-- <div class="sex">未知</div> -->
             }
-            <div [ngClass]="{ gril: 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 +51,7 @@
           </div>
         </div>
         <div class="user-status">
-          <span class="id">爱聊ID:{{ user?.id }}</span>
+          <span class="id">爱聊ID:{{ profile?.get('user')?.id }}</span>
           <!-- @if (profile?.get('isCheck')) {
           <div class="state">
             <span class="spot"></span>
@@ -63,15 +63,34 @@
             <span class="tag">{{ state.val }}</span>
           </div>
           <!-- } -->
-          @if (profile?.get('identyType') === 'anchor') {
+          <!-- @if (profile?.get('identyType') === 'anchor') {
           <div class="video-unit">
             通话:{{ profile?.get("laborCosts") }}钻石/分钟
           </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>
       </div>
       <div class="user-right">
-        @if (user?.id !== currentUser?.id) {
+        @if (profile?.get('user')?.id !== currentUser?.id) {
         <ion-icon
           (click)="onCollection()"
           name="heart-circle-sharp"
@@ -122,7 +141,7 @@
     </div>
     <div class="data-row">
       <div class="title-text">对ta的评价</div>
-      <div class="tags">
+      <!-- <div class="tags">
         <span class="label assess">漂亮小姐姐</span>
         <span class="label assess">颜值主播</span>
         <span class="label assess">唱歌好听</span>
@@ -130,6 +149,12 @@
         <span class="label assess">声优</span>
         <span class="label assess">喜欢日漫</span>
         <span class="label assess">都喜欢</span>
+      </div> -->
+      <div class="comment-room">
+        <div class="comment-title">
+          <div class="li">用户评价({{commentObj.count}})</div>
+          <div class="li">分数({{commentObj.score || '暂无评价'}})</div>
+        </div>
       </div>
     </div>
     <div class="data-row">
@@ -170,8 +195,12 @@
       <div class="gift" (click)="gift.openModal()">
         <ion-icon name="gift-outline"></ion-icon>
       </div>
-      <div class="round" (click)="call.toLiveContact()">
-        <ion-icon name="videocam-outline"></ion-icon>直播通话
+      <div class="round live" (click)="call.toLiveContact()">
+        <ion-icon name="videocam-outline"></ion-icon>
+        <div style="display: flex;flex-direction: column;">
+          <span>直播通话</span>
+          <span>{{ profile?.get("laborCosts") }}钻石/分</span>
+        </div>
       </div>
       } @if(friends?.get('isPass')){
       <div class="round" (click)="toMsg()">

+ 21 - 2
projects/live-app/src/modules/user/profile/profile.component.scss

@@ -126,6 +126,14 @@
               // margin-left: 2.5641vw;
             }
           }
+          .level{
+            margin-left: 1.5385vw;
+            text-align: center;
+            font-size: 3.0769vw;
+            border-radius: 5.1282vw;
+            padding: 0vw 1.5385vw;
+            color: #000;
+          }
           .video-unit {
             margin-left: 2.5641vw;
           }
@@ -199,6 +207,13 @@
         font-size: 3.5897vw;
         font-weight: bold;
       }
+      .comment-room{
+        font-size: 12px;
+        .comment-title{
+          display: flex;
+          justify-content: space-between;
+        }
+      }
       .tags {
         display: flex;
         flex-wrap: wrap;
@@ -261,19 +276,23 @@
     justify-content: space-evenly;
     .round {
       border-radius: 5.1282vw;
-      color: #156bfd;
+      color: #fff;
       font-size: 3.5897vw;
       display: flex;
       align-items: center;
-      border: 0.2564vw solid #156bfd;
+      // border: 0.2564vw solid #156bfd;
       width: 30.7692vw;
       height: 10.2564vw;
       justify-content: center;
+      background: linear-gradient(to right, #ff4545, #5a94f9);
       ion-icon {
         font-size: 5.1282vw;
         margin-right: 2.5641vw;
       }
     }
+    .live{
+      background: linear-gradient(to right, #2a0a97, #db151e);
+    }
     .gift {
       border-radius: 50%;
       display: flex;

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

@@ -67,13 +67,17 @@ export class ProfileComponent implements OnInit {
   userStatus: string = 'OFFLINE';
   loading: boolean = true;
   userVip:any
-
+  commentObj:any = {
+    score: 0,
+    count:0,
+    list: []
+  }
   constructor(
     private activateRoute: ActivatedRoute,
     private router: Router,
     private toastController: ToastController,
     private loadingCtrl: LoadingController,
-    private aiChatServ: AiChatService,
+    public aiChatServ: AiChatService,
     // private alertController: AlertController,
     // private msgSer: MessageService,
     private connectTask: ConnectTaskService,
@@ -143,6 +147,7 @@ export class ProfileComponent implements OnInit {
     let res1 = await this.aiChatServ.getGiftLogCount(this.uid);
     this.numsObject.gift = res1.data[0].gift ?? 0;
     this.giftList = await this.aiChatServ.getGiftList(this.uid, 16);
+    await this.getCommentLeng()
     this.browseLog()
     // this.getRoom();
     loading.dismiss();
@@ -177,6 +182,26 @@ export class ProfileComponent implements OnInit {
     this.birthdat = getBirthdatByIdNo(this.profile?.get('idcard') || '');
     this.constellation = getConstellation(this.profile?.get('idcard') || '');
   }
+  async getCommentLeng(){
+    let query = new Parse.Query('Room');
+    query.equalTo('user', this.uid);
+    query.notEqualTo('isDeleted', true);
+    query.select('objectId');
+    let r = await query.first();
+    if(r?.id){
+      this.commentObj.score = await this.aiChatServ.getCommentScore(r?.id);
+      let queryPost = new Parse.Query('DramaPostLog');
+      queryPost.equalTo('room', r.id);
+      queryPost.notEqualTo('isDeleted', true);
+      queryPost.include('user');
+      queryPost.descending('createdAt');
+      queryPost.equalTo('isVerify',true)
+      this.commentObj.count = await queryPost.count();
+      queryPost.limit(10);
+      this.commentObj.list = await queryPost.find();
+    }
+    console.log(this.commentObj);
+  }
   /* 关注状态 */
   async getFollwState() {
     let query = new Parse.Query('ProfileRadar');

+ 56 - 0
projects/live-app/src/services/aichart.service.ts

@@ -9,6 +9,53 @@ export class AiChatService {
   isLoggedIn = false;
   company: string = 'Qje9D4bqol';
   emojis: Array<any> = [];
+  userLevelColor:any = {
+    '1':{
+      color:'#fff'
+    },
+    '2':{
+      color:'#0ec52e'
+    },
+    '3':{
+      color:'#377cf7'
+    },
+    '4':{
+      color:'#cbb013'
+    },
+    '5':{
+      color:'#ec760c'
+    },
+    '6':{
+      color:'#ec0cce'
+    },
+    '7':{
+      color:'#8d0cec'
+    },
+    '8':{
+      color:'#dd0a0a'
+    },
+  }
+  authorLevelColor:any = {
+    '1':{
+      color:'#10b590'
+    },
+    '2':{
+      color:'#dd70ff'
+    },
+    '3':{
+      color:'#ed9647'
+    },
+    '4':{
+      color:'#fb73ca'
+    },
+    '5':{
+      color:'#efeb38'
+    },
+    '6':{
+      color:'#c11010'
+    }
+  }
+
   get identity(): boolean {
     let profile = JSON.parse(localStorage.getItem('profile') || '{}');
     return profile?.identyType === 'anchor';
@@ -396,4 +443,13 @@ export class AiChatService {
     let res: any = await this.http.customSQL(sql);
     return res.data;
   }
+
+  async getCommentScore(room:string){
+    let sql = `SELECT (SUM("credit")/COUNT("objectId")) AS ave
+    FROM "DramaPostLog"
+    WHERE room = '${room}'
+    `
+    let res: any = await this.http.customSQL(sql);
+    return res.data['ave'];
+  }
 }