取消不用的文章編輯頁kindeditor 及uploadify 及其他 js代碼
Phoenix 2018.2.11 00:00 浏览(
KindEditor.ready(function(K) {
window.editor = K.create('#editor_id',{
uploadJson : 'action',
fileManagerJson : 'file_manager_json.jsp',
allowFileManager : true,
cssData: 'body{font: 16px/1.2 "sans serif",tahoma,verdana,helvetica;color: black;}',
autoHeightMode : true, //启用编辑区自动高度
width:"100%",
afterCreate : function() {
this.loadPlugin('autoheight'); //加载时同步编辑区自动高度
}
});
});
jQuery(".file_upload").each(function() {
var id = $(this).attr("id");
$("#" + id).uploadify({
swf : 'libs/plugins/uploadify/uploadify.swf',
uploader : 'PictureUploadAction;jsessionid=${pageContext.session.id}',
fileObjName : 'file',
buttonText : '<s:text name="uploadPicture"></s:text>',
dataType : 'json',
fileTypeExts : '*.jpeg;*.gif;*.jpg;*.JPEG;*.GIF;*.JPG;*.png;*.PNG',
fileTypeDesc : 'Image Files',
queueSizeLimit : 1,
auto : true,
multi : false,
onUploadStart : function(file) {
var btn = $("#" + id)
btn.uploadify("settings", "formData", {
'ai' : "${article.articleId}",
'c' : "1"
});//给参数赋值
},
onUploadSuccess : function(file, data, response) {
console.log(data)
var obj = JSON.parse(data);
var content = $("#" + id).closest(".upload-container");
console.log(content)
var img = content.find("img");
//var mode =img.attr("mode");
img.attr('src', obj.file);
console.log(img)
var temp = content.find("#temp");
temp.val(obj.temp);
console.log(temp)
},
'onUploadError' : function(file, errorCode, errorMsg, errorString) {
alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
}
});//end uploadify
})//end each */
<s:text name="title"></s:text><s:text name="picture"></s:text>
:
<div class="upload-container">
<div class="img-content">
<input id="temp" type="hidden"/>
<img src="..."/>
</div>
<div class="upload-area">
<input id='picture-upload' class='file_upload' name='uploadify' type='file' />
</div>
<div class="reminder">
<p>文件尺寸: 宽高比例须为4:3</p>
<p>文件大小: 小于 2048 kb</p>
<p>可用扩展名: jpg, gif, png, jpeg</p>
</div>
</div>
$("#categorySelect").change(function(){
var categoryId = $(this).val();
$.ajax({
type: 'post', //请求方式为post方式
url: 'action?c=' + categoryId, //请求地址
dataType: 'json', //服务器返回类型为JSON类型
//data:params, //发送到服务器的数据
success:function(data){ //请求成功后的回调函数
console.log(data)
if (typeof(data) != "undefined"){
$("#articleSubCategorySelect option").remove();
var list = data.data;
$.each(list, function(index, content){
var option = $("<option value=" + index + ">"+ content + "</option>");
$("#articleSubCategorySelect").append(option)
})//end each
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
var msg=XMLHttpRequest.responseText;
setFlatMsg({'msg':msg,'autoFade': false,'backColor':'lightpink'});
console.log(msg);
}
})//end ajax
})//end change */
本文链接 https://www.mangoxo.com/blog/3MDqZq5y 版权所有,转载请保留地址链接,感谢!
☺
加载评论中