From 3962c2bb0435484b60a3e408e4738d792e249a53 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期一, 05 六月 2023 11:09:55 +0800
Subject: [PATCH] LEX CommunityNewCmp

---
 force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js |   70 +++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js b/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js
new file mode 100644
index 0000000..0d8ae06
--- /dev/null
+++ b/force-app/main/default/lwc/lexAgencyInfo/lexAgencyInfo.js
@@ -0,0 +1,70 @@
+import { LightningElement,track } from 'lwc';
+import initAgency from '@salesforce/apex/LexTopPageController.initAgency';
+
+export default class LexAgencyInfo extends LightningElement {
+    @track showSpinner = true;
+    @track showPage = false;
+    @track accountInfo;
+    @track accountId;
+    @track activeSections = ['A', 'B', 'C'];
+    //鏄惁涓�鐩存樉绀烘彁绀�
+    @track isNoteStay = true;
+
+    connectedCallback() {
+        this.init();
+    }
+
+    init() {
+        this.showSpinner = true;
+        initAgency()
+            .then(result => {
+                this.showPage = true;
+                this.isNoteStay = result.isNoteStay;
+                if (result.result == 'Success') {
+                    this.accountInfo = result.accountInfo;
+                    this.accountId = result.accountInfo.Id;
+                    this.showSpinner = false;
+                } else {
+                    this.showSpinner = false;
+                    console.log("Error:" + result.errorMsg);
+                    this.showMyToast('鍒濆鍖栭〉闈㈠け璐�', result.errorMsg, 'error');
+                }
+            })
+            .catch(error => {
+                this.showSpinner = false;
+                console.log("Error:" + error);
+                this.showMyToast('鍒濆鍖栭〉闈㈠け璐�', JSON.stringify(error), 'error');
+            })
+    }
+
+    showMyToast(title, message, variant) {
+        console.log('show custom message');
+        var iconName = '';
+        var content = '';
+        if(variant == 'success'){
+           iconName = 'utility:check';
+        }else{
+           iconName = 'utility:error';
+        }
+        if(message != ''){
+           content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+        }else{
+           content = '<h2><strong>'+title+'<strong/></h2>';
+        }
+        this.template.querySelector('c-common-toast').
+        showToast(variant,content,iconName,10000);
+        // var mode;
+        // if(this.isNoteStay){
+        //     mode ='sticky';
+        // }else{
+        //     mode = 'dismissable';
+        // }
+        // const evt = new ShowToastEvent({
+        //     title: title,
+        //     message: message,
+        //     variant: variant,
+        //     mode: mode
+        // });
+        // this.dispatchEvent(evt);
+     }
+}
\ No newline at end of file

--
Gitblit v1.9.1