Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2c323e49
authored
Jan 31, 2021
by
sunruig
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
海报创建添加图片
1 parent
9cf27f58
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
17 deletions
linkwe-ui/.env.development
linkwe-ui/src/components/SelectMaterial/index.vue
linkwe-ui/src/views/material/components/PosterPage.vue
linkwe-ui/src/views/material/poster.vue
linkwe-ui/.env.development
View file @
2c323e4
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
ENV = 'development'
ENV = 'development'
# 塬微管理系统/开发环境
# 塬微管理系统/开发环境
VUE_APP_BASE_API = 'http://1
06.13.236.58:8080
'
VUE_APP_BASE_API = 'http://1
46.56.222.200/api
'
# VUE_APP_BASE_API = 'http://n3rpzt.natappfree.cc'
# VUE_APP_BASE_API = 'http://n3rpzt.natappfree.cc'
# 开发环境IP
# 开发环境IP
...
...
linkwe-ui/src/components/SelectMaterial/index.vue
View file @
2c323e4
...
@@ -69,7 +69,7 @@ export default {
...
@@ -69,7 +69,7 @@ export default {
</
script
>
</
script
>
<
template
>
<
template
>
<el-dialog
title=
"选择素材"
:visible
.
sync=
"Pvisible"
width=
"650px"
>
<el-dialog
title=
"选择素材"
:visible
.
sync=
"Pvisible"
width=
"650px"
append-to-body
>
<div>
<div>
<el-tabs
v-model=
"Ptype"
>
<el-tabs
v-model=
"Ptype"
>
<el-tab-pane
name=
"0"
v-if=
"showArr.includes(0)"
>
<el-tab-pane
name=
"0"
v-if=
"showArr.includes(0)"
>
...
...
linkwe-ui/src/views/material/components/PosterPage.vue
View file @
2c323e4
<
template
>
<
template
>
<div>
<div
ref=
"tuiImageEditor"
style=
"width: 100%;height: 100%;"
></div>
<div
ref=
"tuiImageEditor"
style=
"width: 100%;height: 100%;"
></div>
<select-material
ref=
"selectMaterial"
type=
"1"
:showArr=
"[1]"
:visible
.
sync=
"visible"
@
success=
"getMaterial"
/>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
ImageEditor
from
'tui-image-editor'
;
import
ImageEditor
from
'tui-image-editor'
;
import
selectMaterial
from
'@/components/SelectMaterial'
import
{
setTimeout
}
from
'timers'
;
import
{
setTimeout
}
from
'timers'
;
import
colorPicker
from
'tui-color-picker'
;
import
colorPicker
from
'tui-color-picker'
;
import
qrCodeImage
from
"@/assets/poster/img/qrCodeImage.png"
;
import
qrCodeImage
from
"@/assets/poster/img/qrCodeImage.png"
;
...
@@ -18,6 +22,9 @@ const editorDefaultOptions = {
...
@@ -18,6 +22,9 @@ const editorDefaultOptions = {
};
};
export
default
{
export
default
{
name
:
'PosterPage'
,
name
:
'PosterPage'
,
components
:
{
selectMaterial
},
props
:
{
props
:
{
btnContainer
:
null
,
// 自带按钮容器
btnContainer
:
null
,
// 自带按钮容器
includeUi
:
{
includeUi
:
{
...
@@ -31,6 +38,11 @@ export default {
...
@@ -31,6 +38,11 @@ export default {
}
}
}
}
},
},
data
()
{
return
{
visible
:
false
}
},
mounted
()
{
mounted
()
{
let
options
=
editorDefaultOptions
;
let
options
=
editorDefaultOptions
;
if
(
this
.
includeUi
)
{
if
(
this
.
includeUi
)
{
...
@@ -49,7 +61,7 @@ export default {
...
@@ -49,7 +61,7 @@ export default {
},
500
)
},
500
)
});
});
}
}
this
.
editorInstance
.
loadImageFromURL
(
'https://
gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg1.gtimg.com%2Fsports%2Fpics%2Fhv1%2F171%2F106%2F1472%2F95744001.jpg&refer=http%3A%2F%2Fimg1.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1612444990&t=6589254fe9669cc6a45fd3688f269612
'
,
'imagePoster'
).
then
(
async
result
=>
{
this
.
editorInstance
.
loadImageFromURL
(
'https://
ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg
'
,
'imagePoster'
).
then
(
async
result
=>
{
console
.
log
(
'old : '
+
result
.
oldWidth
+
', '
+
result
.
oldHeight
);
console
.
log
(
'old : '
+
result
.
oldWidth
+
', '
+
result
.
oldHeight
);
console
.
log
(
'new : '
+
result
.
newWidth
+
', '
+
result
.
newHeight
);
console
.
log
(
'new : '
+
result
.
newWidth
+
', '
+
result
.
newHeight
);
// await this.addImage('https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg')
// await this.addImage('https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg')
...
@@ -157,7 +169,6 @@ export default {
...
@@ -157,7 +169,6 @@ export default {
this
.
btnTextStyle
[
i
].
addEventListener
(
'click'
,
this
.
mouseClickHandler
.
bind
(
this
));
this
.
btnTextStyle
[
i
].
addEventListener
(
'click'
,
this
.
mouseClickHandler
.
bind
(
this
));
i
++
;
i
++
;
}
}
this
.
editorInstance
.
on
({
this
.
editorInstance
.
on
({
objectAdded
:
function
(
objectProps
)
{
objectAdded
:
function
(
objectProps
)
{
console
.
info
(
objectProps
);
console
.
info
(
objectProps
);
...
@@ -433,23 +444,35 @@ export default {
...
@@ -433,23 +444,35 @@ export default {
};
};
},
},
getImages
()
{
getImages
()
{
this
.
visible
=
true
;
// 显示图片列表dialog
// this.activateImageMode();
// this.addImage('https://images.gitee.com/uploads/images/2020/1231/234016_20fdd151_1480777.png',2);
},
// 提交选择的图片
getMaterial
(
text
,
image
,
file
)
{
// console.log(image.materialUrl)
this
.
activateImageMode
();
this
.
activateImageMode
();
this
.
addImage
(
'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg'
,
2
);
this
.
addImage
(
image
.
materialUrl
,
2
);
this
.
visible
=
false
;
},
},
addImage
(
imgPath
,
type
)
{
addImage
(
imgPath
,
type
)
{
if
(
!
imgPath
||
!
imgPath
.
length
){
if
(
!
imgPath
||
!
imgPath
.
length
){
throw
Error
(
"imgPath can't null"
)
throw
Error
(
"imgPath can't null"
)
}
}
this
.
editorInstance
.
addImageObject
(
imgPath
).
then
(
objectProps
=>
{
this
.
editorInstance
.
addImageObject
(
imgPath
).
then
(
objectProps
=>
{
console
.
log
(
objectProps
.
id
);
let
id
=
this
.
GenNonDuplicateID
()
+
'_'
+
objectProps
.
id
;
let
id
=
this
.
GenNonDuplicateID
()
+
'_'
+
objectProps
.
id
;
this
.
$parent
.
imgList
[
id
]
=
imgPath
;
// FIXME
// this.$parent.imgList[id] = imgPath; // FIXME
let
target
=
this
.
$parent
.
records
[
objectProps
.
id
];
// console.log(objectProps)
if
(
target
)
{
// console.log(this.$parent.records)
// let target = this.$parent.records[objectProps.id];
let
target
=
{}
// if (target) {
target
.
url
=
imgPath
;
target
.
url
=
imgPath
;
target
.
randomId
=
id
;
target
.
randomId
=
objectProps
.
id
;
target
.
objType
=
type
;
target
.
objType
=
type
;
}
// }
this
.
$emit
(
'getImageData'
,
target
);
// 将图片数据传给父组件保存
});
});
},
},
addText
(
text
,
style
=
null
,
position
=
null
)
{
addText
(
text
,
style
=
null
,
position
=
null
)
{
...
...
linkwe-ui/src/views/material/poster.vue
View file @
2c323e4
...
@@ -31,6 +31,7 @@ export default {
...
@@ -31,6 +31,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
imgList
:
{},
imgList
:
{},
imgData
:
[],
dialog
:
{
dialog
:
{
preview
:
false
,
// 预览弹出显示隐藏
preview
:
false
,
// 预览弹出显示隐藏
edit
:
false
// 编辑弹出显示隐藏
edit
:
false
// 编辑弹出显示隐藏
...
@@ -356,6 +357,13 @@ export default {
...
@@ -356,6 +357,13 @@ export default {
}
}
});
});
},
},
// 获取子组件传来的数据
getImgData
(
data
)
{
this
.
imgList
.
id
=
data
.
imgUrl
// console.log(data)
this
.
imgData
.
push
(
data
)
// console.log(this.imgData)
},
//
//
async
save
()
{
async
save
()
{
let
list
=
[];
let
list
=
[];
...
@@ -387,6 +395,10 @@ export default {
...
@@ -387,6 +395,10 @@ export default {
let
i
=
0
,
len
=
list
.
length
;
let
i
=
0
,
len
=
list
.
length
;
while
(
i
<
len
)
{
while
(
i
<
len
)
{
let
vo
=
list
[
i
];
let
vo
=
list
[
i
];
vo
.
objType
=
this
.
imgData
[
i
].
objType
;
vo
.
url
=
this
.
imgData
[
i
].
url
;
vo
.
randomId
=
this
.
imgData
[
i
].
randomId
;
// console.log(vo)
let
type
=
list
[
i
].
type
;
let
type
=
list
[
i
].
type
;
let
align
=
vo
.
textAlign
&&
let
align
=
vo
.
textAlign
&&
(
vo
.
textAlign
===
'left'
?
1
:
vo
.
textAlign
===
'center'
?
2
:
3
)
(
vo
.
textAlign
===
'left'
?
1
:
vo
.
textAlign
===
'center'
?
2
:
3
)
...
@@ -395,8 +407,8 @@ export default {
...
@@ -395,8 +407,8 @@ export default {
let
posData
=
{
let
posData
=
{
id
:
vo
.
randomId
||
i
,
id
:
vo
.
randomId
||
i
,
content
:
vo
.
text
||
''
,
// 文本内容
content
:
vo
.
text
||
''
,
// 文本内容
delFlag
:
1
,
// 1 启动 0 删除 FIXME 暂时写死
delFlag
:
0
,
// 1 启动 0 删除 FIXME 暂时写死
fontColor
:
vo
.
fill
||
'#000000'
,
fontColor
:
vo
.
fill
||
'#000000'
,
//
fontId
:
isText
?
i
:
null
,
// 字体ID 与imgPath互斥
fontId
:
isText
?
i
:
null
,
// 字体ID 与imgPath互斥
fontSize
:
vo
.
fontSize
,
fontSize
:
vo
.
fontSize
,
fontTextAlign
:
align
,
// 1 2 3 left center right
fontTextAlign
:
align
,
// 1 2 3 left center right
...
@@ -407,11 +419,11 @@ export default {
...
@@ -407,11 +419,11 @@ export default {
imgPath
:
vo
.
url
||
''
,
imgPath
:
vo
.
url
||
''
,
posterId
:
null
,
posterId
:
null
,
type
:
isText
?
1
:
vo
.
objType
,
// 1 固定文本 2 固定图片 3 二维码图片
type
:
isText
?
1
:
vo
.
objType
,
// 1 固定文本 2 固定图片 3 二维码图片
alpha
:
vo
.
opacity
,
// alpha: vo.opacity, // 页面没有设置透明度,可不传
fontStyle
:
(
vo
.
italic
&&
vo
.
bold
)
?
3
:
vo
.
italic
?
2
:
vo
.
bold
?
1
:
0
,
// 0 通常 1 粗体 2 斜体 3 粗 + 斜
fontStyle
:
(
vo
.
italic
&&
vo
.
bold
)
?
3
:
vo
.
italic
?
2
:
vo
.
bold
?
1
:
0
,
// 0 通常 1 粗体 2 斜体 3 粗 + 斜
rotate
:
vo
.
angle
,
rotate
:
vo
.
angle
,
order
:
i
,
// 层级
order
:
i
,
// 层级
categoryId
:
0
,
// 分类ID
// categoryId: 0, // 分类ID (不需要传了)
verticalType
:
2
// 居中方式 写死2
verticalType
:
2
// 居中方式 写死2
};
};
posterSubList
.
push
(
posData
);
posterSubList
.
push
(
posData
);
...
@@ -424,13 +436,13 @@ export default {
...
@@ -424,13 +436,13 @@ export default {
if
(
posterForm
.
id
)
{
if
(
posterForm
.
id
)
{
// 编辑海报
// 编辑海报
res
=
await
updatePoster
(
Object
.
assign
({},
{
res
=
await
updatePoster
(
Object
.
assign
({},
{
backgroundImgPath
:
'http
://106.13.236.58:8080/profile/2020/12/31/5ca3fa0b-55d7-433c-ba02-61d4502e45e1
.jpg'
,
backgroundImgPath
:
'http
s://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0
.jpg'
,
posterSubassemblyList
:
[]
posterSubassemblyList
:
[]
},
this
.
posterForm
))
},
this
.
posterForm
))
}
else
{
}
else
{
// 新建海报
// 新建海报
res
=
await
addPoster
(
Object
.
assign
({},
{
res
=
await
addPoster
(
Object
.
assign
({},
{
backgroundImgPath
:
'http
://106.13.236.58:8080/profile/2020/12/31/5ca3fa0b-55d7-433c-ba02-61d4502e45e1
.jpg'
,
backgroundImgPath
:
'http
s://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0
.jpg'
,
posterSubassemblyList
:
posterSubList
posterSubassemblyList
:
posterSubList
},
this
.
posterForm
))
},
this
.
posterForm
))
}
}
...
@@ -590,6 +602,7 @@ export default {
...
@@ -590,6 +602,7 @@ export default {
ref=
"tuiImageEditor"
ref=
"tuiImageEditor"
:include-ui=
"useDefaultUI"
:include-ui=
"useDefaultUI"
:options=
"options"
:options=
"options"
@
getImageData=
"getImgData"
></tui-image-editor>
></tui-image-editor>
</div>
</div>
<div
id=
"tbody-containerui-image-editor-controls"
>
<div
id=
"tbody-containerui-image-editor-controls"
>
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment