|
@@ -1,12 +1,46 @@
|
|
|
|
+// tab2.page.ts
|
|
import { Component } from '@angular/core';
|
|
import { Component } from '@angular/core';
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
selector: 'app-tab2',
|
|
selector: 'app-tab2',
|
|
templateUrl: 'tab2.page.html',
|
|
templateUrl: 'tab2.page.html',
|
|
- styleUrls: ['tab2.page.scss']
|
|
|
|
|
|
+ styleUrls: ['tab2.page.scss'],
|
|
})
|
|
})
|
|
export class Tab2Page {
|
|
export class Tab2Page {
|
|
|
|
+ segment: string = 'company';
|
|
|
|
+ results: any[] = [
|
|
|
|
+ { name: '装修公司A', price: '200元/㎡', rating: 4.5 },
|
|
|
|
+ { name: '设计机构B', price: '150元/㎡', rating: 4.2 },
|
|
|
|
+ { name: '设计师C', price: '180元/㎡', rating: 4.8 },
|
|
|
|
+ // 其他搜索结果数据
|
|
|
|
+ ];
|
|
|
|
+ filteredResults: any[] = [];
|
|
|
|
|
|
- constructor() {}
|
|
|
|
|
|
+ constructor() {
|
|
|
|
+ this.filteredResults = this.results;
|
|
|
|
+ }
|
|
|
|
|
|
-}
|
|
|
|
|
|
+ filterResults() {
|
|
|
|
+ this.filteredResults = this.results.filter(result => {
|
|
|
|
+ // 添加筛选条件的逻辑判断
|
|
|
|
+ return true; // 示例中未添加具体筛选条件,需要根据实际需求补充
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ viewCompanyDetail(company: any) {
|
|
|
|
+ // 跳转到装修公司详情页
|
|
|
|
+ console.log(`查看${company.name}的详细信息`);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ segmentChanged(event: any) {
|
|
|
|
+ this.segment = event.detail.value;
|
|
|
|
+ // 根据不同的 segment 值过滤结果
|
|
|
|
+ if (this.segment === 'company') {
|
|
|
|
+ this.filteredResults = this.results.filter(result => result.name.includes('公司'));
|
|
|
|
+ } else if (this.segment === 'design') {
|
|
|
|
+ this.filteredResults = this.results.filter(result => result.name.includes('设计机构'));
|
|
|
|
+ } else if (this.segment === 'designer') {
|
|
|
|
+ this.filteredResults = this.results.filter(result => result.name.includes('设计师'));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|