mirror of https://github.com/mindoc-org/mindoc.git
修复连续创建项目封面无法生成的BUG
parent
b732cbbdc8
commit
4a8d044d14
|
@ -1,6 +1,7 @@
|
||||||
|
@import url("https://fonts.googleapis.com/css?family=Montserrat:300,400,500,600,700,800");
|
||||||
body {
|
body {
|
||||||
position: relative;
|
position: relative;
|
||||||
font-family: "Montserrat","Helvetica Neue",Helvetica,"Segoe UI",Arial,freesans,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Microsoft Yahei","Helvetica Neue",Helvetica;
|
font-family: Helvetica, -apple-system, "Montserrat","Helvetica Neue",Helvetica,"Segoe UI",Arial,freesans,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Microsoft Yahei","Helvetica Neue",Helvetica;
|
||||||
}
|
}
|
||||||
|
|
||||||
a{
|
a{
|
||||||
|
|
|
@ -292,12 +292,12 @@
|
||||||
context.fillRect(0,0,170,230);
|
context.fillRect(0,0,170,230);
|
||||||
|
|
||||||
//设置字体样式
|
//设置字体样式
|
||||||
context.font = "bold 20px SimSun";
|
context.font = "600 20px Helvetica";
|
||||||
context.textAlign = "left";
|
context.textAlign = "left";
|
||||||
//设置字体填充颜色
|
//设置字体填充颜色
|
||||||
context.fillStyle = "#3E403E";
|
context.fillStyle = "#3E403E";
|
||||||
|
|
||||||
var font = $font;
|
var font = $.trim($font);
|
||||||
|
|
||||||
var lineWidth = 0; //当前行的绘制的宽度
|
var lineWidth = 0; //当前行的绘制的宽度
|
||||||
var lastTextIndex = 0; //已经绘制上canvas最后的一个字符的下标
|
var lastTextIndex = 0; //已经绘制上canvas最后的一个字符的下标
|
||||||
|
@ -367,6 +367,9 @@
|
||||||
$("#deleteBookModal").find("input[name='identify']").val($id);
|
$("#deleteBookModal").find("input[name='identify']").val($id);
|
||||||
$("#deleteBookModal").modal("show");
|
$("#deleteBookModal").modal("show");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 复制项目
|
||||||
|
* */
|
||||||
function copyBook($id){
|
function copyBook($id){
|
||||||
var index = layer.load()
|
var index = layer.load()
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -391,12 +394,45 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
/**
|
||||||
|
* 处理创建项目弹窗
|
||||||
|
* */
|
||||||
$("#addBookDialogModal").on("show.bs.modal",function () {
|
$("#addBookDialogModal").on("show.bs.modal",function () {
|
||||||
window.bookDialogModal = $(this).find("#addBookDialogForm").html();
|
window.bookDialogModal = $(this).find("#addBookDialogForm").html();
|
||||||
drawBookCover("bookCover","默认封面");
|
drawBookCover("bookCover","默认封面");
|
||||||
}).on("hidden.bs.modal",function () {
|
}).on("hidden.bs.modal",function () {
|
||||||
$(this).find("#addBookDialogForm").html(window.bookDialogModal);
|
$(this).find("#addBookDialogForm").html(window.bookDialogModal);
|
||||||
});
|
});
|
||||||
|
/**
|
||||||
|
* 处理导入项目弹窗
|
||||||
|
* */
|
||||||
|
$("#importBookDialogModal").on("show.bs.modal",function () {
|
||||||
|
window.importBookDialogModal = $(this).find("#importBookDialogForm").html();
|
||||||
|
$("#import-book-upload").fileinput({
|
||||||
|
'uploadUrl':"{{urlfor "BookController.Import"}}",
|
||||||
|
'theme': 'fa',
|
||||||
|
'showPreview': false,
|
||||||
|
'showUpload' : false,
|
||||||
|
'required': true,
|
||||||
|
'validateInitialCount': true,
|
||||||
|
"language" : "zh",
|
||||||
|
'allowedFileExtensions': ['zip'],
|
||||||
|
'msgPlaceholder' : '请选择Zip文件',
|
||||||
|
'elErrorContainer' : "#import-book-form-error-message",
|
||||||
|
'uploadExtraData' : function () {
|
||||||
|
var book = {};
|
||||||
|
var $then = $("#importBookDialogForm");
|
||||||
|
book.book_name = $then.find("input[name='book_name']").val();
|
||||||
|
book.identify = $then.find("input[name='identify']").val();
|
||||||
|
book.description = $then.find('textarea[name="description"]').val()
|
||||||
|
|
||||||
|
return book;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}).on("hidden.bs.modal",function () {
|
||||||
|
$(this).find("#importBookDialogForm").html(window.importBookDialogModal);
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建项目
|
* 创建项目
|
||||||
*/
|
*/
|
||||||
|
@ -459,39 +495,13 @@
|
||||||
return showError("服务器异常");
|
return showError("服务器异常");
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
});
|
}).on("blur","#bookName",function () {
|
||||||
/**
|
var txt = $("#bookName").val();
|
||||||
* 当填写项目标题后,绘制项目封面
|
if(txt !== ""){
|
||||||
*/
|
drawBookCover("bookCover",txt);
|
||||||
$("#bookName").on("blur",function () {
|
|
||||||
var txt = $(this).val();
|
|
||||||
if(txt !== ""){
|
|
||||||
drawBookCover("bookCover",txt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* 删除项目
|
|
||||||
*/
|
|
||||||
$("#deleteBookForm").ajaxForm({
|
|
||||||
beforeSubmit : function () {
|
|
||||||
$("#btnDeleteBook").button("loading");
|
|
||||||
},
|
|
||||||
success : function (res) {
|
|
||||||
if(res.errcode === 0){
|
|
||||||
window.location = window.location.href;
|
|
||||||
}else{
|
|
||||||
showError(res.message,"#form-error-message2");
|
|
||||||
}
|
|
||||||
$("#btnDeleteBook").button("reset");
|
|
||||||
},
|
|
||||||
error : function () {
|
|
||||||
showError("服务器异常","#form-error-message2");
|
|
||||||
$("#btnDeleteBook").button("reset");
|
|
||||||
}
|
}
|
||||||
});
|
}).on("click","#btnImportBook",function () {
|
||||||
|
console.log("aa");
|
||||||
$("#btnImportBook").on("click",function () {
|
|
||||||
var $this = $(this);
|
|
||||||
var $then = $(this).parents("#importBookDialogForm");
|
var $then = $(this).parents("#importBookDialogForm");
|
||||||
|
|
||||||
|
|
||||||
|
@ -517,11 +527,43 @@
|
||||||
if (filesCount <= 0) {
|
if (filesCount <= 0) {
|
||||||
return showError("请选择需要上传的文件","#import-book-form-error-message");
|
return showError("请选择需要上传的文件","#import-book-form-error-message");
|
||||||
}
|
}
|
||||||
//$("#importBookDialogForm").submit();
|
//$("#importBookDialogForm").submit();
|
||||||
$("#btnImportBook").button("loading");
|
$("#btnImportBook").button("loading");
|
||||||
$('#import-book-upload').fileinput('upload');
|
$('#import-book-upload').fileinput('upload');
|
||||||
|
}).on("fileuploaded","#import-book-upload",function (event, data, previewId, index){
|
||||||
|
|
||||||
|
if(data.response.errcode === 0 || data.response.errcode === '0'){
|
||||||
|
showSuccess(data.response.message,"#import-book-form-error-message");
|
||||||
|
}else{
|
||||||
|
showError(data.response.message,"#import-book-form-error-message");
|
||||||
|
}
|
||||||
|
$("#btnImportBook").button("reset");
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除项目
|
||||||
|
*/
|
||||||
|
$("#deleteBookForm").ajaxForm({
|
||||||
|
beforeSubmit : function () {
|
||||||
|
$("#btnDeleteBook").button("loading");
|
||||||
|
},
|
||||||
|
success : function (res) {
|
||||||
|
if(res.errcode === 0){
|
||||||
|
window.location = window.location.href;
|
||||||
|
}else{
|
||||||
|
showError(res.message,"#form-error-message2");
|
||||||
|
}
|
||||||
|
$("#btnDeleteBook").button("reset");
|
||||||
|
},
|
||||||
|
error : function () {
|
||||||
|
showError("服务器异常","#form-error-message2");
|
||||||
|
$("#btnDeleteBook").button("reset");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
window.app = new Vue({
|
window.app = new Vue({
|
||||||
el : "#bookList",
|
el : "#bookList",
|
||||||
data : {
|
data : {
|
||||||
|
@ -534,38 +576,6 @@
|
||||||
Vue.nextTick(function () {
|
Vue.nextTick(function () {
|
||||||
$("[data-toggle='tooltip']").tooltip();
|
$("[data-toggle='tooltip']").tooltip();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#import-book-upload").fileinput({
|
|
||||||
'uploadUrl':"{{urlfor "BookController.Import"}}",
|
|
||||||
'theme': 'fa',
|
|
||||||
'showPreview': false,
|
|
||||||
'showUpload' : false,
|
|
||||||
'required': true,
|
|
||||||
'validateInitialCount': true,
|
|
||||||
"language" : "zh",
|
|
||||||
'allowedFileExtensions': ['zip'],
|
|
||||||
'msgPlaceholder' : '请选择Zip文件',
|
|
||||||
'elErrorContainer' : "#import-book-form-error-message",
|
|
||||||
'uploadExtraData' : function () {
|
|
||||||
var book = {};
|
|
||||||
var $then = $("#importBookDialogForm");
|
|
||||||
book.book_name = $then.find("input[name='book_name']").val();
|
|
||||||
book.identify = $then.find("input[name='identify']").val();
|
|
||||||
book.description = $then.find('textarea[name="description"]').val()
|
|
||||||
|
|
||||||
return book;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$("#import-book-upload").on("fileuploaded",function (event, data, previewId, index){
|
|
||||||
|
|
||||||
if(data.response.errcode === 0 || data.response.errcode === '0'){
|
|
||||||
showSuccess(data.response.message,"#import-book-form-error-message");
|
|
||||||
}else{
|
|
||||||
showError(data.response.message,"#import-book-form-error-message");
|
|
||||||
}
|
|
||||||
$("#btnImportBook").button("reset");
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue