|
@@ -11,7 +11,7 @@ import { ionicStandaloneModules } from '../../ionic-standalone.modules';
|
|
|
templateUrl: './notice.component.html',
|
|
|
styleUrls: ['./notice.component.scss'],
|
|
|
standalone: true,
|
|
|
- imports: [SharedModule,...ionicStandaloneModules],
|
|
|
+ imports: [SharedModule, ...ionicStandaloneModules],
|
|
|
})
|
|
|
export class NoticeComponent implements OnInit {
|
|
|
active: string = 'notice';
|
|
@@ -37,6 +37,10 @@ export class NoticeComponent implements OnInit {
|
|
|
timer: any;
|
|
|
showModal: boolean = false; //是否长按弹窗
|
|
|
currentObject: any; //当前选择对象
|
|
|
+ isOpen: boolean = false;
|
|
|
+ codeUrl: string = '';
|
|
|
+ notices: Array<any> = [];
|
|
|
+
|
|
|
constructor(
|
|
|
private router: Router,
|
|
|
private aiSer: AiChatService,
|
|
@@ -53,6 +57,21 @@ export class NoticeComponent implements OnInit {
|
|
|
console.log(this.friends);
|
|
|
// let resChat = await this.aiSer.getLinkUsers(uid);
|
|
|
// resChat?.data && this.noticeList.push(...resChat.data);
|
|
|
+ this.getSetting();
|
|
|
+ this.getSysNotice()
|
|
|
+ }
|
|
|
+ async getSetting() {
|
|
|
+ let query = new Parse.Query('SiteConfig');
|
|
|
+ query.equalTo('company', this.aiSer.company);
|
|
|
+ query.notEqualTo('isDeleted', false);
|
|
|
+ query.select('wxCode');
|
|
|
+ let r = await query.first();
|
|
|
+ this.codeUrl = r?.get('wxCode');
|
|
|
+ }
|
|
|
+ async getSysNotice(){
|
|
|
+ let result = await this.aiSer.getSysNotice(Parse.User.current()?.id!)
|
|
|
+ this.notices = result.data
|
|
|
+ console.log(this.notices);
|
|
|
}
|
|
|
segmentChanged(e: any) {
|
|
|
let { value } = e.detail;
|
|
@@ -94,4 +113,35 @@ export class NoticeComponent implements OnInit {
|
|
|
if (this.showModal) return;
|
|
|
this.router.navigate([url]);
|
|
|
}
|
|
|
+ async download() {
|
|
|
+ let canvas: any = document.createElement('canvas');
|
|
|
+ canvas.height = '480';
|
|
|
+ canvas.width = '480';
|
|
|
+ let ctx = canvas.getContext('2d');
|
|
|
+ //绘制二维码
|
|
|
+ ctx.drawImage(await this.compileImage(this.codeUrl), 0, 0, 480, 480);
|
|
|
+ let tempSrc = canvas.toDataURL('image/png');
|
|
|
+ let dlLink: any = document.createElement('a');
|
|
|
+ if ('download' in dlLink) {
|
|
|
+ dlLink.style.visibility = 'hidden';
|
|
|
+ dlLink.href = tempSrc;
|
|
|
+ dlLink.download = '分享海报';
|
|
|
+ document.body.appendChild(dlLink);
|
|
|
+ dlLink.click();
|
|
|
+ document.body.removeChild(dlLink);
|
|
|
+ } else {
|
|
|
+ location.href = tempSrc;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ compileImage(url: string): Promise<any> {
|
|
|
+ return new Promise((res) => {
|
|
|
+ let img = new Image();
|
|
|
+ img.src = url;
|
|
|
+ img.setAttribute('crossOrigin', 'anonymous');
|
|
|
+ img.onload = function () {
|
|
|
+ res(img);
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|