|  | @@ -1,9 +1,11 @@
 | 
											
												
													
														|  | -import { Component, OnInit,NgModule } from '@angular/core';
 |  | 
 | 
											
												
													
														|  | 
 |  | +import { Component, OnInit } from '@angular/core';
 | 
											
												
													
														|  |  import { Router } from '@angular/router';
 |  |  import { Router } from '@angular/router';
 | 
											
												
													
														|  |  import { IonHeader,IonButton, IonContent, IonIcon, IonItem, IonLabel, IonList, 
 |  |  import { IonHeader,IonButton, IonContent, IonIcon, IonItem, IonLabel, IonList, 
 | 
											
												
													
														|  |    IonListHeader,IonCardHeader,IonCardTitle,IonCardContent, IonTitle,IonCard, IonToolbar,IonInput,IonSearchbar, IonSegment, IonSegmentButton, IonSelect, IonSelectOption } from '@ionic/angular/standalone';
 |  |    IonListHeader,IonCardHeader,IonCardTitle,IonCardContent, IonTitle,IonCard, IonToolbar,IonInput,IonSearchbar, IonSegment, IonSegmentButton, IonSelect, IonSelectOption } from '@ionic/angular/standalone';
 | 
											
												
													
														|  |    import { CommonModule } from '@angular/common';
 |  |    import { CommonModule } from '@angular/common';
 | 
											
												
													
														|  |    import { FormsModule } from '@angular/forms';
 |  |    import { FormsModule } from '@angular/forms';
 | 
											
												
													
														|  | 
 |  | +  import { HttpClient } from '@angular/common/http';
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  @Component({
 |  |  @Component({
 | 
											
												
													
														|  |    selector: 'app-page-publishsurvey',
 |  |    selector: 'app-page-publishsurvey',
 | 
											
										
											
												
													
														|  | @@ -11,9 +13,8 @@ import { IonHeader,IonButton, IonContent, IonIcon, IonItem, IonLabel, IonList,
 | 
											
												
													
														|  |    styleUrls: ['./page-publishsurvey.component.scss'],
 |  |    styleUrls: ['./page-publishsurvey.component.scss'],
 | 
											
												
													
														|  |    standalone: true,
 |  |    standalone: true,
 | 
											
												
													
														|  |    imports: [
 |  |    imports: [
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |      IonHeader,IonToolbar,IonTitle,IonContent,IonSegment,IonSegmentButton,IonSelect,IonSelectOption,
 |  |      IonHeader,IonToolbar,IonTitle,IonContent,IonSegment,IonSegmentButton,IonSelect,IonSelectOption,
 | 
											
												
													
														|  | -    IonList,IonListHeader,IonItem,IonCardTitle,
 |  | 
 | 
											
												
													
														|  | 
 |  | +    IonList,IonListHeader,IonItem,IonCardTitle,HttpClient,
 | 
											
												
													
														|  |      IonLabel,IonIcon,IonButton,IonCardContent,
 |  |      IonLabel,IonIcon,IonButton,IonCardContent,
 | 
											
												
													
														|  |      IonInput,IonSearchbar,IonCard,IonCardHeader,
 |  |      IonInput,IonSearchbar,IonCard,IonCardHeader,
 | 
											
												
													
														|  |      CommonModule,FormsModule
 |  |      CommonModule,FormsModule
 | 
											
										
											
												
													
														|  | @@ -26,8 +27,8 @@ export class PagePublishsurveyComponent  implements OnInit {
 | 
											
												
													
														|  |    surveyTitle: string = '';
 |  |    surveyTitle: string = '';
 | 
											
												
													
														|  |    surveyLink: string = '';
 |  |    surveyLink: string = '';
 | 
											
												
													
														|  |    targetAudience: string = 'all'; // 默认面向对象
 |  |    targetAudience: string = 'all'; // 默认面向对象
 | 
											
												
													
														|  | -  societySurveyTitle: string = '';
 |  | 
 | 
											
												
													
														|  | -  societySurveyLink: string = '';
 |  | 
 | 
											
												
													
														|  | 
 |  | +  // societySurveyTitle: string = '';
 | 
											
												
													
														|  | 
 |  | +  // societySurveyLink: string = '';
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |    onCategoryChange() {
 |  |    onCategoryChange() {
 | 
											
												
													
														|  |      console.log(`当前选择的类别: ${this.category}`);
 |  |      console.log(`当前选择的类别: ${this.category}`);
 | 
											
										
											
												
													
														|  | @@ -39,16 +40,32 @@ export class PagePublishsurveyComponent  implements OnInit {
 | 
											
												
													
														|  |      console.log(`链接: ${this.surveyLink}`);
 |  |      console.log(`链接: ${this.surveyLink}`);
 | 
											
												
													
														|  |      console.log(`面向对象: ${this.targetAudience}`);
 |  |      console.log(`面向对象: ${this.targetAudience}`);
 | 
											
												
													
														|  |      // 这里可以添加逻辑将问卷发布到后端或其他处理
 |  |      // 这里可以添加逻辑将问卷发布到后端或其他处理
 | 
											
												
													
														|  | 
 |  | +    const surveyData = {
 | 
											
												
													
														|  | 
 |  | +      title: this.surveyTitle,
 | 
											
												
													
														|  | 
 |  | +      link: this.surveyLink,
 | 
											
												
													
														|  | 
 |  | +      audience: this.targetAudience,
 | 
											
												
													
														|  | 
 |  | +    };
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    this.http.post('http://127.0.0.1:4040/apps/DevServer/browser/survey', surveyData).subscribe(
 | 
											
												
													
														|  | 
 |  | +      response => {
 | 
											
												
													
														|  | 
 |  | +        console.log('问卷已成功发布:', response);
 | 
											
												
													
														|  | 
 |  | +        // 发布成功后可以导航到心理普查页面
 | 
											
												
													
														|  | 
 |  | +        this.router.navigate(['tabs/psysurvey']);
 | 
											
												
													
														|  | 
 |  | +      },
 | 
											
												
													
														|  | 
 |  | +      error => {
 | 
											
												
													
														|  | 
 |  | +        console.error('发布问卷时出错:', error);
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +    );
 | 
											
												
													
														|  |    }
 |  |    }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -  publishSocietySurvey() {
 |  | 
 | 
											
												
													
														|  | -    console.log('发布社会问卷:');
 |  | 
 | 
											
												
													
														|  | -    console.log(`标题: ${this.societySurveyTitle}`);
 |  | 
 | 
											
												
													
														|  | -    console.log(`链接: ${this.societySurveyLink}`);
 |  | 
 | 
											
												
													
														|  | 
 |  | +  // publishSocietySurvey() {
 | 
											
												
													
														|  | 
 |  | +  //   console.log('发布社会问卷:');
 | 
											
												
													
														|  | 
 |  | +  //   console.log(`标题: ${this.societySurveyTitle}`);
 | 
											
												
													
														|  | 
 |  | +  //   console.log(`链接: ${this.societySurveyLink}`);
 | 
											
												
													
														|  |      // 这里可以添加逻辑将问卷发布到后端或其他处理
 |  |      // 这里可以添加逻辑将问卷发布到后端或其他处理
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | 
 |  | +  // }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -  constructor(private router: Router) { }
 |  | 
 | 
											
												
													
														|  | 
 |  | +  constructor(private router: Router,private http: HttpClient) { }
 | 
											
												
													
														|  |    goTab1(){
 |  |    goTab1(){
 | 
											
												
													
														|  |      this.router.navigate(['tabs/tab1']);
 |  |      this.router.navigate(['tabs/tab1']);
 | 
											
												
													
														|  |     }
 |  |     }
 |