' +
+ '
' +
+ _.escape(message) +
+ '
'
+ )
+ $body.append($w)
+
+ const iframeWidth = $w.parent().width() as number
+ const iframeHeight = $w.parent().height() as number
+
+ const windowWidth = $w.width() as number
+ const windowHeight = $w.height() as number
+
+ let setWidth = (iframeWidth - windowWidth) / 2
+ let setHeight = (iframeHeight - windowHeight) / 2
+ if (iframeHeight < windowHeight || setHeight < 0) {
+ setHeight = 0
+ }
+ if (iframeWidth < windowWidth || setWidth < 0) {
+ setWidth = 0
+ }
+ $w.css({ left: setWidth, top: setHeight })
+ setTimeout(() => {
+ $w.remove()
+ }, 3000)
+ }
+
+ /**
+ * 弹出用户必须点击确认的错误信息
+ */
+ showErrorDialog(msgOrTitle: string, msg?: string, dangerouslyUseHTMLString?: boolean, closeCallBack?: () => void) {
+ let title, message
+ if (!msg) {
+ console.trace(msgOrTitle)
+ title = '错误'
+ message = msgOrTitle
+
+ } else {
+ console.trace(msg)
+ title = msgOrTitle
+ message = msg
+ }
+
+ // 如果有一样的内容,就不添加
+ if (_.findIndex(this.errorDialogContent, r => r === message) >= 0) {
+ return
+ }
+ this.errorDialogContent.push(message)
+ if (!this.errorDialogIsShowing) {
+ // 只有在没有弹出对话框的清空下才弹出
+ this.errorDialogIsShowing = true
+ ElMessageBox.alert(
+ //@ts-ignore
+ () => {
+ if (this.errorDialogContent.length <= 0) {
+ return ''
+ }
+ return _.map(this.errorDialogContent, (item) =>
+ h('div', null, item)
+ )
+ },
+ title,
+ {
+ dangerouslyUseHTMLString: false,
+ closeOnPressEscape: true,
+ closeOnClickModal: true,
+ confirmButtonText: '关闭',
+ type: 'error',
+ draggable: true,
+ callback: () => {
+ this.errorDialogIsShowing = false
+ nextTick(() => {
+ this.errorDialogContent.splice(0, this.errorDialogContent.length)
+ })
+ if (closeCallBack) closeCallBack()
+ }
+ }
+ )
+ }
+ }
+
+ /**
+ * 弹出用户必须确认的提示信息
+ */
+ showInfoDialog(content: string, option: showDialogOption = {
+ confirmButtonText: '关闭',
+ draggable: true,
+ showCancelButton: false,
+ showClose: false,
+ dangerouslyUseHTMLString: true,
+ autofocus: true,
+ closeOnClickModal: false,
+ closeOnPressEscape: true
+ }) {
+ return this.alert(content, option)
+ }
+
+ /**
+ * 信息提示内容,强提示,必须用户点击确认
+ */
+ alert(msg: string, option?: showDialogOption): Promise