mirror of
https://github.com/chatopera/cosin.git
synced 2025-08-01 16:38:02 +08:00
#90 增加提示
This commit is contained in:
parent
1985dd3f7f
commit
557607b06a
@ -116,7 +116,7 @@
|
|||||||
if (data.rc == 0) {
|
if (data.rc == 0) {
|
||||||
cb(null, data.data);
|
cb(null, data.data);
|
||||||
} else {
|
} else {
|
||||||
cb(data.error);
|
cb(data.data);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.fail(function (jqXHR, textStatus) {
|
.fail(function (jqXHR, textStatus) {
|
||||||
@ -129,10 +129,17 @@
|
|||||||
var form = layui.form();
|
var form = layui.form();
|
||||||
form.on('submit(save)', function (data) {
|
form.on('submit(save)', function (data) {
|
||||||
var field = data.field;
|
var field = data.field;
|
||||||
|
|
||||||
var submitFinish = function (err, bot) {
|
var submitFinish = function (err, bot) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
layer.confirm(err.data||err.error, {
|
||||||
|
btn: ['关闭'],
|
||||||
|
icon: 2,
|
||||||
|
title: '提示'
|
||||||
|
}, function (popup, layero) {
|
||||||
|
layer.close(popup)
|
||||||
|
}, function (popup) {
|
||||||
|
// 取消方法
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.open({
|
layer.open({
|
||||||
title: '提示'
|
title: '提示'
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
if (data.rc == 0) {
|
if (data.rc == 0) {
|
||||||
resolve(data.data);
|
resolve(data.data);
|
||||||
} else {
|
} else {
|
||||||
reject(data.error);
|
reject(data);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.fail(function (jqXHR, textStatus) {
|
.fail(function (jqXHR, textStatus) {
|
||||||
@ -107,7 +107,18 @@
|
|||||||
|
|
||||||
var isEnabled = $('<td><input type="checkbox" lay-skin="switch" lay-text="开启|关闭" ' + (r.enabled ? 'checked' : '') + '></td>');
|
var isEnabled = $('<td><input type="checkbox" lay-skin="switch" lay-text="开启|关闭" ' + (r.enabled ? 'checked' : '') + '></td>');
|
||||||
isEnabled.change(function () {
|
isEnabled.change(function () {
|
||||||
change(r.id, $(this).find('input').prop('checked'));
|
change(r.id, $(this).find('input').prop('checked'))
|
||||||
|
.then(null, function(err){
|
||||||
|
layer.confirm(err.data||err.error, {
|
||||||
|
btn: ['关闭'],
|
||||||
|
icon: 2,
|
||||||
|
title: '提示'
|
||||||
|
}, function (index, layero) {
|
||||||
|
layer.close(index)
|
||||||
|
}, function (index) {
|
||||||
|
// 取消方法
|
||||||
|
});
|
||||||
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
var rows = [
|
var rows = [
|
||||||
@ -146,7 +157,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
query(1, 10);
|
query(1, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
layui.use(['form'], function () {
|
layui.use(['form'], function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user