- assets/vendor 全量迁移: fontawesome5→assets/fontawesome5, css→assets/css, js→assets/js/runtime(避开 14 个同名自有文件), img 合并去重→assets/img, fonts→assets/fonts; 删除 assets/vendor - libs 五个与 widgets/third-party 字节相同的库不重复入库, loader paths 改指向 - 运行时切换: _win.uri=assets 根, loader baseUrl=/js/runtime, enlighter 注入 路径同步; PHP 7 个引用文件切换并改名 $zibll_*→$runtime_* - 去品牌: Qinver 头注释/品牌 console.log/演示链接清除, 默认文案中性化 - 功能标识符改名: zib__→aksrt__, zib_ajax→aksrt_ajax, window.zib→ window.aksrtLegacy, zibllblock/*→aksrtblock/*, .zib-widget→.aksrt-panel, .zib-slider→.aksrt-slider, zib_menu_options meta 键等 - 自有 CSS 改名: legacy-utilities/compat-vars/footer shell - admin SPA 重建; 契约测试同步(路径/断言/文件更名) - 例外保留: tests/visual 对照环境与 fixtures 前缀(外部 Zibll 产品引用) 验证: php -l 133 个改动文件通过; runtime 86 个 JS node --check 通过; 契约测试 68/70(2 个失败经 stash 对照确认为存量问题)
130 lines
3.7 KiB
JavaScript
130 lines
3.7 KiB
JavaScript
function CaptchaInit() {
|
|
var _mode = $('[machine-verification]');
|
|
var mode = _mode.attr('machine-verification');
|
|
var _body = $('body');
|
|
window.captcha = {};
|
|
|
|
function get_img(_this) {
|
|
$.ajax({
|
|
url: _win.uri + '/action/captcha.php',
|
|
data: {
|
|
type: 'image',
|
|
id: _this.attr('imagecaptcha-id'),
|
|
},
|
|
}).done(function (data) {
|
|
_this.html('<img alt="' + aksrt__('captcha_click_refresh') + '" src="' + data.img + '">');
|
|
});
|
|
}
|
|
|
|
switch (mode) {
|
|
case 'image':
|
|
var _code = $('.imagecaptcha');
|
|
_code.each(function () {
|
|
get_img($(this));
|
|
});
|
|
|
|
_body.on('click', '.imagecaptcha', function () {
|
|
get_img($(this));
|
|
});
|
|
|
|
break;
|
|
|
|
case 'slider':
|
|
tbquire(['slidercaptcha']);
|
|
|
|
break;
|
|
case 'tcaptcha':
|
|
var $btn = $('#TencentCaptcha.aksrt-tcaptcha');
|
|
var appid = _mode.attr('tcaptcha-id');
|
|
if (!$btn.length) {
|
|
_body.append('<div class="hide aksrt-tcaptcha" id="TencentCaptcha" data-appid="' + appid + '" data-cbfn="TCaptchaOK" data-biz-state=""></div>');
|
|
}
|
|
tbquire(['tcaptcha-sdk']);
|
|
|
|
break;
|
|
|
|
case 'geetest':
|
|
GeetestOpenInit(false);
|
|
break;
|
|
}
|
|
}
|
|
CaptchaInit();
|
|
|
|
/*global SliderCaptchaModal, initGeetest4*/
|
|
/**
|
|
* 打开验证码弹窗
|
|
* @param {object} _this - 当前对象
|
|
* @param {string} mode - 模式,可选值为'slider'、'geetest'、'tcaptcha'
|
|
* @returns {number} - 返回1表示打开失败
|
|
*/
|
|
function CaptchaOpen(_this, mode) {
|
|
switch (mode) {
|
|
case 'slider':
|
|
tbquire(['slidercaptcha'], function () {
|
|
SliderCaptchaModal('show', _this);
|
|
});
|
|
break;
|
|
case 'geetest':
|
|
window.captcha._this = _this;
|
|
GeetestOpenInit(true);
|
|
break;
|
|
case 'tcaptcha':
|
|
TCaptchaOpen(_this);
|
|
break;
|
|
}
|
|
return !1;
|
|
}
|
|
|
|
//腾讯验证码弹窗
|
|
function TCaptchaOpen(_this) {
|
|
window.captcha._this = _this;
|
|
tbquire(['tcaptcha-sdk'], function () {
|
|
$('#TencentCaptcha.aksrt-tcaptcha').click();
|
|
});
|
|
}
|
|
|
|
function GeetestOpenInit(open) {
|
|
var _mode = $('[machine-verification]');
|
|
if (window.GeetestCaptcha) {
|
|
open && window.GeetestCaptcha.showCaptcha();
|
|
return;
|
|
}
|
|
if (!_mode.length) {
|
|
return;
|
|
}
|
|
tbquire(['https://static.geetest.com/v4/gt4.js'], function () {
|
|
initGeetest4(
|
|
{
|
|
captchaId: _mode.attr('geetest-id'),
|
|
product: 'bind',
|
|
},
|
|
function (captchaObj) {
|
|
captchaObj
|
|
.onReady(function () {
|
|
window.GeetestCaptcha = captchaObj;
|
|
open && captchaObj.showCaptcha();
|
|
})
|
|
.onSuccess(function () {
|
|
var getValidate = captchaObj.getValidate();
|
|
window.captcha.captcha_output = getValidate.captcha_output;
|
|
window.captcha.gen_time = getValidate.gen_time;
|
|
window.captcha.lot_number = getValidate.lot_number;
|
|
window.captcha.ticket = getValidate.pass_token;
|
|
window.captcha._this.click();
|
|
});
|
|
}
|
|
);
|
|
});
|
|
}
|
|
|
|
//腾讯验证码回调
|
|
function TCaptchaOK(res) {
|
|
window.captcha.ticket = 0;
|
|
window.captcha.randstr = 0;
|
|
if (res.ret === 0) {
|
|
window.captcha.ticket = res.ticket;
|
|
window.captcha.randstr = res.randstr;
|
|
window.captcha._this.click();
|
|
}
|
|
}
|