2025-11-07 09:56:20 +08:00
|
|
|
define(['form'], function (Form) {
|
|
|
|
|
var ConfigModule = {
|
|
|
|
|
index: function () {
|
|
|
|
|
$('.nav-tabs li a').on('click',function(){
|
|
|
|
|
$('.nav-tabs li').removeClass('active');
|
|
|
|
|
$(this).parent().addClass('active');
|
|
|
|
|
$('.tab-pane').hide('active');
|
|
|
|
|
$($(this).attr('href')).show('active');
|
|
|
|
|
return false;
|
|
|
|
|
})
|
|
|
|
|
var form = $('#settingsform');
|
2025-12-24 16:59:05 +08:00
|
|
|
Config['upload_url'] = 'attach/upload';
|
2025-11-07 09:56:20 +08:00
|
|
|
Form.api.bindevent(form,function(res){
|
|
|
|
|
if (res.code) {
|
|
|
|
|
return lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
|
|
|
|
}
|
|
|
|
|
lightyear.notify('保存成功', 'success', 2000, 'mdi mdi-emoticon-happy', 'top', 'center')
|
|
|
|
|
// setTimeout(function () {
|
|
|
|
|
// location.reload();
|
|
|
|
|
// }, 2000);
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
var form = $('#addform');
|
|
|
|
|
Form.api.bindevent(form,function(res){
|
|
|
|
|
if (res.code) {
|
|
|
|
|
return lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
|
|
|
|
}
|
|
|
|
|
lightyear.notify('保存成功', 'success', 2000, 'mdi mdi-emoticon-happy', 'top', 'center')
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
location.reload();
|
|
|
|
|
}, 2000);
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//切换显示隐藏变量字典列表
|
|
|
|
|
$(document).on("change", "form#addform select[name='row[type]']", function (e) {
|
|
|
|
|
$("#add-content-container").toggleClass("hide", ['select', 'selects', 'checkbox', 'radio'].indexOf($(this).val()) > -1 ? false : true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.tagsinput').tagsInput({
|
|
|
|
|
height: '38px',
|
|
|
|
|
width: '100%',
|
|
|
|
|
defaultText: '请设置校验规则',
|
|
|
|
|
removeWithBackspace: true,
|
|
|
|
|
delimiter: [';'],
|
|
|
|
|
'interactive':true,
|
|
|
|
|
'autocomplete': { 'length': 'length()', 'range': 'range()'},
|
|
|
|
|
'onRemoveTag':function(tag){
|
|
|
|
|
console.log(arguments);
|
|
|
|
|
$('.rulelist li a[data-value='+tag+']').parent().removeClass('active');
|
|
|
|
|
},
|
|
|
|
|
'onAddTag':function(tag){
|
|
|
|
|
$('.rulelist li a[data-value='+tag+']').parent().removeClass('active').addClass('active');
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
//选择规则
|
|
|
|
|
$(document).on("click", ".rulelist > li > a", function () {
|
|
|
|
|
var rule = $(this).data("value");
|
|
|
|
|
if ($('#row_rule').tagExist(rule)) {
|
|
|
|
|
$('#row_rule').removeTag(rule);
|
|
|
|
|
$(this).parent().removeClass('active');
|
|
|
|
|
} else {
|
|
|
|
|
$('#row_rule').addTag(rule);
|
|
|
|
|
$(this).parent().removeClass('active').addClass('active');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
$('#test_send_mail_btn').on('click',function(){
|
|
|
|
|
var data = {};
|
|
|
|
|
$(this).parents('.tab-pane').find('input,select').each(function(){
|
|
|
|
|
data[$(this).attr('name')]=$(this).val();
|
|
|
|
|
});
|
|
|
|
|
Fast.api.ajax({
|
2025-12-24 16:59:05 +08:00
|
|
|
'url':'config/testmail',
|
2025-11-07 09:56:20 +08:00
|
|
|
'data':data,
|
|
|
|
|
success:function(res){
|
|
|
|
|
Fast.api.success("操作成功");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
console.log(data);
|
|
|
|
|
});
|
|
|
|
|
//追加控制(点击按钮)
|
|
|
|
|
// $(document).on("click", ".btn-append,.append", function (e, row) {
|
|
|
|
|
// var container = $(this).closest(".fieldlist");
|
|
|
|
|
// append(container, row);
|
|
|
|
|
// // refresh(container);
|
|
|
|
|
// }).on("click", ".btn-remove", function () {
|
|
|
|
|
// //移除控制(点击按钮)
|
|
|
|
|
// var container = $(this).closest(".fieldlist");
|
|
|
|
|
// var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
|
|
|
|
|
// $(this).closest(tagName).remove();
|
|
|
|
|
// refresh(container);
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return ConfigModule
|
|
|
|
|
});
|