Prechádzať zdrojové kódy

主播新增查看主播

warrior 1 týždeň pred
rodič
commit
dde0e0bf29

+ 101 - 15
projects/live-app/src/modules/tabs/anthorhome/anthorhome.component.html

@@ -1,9 +1,28 @@
 <ion-content class="content">
-  <div [ngClass]="{
-    'header': true,
-    'pad-top-ios': deviceSer.isIOS
-  }" [style.background-image]="'url(img/bg.png)'">
+  <div
+    [ngClass]="{
+      header: true,
+      'pad-top-ios': deviceSer.isIOS,
+      'hd-hei': deviceSer.isIOS
+    }"
+    [style.background-image]="'url(img/bg.png)'"
+  >
     <div class="top">
+      <div class="tabs">
+        <ion-segment
+          [scrollable]="true"
+          (ionChange)="segmentChanged($event)"
+          layout="icon-bottom"
+          [value]="active"
+          mode="md"
+        >
+          @for (item of options; track $index) {
+          <ion-segment-button [value]="item?.value" class="tabs">
+            <ion-label>{{ item?.label }}</ion-label>
+          </ion-segment-button>
+          }
+        </ion-segment>
+      </div>
       <ion-searchbar
         animated="true"
         [(ngModel)]="value"
@@ -46,6 +65,7 @@
     </div>
   </div>
   <div class="bar">
+    @if (active == 'user') {
     <ion-select
       label="用户列表"
       [placeholder]="sex"
@@ -53,23 +73,90 @@
       okText="确定"
       (ionChange)="onChangeSex($event)"
       interface="action-sheet"
+      [value]="sex"
     >
       <ion-select-option value="女"></ion-select-option>
       <ion-select-option value="男"></ion-select-option>
     </ion-select>
+    } @else {
+    <ion-select
+      label="主播类型"
+      [placeholder]="sex"
+      cancelText="关闭"
+      okText="确定"
+      (ionChange)="onChange($event)"
+      interface="action-sheet"
+      [value]="currentValue"
+    >
+      <ion-select-option value="recommend">热门</ion-select-option>
+      <ion-select-option value="news">新人</ion-select-option>
+      <ion-select-option value="三星">三星</ion-select-option>
+      <ion-select-option value="四星">四星</ion-select-option>
+      <ion-select-option value="五星">五星</ion-select-option>
+      <ion-select-option value="海外">海外</ion-select-option>
+    </ion-select>
+    }
     <div class="bar-right">
       <div class="city" (click)="isOpenCity = true">
         <ion-icon name="location-outline"></ion-icon>{{ city ? city : "全部" }}
       </div>
-      <!-- <ion-icon
+      @if (active == 'anchor') {
+      <ion-icon
         (click)="isColumn = !isColumn"
         [name]="!isColumn ? 'grid' : 'list'"
         style="font-size: 24px; color: #fe4d53"
-      ></ion-icon> -->
+      ></ion-icon>
+      }
     </div>
   </div>
+
+  @if (active == 'anchor') {
+  <div
+    [ngClass]="{
+        'room-list': true,
+        'room-list-column': isColumn,
+      }"
+  >
+    @for (item of roomList; track $index) {
+    <div
+      [ngClass]="{
+          'list-row': true,
+          'list-row-column': isColumn,
+        }"
+      (click)="toUrl('user/profile/' + item.uid)"
+      [style.background-image]="'url(' + item?.cover + ')'"
+    >
+      <div class="title-tag">在线聊天</div>
+      @if (userList?.includes(item.uid)) {
+      <div class="live-tag">
+        <img src="img/live.gif" alt="" />
+        {{ userList?.includes(item.uid) ? "在线" : "" }}
+      </div>
+      }
+      <div class="room-footer">
+        <div class="user">
+          {{ item?.nickname || item?.mobile }}
+        </div>
+        <div class="desc">{{ item?.title }}</div>
+        <div class="city-block">
+          <div class="row-li">
+            <ion-icon name="location-outline"></ion-icon>
+            {{ item.city }}
+          </div>
+          <div class="row-li" style="margin-left: 4px">
+            <img
+              src="https://file-cloud.fmode.cn/Qje9D4bqol/20241109/pctmvt110807052.png"
+              alt=""
+            />
+            {{ item.birthdate }}
+          </div>
+        </div>
+      </div>
+    </div>
+    }
+  </div>
+  }@else { @for (item of userList; track $index) {
   <div class="list">
-    @for (item of userList; track $index) {
     <div class="list-item">
       <div class="list-item-left">
         <img [src]="item.avatar" alt="" class="avatar" />
@@ -93,9 +180,8 @@
         </div>
       </div>
     </div>
-    }
   </div>
-  @if (disbable) {
+  } } @if (disbable) {
   <ion-infinite-scroll (ionInfinite)="onIonInfinite($event)">
     <ion-infinite-scroll-content></ion-infinite-scroll-content>
   </ion-infinite-scroll>
@@ -106,16 +192,16 @@
     trigger="open-modal-check"
     [isOpen]="isOpen"
     (didDismiss)="isOpen = false"
-    [initialBreakpoint]="1" 
-    [breakpoints]="[0, 0.5,1]"
+    [initialBreakpoint]="1"
+    [breakpoints]="[0, 0.5, 1]"
   >
     <ng-template>
       <div class="msg-modal">
         @for (item of greetingPhrases; track $index) {
-          <div class="msg-modal-item" (click)="changeGreetingPhrase(item)">
-            {{ item }}
-            <ion-icon name="send"></ion-icon>
-          </div>
+        <div class="msg-modal-item" (click)="changeGreetingPhrase(item)">
+          {{ item }}
+          <ion-icon name="send"></ion-icon>
+        </div>
         }
       </div>
     </ng-template>

+ 104 - 11
projects/live-app/src/modules/tabs/anthorhome/anthorhome.component.scss

@@ -13,17 +13,17 @@
         --cancel-button-color: #cccccc;
         --color: #cccccc;
       }
-      // ion-segment {
-      //   justify-content: start;
-      //   padding: 0 3.2vw;
-      //   position: sticky;
-      //   top: 0;
-      //   background: #fd6f6a00;
-      // }
-      // ion-segment-button {
-      //   color: white;
-      //   --indicator-color: white;
-      // }
+      ion-segment {
+        justify-content: start;
+        padding: 0 3.2vw;
+        position: sticky;
+        top: 0;
+        background: #fd6f6a00;
+      }
+      ion-segment-button {
+        color: white;
+        --indicator-color: white;
+      }
       // ::-webkit-scrollbar {
       //   display: none; /* Chrome Safari */
       // }
@@ -40,6 +40,9 @@
       // }
     }
   }
+  .hd-hei{
+    height: 51.2821vw;
+  }
   .banner {
     height: 46.1538vw;
     // width: calc(100% - 5.1282vw);
@@ -182,6 +185,96 @@
       }
     }
   }
+  .room-list {
+    display: grid;
+    grid-template-columns: repeat(2, 46.1538vw);
+    // grid-column-gap: 2.5641vw;
+    grid-row-gap: 2.5641vw;
+    padding: 2.5641vw;
+    justify-content: space-between;
+    font-size: 3.5897vw;
+    .list-row {
+      // width: 46.1538vw;
+      height: 64.1026vw;
+      background-size: 100% 100%;
+      position: relative;
+      color: white;
+      border-radius: 2.5641vw;
+      .title-tag {
+        background: linear-gradient(to bottom right, #9367fe, #d55bd9);
+        position: absolute;
+        top: 0;
+        left: 0;
+        border-radius: 2.5641vw 0;
+        padding: 1.0256vw 2.0513vw;
+      }
+      .live-tag {
+        position: absolute;
+        top: 1.0256vw;
+        right: 2.5641vw;
+        border-radius: 5.1282vw;
+        padding: 1.0256vw 2.5641vw;
+        font-size: 2.5641vw;
+        background: #1414147a;
+        display: flex;
+        align-items: center;
+        justify-content: space-evenly;
+        span {
+          height: 1.0256vw;
+          width: 1.0256vw;
+          border-radius: 50%;
+          background-color: #83f1dd;
+          margin-right: 1.0256vw;
+        }
+        img {
+          width: 3.0769vw;
+          height: 3.5897vw;
+        }
+      }
+      .room-footer {
+        position: absolute;
+        bottom: 0;
+        width: calc(100%);
+        padding: 1.0256vw 2.5641vw 2.5641vw;
+        max-height: 25.641vw;
+        background: linear-gradient(to bottom, #ffffff00, #434343);
+        border-radius: 0 0 2.5641vw 2.5641vw;
+        .user {
+          font-size: 4.1026vw;
+        }
+        .desc {
+          margin: 1.0256vw 0;
+        }
+        .city-block {
+          display: flex;
+          background: linear-gradient(to right, #ff92e3f0, #ff6a93);
+          display: inline-flex;
+          padding: 0.5128vw 1.5385vw;
+          border-radius: 5.1282vw;
+          align-items: center;
+          .row-li {
+            display: flex;
+            align-items: center;
+            img {
+              width: 3.0769vw;
+              height: 3.0769vw;
+              margin-right: 0.5128vw;
+            }
+          }
+        }
+      }
+    }
+  }
+  .room-list-column {
+    display: block;
+    .list-row-column {
+      margin-bottom: 2.5641vw;
+      height: 76.9231vw;
+      background-size: cover;
+      background-repeat: no-repeat;
+      background-position: center;
+    }
+  }
 }
 ion-modal {
   --height: auto;

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

@@ -63,6 +63,22 @@ export class AnthorhomeComponent implements OnInit {
   disbable: boolean = true;
   pushUserMap = new Set(); // 在线用户列表
 
+  options: Array<any> = [
+    {
+      label: '用户',
+      value: 'user',
+      color: 'primary',
+    },
+    {
+      label: '主播',
+      value: 'anchor',
+      color: 'primary',
+    },
+  ];
+  roomList: Array<any> = [];
+  active: string = 'user';
+  isColumn: boolean = false; //单排
+
   constructor(
     private loadingCtrl: LoadingController,
     private alertController: AlertController,
@@ -129,7 +145,7 @@ export class AnthorhomeComponent implements OnInit {
     let res = await this.aiServ.getLinkUsers({
       value: this.value ? this.value : '',
       skip: this.userList.length,
-      // sex: this.viewAnchor,
+      sex: this.viewAnchor,
       city: this.city,
     });
     console.log(res);
@@ -180,14 +196,14 @@ export class AnthorhomeComponent implements OnInit {
       message: item?.get('content') || '',
       buttons: item?.get('url')
         ? [
-          { text: '关闭' },
-          {
-            text: '确定',
-            handler: () => {
-              this.router.navigate([item?.get('url')]);
+            { text: '关闭' },
+            {
+              text: '确定',
+              handler: () => {
+                this.router.navigate([item?.get('url')]);
+              },
             },
-          },
-        ]
+          ]
         : [{ text: '关闭' }],
     });
     await alert.present();
@@ -240,11 +256,22 @@ export class AnthorhomeComponent implements OnInit {
   }
   async toSearch() {
     this.disbable = true;
-    this.userList = [];
-    this.getUserList();
+    console.log(this.active);
+    if (this.active == 'user') {
+      this.userList = [];
+      this.getUserList();
+    } else {
+      this.roomList = [];
+      this.getRoom();
+    }
   }
   async onIonInfinite(ev: any) {
-    let result = await this.getUserList();
+    let result;
+    if (this.active == 'user') {
+      result = await this.getUserList();
+    } else {
+      result = await this.getRoom();
+    }
     if (result == 0) {
       this.disbable = false;
     }
@@ -286,4 +313,140 @@ export class AnthorhomeComponent implements OnInit {
     toast.present();
     this.isOpen = false;
   }
+
+  onChange(e: any) {
+    // console.log(e.detail.value);
+    this.currentValue = e.detail.value;
+    this.getRoom();
+  }
+  async getRoom(type?: string) {
+    console.log(type);
+    const loading = await this.loadingCtrl.create({
+      message: '正在加载',
+    });
+    loading.present();
+    let data: Array<any> = [];
+    // if (type == this.oldCurrentValue) {
+    //   loading.dismiss();
+    //   return;
+    // }
+    // this.oldCurrentValue = this.currentValue;
+    if (!type) type = this.currentValue;
+    let uid = Parse.User.current()?.id;
+    let sex = null;
+    if (!this.connectTask.onlineUserList.size) {
+      await this.connectTask.getOnlieUserList('user_connect_room');
+    }
+    this.userList = Array.from(this.connectTask.onlineUserList) || [];
+    // console.log(userList);
+    switch (type) {
+      case 'follow':
+        data = await this.aiServ.getRooms({
+          title: this.value,
+          skip:this.roomList.length,
+          uid: uid,
+          // users: userList,
+          follow: true,
+          sex,
+          city: this.city,
+        });
+        break;
+      case 'recommend':
+        data = await this.aiServ.getRooms({
+          title: this.value,
+          skip:this.roomList.length,
+          uid: uid,
+          // users: userList,
+          recommend: true,
+          sex,
+          city: this.city,
+        });
+        break;
+      case 'news':
+        data = await this.aiServ.getRooms({
+          title: this.value,
+          skip:this.roomList.length,
+          uid: uid,
+          // users: userList,
+          sex,
+          city: this.city,
+        });
+        break;
+      case '三星':
+        data = await this.aiServ.getRooms({
+          title: this.value,
+          skip:this.roomList.length,
+          uid: uid,
+          // users: userList,
+          star: '三星',
+          sex,
+          city: this.city,
+        });
+        break;
+      case '四星':
+        data = await this.aiServ.getRooms({
+          title: this.value,
+          skip:this.roomList.length,
+          uid: uid,
+          // users: userList,
+          star: '四星',
+          sex,
+          city: this.city,
+        });
+        break;
+      case '五星':
+        data = await this.aiServ.getRooms({
+          title: this.value,
+          skip:this.roomList.length,
+          uid: uid,
+          // users: userList,
+          star: '五星',
+          sex,
+          city: this.city,
+        });
+        break;
+      case '海外':
+        data = await this.aiServ.getRooms({
+          title: this.value,
+          skip:this.roomList.length,
+          uid: uid,
+          // users: userList,
+          star: '海外',
+          sex,
+          city: this.city,
+        });
+        break;
+
+      default:
+        break;
+    }
+    if (data.length == 0) {
+      loading.dismiss();
+      const toast = await this.toastController.create({
+        message: '已加载全部内容',
+        duration: 1500,
+        color: 'warning',
+      });
+      toast.present();
+      return data.length;
+    }
+    this.roomList.push(...data);
+    loading.dismiss();
+    return data.length;
+  }
+  currentValue: string = 'recommend';
+  segmentChanged(e: any) {
+    this.disbable = true;
+    let { value } = e.detail;
+    this.active = value;
+    this.value = '';
+    console.log(this.active);
+    if (this.active == 'user') {
+      this.userList = [];
+      this.getUserList();
+    } else {
+      this.roomList = [];
+      this.getRoom();
+    }
+  }
 }

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

@@ -83,8 +83,8 @@
     </div>
     }@else {
     <div class="ad-left">
-      <div class="text"><span>VIP</span></div>
-      <p>开通爱聊VIP,解锁海量专属主播聊天。</p>
+      <div class="text">hey<span>VIP</span></div>
+      <p>开通VIP,解锁海量专属主播聊天。</p>
     </div>
     <div class="btn" (click)="toUrl('goods/vip')">立即开通</div>
     }

+ 1 - 1
projects/live-app/src/modules/user/gift-log/gift-log.component.ts

@@ -36,7 +36,7 @@ export class GiftLogComponent implements OnInit {
   async getBrowseHistory() {
     let uid = Parse.User.current().id;
     let query = new Parse.Query('LoveRender');
-    query.equalTo('toUser', uid);
+    // query.equalTo('toUser', uid);
     query.notEqualTo('isDeleted', true);
     query.equalTo(
       this.active == 'from' ? 'fromUser' : 'toUser',

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

@@ -244,7 +244,7 @@
         <ion-icon name="create-outline"></ion-icon>编辑资料
       </div>
       }@else{ @if(profile?.get('idcard') && profile?.get('identyType') ==
-      'anchor'){
+      'anchor' && userProfile.identyType !== 'anchor'){
       <div class="gift" (click)="gift.openModal()">
         <ion-icon name="gift-outline"></ion-icon>
       </div>
@@ -259,7 +259,7 @@
       <div class="round" (click)="toMsg()">
         <ion-icon name="chatbubble-outline"></ion-icon>私信
       </div>
-      }@else {
+      }@else if(userProfile.identyType !== 'anchor'){
       <div class="round" (click)="onFriend()">
         <ion-icon name="person-add-outline"></ion-icon>加为好友
       </div>

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

@@ -74,6 +74,7 @@ export class ProfileComponent implements OnInit {
     count:0,
     list: []
   }
+  userProfile = JSON.parse(localStorage.getItem('profile') || '');
   constructor(
     private activateRoute: ActivatedRoute,
     private router: Router,

+ 1 - 1
projects/live-app/src/services/account.service.ts

@@ -149,7 +149,7 @@ export class AccountService {
         let pathname = location.pathname;
         url + pathname + '?invite=' + Parse.User.current()?.id;
         let shareInfo = this.shareInfo || {
-          title: '聊', // 分享标题
+          title: 'hey聊', // 分享标题
           desc: '全新互动1:1视频直播娱乐体验', // 分享描述
           link: url, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
           type: 'link', //分享类型,music、video或link,不填默认为link

+ 3 - 2
projects/live-app/src/services/aichart.service.ts

@@ -274,8 +274,8 @@ export class AiChatService {
   getSysNotice(uid: string, limit?: number, skip?: number): Promise<any> {
     let sql = `SELECT
     "Friends"."objectId" fid,"friend","Friends"."user",
-    (CASE WHEN "user" = '${uid}' THEN '请求添加' || u.name ||'为好友'
-	  ELSE '收到'||us.name||'的好友申请' END) title,
+    (CASE WHEN "user" = '${uid}' THEN '请求添加' || us.name ||'为好友'
+	  ELSE '收到'||u.name||'的好友申请' END) title,
     (CASE WHEN "user" = '${uid}' THEN us.avatar
 	  ELSE u.avatar END) avatar,
     (CASE WHEN "user" = '${uid}' THEN us."objectId"
@@ -290,6 +290,7 @@ export class AiChatService {
 	  LEFT JOIN "_User" AS us
     ON us."objectId" = "Friends"."friend"
     WHERE "Friends"."company" = '${this.company}'
+    AND "Friends"."isDeleted" IS NOT TRUE
     AND (friend = '${uid}' OR "user" = '${uid}')
     ORDER BY "Friends"."createdAt" DESC
     OFFSET ${skip || 0} LIMIT ${limit || 20}`;