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 0157ff45
authored
Feb 21, 2021
by
channing
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
test_posterData
1 parent
56c55237
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
25 deletions
linkwe-ui/src/api/material/poster.js
linkwe-ui/src/views/material/components/PosterPage.vue
linkwe-ui/src/views/material/poster.vue
linkwe-ui/src/api/material/poster.js
View file @
0157ff4
...
@@ -23,6 +23,7 @@ export function updatePoster(data) {
...
@@ -23,6 +23,7 @@ export function updatePoster(data) {
* @param {*} data
* @param {*} data
*/
*/
export
function
addPoster
(
data
)
{
export
function
addPoster
(
data
)
{
console
.
log
(
JSON
.
stringify
(
data
))
return
request
({
url
:
serviceCategory
+
'/insert'
,
method
:
'post'
,
data
})
return
request
({
url
:
serviceCategory
+
'/insert'
,
method
:
'post'
,
data
})
}
}
...
...
linkwe-ui/src/views/material/components/PosterPage.vue
View file @
0157ff4
...
@@ -47,6 +47,9 @@ export default {
...
@@ -47,6 +47,9 @@ export default {
if
(
this
.
includeUi
)
{
if
(
this
.
includeUi
)
{
options
=
Object
.
assign
(
includeUIOptions
,
this
.
options
);
options
=
Object
.
assign
(
includeUIOptions
,
this
.
options
);
}
}
if
(
this
.
editorInstance
)
{
console
.
log
(
'this.editorInstance'
)
}
this
.
editorInstance
=
new
ImageEditor
(
this
.
$refs
.
tuiImageEditor
,
options
);
this
.
editorInstance
=
new
ImageEditor
(
this
.
$refs
.
tuiImageEditor
,
options
);
document
.
getElementsByClassName
(
'tui-image-editor-header'
)[
0
].
innerHTML
=
''
;
document
.
getElementsByClassName
(
'tui-image-editor-header'
)[
0
].
innerHTML
=
''
;
...
@@ -67,6 +70,8 @@ export default {
...
@@ -67,6 +70,8 @@ export default {
this
.
editorInstance
.
ui
.
_actions
.
text
.
modeChange
=
function
()
{}
this
.
editorInstance
.
ui
.
_actions
.
text
.
modeChange
=
function
()
{}
document
.
getElementsByClassName
(
'tui-image-editor-submenu'
)[
0
].
style
.
display
=
'none'
;
document
.
getElementsByClassName
(
'tui-image-editor-submenu'
)[
0
].
style
.
display
=
'none'
;
document
.
getElementsByClassName
(
'tie-btn-text'
)[
0
].
style
.
display
=
'none'
;
document
.
getElementsByClassName
(
'tie-btn-text'
)[
0
].
style
.
display
=
'none'
;
document
.
getElementsByClassName
(
'tui-image-editor-main'
)[
0
].
style
.
top
=
'0'
;
document
.
getElementsByClassName
(
'tui-image-editor-align-wrap'
)[
0
].
style
.
verticalAlign
=
'top'
;
this
.
initBtn
();
this
.
initBtn
();
this
.
addEventListener
();
this
.
addEventListener
();
...
@@ -75,6 +80,7 @@ export default {
...
@@ -75,6 +80,7 @@ export default {
// Object.keys(this.$listeners).forEach(eventName => {
// Object.keys(this.$listeners).forEach(eventName => {
// this.editorInstance.off(eventName);
// this.editorInstance.off(eventName);
// });
// });
console
.
log
(
'deatory poster'
)
this
.
editorInstance
.
destroy
();
this
.
editorInstance
.
destroy
();
this
.
editorInstance
=
null
;
this
.
editorInstance
=
null
;
},
},
...
@@ -178,6 +184,7 @@ export default {
...
@@ -178,6 +184,7 @@ export default {
redoStackChanged
:
this
.
onRedoStackChanged
.
bind
(
this
),
redoStackChanged
:
this
.
onRedoStackChanged
.
bind
(
this
),
objectScaled
:
this
.
onObjectScaled
.
bind
(
this
),
objectScaled
:
this
.
onObjectScaled
.
bind
(
this
),
addText
:
this
.
onAddText
.
bind
(
this
),
addText
:
this
.
onAddText
.
bind
(
this
),
textEditing
:
this
.
textEditing
.
bind
(
this
),
objectActivated
:
this
.
objectActivated
.
bind
(
this
),
objectActivated
:
this
.
objectActivated
.
bind
(
this
),
objectMoved
:
this
.
onObjectMoved
.
bind
(
this
)
objectMoved
:
this
.
onObjectMoved
.
bind
(
this
)
});
});
...
@@ -226,6 +233,10 @@ export default {
...
@@ -226,6 +233,10 @@ export default {
target
&&
(
target
.
randomId
=
id
);
target
&&
(
target
.
randomId
=
id
);
}.
bind
(
this
));
}.
bind
(
this
));
},
},
// 文本改变事件
textEditing
(
e
)
{
console
.
log
(
'dsds'
,
e
)
},
//移动
//移动
onObjectMoved
(
obj
)
{
onObjectMoved
(
obj
)
{
console
.
log
(
'onObjectMoved'
);
console
.
log
(
'onObjectMoved'
);
...
@@ -462,10 +473,6 @@ export default {
...
@@ -462,10 +473,6 @@ export default {
}
}
this
.
editorInstance
.
addImageObject
(
imgPath
).
then
(
objectProps
=>
{
this
.
editorInstance
.
addImageObject
(
imgPath
).
then
(
objectProps
=>
{
let
id
=
this
.
GenNonDuplicateID
()
+
'_'
+
objectProps
.
id
;
let
id
=
this
.
GenNonDuplicateID
()
+
'_'
+
objectProps
.
id
;
// this.$parent.imgList[id] = imgPath; // FIXME
// console.log(objectProps)
// console.log(this.$parent.records)
// let target = this.$parent.records[objectProps.id];
let
target
=
{}
let
target
=
{}
// if (target) {
// if (target) {
...
...
linkwe-ui/src/views/material/poster.vue
View file @
0157ff4
...
@@ -32,7 +32,6 @@ export default {
...
@@ -32,7 +32,6 @@ export default {
data
()
{
data
()
{
return
{
return
{
imgList
:
{},
imgList
:
{},
imgData
:
[],
dialogVisibleSelectMaterial
:
false
,
dialogVisibleSelectMaterial
:
false
,
dialog
:
{
dialog
:
{
preview
:
false
,
// 预览弹出显示隐藏
preview
:
false
,
// 预览弹出显示隐藏
...
@@ -277,6 +276,13 @@ export default {
...
@@ -277,6 +276,13 @@ export default {
}
else
{
}
else
{
this
.
rangeErrorMsg
=
''
this
.
rangeErrorMsg
=
''
}
}
if
(
this
.
$refs
.
tuiImageEditor
&&
this
.
$refs
.
tuiImageEditor
.
editorInstance
)
{
this
.
$refs
.
tuiImageEditor
.
editorInstance
.
_invoker
.
_redoStack
=
[];
this
.
$refs
.
tuiImageEditor
.
editorInstance
.
_invoker
.
_undoStack
=
[];
this
.
$refs
.
tuiImageEditor
.
records
=
{}
this
.
records
=
[];
this
.
imgList
=
{};
}
this
.
$refs
.
form
.
validate
((
valid
)
=>
{
this
.
$refs
.
form
.
validate
((
valid
)
=>
{
if
(
valid
)
{
if
(
valid
)
{
this
.
posterEdit
.
step
=
1
this
.
posterEdit
.
step
=
1
...
@@ -375,10 +381,7 @@ export default {
...
@@ -375,10 +381,7 @@ export default {
},
},
// 获取子组件传来的数据
// 获取子组件传来的数据
getImgData
(
data
)
{
getImgData
(
data
)
{
this
.
imgList
.
id
=
data
.
imgUrl
this
.
imgList
.
id
=
data
// console.log(data)
this
.
imgData
.
push
(
data
)
// console.log(this.imgData)
},
},
// 选择素材确认按钮
// 选择素材确认按钮
submitSelectMaterial
(
text
,
image
,
file
)
{
submitSelectMaterial
(
text
,
image
,
file
)
{
...
@@ -393,13 +396,21 @@ export default {
...
@@ -393,13 +396,21 @@ export default {
//
//
async
save
()
{
async
save
()
{
let
list
=
[];
let
list
=
[];
let
historys
=
[];
try
{
try
{
let
imageEditor
=
this
.
$refs
.
tuiImageEditor
;
let
imageEditor
=
this
.
$refs
.
tuiImageEditor
;
let
deleteId
=
[];
let
deleteId
=
[];
imageEditor
.
editorInstance
.
_invoker
.
_undoStack
.
forEach
(
element
=>
{
imageEditor
.
editorInstance
.
_invoker
.
_undoStack
.
forEach
(
element
=>
{
if
(
element
.
name
==
"removeObject"
){
if
(
element
.
name
==
"removeObject"
){
deleteId
.
push
(
element
.
args
[
1
])
deleteId
.
push
(
element
.
args
[
1
])
}
else
{
if
(
element
.
args
[
1
]
instanceof
Array
)
{
historys
.
push
(
element
.
args
[
1
][
0
])
}
else
{
historys
.
push
(
element
.
args
[
1
])
}
}
}
})
})
Object
.
values
(
imageEditor
.
records
).
forEach
(
item
=>
{
Object
.
values
(
imageEditor
.
records
).
forEach
(
item
=>
{
...
@@ -418,23 +429,31 @@ export default {
...
@@ -418,23 +429,31 @@ export default {
// TODO 塞新建海报的数据
// TODO 塞新建海报的数据
let
posterSubList
=
[];
let
posterSubList
=
[];
let
vo
=
null
;
let
i
=
0
,
len
=
list
.
length
;
let
i
=
0
,
len
=
list
.
length
;
while
(
i
<
len
)
{
while
(
i
<
len
)
{
let
vo
=
list
[
i
];
vo
=
list
[
i
];
if
(
!
this
.
imgData
[
i
])
{
if
(
this
.
imgList
[
vo
.
id
])
{
console
.
log
(
'this.imgData[i] is null'
)
vo
.
objType
=
this
.
imgList
[
vo
.
id
].
objType
;
i
++
;
vo
.
url
=
this
.
imgList
[
vo
.
id
].
url
;
continue
;
vo
.
randomId
=
this
.
imgList
[
vo
.
id
].
randomId
}
}
vo
.
objType
=
this
.
imgData
[
i
].
objType
;
vo
.
url
=
this
.
imgData
[
i
].
url
;
let
type
=
vo
.
type
;
vo
.
randomId
=
this
.
imgData
[
i
].
randomId
;
let
isText
=
false
;
// console.log(vo)
if
(
type
===
'i-text'
||
type
===
'text'
)
{
let
type
=
list
[
i
].
type
;
// 如果是文本需要对文字内容进行特殊处理
isText
=
true
;
let
targetData
=
this
.
getLastSelectData
(
vo
.
id
,
historys
);
if
(
targetData
)
{
vo
.
text
=
targetData
.
text
;
}
}
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
)
||
null
;
||
null
;
let
isText
=
type
===
'i-text'
||
type
===
'text'
;
let
posData
=
{
let
posData
=
{
id
:
vo
.
randomId
||
i
,
id
:
vo
.
randomId
||
i
,
content
:
vo
.
text
||
''
,
// 文本内容
content
:
vo
.
text
||
''
,
// 文本内容
...
@@ -474,7 +493,6 @@ export default {
...
@@ -474,7 +493,6 @@ export default {
}
else
{
}
else
{
// 新建海报
// 新建海报
res
=
await
addPoster
(
Object
.
assign
({},
{
res
=
await
addPoster
(
Object
.
assign
({},
{
// backgroundImgPath: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg',
backgroundImgPath
:
this
.
materialSelected
,
backgroundImgPath
:
this
.
materialSelected
,
posterSubassemblyList
:
posterSubList
posterSubassemblyList
:
posterSubList
},
this
.
posterForm
))
},
this
.
posterForm
))
...
@@ -484,8 +502,26 @@ export default {
...
@@ -484,8 +502,26 @@ export default {
this
.
$refs
.
page
.
getList
(
1
)
this
.
$refs
.
page
.
getList
(
1
)
this
.
beforeCloseDialog
()
this
.
beforeCloseDialog
()
}
}
},
getLastSelectData
(
id
,
arr
)
{
let
index
=
arr
.
length
-
1
,
len
=
0
;
let
selectData
=
null
;
try
{
while
(
index
>=
len
)
{
// 类型转换对比
if
(
arr
[
index
].
id
==
id
)
{
selectData
=
arr
[
index
];
break
;
}
index
--
;
}
}
catch
(
e
)
{
console
.
log
(
'getLastSelectData 循环出错'
)
}
return
selectData
;
}
}
}
,
}
}
}
</
script
>
</
script
>
...
...
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