Commit 5a7bc4ce authored by 黄奎's avatar 黄奎
parents 3056d5c1 81ca5b3b
...@@ -38,12 +38,7 @@ export default { ...@@ -38,12 +38,7 @@ export default {
props: ["vshowG","feature",], props: ["vshowG","feature",],
data() { data() {
return { return {
title:
"北京-马德里-塞戈维亚-萨拉曼卡-贝尼多姆/小镇-瓦伦西亚-巴塞罗那(约 253km,约 3h)北京-马德里-塞戈维亚-萨拉曼卡-贝尼多姆/小镇-瓦伦西亚-巴塞罗那(约 253km,约 3h)",
day: "DAY",
backgroundColor: "",
textColor: "",
textColorOne: ""
}; };
}, },
...@@ -52,7 +47,7 @@ export default { ...@@ -52,7 +47,7 @@ export default {
watch: { watch: {
feature: { feature: {
handler(val, oldVal) { handler(val, oldVal) {
console.log(val, "1111--------");
}, },
deep: true, deep: true,
immediate: true immediate: true
......
<template>
<div id="pdf_6">
<div class="module-title" v-if="vshowG">
<div
style="font-size:36px;font-weight:bolder;margin-top:40px;text-align:center;margin-bottom:20px;"
>
签证
</div>
</div>
<div class="expense" v-if="feature.importantTip != '' && vshowG">
<div class="left">
<div style="font-size:28px;margin-bottom:20px;">
签字须知
</div>
</div>
<div class="right">
<div v-html="feature.visaRemark"></div>
</div>
</div>
<div class="module-title" v-if="vshowM">
<div
style="font-size:36px;font-weight:bolder;margin-top:40px;text-align:center;margin-bottom:20px;"
>
旅客信息
</div>
</div>
<table v-if='vshowM' class="Passenger-table" border="0" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td width="16.6%" class="thClass">姓名</td>
<td width="16.6%" class="thClass">英文姓名</td>
<td width="16.6%" class="thClass">性别</td>
<td width="16.6%" class="thClass">护照号</td>
<td width="16.6%" class="thClass">有效期</td>
<td width="16.6%" class="thClass">联系电话</td>
</tr>
<tr v-for="(item, i) in orderMsg.guestList" :key="i">
<td>{{item.name}}</td>
<td>{{item.eName}}</td>
<td>{{item.sex}}</td>
<td>{{item.passportNo}}</td>
<td>{{item.passportExpiry}}</td>
<td>{{item.mobilePhone}}</td>
</tr>
</tbody>
</table>
<div v-if='vshowJ' class="footer-div">
<img :src="domainManager().ViittoFileUrl+'/Upload/PictureMaterial/Web/TravelControlTripIcon20.png'" />
</div>
<div style="width: 100%;height:2px;"></div>
</div>
</template>
<script>
import Header from "./components/header";
export default {
components: {
Header
},
props: ["vshowG", "vshowM","vshowJ", "feature","orderMsg"],
data() {
return {};
},
methods: {},
computed: {},
watch: {
feature: {
handler(val, oldVal) {},
deep: true,
immediate: true
}
},
mounted() {}
};
</script>
<style></style>
...@@ -160,18 +160,79 @@ ...@@ -160,18 +160,79 @@
getImgColor(img,id){ getImgColor(img,id){
return "#fff" return "#fff"
return return
this.canvasImgColor(img,id, (callback) => { // this.canvasImgColor(img,id, (callback) => {
let rgb = callback // let rgb = callback
rgb = rgb.split(',') // rgb = rgb.split(',')
let rgb0 = rgb[0].split('(') // let rgb0 = rgb[0].split('(')
let arrRgb = [rgb0[1],rgba[1],rgb[2]] // let arrRgb = [rgb0[1],rgba[1],rgb[2]]
if(this.getRgbLevel(arrRgb)>50){ // if(this.getRgbLevel(arrRgb)>50){
return "#333" // return "#333"
}else{ // }else{
return "#fff" // return "#fff"
// }
// })
},
// 获取图片颜色
canvasImgColor(imgs,ids, callback) {
var imgSrc = imgs
var upload = document.getElementById(ids)
const imgEle = document.createElement('img')
const canvas = document.createElement('canvas')
imgEle.src = imgSrc
imgEle.crossOrigin = '';
imgEle.onload = () => {
var ctx = canvas.getContext("2d");
var naturalImgSize = [imgEle.naturalWidth, imgEle.naturalHeight];
canvas.width = naturalImgSize[0];
canvas.height = naturalImgSize[1];
//绘制到canvas
ctx.drawImage(imgEle, 0, 0);
//获取imageData:rgba像素点
var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
const leftSectionData = []
const rightSectionData = []
const oneLineImgDataLen = canvas.width * 4;
imgData.data.forEach((colorVal, i) => {
if (i % oneLineImgDataLen <= 0.5 * oneLineImgDataLen || i % oneLineImgDataLen >= 0.6 * oneLineImgDataLen) {
const inLeft = i % oneLineImgDataLen <= 0.5 * oneLineImgDataLen
if (i % 4 === 0) {
// 获取rgb均值
const curAverageRGB = (imgData.data[i] + imgData.data[i + 1] + imgData.data[i + 2]) / 3;
let leftOrRightRef = inLeft ? leftSectionData : rightSectionData;
//每个数组里存四个值:本颜色值中的r、g、b的均值,以及r、g、b三个值。
//均值一方面用于累加计算本区域的整体均值,然后再跟每个均值对比拿到与整体均值最接近的项的索引,再取该数组里的后三个值:rgb,对应着颜色
leftOrRightRef[leftOrRightRef.length] = [curAverageRGB, imgData.data[i], imgData.data[i + 1], imgData.data[i + 2]]
}
}
})
//generate average rgb
const averageOfLeft = Math.round(leftSectionData.reduce((_cur, item) => {
return _cur + item[0]
}, 0) / leftSectionData.length)
const averageOfRight = Math.round(rightSectionData.reduce((_cur, item) => {
return _cur + item[0]
}, 0) / rightSectionData.length)
//find the most near color
const findNearestIndex = (averageVal, arrBox) => {
let _gapValue = Math.abs(averageVal - arrBox[0])
let _nearColorIndex = 0
arrBox.forEach((item, index) => {
const curGapValue = Math.abs(item - averageVal)
if (curGapValue < _gapValue) {
_gapValue = curGapValue
_nearColorIndex = index
}
})
return _nearColorIndex
} }
}) const leftNearestColor = leftSectionData[findNearestIndex(averageOfLeft, leftSectionData)]
const rightNearestColor = rightSectionData[findNearestIndex(averageOfRight, rightSectionData)]
upload.style.backgroundColor = `rgba(${leftNearestColor[1]},${leftNearestColor[2]},${leftNearestColor[3]},1) 0%,rgba(${rightNearestColor[1]},${rightNearestColor[2]},${rightNearestColor[3]},1)`
callback(upload.style.backgroundColor)
} }
}
}, },
computed: {}, computed: {},
watch: { watch: {
...@@ -189,14 +250,14 @@ ...@@ -189,14 +250,14 @@
} }
}, },
deep: true, deep: true,
immediate: true immediate: false
}, },
tripList: { tripList: {
handler(val, oldVal) { handler(val, oldVal) {
console.log(val,'1111--------') console.log(val,'1111--------')
}, },
deep: true, deep: true,
immediate: true immediate: false
}, },
}, },
mounted() { mounted() {
......
...@@ -202,7 +202,6 @@ ...@@ -202,7 +202,6 @@
<div id="pdfNode" class="LeaveGroupDownload-form"> <div id="pdfNode" class="LeaveGroupDownload-form">
<div id="pdfDom" style="padding:0 20px;"> <div id="pdfDom" style="padding:0 20px;">
<!-- 首页 --> <!-- 首页 -->
<!--
<LeaveGroupDownload <LeaveGroupDownload
:vshowJ="vshowJ" :vshowJ="vshowJ"
:vshowL="vshowL" :vshowL="vshowL"
...@@ -211,32 +210,40 @@ ...@@ -211,32 +210,40 @@
:orderTripdiff="orderTripdiff" :orderTripdiff="orderTripdiff"
:vshowLLR="vshowLLR" :vshowLLR="vshowLLR"
:vshowB="vshowB" :vshowB="vshowB"
:lineId="lineId"></LeaveGroupDownload> --> :lineId="lineId"></LeaveGroupDownload>
<!-- 行程特色 --> <!-- 行程特色 -->
<!-- <ItineraryFeatures :feature="feature"></ItineraryFeatures> --> <ItineraryFeatures :feature="feature"></ItineraryFeatures>
<!-- 行程天数 --> <!-- 行程天数 -->
<!-- <travelDays <travelDays
:dataAll="dataAll" :dataAll="dataAll"
:orderMsg="orderMsg" :orderMsg="orderMsg"
:orderTripdiff="orderTripdiff" :orderTripdiff="orderTripdiff"
:tripList="tripList" :tripList="tripList"
:vshowD="vshowD" :vshowD="vshowD"
:vshowK="vshowK" :vshowK="vshowK"
></travelDays> --> ></travelDays>
<!-- 团队费用说明 --> <!-- 团队费用说明 -->
<!-- <TourFareDescription <TourFareDescription
:vshowE="vshowE" :vshowE="vshowE"
:vshowF="vshowF" :vshowF="vshowF"
:dataList="dataList" :dataList="dataList"
:feature="feature"></TourFareDescription> --> :feature="feature"></TourFareDescription>
<!-- 订单须知 --> <!-- 订单须知 -->
<OrderNotice <OrderNotice
:vshowG="vshowG" :vshowG="vshowG"
:feature="feature"></OrderNotice> :feature="feature"></OrderNotice>
<!-- 签证信息 -->
<VisaInformation
:vshowG="vshowG"
:vshowM="vshowM"
:vshowJ="vshowJ"
:feature="feature"
:orderMsg="orderMsg"></VisaInformation>
</div> </div>
</div> </div>
...@@ -255,6 +262,7 @@ ...@@ -255,6 +262,7 @@
import travelDays from './LeaveGroupDownload/travelDays' import travelDays from './LeaveGroupDownload/travelDays'
import TourFareDescription from './LeaveGroupDownload/TourFareDescription' import TourFareDescription from './LeaveGroupDownload/TourFareDescription'
import OrderNotice from './LeaveGroupDownload/OrderNotice' import OrderNotice from './LeaveGroupDownload/OrderNotice'
import VisaInformation from './LeaveGroupDownload/VisaInformation'
import { import {
setTimeout setTimeout
} from 'timers'; } from 'timers';
...@@ -272,7 +280,8 @@ ...@@ -272,7 +280,8 @@
ItineraryFeatures, ItineraryFeatures,
travelDays, travelDays,
TourFareDescription, TourFareDescription,
OrderNotice OrderNotice,
VisaInformation
}, },
data() { data() {
return { return {
......
...@@ -1743,67 +1743,6 @@ export default { ...@@ -1743,67 +1743,6 @@ export default {
Vue.prototype.getRgbLevel = function (arr) { Vue.prototype.getRgbLevel = function (arr) {
return arr[0] * 0.299 + arr[1] * 0.587 + arr[2] * 0.114; return arr[0] * 0.299 + arr[1] * 0.587 + arr[2] * 0.114;
} }
// 获取图片颜色
Vue.prototype.canvasImgColor = function(imgs, callback) {
var imgSrc = imgs
var upload = document.getElementById('uploadImg')
const imgEle = document.createElement('img')
const canvas = document.createElement('canvas')
imgEle.src = imgSrc
imgEle.crossOrigin = '';
imgEle.onload = () => {
var ctx = canvas.getContext("2d");
var naturalImgSize = [imgEle.naturalWidth, imgEle.naturalHeight];
canvas.width = naturalImgSize[0];
canvas.height = naturalImgSize[1];
//绘制到canvas
ctx.drawImage(imgEle, 0, 0);
//获取imageData:rgba像素点
var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
const leftSectionData = []
const rightSectionData = []
const oneLineImgDataLen = canvas.width * 4;
imgData.data.forEach((colorVal, i) => {
if (i % oneLineImgDataLen <= 0.5 * oneLineImgDataLen || i % oneLineImgDataLen >= 0.6 * oneLineImgDataLen) {
const inLeft = i % oneLineImgDataLen <= 0.5 * oneLineImgDataLen
if (i % 4 === 0) {
// 获取rgb均值
const curAverageRGB = (imgData.data[i] + imgData.data[i + 1] + imgData.data[i + 2]) / 3;
let leftOrRightRef = inLeft ? leftSectionData : rightSectionData;
//每个数组里存四个值:本颜色值中的r、g、b的均值,以及r、g、b三个值。
//均值一方面用于累加计算本区域的整体均值,然后再跟每个均值对比拿到与整体均值最接近的项的索引,再取该数组里的后三个值:rgb,对应着颜色
leftOrRightRef[leftOrRightRef.length] = [curAverageRGB, imgData.data[i], imgData.data[i + 1], imgData.data[i + 2]]
}
}
})
//generate average rgb
const averageOfLeft = Math.round(leftSectionData.reduce((_cur, item) => {
return _cur + item[0]
}, 0) / leftSectionData.length)
const averageOfRight = Math.round(rightSectionData.reduce((_cur, item) => {
return _cur + item[0]
}, 0) / rightSectionData.length)
//find the most near color
const findNearestIndex = (averageVal, arrBox) => {
let _gapValue = Math.abs(averageVal - arrBox[0])
let _nearColorIndex = 0
arrBox.forEach((item, index) => {
const curGapValue = Math.abs(item - averageVal)
if (curGapValue < _gapValue) {
_gapValue = curGapValue
_nearColorIndex = index
}
})
return _nearColorIndex
}
const leftNearestColor = leftSectionData[findNearestIndex(averageOfLeft, leftSectionData)]
const rightNearestColor = rightSectionData[findNearestIndex(averageOfRight, rightSectionData)]
upload.style.backgroundColor = `rgba(${leftNearestColor[1]},${leftNearestColor[2]},${leftNearestColor[3]},1) 0%,rgba(${rightNearestColor[1]},${rightNearestColor[2]},${rightNearestColor[3]},1)`
callback(upload.style.backgroundColor)
}
}
Vue.prototype.base64ToBlob = function (code) { Vue.prototype.base64ToBlob = function (code) {
let parts = code.split(";base64,"); let parts = code.split(";base64,");
let contentType = parts[0].split(":")[1]; let contentType = parts[0].split(":")[1];
......
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