在线编辑保存时增加询问

This commit is contained in:
晚风拂柳颜 2023-06-09 16:26:04 +08:00
parent 1f36630a34
commit 00c56759e5
3 changed files with 52 additions and 35 deletions

View File

@ -1 +1 @@
3.9.43beta6
3.9.43beta7

View File

@ -213,6 +213,11 @@ function f(){
});
//监听提交
form.on('submit(saveBtn)', function (data) {
layer.confirm('确认保存?', {
title: "操作提示",
icon: 0,
btn: ['确定']
} ,function(index){
let txt = editor.getValue();
// console.log(txt);
let postData = {
@ -232,6 +237,9 @@ function f(){
layer.msg(ret.msg);
}
});
layer.close(index);
});
return false;
});

View File

@ -123,25 +123,34 @@
});
//监听提交
form.on('submit(saveBtn)', function (data) {
layer.confirm('确认保存?', {
title: "操作提示",
icon: 0,
btn: ['确定']
} ,function(index){
let txt = $('#script_code').val();
// console.log(txt);
let postData = {
name:'{{name}}',
code:txt,
name: '{{name}}',
code: txt,
// code:txt.replaceAll("+","&").replaceAll("console.log","console.Log")
}
// console.log(postData);
$.ajax({
type:'post',
url:api_save_url,
data:postData,
dataType:'json',
async:false,
success:function (ret) {
type: 'post',
url: api_save_url,
data: postData,
dataType: 'json',
async: false,
success: function (ret) {
console.log(ret);
layer.msg(ret.msg);
}
});
layer.close(index);
});
return false;
});