Commit c808cf13 by 杨明

fixed

1 parent 0993e6bf
......@@ -12589,6 +12589,11 @@
"integrity": "sha512-OJSOnJtn7f1v/8xX+MJae+RrE8WguhiiG9QTBx/MNOPXYsxqut6Ommo+ZD3raNc7eryhqdM2T/DlMfdvIKpCtw==",
"dev": true
},
"vue-draggable-resizable": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/vue-draggable-resizable/-/vue-draggable-resizable-2.3.0.tgz",
"integrity": "sha512-77CLRj1TPwB30pwsjOf3pkd1UzYanCdKXbqhILJ0Oo5QQl50lvBfyQCXxMFzwWwTc3sbBbQH3FfWSV+BkoSElA=="
},
"vue-eslint-parser": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-5.0.0.tgz",
......
......@@ -16,7 +16,9 @@
"glsx-common": "^1.4.6",
"glsx-components": "^1.5.7",
"vue": "^2.6.10",
"vue-draggable-resizable": "^2.3.0",
"vue-router": "^3.1.3",
"vuedraggable": "^2.24.3",
"vuex": "^3.1.2",
"xlsx": "^0.18.5"
},
......
.vdr {
touch-action: none;
position: absolute;
box-sizing: border-box;
border: 1px dashed black;
}
.handle {
box-sizing: border-box;
position: absolute;
width: 10px;
height: 10px;
background: #EEE;
border: 1px solid #333;
}
.handle-tl {
top: -10px;
left: -10px;
cursor: nw-resize;
}
.handle-tm {
top: -10px;
left: 50%;
margin-left: -5px;
cursor: n-resize;
}
.handle-tr {
top: -10px;
right: -10px;
cursor: ne-resize;
}
.handle-ml {
top: 50%;
margin-top: -5px;
left: -10px;
cursor: w-resize;
}
.handle-mr {
top: 50%;
margin-top: -5px;
right: -10px;
cursor: e-resize;
}
.handle-bl {
bottom: -10px;
left: -10px;
cursor: sw-resize;
}
.handle-bm {
bottom: -10px;
left: 50%;
margin-left: -5px;
cursor: s-resize;
}
.handle-br {
bottom: -10px;
right: -10px;
cursor: se-resize;
}
@media only screen and (max-width: 768px) {
[class*="handle-"]:before {
content: '';
left: -10px;
right: -10px;
bottom: -10px;
top: -10px;
position: absolute;
}
}
......@@ -4,12 +4,13 @@
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-31 16:27:05
* @LastEditTime: 2023-07-03 11:27:37
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
// let request = require('@/http/request.js')
let cfg = require('./conf.js')
import { Http } from 'glsx-common'
let timeout = 30000 //超时时间
export const fetchConfig = function(common) {
// if (isEnv) {
......
import { isFunction } from './fns'
export function matchesSelectorToParentElements(el, selector, baseNode) {
let node = el
const matchesSelectorFunc = ['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'].find(func => isFunction(node[func]))
if (!isFunction(node[matchesSelectorFunc])) return false
do {
if (node[matchesSelectorFunc](selector)) return true
if (node === baseNode) return false
node = node.parentNode
} while (node)
return false
}
export function getComputedSize($el) {
const style = window.getComputedStyle($el)
return [parseFloat(style.getPropertyValue('width'), 10), parseFloat(style.getPropertyValue('height'), 10)]
}
export function addEvent(el, event, handler) {
if (!el) {
return
}
if (el.attachEvent) {
el.attachEvent('on' + event, handler)
} else if (el.addEventListener) {
el.addEventListener(event, handler, true)
} else {
el['on' + event] = handler
}
}
export function removeEvent(el, event, handler) {
if (!el) {
return
}
if (el.detachEvent) {
el.detachEvent('on' + event, handler)
} else if (el.removeEventListener) {
el.removeEventListener(event, handler, true)
} else {
el['on' + event] = null
}
}
export function isFunction(func) {
return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]'
}
export function snapToGrid(grid, pendingX, pendingY, scale = 1) {
const [scaleX, scaleY] = typeof scale === 'number' ? [scale, scale] : scale
const x = Math.round(pendingX / scaleX / grid[0]) * grid[0]
const y = Math.round(pendingY / scaleY / grid[1]) * grid[1]
return [x, y]
}
export function getSize(el) {
const rect = el.getBoundingClientRect()
return [parseInt(rect.width), parseInt(rect.height)]
}
export function computeWidth(parentWidth, left, right) {
return parentWidth - left - right
}
export function computeHeight(parentHeight, top, bottom) {
return parentHeight - top - bottom
}
export function restrictToBounds(value, min, max) {
if (min !== null && value < min) {
return min
}
if (max !== null && max < value) {
return max
}
return value
}
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-10 17:17:31
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-25 15:55:08
* @LastEditTime: 2023-07-06 17:38:54
* @FilePath: \outbound\src\views\calendar\add.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -53,7 +53,7 @@
</div>
</glsx-combi-form>
<div class="preview-panel">
<PhoneView :editForm="editForm" :selectedGoodsList="selectedGoodsList"></PhoneView>
<PhoneView :editForm="editForm" ref="preview" :selectedGoodsList="selectedGoodsList"></PhoneView>
</div>
</div>
<GLFooter>
......@@ -206,6 +206,15 @@ export default {
couponAmount: item.couponAmount
}
})
if (param.titleStyle) {
const style1 = this.$refs.preview.draggableList[0]
const style2 = this.$refs.preview.draggableList[1]
const titleStyle = JSON.parse(param.titleStyle)
const subTitleStyle = JSON.parse(param.subTitleStyle)
param.titleStyle = JSON.stringify(Object.assign(titleStyle, { x: style1.x, y: style1.y, size: style1.size, width: style1.width }))
param.subTitleStyle = JSON.stringify(Object.assign(subTitleStyle, { x: style2.x, y: style2.y, size: style2.size, width: style2.width }))
}
console.log(param.titleStyle)
delete param.goodsList
delete param.couponTemplateName
delete param.couponTemplateId
......
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-15 15:08:32
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-05-31 17:18:14
* @LastEditTime: 2023-07-06 17:44:39
* @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
-->
......@@ -10,7 +10,36 @@
<div class="review-body">
<img src="@/assets/phone.png" class="review-phone" />
<div class="review-title_top">{{ detail.title }}</div>
<div class="review-content">
<div class="review-content" v-if="detail.marketingType == 5">
<div class="review-main">
<template v-for="item in draggableList">
<vue-draggable-resizable
:customId="item.customId"
:key="item.customId"
v-if="item.type == 'text'"
:w="item.width"
:h="item.height"
:x="item.x"
:y="item.y"
:style="{
'font-size': item.size + 'px',
color: item.color
}"
class="img_cl"
parent=".review-main"
@dragging="onDrag"
@resizing="onResize"
@activated="onActivated"
>
{{ item.content }}
</vue-draggable-resizable>
</template>
<div class="review-bg-img">
<img :src="detail.backgroundImg" v-if="detail.backgroundImg" />
</div>
</div>
</div>
<div class="review-content" v-else>
<div class="review-main">
<div class="main-title" :style="{ top: item.y + 'px', 'font-size': item.fontSize + 'px', color: item.color }" v-for="(item, index) in textList" :key="index">{{ item.text }}</div>
<div class="review-bg-img">
......@@ -38,9 +67,41 @@
</div>
</template>
<script>
import VueDraggableResizable from '@/components/draggable/vue-draggable-resizable'
import '@/components/draggable/vue-draggable-resizable.css'
export default {
components: {
VueDraggableResizable
},
data() {
return {
currentIndex: 0,
draggableList: [
{
type: 'text',
x: 0,
y: 0,
width: 40,
height: 20,
content: '默认',
remark: '文字',
size: 20,
color: '',
customId: '1'
},
{
type: 'text',
x: 0,
y: 0,
width: 40,
height: 20,
content: '默认',
remark: '文字',
size: 20,
color: '',
customId: '2'
}
],
detail: {},
cavansObj: {
1: {
......@@ -93,6 +154,7 @@ export default {
watch: {
editForm: {
handler(val) {
console.log(33)
const mainTitle = this.cavansObj[val.id],
{ title, subTitle } = val,
textList = []
......@@ -116,11 +178,43 @@ export default {
})
})
}
this.textList = textList
this.detail = val
},
deep: true,
immediate: true
},
'editForm.titleStyle': {
handler(val) {
console.log(888)
const { title, subTitle, titleStyle, subTitleStyle,marketingType } = this.editForm
if (marketingType == 5) {
const style1 = JSON.parse(titleStyle)
const style2 = JSON.parse(subTitleStyle)
Object.assign(this.draggableList[0], { content: title, ...style1, color: style1.style.color })
Object.assign(this.draggableList[1], { content: subTitle, ...style1, color: style2.style.color })
}
},
deep: true,
immediate: true
}
},
methods: {
onDrag(x, y) {
this.draggableList[this.currentIndex].x = x
this.draggableList[this.currentIndex].y = y
},
onActivated(index) {
const idx = this.draggableList.findIndex(item => item.customId == index)
this.currentIndex = idx
},
onResize(x, y, width, height) {
this.draggableList[this.currentIndex].x = x
this.draggableList[this.currentIndex].y = y
this.draggableList[this.currentIndex].width = width
this.draggableList[this.currentIndex].height = height
this.draggableList[this.currentIndex].size = height
}
}
}
......@@ -157,10 +251,12 @@ export default {
width: calc(100% - 20px);
height: 504px;
overflow-y: auto;
overflow-x: hidden;
top: 77px;
left: 13px;
.review-main {
position: relative;
height: 300px;
.main-title {
width: 100%;
position: absolute;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!