|
@@ -118,71 +118,73 @@ var app = new Vue({
|
|
|
background: '#fff',
|
|
background: '#fff',
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- setTimeout(function(){
|
|
|
|
|
- html2canvas($previewImg, opts).then( function (canvas) {
|
|
|
|
|
- const context = canvas.getContext('2d');
|
|
|
|
|
- context.translate(0.5,0.5);
|
|
|
|
|
- context.mozImageSmoothingEnabled = false;
|
|
|
|
|
- context.webkitImageSmoothingEnabled = false;
|
|
|
|
|
- context.msImageSmoothingEnabled = false;
|
|
|
|
|
- context.imageSmoothingEnabled = false;
|
|
|
|
|
|
|
+ if(id<=0){
|
|
|
|
|
+ setTimeout(function(){
|
|
|
|
|
+ html2canvas($previewImg, opts).then( function (canvas) {
|
|
|
|
|
+ const context = canvas.getContext('2d');
|
|
|
|
|
+ context.translate(0.5,0.5);
|
|
|
|
|
+ context.mozImageSmoothingEnabled = false;
|
|
|
|
|
+ context.webkitImageSmoothingEnabled = false;
|
|
|
|
|
+ context.msImageSmoothingEnabled = false;
|
|
|
|
|
+ context.imageSmoothingEnabled = false;
|
|
|
|
|
|
|
|
- var src = canvas.toDataURL('image/jpeg');
|
|
|
|
|
- var file = _this.dataURLtoFile(src, name? name : '图片打印.jpeg');
|
|
|
|
|
- formData.append('type', 1);
|
|
|
|
|
- formData.append('taskKey', _this.taskKey);
|
|
|
|
|
- formData.append('image[]', file);
|
|
|
|
|
- formData.append('nums[]', num);
|
|
|
|
|
- formData.append('ids[]', id);
|
|
|
|
|
- formData.append('colors[]', colorType);
|
|
|
|
|
- count++;
|
|
|
|
|
|
|
+ var src = canvas.toDataURL('image/jpeg');
|
|
|
|
|
+ var file = _this.dataURLtoFile(src, name? name : '图片打印.jpeg');
|
|
|
|
|
+ formData.append('type', 1);
|
|
|
|
|
+ formData.append('taskKey', _this.taskKey);
|
|
|
|
|
+ formData.append('image[]', file);
|
|
|
|
|
+ formData.append('nums[]', num);
|
|
|
|
|
+ formData.append('ids[]', id);
|
|
|
|
|
+ formData.append('colors[]', colorType);
|
|
|
|
|
+ count++;
|
|
|
|
|
|
|
|
- if(total <= (k+1)){
|
|
|
|
|
- if(count<=0){
|
|
|
|
|
- $.toast('请选择打印的图片');
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- _this.submitting = true;
|
|
|
|
|
|
|
+ if(total <= (k+1)){
|
|
|
|
|
+ if(count<=0){
|
|
|
|
|
+ $.toast('请选择打印的图片');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ _this.submitting = true;
|
|
|
|
|
|
|
|
- // 上传
|
|
|
|
|
- $.showLoading('文件上传处理中...');
|
|
|
|
|
- var ajax = $.ajax({
|
|
|
|
|
- url: '/weixin/upload/image',
|
|
|
|
|
- data: formData,
|
|
|
|
|
- type: "post",
|
|
|
|
|
- dataType: 'json',
|
|
|
|
|
- cache: false,
|
|
|
|
|
- contentType: false,
|
|
|
|
|
- processData: false,
|
|
|
|
|
- timeout: 30000,
|
|
|
|
|
- success: function (res) {
|
|
|
|
|
- $.hideLoading();
|
|
|
|
|
- _this.submitting = false;
|
|
|
|
|
- if (res.code == 'success') {
|
|
|
|
|
- _this.showModal();
|
|
|
|
|
- } else if (res.code == 'login') {
|
|
|
|
|
- login(res.data.url);
|
|
|
|
|
- } else {
|
|
|
|
|
- $.toast(res.message);
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- error: function(res){
|
|
|
|
|
- _this.submitting = false;
|
|
|
|
|
- $.toast('服务器错误');
|
|
|
|
|
- },
|
|
|
|
|
- complete: function (XMLHttpRequest, status) {
|
|
|
|
|
- if(status == 'timeout'){
|
|
|
|
|
- ajax.abort();
|
|
|
|
|
- $.toast('请求超时,请重新提交');
|
|
|
|
|
- location.reload();
|
|
|
|
|
|
|
+ // 上传
|
|
|
|
|
+ $.showLoading('文件上传处理中...');
|
|
|
|
|
+ var ajax = $.ajax({
|
|
|
|
|
+ url: '/weixin/upload/image',
|
|
|
|
|
+ data: formData,
|
|
|
|
|
+ type: "post",
|
|
|
|
|
+ dataType: 'json',
|
|
|
|
|
+ cache: false,
|
|
|
|
|
+ contentType: false,
|
|
|
|
|
+ processData: false,
|
|
|
|
|
+ timeout: 30000,
|
|
|
|
|
+ success: function (res) {
|
|
|
|
|
+ $.hideLoading();
|
|
|
|
|
+ _this.submitting = false;
|
|
|
|
|
+ if (res.code == 'success') {
|
|
|
|
|
+ _this.showModal();
|
|
|
|
|
+ } else if (res.code == 'login') {
|
|
|
|
|
+ login(res.data.url);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $.toast(res.message);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function(res){
|
|
|
|
|
+ _this.submitting = false;
|
|
|
|
|
+ $.toast('服务器错误');
|
|
|
|
|
+ },
|
|
|
|
|
+ complete: function (XMLHttpRequest, status) {
|
|
|
|
|
+ if(status == 'timeout'){
|
|
|
|
|
+ ajax.abort();
|
|
|
|
|
+ $.toast('请求超时,请重新提交');
|
|
|
|
|
+ location.reload();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- );
|
|
|
|
|
- }, 100)
|
|
|
|
|
|
|
+ );
|
|
|
|
|
+ }, 100)
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
// 显示填写窗口
|
|
// 显示填写窗口
|