interest-search.component.html 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <!-- src/app/interest-search/interest-search.component.html -->
  2. <ion-header [translucent]="true">
  3. <ion-toolbar>
  4. <ion-buttons slot="start">
  5. <ion-back-button default-href="/tabs/tab1" style="color:black;"></ion-back-button>
  6. </ion-buttons>
  7. <ion-title style="font-family: 'Courier New', Courier, monospace;">
  8. <span style="font-weight: bold;">调查问卷</span>
  9. </ion-title>
  10. </ion-toolbar>
  11. </ion-header>
  12. <ion-content color="light">
  13. <!-- 一、基本情况 -->
  14. <ion-list [inset]="true">
  15. <ion-item>
  16. <ion-label>一、基本情况</ion-label>
  17. </ion-item>
  18. <ion-item>
  19. <ion-label position="floating">姓名</ion-label>
  20. <ion-input [(ngModel)]="name"></ion-input>
  21. </ion-item>
  22. <ion-item>
  23. <ion-label position="floating">生日</ion-label>
  24. <ion-datetime displayFormat="YYYY-MM-DD" [(ngModel)]="birthday"></ion-datetime>
  25. </ion-item>
  26. </ion-list>
  27. <!-- 二、问卷问题 -->
  28. <ion-list [inset]="true">
  29. <!-- 遍历 questionsWithOptions 逐个显示问题 -->
  30. <div *ngFor="let question of questionsWithOptions">
  31. <!-- 问题文本 -->
  32. <ion-item>
  33. <ion-label>{{ question.questionText }}</ion-label>
  34. </ion-item>
  35. <!-- 选项列表 -->
  36. <ion-radio-group [(ngModel)]="answers[question.QuestionId]" [allowEmptySelection]="true">
  37. <!-- 如果选项还未加载完,显示加载中 -->
  38. <ion-item *ngIf="!question.optionsData || question.optionsData.length === 0">
  39. <ion-label>加载中...</ion-label>
  40. </ion-item>
  41. <!-- 加载完成后显示选项 -->
  42. <ion-item *ngFor="let option of question.optionsData">
  43. <ion-radio slot="start" [value]="option.OptionId"></ion-radio>
  44. <ion-label>{{ option.optionText }}</ion-label>
  45. </ion-item>
  46. </ion-radio-group>
  47. </div>
  48. </ion-list>
  49. <!-- 保存和提交按钮 -->
  50. <div style="display: flex; justify-content: space-between; align-items: center; margin: 0 15px;">
  51. <ion-button style="width: 45%;" (click)="save()">保存</ion-button>
  52. <ion-button id="yes/no" style="width: 45%;">提交</ion-button>
  53. <ion-alert trigger="yes/no" header="是否确定提交" [buttons]="alertButtons"></ion-alert>
  54. </div>
  55. </ion-content>