|
@@ -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,
|
|
|
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) {
|
|
|
+
|
|
|
+ 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) 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) || [];
|
|
|
+
|
|
|
+ switch (type) {
|
|
|
+ case 'follow':
|
|
|
+ data = await this.aiServ.getRooms({
|
|
|
+ title: this.value,
|
|
|
+ skip:this.roomList.length,
|
|
|
+ uid: uid,
|
|
|
+
|
|
|
+ follow: true,
|
|
|
+ sex,
|
|
|
+ city: this.city,
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case 'recommend':
|
|
|
+ data = await this.aiServ.getRooms({
|
|
|
+ title: this.value,
|
|
|
+ skip:this.roomList.length,
|
|
|
+ uid: uid,
|
|
|
+
|
|
|
+ recommend: true,
|
|
|
+ sex,
|
|
|
+ city: this.city,
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case 'news':
|
|
|
+ data = await this.aiServ.getRooms({
|
|
|
+ title: this.value,
|
|
|
+ skip:this.roomList.length,
|
|
|
+ uid: uid,
|
|
|
+
|
|
|
+ sex,
|
|
|
+ city: this.city,
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case '三星':
|
|
|
+ data = await this.aiServ.getRooms({
|
|
|
+ title: this.value,
|
|
|
+ skip:this.roomList.length,
|
|
|
+ uid: uid,
|
|
|
+
|
|
|
+ star: '三星',
|
|
|
+ sex,
|
|
|
+ city: this.city,
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case '四星':
|
|
|
+ data = await this.aiServ.getRooms({
|
|
|
+ title: this.value,
|
|
|
+ skip:this.roomList.length,
|
|
|
+ uid: uid,
|
|
|
+
|
|
|
+ star: '四星',
|
|
|
+ sex,
|
|
|
+ city: this.city,
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case '五星':
|
|
|
+ data = await this.aiServ.getRooms({
|
|
|
+ title: this.value,
|
|
|
+ skip:this.roomList.length,
|
|
|
+ uid: uid,
|
|
|
+
|
|
|
+ star: '五星',
|
|
|
+ sex,
|
|
|
+ city: this.city,
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case '海外':
|
|
|
+ data = await this.aiServ.getRooms({
|
|
|
+ title: this.value,
|
|
|
+ skip:this.roomList.length,
|
|
|
+ uid: uid,
|
|
|
+
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|