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 f84c0418
authored
Feb 24, 2021
by
liuchuanming
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
poster_reShowDisplay
1 parent
23c1a8dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
12 deletions
linkwe-ui/src/views/material/components/PosterPage.vue
linkwe-ui/src/views/material/poster.vue
linkwe-ui/src/views/material/components/PosterPage.vue
View file @
f84c041
...
...
@@ -39,6 +39,7 @@ export default {
},
data
()
{
return
{
qrCodeUrl
:
'http://www.linkwechat.cn/static/img/qrCodeImage.a6d01316.png'
,
visible
:
false
}
},
...
...
@@ -86,25 +87,47 @@ export default {
},
methods
:
{
// 设置背景图片
getBackgroundUrl
(
bacUrl
)
{
getBackgroundUrl
(
bacUrl
,
posterSubassemblyList
)
{
this
.
editorInstance
.
loadImageFromURL
(
bacUrl
,
'imagePoster'
).
then
(
async
result
=>
{
console
.
log
(
'old : '
+
result
.
oldWidth
+
', '
+
result
.
oldHeight
);
console
.
log
(
'new : '
+
result
.
newWidth
+
', '
+
result
.
newHeight
);
// 由于篡改了tuiimage,第一次使用addText会报错,错误不影响流程,但是会导致promise中断,提前触发报错。
try
{
this
.
editorInstance
.
addText
(
''
,
{
position
:
{
x
:
0
,
y
:
0
},
})
.
then
(
function
(
objectProps
)
{
console
.
log
(
'dd'
);
}).
catch
(()
=>
{});
}
catch
(
e
)
{
console
.
log
(
'addText 内部状态错误'
)
}
// FIXME 暂时延迟回显
setTimeout
(()
=>
{
posterSubassemblyList
.
length
&&
this
.
reShowDisplay
(
posterSubassemblyList
);
},
500
);
});
},
// 设置修改回显
reShowDisplay
(
reShowDisplays
)
{
async
reShowDisplay
(
reShowDisplays
)
{
let
i
=
0
,
len
=
reShowDisplays
.
length
;
let
_data
=
null
;
while
(
i
<
len
)
{
_data
=
reShowDisplays
[
i
];
_data
&&
this
.
createReShowDisplay
(
_data
);
if
(
_data
)
{
await
this
.
createReShowDisplay
(
_data
);
}
i
++
;
}
},
// 1 固定文本 2 固定图片 3 二维码图片
async
createReShowDisplay
(
data
)
{
return
Promise
((
resolve
)
=>
{
createReShowDisplay
(
data
)
{
return
new
Promise
((
resolve
)
=>
{
switch
(
data
.
type
)
{
case
1
:
this
.
editorInstance
.
...
...
@@ -118,16 +141,24 @@ export default {
console
.
log
(
objectProps
);
resolve
();
});
break
;
case
2
:
case
3
:
this
.
editorInstance
.
addImageObject
(
data
.
imgPath
).
then
(
objectProps
=>
{
this
.
editorInstance
.
addImageObject
(
data
.
type
===
2
?
data
.
imgPath
:
data
.
imgPath
===
this
.
qrCodeUrl
?
qrCodeImage
:
data
.
imgPath
).
then
(
objectProps
=>
{
console
.
log
(
objectProps
.
id
);
}).
then
(
function
(
objectProps
)
{
let
target
=
{}
target
.
url
=
data
.
imgPath
;
target
.
randomId
=
objectProps
.
id
;
target
.
objType
=
data
.
type
;
this
.
editorInstance
.
setObjectProperties
(
objectProps
.
id
,
{
left
:
data
.
left
,
top
:
data
.
top
})
// 将图片数据传给父组件保存
this
.
$emit
(
'getImageData'
,
target
);
console
.
log
(
objectProps
);
resolve
()
...
...
@@ -513,7 +544,7 @@ export default {
let
target
=
{}
// 二维码是占位符,所以可以写死
target
.
url
=
type
===
3
?
'http://www.linkwechat.cn/static/img/qrCodeImage.a6d01316.png'
:
imgPath
;
target
.
url
=
type
===
3
?
this
.
qrCodeUrl
:
imgPath
;
target
.
randomId
=
objectProps
.
id
;
target
.
objType
=
type
;
// 将图片数据传给父组件保存
...
...
linkwe-ui/src/views/material/poster.vue
View file @
f84c041
...
...
@@ -284,9 +284,7 @@ export default {
this
.
$refs
.
form
.
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
posterEdit
.
step
=
1
this
.
$refs
.
tuiImageEditor
.
getBackgroundUrl
(
this
.
materialSelected
);
// TODO 如果有数据说明是修改,则回显老数据
this
.
posterSubassemblyList
.
length
&&
this
.
$refs
.
tuiImageEditor
.
reShowDisplay
(
this
.
posterSubassemblyList
);
this
.
$refs
.
tuiImageEditor
.
getBackgroundUrl
(
this
.
materialSelected
,
this
.
posterSubassemblyList
);
}
else
{
return
false
;
}
...
...
@@ -424,7 +422,7 @@ export default {
content
:
vo
.
text
||
''
,
// 文本内容
delFlag
:
0
,
// 1 启动 0 删除 FIXME 暂时写死
fontColor
:
vo
.
fill
||
'#000000'
,
//
fontId
:
isText
?
i
:
null
,
// 字体ID 与imgPath互斥
fontId
:
null
,
// TODO 后端让传NULL
isText ? i : null, // 字体ID 与imgPath互斥
fontSize
:
vo
.
fontSize
,
fontTextAlign
:
align
,
// 1 2 3 left center right
left
:
parseInt
(
vo
.
left
),
...
...
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