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