Commit 66d415b2 by 杨明

fixed

1 parent 2c4a8414
......@@ -59,7 +59,7 @@ export default {
new Array(marketingSubtitle).forEach((item, index) => {
textList.push({
x: title.subTitleStyle.x,
y: title.subTitleStyle.y + title.titleStyle.fontSize * 1.1*(textList.length - 1),
y: title.subTitleStyle.y + title.titleStyle.fontSize * 1.1 * (textList.length - 1),
fontSize: title.subTitleStyle.fontSize,
color: title.subTitleStyle.color,
text: item
......
......@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-19 13:46:20
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-23 10:14:30
* @LastEditTime: 2023-05-30 16:21:24
* @FilePath: \scrm-micro-home\src\mixins\gpt.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -18,9 +18,12 @@ export default {
...mapState('marketing', ['keywords', 'GPTList'])
},
watch: {
keywords() {
this.t1 = 0
this.t2 = 0
GPTList: {
handler() {
this.t1 = 0
this.t2 = 0
},
deep: true
}
},
methods: {
......
......@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-16 17:13:33
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-26 16:19:48
* @LastEditTime: 2023-05-30 16:58:01
* @FilePath: \scrm-micro-home\src\store\modules\marketing.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -94,6 +94,9 @@ export default {
setKeyWords({ commit, state }, data) {
if (state.keywords == data) return
commit('SET_KET_WORDs', data)
setTimeout(() => {
commit('SET_KET_WORDs', '')
}, 1000);
apis.activity.getChatGPTList({ 'req.userPrompt': data }).then(res => {
const gptList = JSON.parse(res.message)
if (gptList.mainTitles) {
......
......@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-22 20:12:55
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-25 11:36:45
* @LastEditTime: 2023-05-30 16:17:39
* @FilePath: \scrm-micro-home\src\utils\color.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -38,24 +38,20 @@ function gethex(r, g, b) {
return hex
}
function uploadImg(img, callbackFn) {
var reader = new FileReader()
reader.readAsDataURL(img)
async function uploadImg(url, callbackFn) {
var image = new Image()
image.src = url
image.setAttribute('crossOrigin', 'Anonymous')
image.onload = function() {
img_width = this.width
img_height = this.height
// 设置画布尺寸
canvas.width = img_width
canvas.height = img_height
reader.onload = function(e) {
var image = new Image()
image.src = e.target.result
image.onload = function() {
img_width = this.width
img_height = this.height
// 设置画布尺寸
canvas.width = img_width
canvas.height = img_height
// 将图片按像素写入画布
context.drawImage(this, 0, 0, img_width, img_height)
callbackFn(getColor())
}
// 将图片按像素写入画布
context.drawImage(this, 0, 0, img_width, img_height)
callbackFn(getColor())
}
}
export default uploadImg
......@@ -2,22 +2,29 @@
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-17 16:07:55
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-30 15:02:01
* @LastEditTime: 2023-05-30 16:50:44
* @FilePath: \scrm-micro-home\src\utils\drawing.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
class Drawing {
constructor(el, canvasParams) {
this.canvasId = el
const { width, height } = canvasParams
let { width, height } = canvasParams
this.pixelRatio = 2
this.ctx = this.canvasId.getContext('2d')
width = this.toRpx(width)
height = this.toRpx(height)
this.canvasId.width = width
this.canvasId.height = height
this.ctx = this.canvasId.getContext('2d')
}
async drawImages(imageParams, callback) {
this.ctx.beginPath()
this.ctx.save()
let { height, width, url, x, y } = imageParams
height = this.toRpx(height)
width = this.toRpx(width)
x = this.toRpx(x)
y = this.toRpx(y)
let image = this.createImage()
image.src = url
return new Promise(resolve => {
......@@ -32,9 +39,14 @@ class Drawing {
}
})
}
toRpx(val) {
return this.pixelRatio * val
}
drawText(textParams) {
const { fontSize, color, text, x, y } = textParams
console.log(x, y)
let { fontSize, color, text, x, y } = textParams
fontSize = this.toRpx(fontSize)
x = this.toRpx(x)
y = this.toRpx(y)
this.ctx.font = `${fontSize}px Calibri`
this.ctx.fillStyle = color
this.ctx.textAlign = 'center'
......
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-16 10:20:01
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-26 18:26:10
* @LastEditTime: 2023-05-30 17:00:21
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\ChatGPT.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -86,7 +86,7 @@ export default {
}
},
computed: {
...mapState('marketing', ['calendarDataAll', 'activityInfo'])
...mapState('marketing', ['calendarDataAll', 'activityInfo', 'keywords'])
},
watch: {
chatItem() {
......@@ -97,7 +97,8 @@ export default {
})
},
activityInfo(val) {
if (val.id) this.chatItem = []
this.chatItem = []
}
},
methods: {
......
......@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-16 10:23:52
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-30 15:28:53
* @LastEditTime: 2023-05-30 16:23:42
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\GPTAnalysis.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -199,7 +199,7 @@ import getUploadImgColor from '@/utils/color'
import { mapState, mapActions } from 'vuex'
import gpt from '@/mixins/gpt'
import draw from '@/mixins/draw'
import util from '@/utils/util'
import util from '@/utils/util'
export default {
mixins: [gpt, draw],
name: 'analysis',
......@@ -290,9 +290,6 @@ export default {
maxPhotoNum: 1,
suffixSlot: 'detailImage',
handleUpload: (e, file, targetItem) => {
getUploadImgColor(file, color => {
this.editForm.mainColor = color
})
const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.loading = true
......@@ -413,7 +410,7 @@ export default {
},
componentsName: 'analysis',
computed: {
...mapState('marketing', ['activityInfo', 'GPTList', 'merchantInfo']),
...mapState('marketing', ['activityInfo', 'GPTList', 'merchantInfo','keywords']),
mergeStr() {
const { backgroundImage, detailImage, merchantLog, mainColor, logoInfo, marketingTitle, marketingSubtitle, templateId } = this.editForm
return [backgroundImage, detailImage, merchantLog, mainColor, logoInfo, marketingTitle, marketingSubtitle, templateId]
......@@ -430,6 +427,11 @@ export default {
'editForm.activityPrice'(newValue, oldValue) {
this.editForm.activityPrice = util.limitPrice(newValue, oldValue, 6, 2, 0)
},
'editForm.detailImage'(newValue, oldValue) {
getUploadImgColor(newValue, color => {
this.editForm.mainColor = color
})
}
},
components: {
selectGiftDialog,
......@@ -719,7 +721,7 @@ export default {
// isGetList =true 创建成功初始化
init(isGetList = true) {
isGetList && this.setSchemeListData({ merchantId: this.editForm.merchantId, pageSize: 5, currentPage: 1 })
this.editForm = { mainColor: '', marketingTitle: '', bigImage: '', marketingSubtitle: '', activityTime: [], superMarketingCouponRelRequestList: [], backgroundImage: '', detailImage: '', merchantLog: '', merchantname: this.merchantInfo.merchantName, merchantAddress: this.merchantInfo.merchantAddress, merchantId: this.merchantInfo.merchantNo }
this.editForm = { mainColor: '', activityPrice: '', marketingTitle: '', bigImage: '', marketingSubtitle: '', activityTime: [], superMarketingCouponRelRequestList: [], backgroundImage: '', detailImage: '', merchantLog: '', merchantname: this.merchantInfo.merchantName, merchantAddress: this.merchantInfo.merchantAddress, merchantId: this.merchantInfo.merchantNo }
this.selectedGoodsList = []
this.selectedEquityList = []
this.exportUrl = ''
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!