Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-business
/
develop-platform
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 2b401072
authored
Nov 18, 2020
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
图片
1 parent
1850d162
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
62 deletions
src/components/d2-form/index.vue
src/components/d2-form/index.vue
View file @
2b40107
...
...
@@ -5,6 +5,7 @@
:model=
"formData"
:rules=
"rules"
:ref=
"formRef + 'd2FormRuleForm'"
v-loading=
"$store.state.d2admin.loading.value"
>
<div
v-for=
"(i, idx) in formList"
...
...
@@ -54,7 +55,7 @@
</el-option>
</el-select>
<!-- 远程搜索 - 选择框 -->
<el-select
<
!--
<
el-select
v-else-if=
"item.type === 'selectRemote'"
v-model=
"formData[item.name]"
:placeholder=
"'请选择' + item.label"
...
...
@@ -71,9 +72,9 @@
:value=
"subItem[item.optionId]"
>
</el-option>
</el-select>
</el-select>
-->
<!-- 复选选择框 -->
<el-select
<
!--
<
el-select
v-else-if=
"item.type === 'mutiSelect'"
multiple
v-model=
"formData[item.name]"
...
...
@@ -87,7 +88,7 @@
:label=
"subItem[item.optionLabel]"
:value=
"subItem"
></el-option>
</el-select>
</el-select>
-->
<template
v-else-if=
"item.type === 'button'"
>
<div
v-if=
"item.name === 'linkMerchantIds'"
>
<div
...
...
@@ -131,8 +132,8 @@
v-model=
"subItem.profitValue"
></el-input>
%
<el-select
class=
"pro-item"
v-model=
"subItem.profitType"
size=
"small"
>
<el-option
v-for=
"x in separateOpt"
...
...
@@ -165,32 +166,12 @@
<
template
v-else-if=
"item.type === 'photo'"
>
<p
class=
"photo-top-tips"
>
{{
item
.
topTips
}}
</p>
<div
v-if=
"formData[item.name].length
< item
.
maxPhotoNum
"
class=
"activity-img img-w-h"
:class=
"[disabled ? 'input-bg':'']"
>
<div
class=
"add"
v-show=
"formData[item.name].length
< item
.
maxPhotoNum
"
>
+
</div>
<!--
<span
class=
"number"
v-if=
"!formData[item.name] && item.maxPhotoNum === 1"
>
0/
{{
item
.
maxPhotoNum
}}
</span>
-->
<div
class=
"add"
>
+
</div>
<span
class=
"number"
>
{{
formData
[
item
.
name
].
length
}}
/
{{
item
.
maxPhotoNum
}}
</span>
<!--
<span
v-show=
"!formData[item.name]"
class=
"close"
@
click=
'handleImgDelete(item)'
>
<i
class=
"el-icon-delete"
></i>
</span>
-->
<!--
<template>
<img
v-if=
"!formData[item.name].content && item.maxPhotoNum === 1"
:src=
"formData[item.name].content"
alt=
""
>
</
template
>
-->
<input
type=
"file"
name=
'thumbUrl'
...
...
@@ -206,26 +187,29 @@
<template>
<div
v-if=
"formData[item.name].length"
>
<span
class=
"muti-imgs"
v-for=
"(subItem, subIndex) in formData[item.name]"
:key=
"subIndex"
class=
"muti-imgs img-w-h"
>
<img
class=
"img-w-h"
:src=
"subItem.content"
/>
<span
class=
"close"
@
click=
'handleImgDelete(item, subIndex)'
>
<i
class=
"el-icon-delete"
></i>
<img
:src=
"subItem.content"
/>
<span
class=
"img-btns"
>
<span
class=
"btn-item"
>
<i
@
click=
'handleImgDelete(item, subIndex)'
class=
"el-icon-delete"
></i>
<i
@
click=
"handleImgLook(subItem.content)"
class=
"el-icon-zoom-in"
></i>
</span>
</span>
</span>
</div>
</
template
>
</template>
<
template
v-else-if=
"item.type === 'descList'"
>
<el-row>
<el-row
class=
"desc-btns"
>
<el-button
size=
"small"
@
click=
"handleAddDesc(2, item)"
...
...
@@ -239,22 +223,40 @@
v-for=
"(subItem, subIndex) in formData[item.name]"
:key=
"subIndex"
>
<el-input
v-if=
"subItem.resType === 2"
type=
"textarea"
v-model=
"subItem.content"
:rows=
"4"
placeholder=
"请输入详情内容"
></el-input>
<template
v-if=
"subItem.resType === 2"
>
<el-input
type=
"textarea"
v-model=
"subItem.content"
:rows=
"4"
placeholder=
"请输入详情内容"
></el-input>
<i
class=
"el-icon-delete"
@
click=
'handleImgDelete(item, subIndex)'
></i>
</
template
>
<div
class=
"
descList-img
img-w-h"
class=
"
activity-img muti-imgs
img-w-h"
v-else-if=
"subItem.resType === 1"
>
<div
v-show=
"!subItem.content"
class=
"add"
>
+
</div>
<img
v-show=
"subItem.content"
class=
"img-w-h"
:src=
"subItem.content"
/>
<span
class=
"img-btns"
v-show=
"subItem.content"
>
<span
class=
"btn-item"
>
<i
@
click=
'handleImgDelete(item, subIndex)'
class=
"el-icon-delete"
></i>
<i
@
click=
"handleImgLook(subItem.content)"
class=
"el-icon-zoom-in"
></i>
</span>
</span>
<input
type=
"file"
class=
"activity-Input img-w-h"
...
...
@@ -264,10 +266,6 @@
style=
"opacity: 0;"
>
</div>
<i
class=
"el-icon-delete"
@
click=
'handleImgDelete(item, subIndex)'
></i>
</el-row>
</template>
<span
v-else
>
{{item.name ? formData[item.name] : item.value}}
</span>
...
...
@@ -292,6 +290,7 @@
<el-button
type=
"primary"
@
click=
"handleUp"
:disabled=
"$store.state.d2admin.loading.value"
>
上架
</el-button>
</div>
<relate-pro-dialog
...
...
@@ -310,6 +309,13 @@
@
handleRelateStoreConfirm=
"handleRelateStoreConfirm"
@
handleRelateStoreClose=
"handleRelateStoreClose"
></relate-store-dialog>
<el-dialog
:visible
.
sync=
"lookImgVisible"
>
<img
width=
"100%"
:src=
"imageUrl"
alt=
"图片"
>
</el-dialog>
</d2-container>
</template>
...
...
@@ -326,6 +332,8 @@ export default {
// 关联商品弹窗
relateProVisible
:
false
,
relateStoreVisible
:
false
,
lookImgVisible
:
false
,
imageUrl
:
''
,
storeSelected
:
[],
proIndex
:
-
1
,
proList
:
[],
...
...
@@ -540,6 +548,11 @@ export default {
handleImgDelete
(
targetItem
,
subIndex
=
-
1
)
{
Array
.
isArray
(
this
.
formData
[
targetItem
.
name
])
?
this
.
formData
[
targetItem
.
name
].
splice
(
subIndex
,
1
)
:
(
this
.
formData
[
targetItem
.
name
]
=
''
)
},
// 图片查看
handleImgLook
(
src
)
{
this
.
lookImgVisible
=
true
this
.
imageUrl
=
src
},
// 描述 1-图片;2-文字
handleAddDesc
(
resType
,
targetItem
)
{
// console.log(this.formData[targetItem.name])
...
...
@@ -648,8 +661,7 @@ export default {
width
:
88px
;
height
:
74px
;
}
.d2-form
.activity-img
,
.d2-form
.descList-img
{
.d2-form
.activity-img
{
position
:
relative
;
/* width: 88px;
height: 74px; */
...
...
@@ -666,6 +678,7 @@ export default {
}
.d2-form
.muti-imgs
{
display
:
inline-block
;
position
:
relative
;
}
...
...
@@ -674,10 +687,10 @@ export default {
height: 74px;
} */
.activity-img
img
{
/*
.activity-img img {
width: 100%;
height: 100%;
}
}
*/
.activity-img
.add
{
position
:
absolute
;
...
...
@@ -694,7 +707,7 @@ export default {
transform
:
translateX
(
-50%
);
}
.
activity-img
.close
{
.
muti-imgs
.img-btns
{
display
:
none
;
width
:
100%
;
height
:
100%
;
...
...
@@ -702,26 +715,36 @@ export default {
left
:
0
;
top
:
0
;
z-index
:
2
;
color
:
#fff
;
background
:
rgba
(
0
,
0
,
0
,
0.5
);
opacity
:
1
;
}
.d2-form
.el-icon-delete
{
.d2-form
.el-icon-delete
,
.d2-form
.el-icon-zoom-in
{
cursor
:
pointer
;
}
.
activity-img
.close
i
{
width
:
18px
;
height
:
18px
;
.
muti-imgs
.img-btns
.btn-item
{
/*
width: 18px;
height: 18px;
*/
position
:
absolute
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
}
.activity-img
:hover
.close
{
.muti-imgs
.img-btns
.btn-item
{
display
:
flex
;
width
:
70%
;
justify-content
:
space-around
;
}
.muti-imgs
:hover
.img-btns
{
display
:
block
;
}
.d2-form
.input-bg
{
background-color
:
#eee
;
/* background-color: #eee; */
}
.d2-form
.desc-btns
{
margin-bottom
:
6px
;
}
.d2-form
.pro-item.el-input--medium
.el-input__inner
,
.d2-form
.pro-item
.el-input--medium
.el-input__inner
{
...
...
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