| | |
| | | import { LightningElement,track } from 'lwc'; |
| | | import { LightningElement, track } from 'lwc'; |
| | | import initAgency from '@salesforce/apex/LexTopPageController.initAgency'; |
| | | |
| | | export default class LexAgencyInfo extends LightningElement { |
| | |
| | | init() { |
| | | this.showSpinner = true; |
| | | initAgency() |
| | | .then(result => { |
| | | .then((result) => { |
| | | this.showPage = true; |
| | | this.isNoteStay = result.isNoteStay; |
| | | if (result.result == 'Success') { |
| | |
| | | this.showSpinner = false; |
| | | } else { |
| | | this.showSpinner = false; |
| | | console.log("Error:" + result.errorMsg); |
| | | this.showMyToast('初始化页面失败', result.errorMsg, 'error'); |
| | | console.log('Error:' + result.errorMsg); |
| | | this.showMyToast( |
| | | '初始化页面失败', |
| | | result.errorMsg, |
| | | 'error' |
| | | ); |
| | | } |
| | | }) |
| | | .catch(error => { |
| | | .catch((error) => { |
| | | this.showSpinner = false; |
| | | console.log("Error:" + error); |
| | | this.showMyToast('初始化页面失败', JSON.stringify(error), 'error'); |
| | | }) |
| | | 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 (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>'; |
| | | 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); |
| | | this.template |
| | | .querySelector('c-common-toast') |
| | | .showToast(variant, content, iconName, 10000); |
| | | // var mode; |
| | | // if(this.isNoteStay){ |
| | | // mode ='sticky'; |
| | |
| | | // mode: mode |
| | | // }); |
| | | // this.dispatchEvent(evt); |
| | | } |
| | | } |
| | | } |