|
@@ -14,12 +14,23 @@ import {
|
|
|
LoadingController,
|
|
|
} from '../../ionic-standalone.modules';
|
|
|
import { CommonModule, DatePipe } from '@angular/common';
|
|
|
+import { province } from '../../../services/address';
|
|
|
+import { FormsModule } from '@angular/forms';
|
|
|
+province.unshift({
|
|
|
+ provinceName: '全部',
|
|
|
+ citys: [
|
|
|
+ {
|
|
|
+ cityName: '',
|
|
|
+ cityType: '',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+});
|
|
|
@Component({
|
|
|
selector: 'app-home',
|
|
|
templateUrl: './home.component.html',
|
|
|
styleUrls: ['./home.component.scss'],
|
|
|
standalone: true,
|
|
|
- imports: [...ionicStandaloneModules, CommonModule],
|
|
|
+ imports: [...ionicStandaloneModules, CommonModule,FormsModule],
|
|
|
// schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
|
providers: [DatePipe],
|
|
|
})
|
|
@@ -77,6 +88,15 @@ export class HomeComponent implements OnInit {
|
|
|
};
|
|
|
return map[this.viewAnchor];
|
|
|
}
|
|
|
+ isOpenCity: boolean = false;
|
|
|
+ provinceColumns = province.map((item) => item.provinceName);
|
|
|
+ cityColumns = province[0].citys.map((item) => item.cityName);
|
|
|
+ province: string = ''; //省份
|
|
|
+ city: string = ''; //市
|
|
|
+ old_province: string = ''; //省份
|
|
|
+ old_city: string = ''; //市
|
|
|
+ isColumn: boolean = false; //单排
|
|
|
+ userList: Array<string> | any = [];
|
|
|
constructor(
|
|
|
private loadingCtrl: LoadingController,
|
|
|
private alertController: AlertController,
|
|
@@ -84,7 +104,7 @@ export class HomeComponent implements OnInit {
|
|
|
private connectTask: ConnectTaskService,
|
|
|
private router: Router,
|
|
|
private aiServ: AiChatService,
|
|
|
- private datePipe: DatePipe,
|
|
|
+ private datePipe: DatePipe
|
|
|
) {}
|
|
|
|
|
|
ngOnInit() {
|
|
@@ -169,50 +189,60 @@ export class HomeComponent implements OnInit {
|
|
|
if (!this.connectTask.onlineUserList.size) {
|
|
|
await this.connectTask.getOnlieUserList('user_connect_room');
|
|
|
}
|
|
|
- const userList = Array.from(this.connectTask.onlineUserList);
|
|
|
- console.log(userList);
|
|
|
+ this.userList = Array.from(this.connectTask.onlineUserList)|| [];
|
|
|
+ // console.log(userList);
|
|
|
switch (type) {
|
|
|
case 'follow':
|
|
|
data = await this.aiServ.getRooms({
|
|
|
uid: uid,
|
|
|
- users: userList,
|
|
|
+ // users: userList,
|
|
|
follow: true,
|
|
|
sex,
|
|
|
+ city: this.city,
|
|
|
});
|
|
|
break;
|
|
|
case 'recommend':
|
|
|
data = await this.aiServ.getRooms({
|
|
|
uid: uid,
|
|
|
- users: userList,
|
|
|
+ // users: userList,
|
|
|
recommend: true,
|
|
|
sex,
|
|
|
+ city: this.city,
|
|
|
});
|
|
|
break;
|
|
|
case 'news':
|
|
|
- data = await this.aiServ.getRooms({ uid: uid, users: userList, sex });
|
|
|
+ data = await this.aiServ.getRooms({
|
|
|
+ uid: uid,
|
|
|
+ // users: userList,
|
|
|
+ sex,
|
|
|
+ city: this.city,
|
|
|
+ });
|
|
|
break;
|
|
|
case '三星':
|
|
|
data = await this.aiServ.getRooms({
|
|
|
uid: uid,
|
|
|
- users: userList,
|
|
|
+ // users: userList,
|
|
|
star: '三星',
|
|
|
sex,
|
|
|
+ city: this.city,
|
|
|
});
|
|
|
break;
|
|
|
case '四星':
|
|
|
data = await this.aiServ.getRooms({
|
|
|
uid: uid,
|
|
|
- users: userList,
|
|
|
+ // users: userList,
|
|
|
star: '四星',
|
|
|
sex,
|
|
|
+ city: this.city,
|
|
|
});
|
|
|
break;
|
|
|
case '五星':
|
|
|
data = await this.aiServ.getRooms({
|
|
|
uid: uid,
|
|
|
- users: userList,
|
|
|
+ // users: userList,
|
|
|
star: '五星',
|
|
|
sex,
|
|
|
+ city: this.city,
|
|
|
});
|
|
|
break;
|
|
|
default:
|
|
@@ -280,4 +310,35 @@ export class HomeComponent implements OnInit {
|
|
|
toUrl(url: string) {
|
|
|
url && this.router.navigate([url]);
|
|
|
}
|
|
|
+
|
|
|
+ changeCityCancel(type: string) {
|
|
|
+ if (type === 'confirm') {
|
|
|
+ if (this.city !== this.old_city) {
|
|
|
+ this.getRoom();
|
|
|
+ }
|
|
|
+ this.old_province = this.province;
|
|
|
+ this.old_city = this.city;
|
|
|
+ } else {
|
|
|
+ this.province = this.old_province;
|
|
|
+ this.city = this.old_city;
|
|
|
+ }
|
|
|
+ this.isOpenCity = false;
|
|
|
+ }
|
|
|
+ onIonChangeCity(event: CustomEvent, type: string) {
|
|
|
+ let val = event.detail.value;
|
|
|
+ switch (type) {
|
|
|
+ case 'province':
|
|
|
+ this.province = event.detail.value;
|
|
|
+ this.cityColumns = province
|
|
|
+ .find((item) => item.provinceName === val)
|
|
|
+ ?.citys.map((item) => item.cityName)!;
|
|
|
+ console.log(this.cityColumns);
|
|
|
+ this.city = this.cityColumns[0];
|
|
|
+ break;
|
|
|
+ case 'city':
|
|
|
+ this.city = event.detail.value;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ console.log(this.province, this.city);
|
|
|
+ }
|
|
|
}
|