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/lexLicenceReminder/lexLicenceReminder.js |   64 ++++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js b/force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js
new file mode 100644
index 0000000..f154617
--- /dev/null
+++ b/force-app/main/default/lwc/lexLicenceReminder/lexLicenceReminder.js
@@ -0,0 +1,64 @@
+import { LightningElement,track} from 'lwc';
+import initReminder from '@salesforce/apex/LexLicenceReminderController.initReminder';
+
+export default class LexLicenceReminder extends LightningElement {
+    @track days = 0;
+    @track isShowReminder = false;
+    @track msg = '';
+
+    connectedCallback(){
+        initReminder()
+        .then(result=>{
+            if (result.result == 'Success') {
+                this.days = result.days;
+                this.isShowReminder = result.isShowReminder;
+                if(this.days > 0){
+                    this.msg = '鎮ㄧ殑鍖荤枟鍣ㄦ缁忚惀浼佷笟璁稿彲璇佽繕鏈�'+this.days+'澶╁氨鍒版湡浜嗭紒';
+                }else if(this.days == 0){
+                    this.msg = '鎮ㄧ殑鍖荤枟鍣ㄦ缁忚惀浼佷笟璁稿彲璇佷粖澶╁氨鍒版湡浜嗭紒';
+                }else if(this.days < 0){
+                    var days = this.days * -1
+                    this.msg = '鎮ㄧ殑鍖荤枟鍣ㄦ缁忚惀浼佷笟璁稿彲璇佸凡缁忚繃鏈�'+days+'澶╀簡锛�';
+                }
+            } else {
+                console.log("Error:" + result.errorMsg);
+                this.showMyToast(result.errorMsg, '', 'error');
+            }
+        })
+        .catch(error => {
+            console.log("Error:" + JSON.stringify(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