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
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
19 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 @@
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'
# 开发环境IP
...
...
linkwe-ui/src/components/SelectMaterial/index.vue
View file @
2c323e4
...
...
@@ -69,7 +69,7 @@ export default {
</
script
>
<
template
>
<el-dialog
title=
"选择素材"
:visible
.
sync=
"Pvisible"
width=
"650px"
>
<el-dialog
title=
"选择素材"
:visible
.
sync=
"Pvisible"
width=
"650px"
append-to-body
>
<div>
<el-tabs
v-model=
"Ptype"
>
<el-tab-pane
name=
"0"
v-if=
"showArr.includes(0)"
>
...
...
linkwe-ui/src/views/material/components/PosterPage.vue
View file @
2c323e4
<
template
>
<div
ref=
"tuiImageEditor"
style=
"width: 100%;height: 100%;"
></div>
<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
>
<
script
>
import
ImageEditor
from
'tui-image-editor'
;
import
selectMaterial
from
'@/components/SelectMaterial'
import
{
setTimeout
}
from
'timers'
;
import
colorPicker
from
'tui-color-picker'
;
import
qrCodeImage
from
"@/assets/poster/img/qrCodeImage.png"
;
...
...
@@ -18,6 +22,9 @@ const editorDefaultOptions = {
};
export
default
{
name
:
'PosterPage'
,
components
:
{
selectMaterial
},
props
:
{
btnContainer
:
null
,
// 自带按钮容器
includeUi
:
{
...
...
@@ -31,6 +38,11 @@ export default {
}
}
},
data
()
{
return
{
visible
:
false
}
},
mounted
()
{
let
options
=
editorDefaultOptions
;
if
(
this
.
includeUi
)
{
...
...
@@ -49,7 +61,7 @@ export default {
},
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
(
'new : '
+
result
.
newWidth
+
', '
+
result
.
newHeight
);
// await this.addImage('https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg')
...
...
@@ -157,7 +169,6 @@ export default {
this
.
btnTextStyle
[
i
].
addEventListener
(
'click'
,
this
.
mouseClickHandler
.
bind
(
this
));
i
++
;
}
this
.
editorInstance
.
on
({
objectAdded
:
function
(
objectProps
)
{
console
.
info
(
objectProps
);
...
...
@@ -433,23 +444,35 @@ export default {
};
},
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
.
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
)
{
if
(
!
imgPath
||
!
imgPath
.
length
){
throw
Error
(
"imgPath can't null"
)
}
this
.
editorInstance
.
addImageObject
(
imgPath
).
then
(
objectProps
=>
{
console
.
log
(
objectProps
.
id
);
let
id
=
this
.
GenNonDuplicateID
()
+
'_'
+
objectProps
.
id
;
this
.
$parent
.
imgList
[
id
]
=
imgPath
;
// FIXME
let
target
=
this
.
$parent
.
records
[
objectProps
.
id
];
if
(
target
)
{
// this.$parent.imgList[id] = imgPath; // FIXME
// console.log(objectProps)
// console.log(this.$parent.records)
// let target = this.$parent.records[objectProps.id];
let
target
=
{}
// if (target) {
target
.
url
=
imgPath
;
target
.
randomId
=
id
;
target
.
randomId
=
objectProps
.
id
;
target
.
objType
=
type
;
}
// }
this
.
$emit
(
'getImageData'
,
target
);
// 将图片数据传给父组件保存
});
},
addText
(
text
,
style
=
null
,
position
=
null
)
{
...
...
linkwe-ui/src/views/material/poster.vue
View file @
2c323e4
...
...
@@ -31,6 +31,7 @@ export default {
data
()
{
return
{
imgList
:
{},
imgData
:
[],
dialog
:
{
preview
:
false
,
// 预览弹出显示隐藏
edit
:
false
// 编辑弹出显示隐藏
...
...
@@ -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
()
{
let
list
=
[];
...
...
@@ -387,6 +395,10 @@ export default {
let
i
=
0
,
len
=
list
.
length
;
while
(
i
<
len
)
{
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
align
=
vo
.
textAlign
&&
(
vo
.
textAlign
===
'left'
?
1
:
vo
.
textAlign
===
'center'
?
2
:
3
)
...
...
@@ -395,8 +407,8 @@ export default {
let
posData
=
{
id
:
vo
.
randomId
||
i
,
content
:
vo
.
text
||
''
,
// 文本内容
delFlag
:
1
,
// 1 启动 0 删除 FIXME 暂时写死
fontColor
:
vo
.
fill
||
'#000000'
,
delFlag
:
0
,
// 1 启动 0 删除 FIXME 暂时写死
fontColor
:
vo
.
fill
||
'#000000'
,
//
fontId
:
isText
?
i
:
null
,
// 字体ID 与imgPath互斥
fontSize
:
vo
.
fontSize
,
fontTextAlign
:
align
,
// 1 2 3 left center right
...
...
@@ -406,12 +418,12 @@ export default {
height
:
vo
.
height
,
imgPath
:
vo
.
url
||
''
,
posterId
:
null
,
type
:
isText
?
1
:
vo
.
objType
,
// 1 固定文本 2 固定图片 3 二维码图片
alpha
:
vo
.
opacity
,
type
:
isText
?
1
:
vo
.
objType
,
// 1 固定文本 2 固定图片 3 二维码图片
// alpha: vo.opacity, // 页面没有设置透明度,可不传
fontStyle
:
(
vo
.
italic
&&
vo
.
bold
)
?
3
:
vo
.
italic
?
2
:
vo
.
bold
?
1
:
0
,
// 0 通常 1 粗体 2 斜体 3 粗 + 斜
rotate
:
vo
.
angle
,
order
:
i
,
// 层级
categoryId
:
0
,
// 分类ID
// categoryId: 0, // 分类ID (不需要传了)
verticalType
:
2
// 居中方式 写死2
};
posterSubList
.
push
(
posData
);
...
...
@@ -424,13 +436,13 @@ export default {
if
(
posterForm
.
id
)
{
// 编辑海报
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
:
[]
},
this
.
posterForm
))
}
else
{
// 新建海报
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
},
this
.
posterForm
))
}
...
...
@@ -590,6 +602,7 @@ export default {
ref=
"tuiImageEditor"
:include-ui=
"useDefaultUI"
:options=
"options"
@
getImageData=
"getImgData"
></tui-image-editor>
</div>
<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