12345678910111213141516171819202122232425262728293031 |
- import { Component, OnInit } from '@angular/core';
- @Component({
- selector: 'app-feedback',
- templateUrl: './feedback.page.html',
- styleUrls: ['./feedback.page.scss'],
- })
- export class FeedbackPage implements OnInit {
- chatMessages: { text: string, sender: string, avatar: string }[] = [];
- newMessage: string = '';
- constructor() {}
- ngOnInit() {
- // 模拟一些聊天消息
- this.chatMessages = [
- { text: '你好,请问有什么可以帮助您的吗?', sender: 'customer', avatar: 'https://img-bsy.txrpic.com/preview/Element/00/00/89/11/E-891182-2418FE26A.png?imageMogr2/quality/90/thumbnail/320x%3E' },
- { text: '您好,我想咨询一下关于产品的信息。', sender: 'support', avatar: 'https://tse3-mm.cn.bing.net/th/id/OIP-C.c43kVbudRWN3-pJYtmfugAAAAA?rs=1&pid=ImgDetMain' }
- ];
- }
- sendMessage() {
- if (this.newMessage.trim() !== '') {
- this.chatMessages.push({ text: this.newMessage, sender: 'customer', avatar: 'https://tse3-mm.cn.bing.net/th/id/OIP-C.c43kVbudRWN3-pJYtmfugAAAAA?rs=1&pid=ImgDetMain' });
- // 在这里可以添加客服回复的逻辑
- this.newMessage = '';
- }
- }
- }
|