const TYPE = "DISABLE"; import "./disable.scss" import {Dom} from "../common/common"; function getTemplate(styleConfig) { return `
${styleConfig.i18n.disable_title}
`; } class Disable { constructor(boxEl, styleConfig) { this.boxEl = boxEl; this.styleConfig = styleConfig; this.type = TYPE; this.currentCaptchaData = {} } init(captchaData, endCallback, loadSuccessCallback) { // 重载样式 this.destroy(); this.boxEl.append(getTemplate(this.styleConfig)); this.el = this.boxEl.find("#tianai-captcha"); // 绑定全局 // window.currentCaptcha = this; // 载入验证码 this.loadCaptchaForData(this, captchaData); this.endCallback = endCallback; if (loadSuccessCallback) { // 加载成功 loadSuccessCallback(this); } return this; } destroy () { const existsCaptchaEl = this.boxEl.find("#tianai-captcha"); if (existsCaptchaEl) { existsCaptchaEl.remove(); } } loadCaptchaForData (that, data) { const msg = data.msg || data.message || "接口异常"; that.el.find("#content-span").text(msg); } } export default Disable;