Commit 60719bff authored by 黄奎's avatar 黄奎

行程下载

parent 69717fc8
......@@ -651,86 +651,86 @@
let UploadUrl = this.domainManager().UploadUrl
let _this = this
if (this.showType >= 4) { // 判断是否为行程特色
$.ajax({ //调用是否已经存在文件夹接口判断是否进行上传图片操作
url: UploadUrl + '/Upload/GetImage?filePath=Feature/' + tcid,
type: "POST",
datatype: "jsonP",
success: function (data) {
let msg = JSON.parse(data)
if (msg.ResultCode) { // 已经存在文件 直接调用下载
var apiurl = this.domainManager().UploadUrl + '/Upload/GetImage?filePath=Feature/' + tcid;
this.$http.post(apiurl).then(res => {
let msg = res
if (msg.ResultCode) { // 已经存在文件 直接调用下载
_this.ToWord(_this.orderMsg.startDate + _this.orderMsg.lineteamName + _this.orderMsg.dayNum +
'日游', isPc)
} else if (document.querySelector("#gernalCanvas")) { // 不存在图片保存图片后下载
if (document.querySelector("#gernalCanvas").querySelectorAll('img').length === 0) {
_this.ToWord(_this.orderMsg.startDate + _this.orderMsg.lineteamName + _this.orderMsg.dayNum +
'日游', isPc)
} else if (document.querySelector("#gernalCanvas")) { // 不存在图片保存图片后下载
if (document.querySelector("#gernalCanvas").querySelectorAll('img').length === 0) {
_this.ToWord(_this.orderMsg.startDate + _this.orderMsg.lineteamName + _this.orderMsg.dayNum +
'日游', isPc)
return
}
document.querySelector("#gernalCanvas").querySelectorAll('img').forEach(x => {
let src = x.src
src = src.replace('https:', 'http:')
if (src.indexOf('http') != -1) {
x.setAttribute('crossOrigin', 'anonymous')
}
x.src = src
});
let cName = ''
if (_this.showType == 4) {
cName = '.feature-box'
} else if (_this.showType > 4) {
cName = '.travle_page'
return
}
document.querySelector("#gernalCanvas").querySelectorAll('img').forEach(x => {
let src = x.src
src = src.replace('https:', 'http:')
if (src.indexOf('http') != -1) {
x.setAttribute('crossOrigin', 'anonymous')
}
if (cName != '') {
let allNum = 1
document.querySelectorAll(cName).forEach((x, index) => {
html2Canvas(x, {
useCORS: true,
scale: 0.7,
backgroundColor: '#FFFFFF',
}).then((canvas) => {
if (canvas) {
var context = canvas.getContext('2d')
context.mozImageSmoothingEnabled = false
context.webkitImageSmoothingEnabled = false
context.msImageSmoothingEnabled = false
context.imageSmoothingEnabled = false
var image = new Image();
image.src = canvas.toDataURL("image/png");
$.ajax({
url: UploadUrl +
'/Upload/UploadBase64?fileType=1&fileLimit=5&&filePath=Feature/' + tcid,
type: "POST",
data: {
myfile: image.src,
fileIndex: index
},
datatype: "jsonP",
success: function (data) {
//console.log("上传成功",data);
},
error: function () {
//console.log("上传失败");
}
});
if (allNum !== document.querySelectorAll(cName).length) {
allNum += 1
} else {
_this.ToWord(_this.orderMsg.startDate + _this.orderMsg.lineteamName + _this.orderMsg
.dayNum + '日游', isPc)
x.src = src
});
let cName = ''
if (_this.showType == 4) {
cName = '.feature-box'
} else if (_this.showType > 4) {
cName = '.travle_page'
}
if (cName != '') {
let allNum = 1
document.querySelectorAll(cName).forEach((x, index) => {
html2Canvas(x, {
useCORS: true,
scale: 0.7,
backgroundColor: '#FFFFFF',
}).then((canvas) => {
if (canvas) {
var context = canvas.getContext('2d')
context.mozImageSmoothingEnabled = false
context.webkitImageSmoothingEnabled = false
context.msImageSmoothingEnabled = false
context.imageSmoothingEnabled = false
var image = new Image();
image.src = canvas.toDataURL("image/png");
// this.uploadImg(tcid,{myfile: image.src,fileIndex: index},res=>{
// console.log(res)
// },err=>{
// console.log(err)
// })
// return
$.ajax({
url: UploadUrl +
'/Upload/UploadBase64?fileType=1&fileLimit=5&&filePath=Feature/' + tcid,
type: "POST",
data: {
myfile: image.src,
fileIndex: index
},
datatype: "jsonP",
success: function (data) {
//console.log("上传成功",data);
},
error: function () {
//console.log("上传失败");
}
});
if (allNum !== document.querySelectorAll(cName).length) {
allNum += 1
} else {
_this.ToWord(_this.orderMsg.startDate + _this.orderMsg.lineteamName + _this.orderMsg
.dayNum + '日游', isPc)
}
});
}
});
}
} else {
_this.ToWord(_this.orderMsg.startDate + _this.orderMsg.lineteamName + _this.orderMsg.dayNum +
'日游', isPc)
});
}
},
error: function () {
// console.log("上传失败");
} else {
_this.ToWord(_this.orderMsg.startDate + _this.orderMsg.lineteamName + _this.orderMsg.dayNum +
'日游', isPc)
}
});
}, null)
return
} else {
this.ToWord(this.orderMsg.startDate + this.orderMsg.lineteamName + this.orderMsg.dayNum + '日游', isPc)
}
......
......@@ -34,7 +34,6 @@
let newUrl = url.substring(url.indexOf("=")+1);
return newUrl;
}
import axios from "axios";
export default {
name: "signature",
data(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment