mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
Update login.js
This commit is contained in:
parent
20e53c6d88
commit
cfb64e1eac
@ -33,23 +33,25 @@ $(function () {
|
|||||||
|
|
||||||
/*! 登录图形验证码刷新 */
|
/*! 登录图形验证码刷新 */
|
||||||
$body.on('click', '[data-captcha]', function () {
|
$body.on('click', '[data-captcha]', function () {
|
||||||
var type, token, $that, verifyField, uniqidField, captchaUrl;
|
var type, token, $that, verify, uniqid, captchaUrl;
|
||||||
$that = $(this), captchaUrl = this.getAttribute('data-captcha') || '';
|
$that = $(this), captchaUrl = this.getAttribute('data-captcha') || '';
|
||||||
if (captchaUrl.length < 5) return $.msg.tips('请设置验证码请求地址');
|
if (captchaUrl.length < 5) return $.msg.tips('请设置验证码请求地址');
|
||||||
uniqidField = this.getAttribute('data-field-uniqid') || 'uniqid';
|
uniqid = this.getAttribute('data-field-uniqid') || 'uniqid';
|
||||||
verifyField = this.getAttribute('data-field-verify') || 'verify';
|
verify = this.getAttribute('data-field-verify') || 'verify';
|
||||||
type = this.getAttribute('data-captcha-type') || 'captcha-type';
|
type = this.getAttribute('data-captcha-type') || 'captcha-type';
|
||||||
token = this.getAttribute('data-captcha-token') || 'captcha-token';
|
token = this.getAttribute('data-captcha-token') || 'captcha-token';
|
||||||
$.form.load(captchaUrl, {type: type, token: token}, 'post', function (ret) {
|
$.form.load(captchaUrl, {type: type, token: token}, 'post', function (ret) {
|
||||||
|
if (ret.code) {
|
||||||
$that.html('');
|
$that.html('');
|
||||||
$that.append($('<img alt="img" src="">').attr('src', ret.data.image));
|
$that.append($('<img alt="img" src="">').attr('src', ret.data.image));
|
||||||
$that.append($('<input type="hidden">').attr('name', uniqidField || 'uniqid').val(ret.data.uniqid));
|
$that.append($('<input type="hidden">').attr('name', uniqid).val(ret.data.uniqid));
|
||||||
if (ret.data.code) {
|
if (ret.data.code) {
|
||||||
$that.parents('form').find('[name=' + (verifyField || 'verify') + ']').attr('value', ret.data.code);
|
$that.parents('form').find('[name=' + verify + ']').attr('value', ret.data.code);
|
||||||
} else {
|
} else {
|
||||||
$that.parents('form').find('[name=' + (verifyField || 'verify') + ']').attr('value', '');
|
$that.parents('form').find('[name=' + verify + ']').attr('value', '');
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}, false);
|
}, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user