Compare commits

...

5 Commits

Author SHA1 Message Date
Karson d4c866cb55 优化格式化输出时文本编码 2024-04-02 17:50:19 +08:00
Karson 47c4115a53 优化日期区间选择组件事件 2024-04-02 17:41:29 +08:00
Karson 5a29c4eeed 优化customField字段
优化占位符替换
2024-04-02 17:16:51 +08:00
Karson 7898b811b2 优化验证码发送和验证 2024-04-02 16:18:31 +08:00
Karson 0de3858c90 优化登录失效判断 2024-04-02 15:07:04 +08:00
5 changed files with 29 additions and 23 deletions

View File

@ -8,7 +8,7 @@
<div class="input-group">
<input type="text" name="captcha" class="form-control" data-rule="required;length({$Think.config.captcha.length})" />
<span class="input-group-btn" style="padding:0;border:none;">
<img src="{:captcha_src()}" width="107" height="32" onclick="this.src = '{:captcha_src()}?r=' + Math.random();"/>
<img src="{:captcha_src()}" width="107" height="32" class="captcha-img" onclick="this.src = '{:captcha_src()}?r=' + Math.random();"/>
</span>
</div>
<span class="msg-box n-right" style="left:0;top:33px;text-align: left;" for="captcha"></span>

View File

@ -483,7 +483,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'cookie']
//如果登录已经超时,重新提醒登录
if (uid && uid != ret.data.uid) {
Controller.api.userinfo.set(null);
$(".operate[data-name='" + name + "'] .btn-install").trigger("click");
$(".operate[data-name='" + name + "'] .btn-install:first").trigger("click");
return;
}
top.Fast.api.open(ret.data.payurl, __('Pay now'), {

View File

@ -2,7 +2,7 @@ define(['fast', 'template', 'moment'], function (Fast, Template, Moment) {
var Frontend = {
api: {
//发送验证码
sendcaptcha: function (btn, type, data, callback) {
sendcaptcha: function (btn, type, data, success, error) {
$(btn).addClass("disabled", true).text("发送中...");
var si = {};
Frontend.api.ajax({url: $(btn).data("url"), data: data}, function (data, ret) {
@ -17,11 +17,15 @@ define(['fast', 'template', 'moment'], function (Fast, Template, Moment) {
$(btn).addClass("disabled").text(seconds + "秒后可再次发送");
}
}, 1000);
if (typeof callback == 'function') {
callback.call(this, data, ret);
if (typeof success == 'function') {
success.call(this, data, ret);
}
}, function () {
}, function (data, ret) {
$(btn).removeClass("disabled").text('发送验证码');
if (typeof error == 'function') {
error.call(this, data, ret);
}
});
},
//准备验证码
@ -39,6 +43,8 @@ define(['fast', 'template', 'moment'], function (Fast, Template, Moment) {
data.captcha = $("input[name=captcha]", form).val();
Frontend.api.sendcaptcha(btn, type, data, function (data, ret) {
Layer.close(index);
}, function (data, ret) {
$("img.captcha-img", form).trigger("click");
});
return true;
}

View File

@ -219,7 +219,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], functio
};
var origincallback = function (start, end) {
$(this.element).val(start.format(this.locale.format) + " - " + end.format(this.locale.format));
$(this.element).trigger('change');
$(this.element).trigger('change').trigger('validate');
};
$(".datetimerange", form).each(function () {
var callback = typeof $(this).data('callback') == 'function' ? $(this).data('callback') : origincallback;
@ -227,7 +227,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], functio
callback.call(picker, picker.startDate, picker.endDate);
});
$(this).on('cancel.daterangepicker', function (ev, picker) {
$(this).val('').trigger('change');
$(this).val('').trigger('change').trigger('validate');
});
$(this).daterangepicker($.extend(true, {}, options, $(this).data() || {}, $(this).data("daterangepicker-options") || {}));
});

View File

@ -833,8 +833,11 @@ define(['jquery', 'bootstrap'], function ($, undefined) {
},
search: function (value, row, index) {
var field = this.field;
if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
value = row[this.customField];
if (typeof this.customField !== 'undefined') {
var customValue = this.customField.split('.').reduce(function (obj, key) {
return obj === null || obj === undefined ? '' : obj[key];
}, row);
value = Fast.api.escape(customValue);
field = this.customField;
}
return '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', value) + '" data-field="' + field + '" data-value="' + value + '">' + value + '</a>';
@ -858,8 +861,11 @@ define(['jquery', 'bootstrap'], function ($, undefined) {
colorArr = $.extend(colorArr, this.custom);
}
var field = this.field;
if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
value = row[this.customField];
if (typeof this.customField !== 'undefined') {
var customValue = this.customField.split('.').reduce(function (obj, key) {
return obj === null || obj === undefined ? '' : obj[key];
}, row);
value = Fast.api.escape(customValue);
field = this.customField;
}
if (typeof that.searchList === 'object' && typeof that.custom === 'undefined') {
@ -1011,17 +1017,11 @@ define(['jquery', 'bootstrap'], function ($, undefined) {
url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url;
url = url.replace(/\{(.*?)\}/gi, function (matched) {
matched = matched.substring(1, matched.length - 1);
if (matched.indexOf(".") !== -1) {
var temp = row;
var arr = matched.split(/\./);
for (var i = 0; i < arr.length; i++) {
if (typeof temp[arr[i]] !== 'undefined') {
temp = temp[arr[i]];
}
}
return typeof temp === 'object' ? '' : temp;
}
return row[matched];
var temp = matched.split('.').reduce(function (obj, key) {
return obj === null || obj === undefined ? '' : obj[key];
}, row);
temp = Fast.api.escape(temp);
return temp;
});
return url;
},