Преглед на файлове

更新全平台礼物飘窗

warrior преди 2 месеца
родител
ревизия
81503ab21b

+ 2 - 2
projects/live-app/src/app/components/upload/upload.component.ts

@@ -88,7 +88,7 @@ export class UploadComponent implements OnInit {
     this.fileList = this.files?.map((item: any) => {
       console.log(item);
       return {
-        url: item?.url,
+        url: item?.url || item,
         name: item?.name,
         type: 'http',
         // status: 'done',
@@ -265,7 +265,7 @@ export class UploadComponent implements OnInit {
       const putExtra = {
         fname: '',
         params: {},
-        mimeType: this.accept,
+        mimeType: this.accept === 'image/*'?'image/*' : undefined,
       };
       const config = {
         useCdnDomain: true, //使用cdn加速

+ 2 - 2
projects/live-app/src/modules/live/search/search.component.ts

@@ -13,8 +13,8 @@ import { ionicStandaloneModules } from '../../ionic-standalone.modules';
   templateUrl: './search.component.html',
   styleUrls: ['./search.component.scss'],
   standalone: true,
-  imports: [FormsModule, DatePipe, NavComponent, ...ionicStandaloneModules],
-  providers: [DatePipe],
+  imports: [FormsModule, NavComponent, ...ionicStandaloneModules],
+  providers: [DatePipe]
 })
 export class SearchComponent implements OnInit {
   roomList: any = [];

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

@@ -28,7 +28,7 @@
     <div class="swiper mySwiper">
       <div class="swiper-wrapper">
         @for (item of banner; track $index) {
-        <div class="swiper-slide">
+        <div class="swiper-slide" (click)="toUrl(item?.get('url'))">
           <img [src]="item?.get('image')" alt="" />
         </div>
         }
@@ -44,14 +44,14 @@
         <div class="swiper-slide notice-item" (click)="presentAlert(item)">
           <div class="notice-item-title">
             <div class="notice-item-text">
-              {{ item?.title }}
+              {{ item?.get('title') }}
             </div>
             <div class="notice-item-content">
-              {{ item?.content }}
+              {{ item?.get('content') }}
             </div>
           </div>
           <div class="notice-item-time">
-            {{ item?.time }}
+            {{ item?.createdAt | date : "yyyy-MM-dd HH:mm" }}
           </div>
         </div>
         }

+ 1 - 0
projects/live-app/src/modules/tabs/home/home.component.scss

@@ -101,6 +101,7 @@
             -webkit-box-orient: vertical; //设置伸缩盒子对象的子元素的排列方式
             -webkit-line-clamp: 1; //设置 块元素包含的文本行数
             margin: 0 6px 0 0;
+            text-align: left;
           }
         }
         .notice-item-time{

+ 31 - 22
projects/live-app/src/modules/tabs/home/home.component.ts

@@ -13,13 +13,15 @@ import {
   AlertController,
   LoadingController,
 } from '../../ionic-standalone.modules';
+import { CommonModule, DatePipe } from '@angular/common';
 @Component({
   selector: 'app-home',
   templateUrl: './home.component.html',
   styleUrls: ['./home.component.scss'],
   standalone: true,
-  imports: [...ionicStandaloneModules],
+  imports: [...ionicStandaloneModules, CommonModule],
   // schemas: [CUSTOM_ELEMENTS_SCHEMA],
+  providers: [DatePipe],
 })
 export class HomeComponent implements OnInit {
   options: Array<any> = [
@@ -65,20 +67,7 @@ export class HomeComponent implements OnInit {
   banner: Array<Parse.Object> = [];
   roomList: Array<any> = [];
   pageSwiper: Swiper | undefined | any;
-  notices: Array<any> = [
-    {
-      title: '【公告】',
-      content:
-        '欢迎来到直播间,请遵守直播规则,禁止一切违法直播行为,否则封号处理。',
-      time: '2024-12-01',
-    },
-    {
-      title: '【公告】',
-      content:
-        '欢迎使用爱聊',
-      time: '2024-12-10',
-    },
-  ];
+  notices: Array<any> = [];
   viewAnchor: string = localStorage.getItem('viewSex') || '女';
   get sex(): string {
     const map: any = {
@@ -94,7 +83,8 @@ export class HomeComponent implements OnInit {
     private activateRoute: ActivatedRoute,
     private connectTask: ConnectTaskService,
     private router: Router,
-    private aiServ: AiChatService
+    private aiServ: AiChatService,
+    private datePipe: DatePipe,
   ) {}
 
   ngOnInit() {
@@ -109,6 +99,7 @@ export class HomeComponent implements OnInit {
     loading.present();
     await this.connectTask.init();
     await this.getBanner();
+    await this.getNotice();
     await this.getRoom();
     setTimeout(() => {
       this.initSwiperTimeEvent();
@@ -124,6 +115,15 @@ export class HomeComponent implements OnInit {
     let banner = await query.find();
     this.banner = banner;
   }
+  async getNotice() {
+    let query = new Parse.Query('Notice');
+    query.equalTo('company', this.aiServ.company);
+    query.notEqualTo('isDeleted', true);
+    query.equalTo('type', 'application');
+    query.select('title', 'content');
+    query.descending('createdAt');
+    this.notices = await query.find();
+  }
   initSwiperTimeEvent() {
     // 初始化轮播图
     let swiper = new Swiper('.mySwiper', {
@@ -224,11 +224,20 @@ export class HomeComponent implements OnInit {
   }
   async presentAlert(item: any) {
     const alert = await this.alertController.create({
-      header: item.title || '消息通知',
-      subHeader:item.time,
-      message:
-        item.content || 'A message should be a short, complete sentence.',
-      buttons: ['关闭'],
+      header: item?.get('title') || '消息通知',
+      subHeader: this.datePipe.transform(item?.createdAt, 'yyyy-MM-dd HH:mm')!,
+      message: item?.get('content') || '',
+      buttons: item?.get('url')
+        ? [
+            { text: '关闭' },
+            {
+              text: '确定',
+              handler: () => {
+                this.router.navigate([item?.get('url')]);
+              },
+            },
+          ]
+        : [{ text: '关闭' }],
     });
     await alert.present();
   }
@@ -269,6 +278,6 @@ export class HomeComponent implements OnInit {
     this.router.navigate(['live/search']);
   }
   toUrl(url: string) {
-    this.router.navigate([url]);
+    url && this.router.navigate([url]);
   }
 }

+ 5 - 4
projects/live-app/src/modules/user/anchor/anchor.component.html

@@ -39,7 +39,7 @@
       <div class="title">头像<span style="color: red">*</span></div>
       @if (locadingComplete) {
       <app-upload
-        (onChangeFile)="onChangeFile($event, 'avatar', 'string')"
+        (onChange)="onChangeFile($event, 'avatar', 'string')"
         #upload
         [maxlenght]="1"
         [files]="formData.avatar ? [{ url: formData.avatar }] : []"
@@ -53,7 +53,7 @@
       <div class="title">照片<span style="color: red">*</span></div>
       @if (locadingComplete) {
       <app-upload
-        (onChangeFile)="onChangeFile($event, 'avatar', 'array')"
+        (onChange)="onChangeFile($event, 'photo', 'array')"
         #upload
         [maxlenght]="4"
         [files]="formData.photo"
@@ -68,7 +68,7 @@
       <div class="title">个人视频<span style="color: red">*</span></div>
       @if (locadingComplete) {
       <app-upload
-        (onChangeFile)="onChangeFile($event, 'avatar', 'string')"
+        (onChange)="onChangeFile($event, 'video', 'string')"
         #upload
         [maxlenght]="1"
         [files]="formData.video ? [{ url: formData.video }] : []"
@@ -76,7 +76,8 @@
         [fileHeight]="140"
         [boxWidth]="370"
         [type]="'video'"
-      ></app-upload>
+        [active]="true"
+        ></app-upload>
       }
     </div>
   </div>

+ 5 - 3
projects/live-app/src/modules/user/anchor/anchor.component.ts

@@ -21,7 +21,7 @@ interface FormGroup {
   nickname: string;
   photo: Array<any>;
   video: string;
-  sex: string;
+  sex?: string;
   remark: string;
 }
 @Component({
@@ -43,7 +43,7 @@ export class AnchorComponent implements OnInit {
     nickname: '',
     photo: [],
     video: '',
-    sex: '',
+    // sex: '',
     remark: '',
   };
   loading: any;
@@ -87,7 +87,7 @@ export class AnchorComponent implements OnInit {
       this.formData.mobile = this.profile?.get('mobile');
       this.formData.name = this.profile?.get('name');
       this.formData.nickname = this.user?.get('nickname');
-      this.formData.remark = this.user?.get('remark');
+      this.formData.remark = this.profile?.get('remark');
       this.formData.avatar =
         this.user?.get('avatar') ||
         'https://file-cloud.fmode.cn/DXNgcD6zo6/20221202/j6p8kb034039.png';
@@ -149,6 +149,8 @@ export class AnchorComponent implements OnInit {
     let data:any = this.formData;
     for (const key in data) {
       if (!data[key] || (key == 'photo' && !data[key].length)) {
+        console.log(key);
+        console.log(data[key]);
         this.loading.dismiss();
         const toast = await this.toastController.create({
           message: '请填写完整信息',