Commit 946aac4d by 杨明

fixed

1 parent c903e984
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn * @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-19 13:46:20 * @Date: 2023-05-19 13:46:20
* @LastEditors: yangming yangming@didihu.com.cn * @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-07-20 17:40:13 * @LastEditTime: 2023-08-30 18:11:11
* @FilePath: \scrm-micro-home\src\mixins\gpt.js * @FilePath: \scrm-micro-home\src\mixins\gpt.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -119,8 +119,8 @@ export default { ...@@ -119,8 +119,8 @@ export default {
imageList.push({ ...info.logoInfo, url: info.merchantLogo }) imageList.push({ ...info.logoInfo, url: info.merchantLogo })
} }
const textList = [ const textList = [
{ x: style1.x, y: style1.y, fontSize: style1.size, width: style1.width, text: style1.content, color: style1.color, font: style1.font }, { x: style1.x, y: style1.y, fontSize: style1.size, width: style1.width, text: style1.content, color: style1.color, font: style1.font, shadow: style1.shadow },
{ x: style2.x, y: style2.y, fontSize: style2.size, width: style2.width, text: style2.content, color: style2.color, font: style2.font } { x: style2.x, y: style2.y, fontSize: style2.size, width: style2.width, text: style2.content, color: style2.color, font: style2.font, shadow: style2.shadow }
] ]
console.log(imageList, textList) console.log(imageList, textList)
const canvasBase64 = await drawfun.begin({ const canvasBase64 = await drawfun.begin({
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn * @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-17 16:07:55 * @Date: 2023-05-17 16:07:55
* @LastEditors: yangming yangming@didihu.com.cn * @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-07-16 15:11:28 * @LastEditTime: 2023-08-30 18:18:33
* @FilePath: \scrm-micro-home\src\utils\drawing.js * @FilePath: \scrm-micro-home\src\utils\drawing.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -43,10 +43,17 @@ class Drawing { ...@@ -43,10 +43,17 @@ class Drawing {
return this.pixelRatio * val return this.pixelRatio * val
} }
drawText(textParams) { drawText(textParams) {
let { fontSize, color, text, x, y, bold, font } = textParams let { fontSize, color, text, x, y, bold, font, shadow } = textParams
fontSize = this.toRpx(fontSize) fontSize = this.toRpx(fontSize)
x = this.toRpx(x) x = this.toRpx(x)
y = this.toRpx(y) y = this.toRpx(y)
if (shadow) {
const arr = shadow.split(' ').filter(item => item)
this.ctx.shadowOffsetX = this.toRpx(arr[0].match(/\d+/)[0]) //在X轴偏移值
this.ctx.shadowOffsetY = this.toRpx(arr[1].match(/\d+/)[0]) //在Y轴偏移值
this.ctx.shadowBlur = this.toRpx(arr[2].match(/\d+/)[0]) //阴影模糊程度
this.ctx.shadowColor = arr[3] //必填
}
this.ctx.font = `${bold ? 'bold ' : ''}${fontSize}px ${font}` this.ctx.font = `${bold ? 'bold ' : ''}${fontSize}px ${font}`
this.ctx.fillStyle = color this.ctx.fillStyle = color
this.ctx.textAlign = 'center' this.ctx.textAlign = 'center'
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-15 15:08:32 * @Date: 2023-05-15 15:08:32
* @LastEditors: yangming yangming@didihu.com.cn * @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-08-30 16:33:40 * @LastEditTime: 2023-08-30 18:10:31
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\MarketingRight.vue * @FilePath: \scrm-micro-home\src\views\home\components\Marketing\MarketingRight.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
:style="{ :style="{
'font-size': item.size + 'px', 'font-size': item.size + 'px',
'font-family': item.font, 'font-family': item.font,
'text-shadow': item.shadow,
color: item.color color: item.color
}" }"
class="img_cl" class="img_cl"
...@@ -471,8 +472,8 @@ export default { ...@@ -471,8 +472,8 @@ export default {
jingnanyuanmoti: 1.1, jingnanyuanmoti: 1.1,
YouSheBiaoTiYuan: 1.4 YouSheBiaoTiYuan: 1.4
} }
Object.assign(this.draggableList[0], { content: this.detail.marketingTitle, ...style1, width: this.detail.marketingTitle.length * (style1.size * fontObj[style1.font]), color: style1.style.color, font: style1.font, height: 'auto' }) Object.assign(this.draggableList[0], { content: this.detail.marketingTitle, ...style1, width: this.detail.marketingTitle.length * (style1.size * fontObj[style1.font]), color: style1.style.color, font: style1.font, height: 'auto', shadow: style1.style['text-shadow'] })
Object.assign(this.draggableList[1], { content: this.detail.marketingSubtitle, ...style2, width: this.detail.marketingSubtitle.length * (style2.size * fontObj[style2.font]), color: style2.style.color, font: style2.font, height: 'auto' }) Object.assign(this.draggableList[1], { content: this.detail.marketingSubtitle, ...style2, width: this.detail.marketingSubtitle.length * (style2.size * fontObj[style2.font]), color: style2.style.color, font: style2.font, height: 'auto', shadow: style2.style['text-shadow'] })
console.log(this.draggableList[0]) console.log(this.draggableList[0])
setTimeout(() => { setTimeout(() => {
const textDom = document.querySelectorAll('.img_cl') const textDom = document.querySelectorAll('.img_cl')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!