|
@@ -2,7 +2,9 @@ import { Component, OnInit } from '@angular/core';
|
|
|
import { IonicModule } from '@ionic/angular';
|
|
|
|
|
|
import * as Parse from 'parse';
|
|
|
-
|
|
|
+import { AgreementComponent } from '../../login/agreement/agreement.component';
|
|
|
+import { AlertController, ModalController } from '@ionic/angular';
|
|
|
+import { Router } from '@angular/router';
|
|
|
@Component({
|
|
|
selector: 'app-my',
|
|
|
templateUrl: './my.component.html',
|
|
@@ -12,58 +14,72 @@ import * as Parse from 'parse';
|
|
|
})
|
|
|
export class MyComponent implements OnInit {
|
|
|
user?: Parse.Object = Parse.User.current();
|
|
|
- constructor() {}
|
|
|
- tools: Array<{ icon: string; title: string }> = [
|
|
|
+ constructor(
|
|
|
+ private modalController: ModalController,
|
|
|
+ private alertController: AlertController,
|
|
|
+ private router: Router
|
|
|
+ ) {}
|
|
|
+ tools: Array<{ icon: string; title: string; path: string }> = [
|
|
|
{
|
|
|
icon: '/img/钱包.png',
|
|
|
title: '钱包',
|
|
|
+ path: '',
|
|
|
},
|
|
|
{
|
|
|
icon: '/img/相册.png',
|
|
|
title: '相册',
|
|
|
+ path: '',
|
|
|
},
|
|
|
{
|
|
|
icon: '/img/邀请.png',
|
|
|
title: '邀请',
|
|
|
+ path: '',
|
|
|
},
|
|
|
{
|
|
|
icon: '/img/设置.png',
|
|
|
title: '设置',
|
|
|
- },
|
|
|
- ];
|
|
|
- settings: Array<{ icon: string; title: string; path: string }> = [
|
|
|
- {
|
|
|
- icon: '/img/成为主播.png',
|
|
|
- title: '成为主播',
|
|
|
- path: '',
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/img/隐私.png',
|
|
|
- title: '隐私协议',
|
|
|
- path: '',
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/img/意见反馈.png',
|
|
|
- title: '意见反馈',
|
|
|
- path: '',
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/img/在线客服.png',
|
|
|
- title: '在线客服',
|
|
|
- path: '',
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/img/直播协议.png',
|
|
|
- title: '直播协议',
|
|
|
- path: '',
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/img/退出登录.png',
|
|
|
- title: '退出登录',
|
|
|
path: '',
|
|
|
},
|
|
|
];
|
|
|
+ registerAgreement: any; //用户协议
|
|
|
+ liveAgreement: any; //直播协议
|
|
|
+ company: string | null = localStorage?.getItem('company');
|
|
|
ngOnInit() {
|
|
|
- console.log(this.user);
|
|
|
+ this.getAgreement();
|
|
|
+ }
|
|
|
+ getAgreement() {
|
|
|
+ let Agreement = new Parse.Query('ContractAgreement');
|
|
|
+ Agreement.equalTo('company', this.company);
|
|
|
+ Agreement.equalTo('type', 'register');
|
|
|
+ Agreement.first().then((res) => {
|
|
|
+ console.log(res);
|
|
|
+ this.registerAgreement = res;
|
|
|
+ });
|
|
|
+ let Agreement2 = new Parse.Query('ContractAgreement');
|
|
|
+ Agreement2.equalTo('company', this.company);
|
|
|
+ Agreement2.equalTo('type', 'live');
|
|
|
+ Agreement2.first().then((res) => {
|
|
|
+ console.log(res);
|
|
|
+ this.liveAgreement = res;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ toUrl(url: string, params?: Object) {
|
|
|
+ if (params) {
|
|
|
+ this.router.navigate([url, Object]);
|
|
|
+ } else {
|
|
|
+ this.router.navigate([url]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ async showAgreement(type: string) {
|
|
|
+ if (type == 'liveAgreement' || type == 'registerAgreement') {
|
|
|
+ const modal = await this.modalController.create({
|
|
|
+ component: AgreementComponent,
|
|
|
+ cssClass: 'my-custom-class',
|
|
|
+ componentProps: {
|
|
|
+ agreement: this[type],
|
|
|
+ },
|
|
|
+ });
|
|
|
+ return await modal.present();
|
|
|
+ }
|
|
|
}
|
|
|
}
|