var token=$.cookie("token")
function showImg() {
var imageUrl = $("#imageUrl");
var img_file = $("#img_file").val();
var file = document.getElementById('img_file').files[0];
var re = new FileReader();
re.readAsDataURL(file);
re.onload = function(re) {
$('#img').attr("src", re.target.result);
}
var myfrom = new FormData();
myfrom.append('file', $("#img_file")[0].files[0]);
$.ajax({
type: "post",
url: "http://localhost:8083/admin/teacher/teImg",
data: myfrom,
beforeSend:function(request){
request.setRequestHeader("token",token);
//},
//beforeSend: function() {
//request.setRequestHeader("tokens",tokens);
ShowDiv();
},
complete: function() {
HiddenDiv();
},
contentType: false, //这个一定要写
processData: false, //这个也一定要写,不然会报错
dataType: 'json', //返回类型,有json,text,HTML。这里并没有jsonp格式,所以别妄想能用jsonp做跨域了。
async: true,
success: function(result) {
imageUrl.val(result.data)
console.log(result)
}
});
}
function into() {
$("#content").val($('.summernote').summernote('code'))
var eduArticle= $('#form1').serialize();
//alert(eduArticle);
$.ajax({
type:"post",
url:"http://localhost:8083/admin/article/into",
data: $('#form1').serialize(),
beforeSend: function(request) {
request.setRequestHeader("token",token);
},
//contentType: false, //这个一定要写
//processData: false, //这个也一定要写,不然会报错
//dataType: 'json', //返回类型,有json,text,HTML。这里并没有jsonp格式,所以别妄想能用jsonp做跨域了。
//async: false,
success:function(msg){
if(msg.code == 200) {
location.href = './article.html'
}
}
})
}
function ShowDiv() {
$("#loading").show();
}
function HiddenDiv() {
$("#loading").hide();
}
$(function(){
$('.summernote').summernote({
height: 800,
tabsize: 2,
lang: 'zh-CN'
});
})
input {
border: 1px solid #333333;
color: #666666;
background: #eeeeee;
height: 40px;
width: 30px
}
img {
border: 1px dotted #7FFFAA;
color: #666666;
height: 200px;
width: 300px
}
#loading {
width: 170px;
height: 25px;
border: 3px solid #C3DAF9;
position: absolute;
top: 300px;
left: 600px;
z-index: 10000;
background-color: #F7F9FC;
line-height: 25px;
vertical-align: middle;
font-size: 11pt;
display: none;
}
一键复制
编辑
Web IDE
原始数据
按行查看
历史