Commit a45909fa by 杨明

fixed

1 parent 5a7f8ac3
......@@ -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-22 10:49:33
* @LastEditTime: 2023-05-23 17:03:18
* @FilePath: \scrm-micro-home\src\store\modules\marketing.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -103,7 +103,7 @@ export default {
//营销方案列表
setSchemeListData(conText, payload) {
apis.activity.listByPage(payload).then(res => {
if (res.list) {
if (res) {
conText.commit('SET_SCHEME_DATA', res.list)
}
})
......
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-22 20:12:55
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-22 20:27:53
* @FilePath: \scrm-micro-home\src\utils\color.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
var img_width = 0,
img_height = 0
var canvas = document.createElement('canvas')
var context = canvas.getContext('2d')
var myColor = []
function getColor() {
var imageData = context.getImageData(img_width - 1, img_height - 1, img_width, img_height)
myColor = [imageData.data[0], imageData.data[1], imageData.data[2]]
var hexColor = gethex(...myColor)
return `#${hexColor}`
}
// 获取16进制颜色
function gethex(r, g, b) {
console.log(r, g, b)
r = r.toString(16)
g = g.toString(16)
b = b.toString(16)
// 补0
r.length == 1 ? (r = '0' + r) : ''
g.length == 1 ? (g = '0' + g) : ''
b.length == 1 ? (b = '0' + b) : ''
var hex = r + g + b
// 简化处理,如 FFEEDD 可以写为 FED
if (r.slice(0, 1) == r.slice(1, 1) && g.slice(0, 1) == g.slice(1, 1) && b.slice(0, 1) == b.slice(1, 1)) {
hex = r.slice(0, 1) + g.slice(0, 1) + b.slice(0, 1)
}
return hex
}
function uploadImg(img, callbackFn) {
var reader = new FileReader()
reader.readAsDataURL(img)
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())
}
}
}
export default uploadImg
......@@ -2,14 +2,14 @@
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-16 10:23:52
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-22 17:59:57
* @LastEditTime: 2023-05-23 16:38:54
* @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
-->
<template>
<div>
<div class="main-box">
<div class="main-title">本次营销模型解析{{ keywords }}</div>
<div class="main-box" v-loading="loading">
<div class="main-title">本次营销模型解析</div>
<div class="inport-result" v-if="importNum">
本次导入客户解析:客户数:
<span>{{ importNum }}人</span>
......@@ -195,6 +195,7 @@ import selectGoodsDialog from './selectGoodsDialog'
import selectEquityDialog from './selectEquityDialog'
import selectEmpDialog from './selectEmpDialog'
import Drawing from '@/utils/drawing'
import getUploadImgColor from '@/utils/color'
import { mapState, mapActions } from 'vuex'
import gpt from '@/mixins/gpt'
export default {
......@@ -202,6 +203,7 @@ export default {
name: 'analysis',
data() {
return {
mainColor: '',
editChildRef: 'editChildRef',
importNum: 0,
couponTemplateList: [],
......@@ -211,6 +213,7 @@ export default {
selectedGoodsList: [],
selectedEquityList: [],
goodsLoading: false,
loading: false,
couponObj: JSON.parse(JSON.stringify(couponObj)),
goodsObj: JSON.parse(JSON.stringify(goodsObj)),
numToCoupon,
......@@ -285,6 +288,9 @@ export default {
maxPhotoNum: 1,
suffixSlot: 'detailImage',
handleUpload: (e, file, targetItem) => {
getUploadImgColor(file, color => {
this.mainColor = color
})
const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.loading = true
......@@ -498,7 +504,6 @@ export default {
},
uploadImg(imgFile) {
const base64 = 'png' + '@' + imgFile.split(',')[1]
this.loading = true
this.$apis.common.pictureUpload({ file: base64, fileType: 'image' }).then(res => {
this.bigImage = res
})
......@@ -699,10 +704,6 @@ export default {
return param
},
handleConfirm() {
if (!this.importNum) {
this.$message.error('请导入客户')
return
}
if (this.selectedGoodsList.length + this.editForm.superMarketingCouponRelRequestList.length + this.selectedGoodsList.length == 0) {
this.$message.error('权益服务、平台优惠、门店优惠券至少选一项')
return
......
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-15 15:08:01
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-22 17:01:11
* @LastEditTime: 2023-05-23 17:02:43
* @FilePath: \scrm-micro-home\src\views\home\components\marketing\MarketingLeft.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -109,7 +109,8 @@ export default {
setSchemeListData() {
this.$apis.activity.listByPage({ merchantId: this.$globalState.session.merchantId, pageSize: 5, currentPage: this.currentPage }).then(res => {
if (res) {
this.schemeList = this.schemeList.concat(res.list || [])
let list = res.list || []
this.schemeList = this.currentPage == 1?list:this.schemeList.concat(res.list || [])
this.total = res.total
}
})
......
......@@ -92,7 +92,7 @@ export default {
display: flex;
.home-use-item {
position: relative;
padding: 20px;
padding: 1vw;
box-sizing: border-box;
flex: 1;
border: 1px solid #e5e5e5;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!