|
@@ -6,7 +6,9 @@ import { HttpClient } from '@angular/common/http';
|
|
|
import { TestChatCompletion, TestChatMessage } from './class-test-chat-completion';
|
|
|
import { TestRxjsChatCompletion } from './class-rxjs-chat-completion';
|
|
|
|
|
|
-
|
|
|
+import { ModalController } from '@ionic/angular';
|
|
|
+import { ModalSuccessPage } from '../modal-success/modal-success.page';
|
|
|
+import { AlertController } from '@ionic/angular';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-tab3',
|
|
@@ -24,10 +26,13 @@ export class Tab3Page implements OnInit {
|
|
|
messageList:Array<TestChatMessage> = []
|
|
|
userInput:string = ""
|
|
|
|
|
|
+ aiTransportAdvice: string = ''; // 用于存储AI的建议
|
|
|
|
|
|
constructor(
|
|
|
private route: ActivatedRoute,
|
|
|
- private http: HttpClient // 注入HttpClient服务
|
|
|
+ private http: HttpClient, // 注入HttpClient服务
|
|
|
+ public modalCtrl: ModalController,
|
|
|
+ private alertController: AlertController // 注入 AlertController
|
|
|
) {}
|
|
|
|
|
|
ngOnInit() {
|
|
@@ -45,6 +50,25 @@ export class Tab3Page implements OnInit {
|
|
|
// 确认信息的逻辑
|
|
|
}
|
|
|
|
|
|
+ async showAlert() {
|
|
|
+ const alert = await this.alertController.create({
|
|
|
+ header: '确认信息',
|
|
|
+ message: '确认信息成功',
|
|
|
+ mode: 'ios', // 可以根据需要选择 'md', 'ios'
|
|
|
+ backdropDismiss: false, // 禁止点击背景关闭警告框
|
|
|
+ buttons: [
|
|
|
+ {
|
|
|
+ text: '关闭',
|
|
|
+ handler: () => {
|
|
|
+ // 点击确定后的操作
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ cssClass: 'custom-alert' // 自定义 CSS 类
|
|
|
+ });
|
|
|
+ await alert.present();
|
|
|
+ }
|
|
|
+
|
|
|
modifyInfo() {
|
|
|
console.log('信息将被修改');
|
|
|
// 修改信息的逻辑
|
|
@@ -75,6 +99,7 @@ export class Tab3Page implements OnInit {
|
|
|
console.log(`Content: ${content}`);
|
|
|
console.log(`Cumulative Content: ${cumulativeContent}`);
|
|
|
if (done) {
|
|
|
+ this.aiTransportAdvice = cumulativeContent; // 更新aiTransportAdvice属性
|
|
|
console.log('Stream completed');
|
|
|
}
|
|
|
},
|
|
@@ -84,10 +109,20 @@ export class Tab3Page implements OnInit {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+//点击确认跳转
|
|
|
confirmTransport() {
|
|
|
console.log('运输方式已确认');
|
|
|
- // 确认运输方式的逻辑
|
|
|
+
|
|
|
+ // 显示提交成功模态
|
|
|
+ this.presentSuccessModal();
|
|
|
+
|
|
|
+ }
|
|
|
+ async presentSuccessModal() {
|
|
|
+ const modal = await this.modalCtrl.create({
|
|
|
+ component: ModalSuccessPage,
|
|
|
+ cssClass: 'my-custom-class'
|
|
|
+ });
|
|
|
+ return await modal.present();
|
|
|
}
|
|
|
|
|
|
sendMessage(){
|