//增加公告
function addnote(){
layer.open({
type: 1,
title:["新增升级公告"],
skin: 'layui-layer-demo',
area: ['600px', '360px'],
shadeClose: true,
content: '<textarea rows="3" cols="20" maxlength="64" id="noteinfo" style="margin-left:10px;margin-top:10px;width:580px;height:200px;resize:none;"></textarea>',
btn:["确定","取消"],
btn1:function(){
var notes=document.getElementById("noteinfo").value;
$.ajax({
cache:false,
type:"POST",
url:"/addnote/",
data:{'info':notes},
async:true,
beforeSend:function(xhr,settings){
xhr.setRequestHeader("X-CSRFToken","{{csrf_token}}");
},
success:function(data){
if(data.notecode=="success"){
window.layer.closeAll();
layer.msg("提交成功",{
time:1000
},function(){
window.location.reload();
});
}else{
layer.msg("提交失败");
}
}
})
},
btn2:function(){
layer.msg("取消成功");
return true;
},
});
};
//启禁公告
function turnnote(noteid){
$.ajax({
cache:false,
type:"POST",
url:"/ablenote/",
data:{'noid':noteid},
async:true,
beforeSend:function(xhr,settings){
xhr.setRequestHeader("X-CSRFToken","{{csrf_token}}");
},
success:function(data){
if(data.scode==="success0"){
layer.msg("禁用成功",{
time:1000
},function(){
window.location.reload();
});
}else if(data.scode==="success1"){
layer.msg("启用成功",{
time:1000
},function(){
window.location.reload();
});
}else{
layer.msg("请求错误",{
time:1000
},function(){
window.location.reload();
});
}
},
})
};
已开流量主的小程序欢迎体验,还在完善中。。