Browse Source

修复部分问题

warrior 1 tuần trước cách đây
mục cha
commit
f34d19bccc

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


+ 1 - 1
projects/live-app/src/app/components/upload/upload.component.html

@@ -33,7 +33,7 @@
     ></ion-icon>
     } }
     <div class="del" (click)="onDelete($index)">
-      <ion-icon name="close-outline"></ion-icon>
+      <ion-icon style="font-size:20px"  name="close-outline"></ion-icon>
     </div>
   </div>
   } @if (fileList.length < maxlenght) {

+ 1 - 1
projects/live-app/src/modules/account/withdrawal/withdrawal.component.html

@@ -11,7 +11,7 @@
         银行卡
       </div>
       <div class="bank">
-        <div class="name">所属银行:</div>
+        <div class="name">银行名称:</div>
         <input
           type="text"
           [(ngModel)]="bankinfo.bankName"

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

@@ -61,8 +61,8 @@
           </div>
         </div>
         <div class="user-footer">
-          <div class="row">{{ userObj.fans }} 粉丝</div>
-          <div class="row">{{ userObj.follow }} 关注</div>
+          <div class="row" (click)="toUrl('user/friends')">{{ userObj.fans }} 粉丝</div>
+          <div class="row" (click)="toUrl('user/friends')">{{ userObj.follow }} 关注</div>
           <div class="row">{{ userObj.friendly_degree }} 亲密度</div>
         </div>
       </div>

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

@@ -41,7 +41,15 @@
             </div>
             <ion-icon style="color: #afafaf" name="chevron-forward-outline"></ion-icon>
           </ion-item>
-
+          <ion-item class="li" (click)="toUrl('/user/giftlog')">
+            <img src="img/礼物.png" class="avatar" slot="start" alt="avatar" />
+            <div class="li-right">
+              <div class="name">
+                送礼记录
+              </div>
+            </div>
+            <ion-icon style="color: #afafaf" name="chevron-forward-outline"></ion-icon>
+          </ion-item>
           <ion-item class="li" (click)="toUrl('/live/call-log')">
             <img src="img/通话记录.png" class="avatar" slot="start" alt="avatar" />
             <div class="li-right">
@@ -83,7 +91,7 @@
           </ion-item>
 
           @for (item of friends; track $index) {
-          <ion-item class="li" (click)="toUrl('/live/chat/' + item.channel)" (touchstart)="startPress()"
+          <ion-item class="li" (click)="toUrl('/live/chat/' + item.channel)" (touchstart)="startPress(item)"
             (mousemove)="stopPress()">
             <img [src]="item.avatar" class="avatar" slot="start" alt="avatar" />
             <div class="li-right">

+ 26 - 9
projects/live-app/src/modules/tabs/notice/notice.component.ts

@@ -13,7 +13,7 @@ import { CommonModule } from '@angular/common';
   templateUrl: './notice.component.html',
   styleUrls: ['./notice.component.scss'],
   standalone: true,
-  imports: [SharedModule, ...ionicStandaloneModules,CommonModule],
+  imports: [SharedModule, ...ionicStandaloneModules, CommonModule],
 })
 export class NoticeComponent implements OnInit {
   active: string = 'notice';
@@ -29,8 +29,22 @@ export class NoticeComponent implements OnInit {
     {
       text: '确认',
       role: 'confirm',
-      handler: () => {
-        console.log('Alert confirmed');
+      handler: async () => {
+        console.log(this.currentFriend);
+        let query = new Parse.Query('Friends');
+        query.equalTo('channel', this.currentFriend.channel);
+        query.equalTo('company', this.msgServe.company);
+        query.equalTo('isPass', true);
+        query.notEqualTo('isDeleted', true);
+        let f = await query.first();
+        if (f?.id) {
+          let uid = Parse.User.current()?.id!;
+          let config = f?.get('config') || {};
+          config[uid] = new Date()?.getTime();
+          f.set('config', config);
+          await f.save();
+        }
+        this.msgServe.delMsg(this.currentFriend.channel);
       },
     },
   ];
@@ -42,13 +56,14 @@ export class NoticeComponent implements OnInit {
   isOpen: boolean = false;
   codeUrl: string = '';
   notices: Array<any> = [];
+  currentFriend: any; //当前选中的好友
 
   constructor(
     private router: Router,
     private aiSer: AiChatService,
     public msgServe: MessageService,
     public deviceSer: DeviceService
-  ) { }
+  ) {}
 
   ngOnInit() {
     this.refresh();
@@ -71,8 +86,8 @@ export class NoticeComponent implements OnInit {
     this.codeUrl = r?.get('wxCode');
   }
   async getSysNotice() {
-    let result = await this.aiSer.getSysNotice(Parse.User.current()?.id!)
-    this.notices = result.data
+    let result = await this.aiSer.getSysNotice(Parse.User.current()?.id!);
+    this.notices = result.data;
     console.log(this.notices);
   }
   segmentChanged(e: any) {
@@ -80,17 +95,19 @@ export class NoticeComponent implements OnInit {
     this.active = value;
   }
   /* 手指按下 */
-  startPress() {
+  startPress(item: any) {
     this.showModal = false;
     if (this.times >= 500) {
-      console.log(this.times);
+      // console.log(this.times);
       this.times = 0;
+      this.currentFriend = item;
+      // console.log(this.currentFriend);
       this.showModal = true;
       return;
     }
     this.timer = setTimeout(() => {
       this.times += 500;
-      this.startPress();
+      this.startPress(item);
     }, 500);
   }
   /* 触摸屏幕并移动,取消长按事件 */

+ 5 - 0
projects/live-app/src/modules/user/browse/browse.component.ts

@@ -36,6 +36,11 @@ export class BrowseComponent implements OnInit {
     let query = new Parse.Query('ProfileRadar');
     query.equalTo('name', '查看');
     query.equalTo(this.active == 'from' ? 'fromUser' : 'toUser', Parse.User.current());
+    if(this.active == 'from'){
+      query.notEqualTo('toUser', Parse.User.current());
+    }else{
+      query.notEqualTo('fromUser', Parse.User.current());
+    }
     query.descending('createdAt');
     query.limit(20);
     query.skip(this.list.length)

+ 66 - 0
projects/live-app/src/modules/user/friends/friends.component.html

@@ -0,0 +1,66 @@
+<nav title="粉丝和关注"></nav>
+<ion-content class="content">
+  <ion-segment
+    [scrollable]="true"
+    (ionChange)="segmentChanged($event)"
+    layout="icon-bottom"
+    value="from"
+    mode="md"
+  >
+    <ion-segment-button value="from" class="tabs" content-id="from">
+      <ion-label>关注</ion-label>
+    </ion-segment-button>
+    <ion-segment-button value="to" class="tabs" content-id="to">
+      <ion-label>粉丝</ion-label>
+    </ion-segment-button>
+  </ion-segment>
+
+  <div class="list">
+    @for (item of list; track $index) { @if (active === 'from') {
+    <div class="li" (click)="toUrl(item.get('toUser')?.id)">
+      <div class="li-left">
+        <img [src]="item.get('toUser')?.get('avatar')" class="avatar" />
+      </div>
+      <div class="li-right">
+        <div class="li-right-user">
+          <div class="user-name">
+            {{
+              item.get("toUser")?.get("nickname") ||
+                item.get("toUser")?.get("name")
+            }}
+          </div>
+          <div class="time">
+            {{ item.createdAt | showDate }}
+          </div>
+        </div>
+        <ion-icon name="chevron-forward"></ion-icon>
+      </div>
+    </div>
+    }@else {
+    <div class="li" (click)="toUrl(item.get('fromUser')?.id)">
+      <div class="li-left">
+        <img [src]="item.get('fromUser')?.get('avatar')" class="avatar" />
+      </div>
+      <div class="li-right">
+        <div class="li-right-user">
+          <div class="user-name">
+            {{
+              item.get("fromUser")?.get("nickname") ||
+                item.get("fromUser")?.get("name")
+            }}
+          </div>
+          <div class="time">
+            {{ item.createdAt | showDate }}
+          </div>
+        </div>
+        <ion-icon name="chevron-forward"></ion-icon>
+      </div>
+    </div>
+    } }
+  </div>
+  @if (disbable) {
+  <ion-infinite-scroll (ionInfinite)="onIonInfinite($event)">
+    <ion-infinite-scroll-content></ion-infinite-scroll-content>
+  </ion-infinite-scroll>
+  }
+</ion-content>

+ 52 - 0
projects/live-app/src/modules/user/friends/friends.component.scss

@@ -0,0 +1,52 @@
+.content {
+  padding-bottom: 12.8205vw;
+  background-image: url("https://file-cloud.fmode.cn/Qje9D4bqol/20241220/b313ov054708770.png") !important;
+  background-repeat: no-repeat;
+  background-position: center top;
+  background-size: 100% 100%;
+  --background: #ffffff00;
+  ion-segment {
+    // justify-content: start;
+    // padding: 0 3.2vw;
+    // position: sticky;
+    // top: 0;
+    border-bottom: 0.2564vw solid #e5e5e5;
+  }
+  .list {
+    .li {
+      display: flex;
+      justify-content: space-between;
+      padding: 1.0256vw 2.5641vw;
+      background: white;
+      border-bottom: 0.2564vw solid #e5e5e5;
+      .li-left {
+        flex-shrink: 0;
+        width: 10.2564vw;
+        .avatar {
+          width: 9.2308vw;
+          height: 9.2308vw;
+          border-radius: 50%;
+        }
+      }
+      .li-right {
+        display: flex;
+        flex: 1;
+        margin-left: 2.5641vw;
+        justify-content: space-between;
+        align-items: center;
+        .li-right-user {
+          display: flex;
+          flex-direction: column;
+          .user-name{
+            font-size: 3.5897vw;
+            margin-bottom: 1.5385vw;
+          }
+          .time {
+            font-size: 3.0769vw;
+            color: #7d7d7d;
+          }
+        }
+      }
+    }
+  }
+}

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

+ 62 - 0
projects/live-app/src/modules/user/friends/friends.component.ts

@@ -0,0 +1,62 @@
+import { Component, OnInit } from '@angular/core';
+import { NavComponent } from '../../../app/components/nav/nav.component';
+import { InfiniteScrollCustomEvent, ToastController } from '@ionic/angular';
+import * as Parse from 'parse';
+import { ionicStandaloneModules } from '../../ionic-standalone.modules';
+import { SharedModule } from '../../shared.module';
+import { Router } from '@angular/router';
+@Component({
+  selector: 'app-friends',
+  templateUrl: './friends.component.html',
+  styleUrls: ['./friends.component.scss'],
+  standalone: true,
+  imports: [...ionicStandaloneModules, NavComponent, SharedModule],
+})
+export class FriendsComponent implements OnInit {
+  active: string = 'from';
+  list: Array<Parse.Object> = [];
+  disbable: boolean = true;
+
+  constructor(private router: Router) {}
+
+  ngOnInit() {
+    this.getBrowseHistory();
+  }
+  segmentChanged(e: any) {
+    let { value } = e.detail;
+    this.active = value;
+    // console.log(this.active);
+    this.list = [];
+    this.disbable = true;
+    this.getBrowseHistory();
+  }
+
+  async getBrowseHistory() {
+    let query = new Parse.Query('ProfileRadar');
+    query.equalTo('name', '关注');
+    query.equalTo(
+      this.active == 'from' ? 'fromUser' : 'toUser',
+      Parse.User.current()
+    );
+    query.descending('createdAt');
+    query.limit(20);
+    query.skip(this.list.length);
+    query.include('fromUser', 'toUser');
+    let r = await query.find();
+    this.list.push(...r);
+    return r;
+  }
+
+  async onIonInfinite(ev: any) {
+    let result = await this.getBrowseHistory();
+    if (result.length == 0) {
+      this.disbable = false;
+    }
+    setTimeout(() => {
+      (ev as InfiniteScrollCustomEvent).target.complete();
+    }, 500);
+  }
+  toUrl(id: string) {
+    this.router.navigate(['/user/profile/' + id]);
+  }
+}

+ 105 - 0
projects/live-app/src/modules/user/gift-log/gift-log.component.html

@@ -0,0 +1,105 @@
+<nav title="礼物列表"></nav>
+<ion-content class="content">
+  <ion-segment
+    [scrollable]="true"
+    (ionChange)="segmentChanged($event)"
+    layout="icon-bottom"
+    value="from"
+    mode="md"
+  >
+    <ion-segment-button value="from" class="tabs" content-id="from">
+      <ion-label>我送出的</ion-label>
+    </ion-segment-button>
+    <ion-segment-button value="to" class="tabs" content-id="to">
+      <ion-label>送给我的</ion-label>
+    </ion-segment-button>
+  </ion-segment>
+
+  <!-- <div class="list"> -->
+  <div class="comment-list">
+    @for (item of list; track $index) { @if (active === 'from') {
+
+    <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:mm" }}
+          </div>
+          <div class="credit">
+            钻石:<span style="color: red">{{ item?.get("gold") }}</span>
+          </div>
+        </div>
+      </div>
+    </div>
+
+    }@else {
+    <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:mm" }}
+          </div>
+          <div class="credit">
+            钻石:<span style="color: red">{{ item?.get("gold") }}</span>
+          </div>
+        </div>
+      </div>
+    </div>
+    } }
+  </div>
+  @if (disbable) {
+  <ion-infinite-scroll (ionInfinite)="onIonInfinite($event)">
+    <ion-infinite-scroll-content></ion-infinite-scroll-content>
+  </ion-infinite-scroll>
+  }
+</ion-content>

+ 75 - 0
projects/live-app/src/modules/user/gift-log/gift-log.component.scss

@@ -0,0 +1,75 @@
+.content {
+  padding-bottom: 12.8205vw;
+  background-image: url("https://file-cloud.fmode.cn/Qje9D4bqol/20241220/b313ov054708770.png") !important;
+  background-repeat: no-repeat;
+  background-position: center top;
+  background-size: 100% 100%;
+  --background: #ffffff00;
+  ion-segment {
+    // justify-content: start;
+    // padding: 0 3.2vw;
+    // position: sticky;
+    // top: 0;
+    border-bottom: 0.2564vw solid #e5e5e5;
+  }
+  .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-log/gift-log.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 { GiftLogComponent } from './gift-log.component';
+
+describe('GiftLogComponent', () => {
+  let component: GiftLogComponent;
+  let fixture: ComponentFixture<GiftLogComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ GiftLogComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(GiftLogComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

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

@@ -0,0 +1,71 @@
+import { Component, OnInit } from '@angular/core';
+import { NavComponent } from '../../../app/components/nav/nav.component';
+import { InfiniteScrollCustomEvent, ToastController } from '@ionic/angular';
+import * as Parse from 'parse';
+import { ionicStandaloneModules } from '../../ionic-standalone.modules';
+import { SharedModule } from '../../shared.module';
+import { Router } from '@angular/router';
+import { CommonModule, DatePipe } from '@angular/common';
+import { AiChatService } from '../../../services/aichart.service';
+@Component({
+  selector: 'app-gift-log',
+  templateUrl: './gift-log.component.html',
+  styleUrls: ['./gift-log.component.scss'],
+  standalone: true,
+  imports: [...ionicStandaloneModules, NavComponent, SharedModule,CommonModule],
+  providers: [DatePipe],
+})
+export class GiftLogComponent implements OnInit {
+  active: string = 'from';
+  list: Array<Parse.Object> = [];
+  disbable: boolean = true;
+  constructor(private router: Router, public aiChatServ: AiChatService) {}
+
+  ngOnInit() {
+    this.getBrowseHistory();
+  }
+  segmentChanged(e: any) {
+    let { value } = e.detail;
+    this.active = value;
+    // console.log(this.active);
+    this.list = [];
+    this.disbable = true;
+    this.getBrowseHistory();
+  }
+
+  async getBrowseHistory() {
+    let uid = Parse.User.current().id;
+    let query = new Parse.Query('LoveRender');
+    query.equalTo('toUser', uid);
+    query.notEqualTo('isDeleted', true);
+    query.equalTo(
+      this.active == 'from' ? 'fromUser' : 'toUser',
+      Parse.User.current()
+    );
+    // if (this.active == 'from') {
+    //   query.notEqualTo('toUser', Parse.User.current());
+    // } else {
+    //   query.notEqualTo('fromUser', Parse.User.current());
+    // }
+    query.descending('createdAt');
+    query.limit(20);
+    query.skip(this.list.length);
+    query.include('fromUser', 'toUser');
+    let r = await query.find();
+    this.list.push(...r);
+    return r;
+  }
+
+  async onIonInfinite(ev: any) {
+    let result = await this.getBrowseHistory();
+    if (result.length == 0) {
+      this.disbable = false;
+    }
+    setTimeout(() => {
+      (ev as InfiniteScrollCustomEvent).target.complete();
+    }, 500);
+  }
+  toUrl(id: string) {
+    this.router.navigate(['/user/profile/' + id]);
+  }
+}

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

@@ -12,6 +12,8 @@ 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';
+import { FriendsComponent } from './friends/friends.component';
+import { GiftLogComponent } from './gift-log/gift-log.component';
 const routes: Routes = [
   {
     path: 'profile/:id',//主页
@@ -62,6 +64,14 @@ const routes: Routes = [
     path: 'ranking', //排名
     component: RankingComponent,
   },
+  {
+    path: 'friends', //粉丝和关注
+    component: FriendsComponent,
+  },
+  {
+    path: 'giftlog', //礼物记录
+    component: GiftLogComponent,
+  },
 ]
 @NgModule({
   imports: [RouterModule.forChild(routes)],