|
@@ -3,48 +3,64 @@ import { IonicModule } from '@ionic/angular';
|
|
import * as Parse from 'parse';
|
|
import * as Parse from 'parse';
|
|
import { InfiniteScrollCustomEvent } from '@ionic/angular';
|
|
import { InfiniteScrollCustomEvent } from '@ionic/angular';
|
|
import { Router } from '@angular/router';
|
|
import { Router } from '@angular/router';
|
|
|
|
+import { AiChatService } from '../../../services/aichart.service';
|
|
|
|
+import { SharedModule } from '../../shared.module';
|
|
@Component({
|
|
@Component({
|
|
selector: 'app-notice',
|
|
selector: 'app-notice',
|
|
templateUrl: './notice.component.html',
|
|
templateUrl: './notice.component.html',
|
|
styleUrls: ['./notice.component.scss'],
|
|
styleUrls: ['./notice.component.scss'],
|
|
standalone: true,
|
|
standalone: true,
|
|
- imports: [IonicModule],
|
|
|
|
|
|
+ imports: [IonicModule,SharedModule],
|
|
})
|
|
})
|
|
export class NoticeComponent implements OnInit {
|
|
export class NoticeComponent implements OnInit {
|
|
active: string = 'notice';
|
|
active: string = 'notice';
|
|
noticeList: Array<any> = [
|
|
noticeList: Array<any> = [
|
|
{
|
|
{
|
|
- avatar: Parse.User.current()?.get('avatar'),
|
|
|
|
|
|
+ avatar: '/img/notice.png',
|
|
name: '系统消息',
|
|
name: '系统消息',
|
|
content: '',
|
|
content: '',
|
|
createdAt: new Date(),
|
|
createdAt: new Date(),
|
|
},
|
|
},
|
|
|
|
+ ];
|
|
|
|
+ alertButtons = [
|
|
{
|
|
{
|
|
- avatar: Parse.User.current()?.get('avatar'),
|
|
|
|
- name: '系统消息',
|
|
|
|
- content: '',
|
|
|
|
- createdAt: new Date(),
|
|
|
|
|
|
+ text: '取消',
|
|
|
|
+ role: 'cancel',
|
|
|
|
+ handler: () => {
|
|
|
|
+ console.log('Alert canceled');
|
|
|
|
+ },
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- avatar: Parse.User.current()?.get('avatar'),
|
|
|
|
- name: '系统消息',
|
|
|
|
- content: '',
|
|
|
|
- createdAt: new Date(),
|
|
|
|
|
|
+ text: '确认',
|
|
|
|
+ role: 'confirm',
|
|
|
|
+ handler: () => {
|
|
|
|
+ console.log('Alert confirmed');
|
|
|
|
+ },
|
|
},
|
|
},
|
|
];
|
|
];
|
|
- friends: Array<Object> = [];
|
|
|
|
|
|
+ friends: Array<any> = [];
|
|
times: number = 0;
|
|
times: number = 0;
|
|
timer: any;
|
|
timer: any;
|
|
showModal: boolean = false; //是否长按弹窗
|
|
showModal: boolean = false; //是否长按弹窗
|
|
currentObject: any; //当前选择对象
|
|
currentObject: any; //当前选择对象
|
|
- constructor(private router: Router) {}
|
|
|
|
|
|
+ constructor(private router: Router, private aiSer:AiChatService) {}
|
|
|
|
|
|
- ngOnInit() {}
|
|
|
|
|
|
+ ngOnInit() {
|
|
|
|
+ this.refresh()
|
|
|
|
+ }
|
|
|
|
+ async refresh(){
|
|
|
|
+ let uid:any = Parse.User.current()?.id
|
|
|
|
+ let resultFriends = await this.aiSer.getFriends(uid)
|
|
|
|
+ this.friends = resultFriends['data']
|
|
|
|
+ console.log(this.friends);
|
|
|
|
+ let resChat = await this.aiSer.getLinkUsers(uid)
|
|
|
|
+ resChat?.data && this.noticeList.push(...resChat.data)
|
|
|
|
+ }
|
|
segmentChanged(e: any) {
|
|
segmentChanged(e: any) {
|
|
let { value } = e.detail;
|
|
let { value } = e.detail;
|
|
this.active = value;
|
|
this.active = value;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ /* 手指按下 */
|
|
startPress() {
|
|
startPress() {
|
|
this.showModal = false;
|
|
this.showModal = false;
|
|
if (this.times >= 500) {
|
|
if (this.times >= 500) {
|
|
@@ -58,11 +74,13 @@ export class NoticeComponent implements OnInit {
|
|
this.startPress();
|
|
this.startPress();
|
|
}, 500);
|
|
}, 500);
|
|
}
|
|
}
|
|
|
|
+ /* 触摸屏幕并移动,取消长按事件 */
|
|
onMousemove(e: any) {
|
|
onMousemove(e: any) {
|
|
clearTimeout(this.timer);
|
|
clearTimeout(this.timer);
|
|
- this.showModal = false;
|
|
|
|
|
|
+ // this.showModal = false;
|
|
this.times = 0;
|
|
this.times = 0;
|
|
}
|
|
}
|
|
|
|
+ /* 手指抬起 */
|
|
stopPress() {
|
|
stopPress() {
|
|
clearTimeout(this.timer);
|
|
clearTimeout(this.timer);
|
|
this.times = 0;
|
|
this.times = 0;
|
|
@@ -73,6 +91,7 @@ export class NoticeComponent implements OnInit {
|
|
(ev as InfiniteScrollCustomEvent).target.complete();
|
|
(ev as InfiniteScrollCustomEvent).target.complete();
|
|
}, 500);
|
|
}, 500);
|
|
}
|
|
}
|
|
|
|
+
|
|
toUrl(url: string) {
|
|
toUrl(url: string) {
|
|
if (this.showModal) return;
|
|
if (this.showModal) return;
|
|
this.router.navigate([url]);
|
|
this.router.navigate([url]);
|