|
@@ -12,18 +12,24 @@ import {
|
|
} from '../../../modules/ionic-standalone.modules';
|
|
} from '../../../modules/ionic-standalone.modules';
|
|
import { AccountService } from '../../../services/account.service';
|
|
import { AccountService } from '../../../services/account.service';
|
|
import { MessageService } from '../../../services/message.service';
|
|
import { MessageService } from '../../../services/message.service';
|
|
-import {VapInit} from '../../../lib/vap-player/index'
|
|
|
|
|
|
+import { VapInit } from '../../../lib/vap-player/index';
|
|
|
|
+import { RechargeComponent } from '../../../modules/account/recharge/recharge.component';
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
selector: 'app-gift-modal',
|
|
selector: 'app-gift-modal',
|
|
templateUrl: './gift-modal.component.html',
|
|
templateUrl: './gift-modal.component.html',
|
|
styleUrls: ['./gift-modal.component.scss'],
|
|
styleUrls: ['./gift-modal.component.scss'],
|
|
standalone: true,
|
|
standalone: true,
|
|
- imports: [...ionicStandaloneModules, CommonModule, FormsModule],
|
|
|
|
|
|
+ imports: [
|
|
|
|
+ ...ionicStandaloneModules,
|
|
|
|
+ CommonModule,
|
|
|
|
+ FormsModule,
|
|
|
|
+ RechargeComponent,
|
|
|
|
+ ],
|
|
})
|
|
})
|
|
export class GiftModalComponent implements OnInit {
|
|
export class GiftModalComponent implements OnInit {
|
|
@Input('toUid') toUid!: string; // 接收礼物的uid
|
|
@Input('toUid') toUid!: string; // 接收礼物的uid
|
|
- @Input('domId') domId: string = 'vap-warp'
|
|
|
|
|
|
+ @Input('domId') domId: string = 'vap-warp';
|
|
isOpenGift: boolean = false; // 是否显示礼物弹窗
|
|
isOpenGift: boolean = false; // 是否显示礼物弹窗
|
|
giftList: Array<any> = [];
|
|
giftList: Array<any> = [];
|
|
tabs: Array<any> = [
|
|
tabs: Array<any> = [
|
|
@@ -48,6 +54,13 @@ export class GiftModalComponent implements OnInit {
|
|
times: any;
|
|
times: any;
|
|
@Output() sendEmit: EventEmitter<any> = new EventEmitter<any>();
|
|
@Output() sendEmit: EventEmitter<any> = new EventEmitter<any>();
|
|
|
|
|
|
|
|
+ showRechargeModal: boolean = false;
|
|
|
|
+ options: Array<number> = [30, 50, 100, 200, 500, 1000, 2000, 5000];
|
|
|
|
+ company = localStorage.getItem('company');
|
|
|
|
+ account?: Parse.Object;
|
|
|
|
+ loading: any;
|
|
|
|
+ tradeNo: string = ''; //支付单号
|
|
|
|
+
|
|
constructor(
|
|
constructor(
|
|
private aiServ: AiChatService,
|
|
private aiServ: AiChatService,
|
|
private alertController: AlertController,
|
|
private alertController: AlertController,
|
|
@@ -56,13 +69,12 @@ export class GiftModalComponent implements OnInit {
|
|
public accServ: AccountService,
|
|
public accServ: AccountService,
|
|
public toastController: ToastController,
|
|
public toastController: ToastController,
|
|
public msgSerrvice: MessageService
|
|
public msgSerrvice: MessageService
|
|
- ) {
|
|
|
|
- }
|
|
|
|
|
|
+ ) {}
|
|
async ngOnInit() {
|
|
async ngOnInit() {
|
|
this.giftList = this.msgSerrvice.giftList;
|
|
this.giftList = this.msgSerrvice.giftList;
|
|
- setTimeout(()=>{
|
|
|
|
- this.selectTab("all")
|
|
|
|
- },200)
|
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.selectTab('all');
|
|
|
|
+ }, 200);
|
|
}
|
|
}
|
|
async openModal() {
|
|
async openModal() {
|
|
let uid: any = Parse.User.current()?.id;
|
|
let uid: any = Parse.User.current()?.id;
|
|
@@ -82,7 +94,10 @@ export class GiftModalComponent implements OnInit {
|
|
|
|
|
|
async sendGift() {
|
|
async sendGift() {
|
|
let _this = this;
|
|
let _this = this;
|
|
- if(!this.wallet?.balance || this.wallet.balance < this.currentGift.price * this.giftCount){
|
|
|
|
|
|
+ if (
|
|
|
|
+ !this.wallet?.balance ||
|
|
|
|
+ this.wallet.balance < this.currentGift.price * this.giftCount
|
|
|
|
+ ) {
|
|
const toast = await this.toastController.create({
|
|
const toast = await this.toastController.create({
|
|
message: '余额不足',
|
|
message: '余额不足',
|
|
color: 'danger',
|
|
color: 'danger',
|
|
@@ -114,7 +129,7 @@ export class GiftModalComponent implements OnInit {
|
|
.putGift(_this.toUid, _this.currentGift.id, _this.giftCount)
|
|
.putGift(_this.toUid, _this.currentGift.id, _this.giftCount)
|
|
.then((data) => {
|
|
.then((data) => {
|
|
console.log(data);
|
|
console.log(data);
|
|
- // _this.liveService.get_duration();
|
|
|
|
|
|
+ _this.liveService.get_duration();
|
|
loading.dismiss();
|
|
loading.dismiss();
|
|
_this.sendEmit.emit(); //触发父组件的sendEmit事件
|
|
_this.sendEmit.emit(); //触发父组件的sendEmit事件
|
|
_this.isOpenGift = false;
|
|
_this.isOpenGift = false;
|
|
@@ -126,7 +141,7 @@ export class GiftModalComponent implements OnInit {
|
|
// console.log('5s后关闭');
|
|
// console.log('5s后关闭');
|
|
// }, 5000);
|
|
// }, 5000);
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
- this.initPlayer()
|
|
|
|
|
|
+ this.initPlayer();
|
|
}, 0);
|
|
}, 0);
|
|
})
|
|
})
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
@@ -141,12 +156,11 @@ export class GiftModalComponent implements OnInit {
|
|
await alert.present();
|
|
await alert.present();
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- initPlayer(){
|
|
|
|
- console.log('送出礼物',this.currentGift);
|
|
|
|
- let json = this.currentGift.config
|
|
|
|
- let dom:any = document.getElementById(this.domId);
|
|
|
|
- let vapPlayer:any = VapInit({
|
|
|
|
|
|
+ initPlayer() {
|
|
|
|
+ console.log('送出礼物', this.currentGift);
|
|
|
|
+ let json = this.currentGift.config;
|
|
|
|
+ let dom: any = document.getElementById(this.domId);
|
|
|
|
+ let vapPlayer: any = VapInit({
|
|
container: dom, // 要渲染的载体,dom元素
|
|
container: dom, // 要渲染的载体,dom元素
|
|
src: this.currentGift.video, // vap动画地址
|
|
src: this.currentGift.video, // vap动画地址
|
|
config: json, // 播放vap动画需要的 json文件。必填
|
|
config: json, // 播放vap动画需要的 json文件。必填
|
|
@@ -167,7 +181,9 @@ export class GiftModalComponent implements OnInit {
|
|
vapPlayer = null;
|
|
vapPlayer = null;
|
|
console.log('play end');
|
|
console.log('play end');
|
|
});
|
|
});
|
|
- vapPlayer.on('playering', function() { console.log('playering'); })
|
|
|
|
|
|
+ vapPlayer.on('playering', function () {
|
|
|
|
+ console.log('playering');
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
onCloseGiftModal() {
|
|
onCloseGiftModal() {
|
|
@@ -184,4 +200,15 @@ export class GiftModalComponent implements OnInit {
|
|
this.toUid
|
|
this.toUid
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /* 充值返回结果 */
|
|
|
|
+ async onRecharge(e: any) {
|
|
|
|
+ console.log(e);
|
|
|
|
+ if (e) {
|
|
|
|
+ let uid: any = Parse.User.current()?.id;
|
|
|
|
+ this.wallet = await this.aiServ.getWallet(uid);
|
|
|
|
+ this.liveService.get_duration();
|
|
|
|
+ }
|
|
|
|
+ this.showRechargeModal = false;
|
|
|
|
+ }
|
|
}
|
|
}
|