Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-services
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 6aad7b33
authored
Oct 15, 2021
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
直播间
1 parent
abfee68e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
8 deletions
src/api/modules/cmmodityLibrary.js
src/components/glsx-combi-form/index.vue
src/views/cmmodityLibrary/editProduct.vue
src/api/modules/cmmodityLibrary.js
View file @
6aad7b3
...
@@ -10,4 +10,15 @@ const getWarehousListApi = params => {
...
@@ -10,4 +10,15 @@ const getWarehousListApi = params => {
})
})
}
}
export
{
getWarehousListApi
}
const
uploadImg
=
params
=>
{
params
.
method
=
'scrm.api.live.wechat.upload.image'
return
http
({
url
:
''
,
method
:
'POST'
,
data
:
params
,
sign
:
true
,
noSignAttr
:
[
'file'
]
})
}
export
{
getWarehousListApi
,
uploadImg
}
src/components/glsx-combi-form/index.vue
View file @
6aad7b3
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
</el-radio-group>
</el-radio-group>
<el-date-picker
v-else-if=
"item.type === 'datePicker'"
v-model=
"formObj[item.name]"
:type=
"item.dateType || 'daterange'"
:clearable=
"item.isClear || false"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
:picker-options=
"pickerOption[item.pickerOptions]"
></el-date-picker>
<el-date-picker
v-else-if=
"item.type === 'datePicker'"
v-model=
"formObj[item.name]"
:type=
"item.dateType || 'daterange'"
:clearable=
"item.isClear || false"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
:picker-options=
"pickerOption[item.pickerOptions]"
></el-date-picker>
<!-- 图片上传 -->
<!-- 图片上传 -->
<el-upload
v-else-if=
"item.type === 'upload'"
action=
"#"
list-type=
"picture-card"
:auto-upload=
"false
"
:limit=
"item.limitNum || 1"
:fileList=
"formObj[item.name]"
accept=
"image/jpeg,image/png,image/jpg"
:on-change=
"(file, fileList) => handleChangeUpload(file, fileList, item)"
>
<el-upload
v-else-if=
"item.type === 'upload'"
:auto-upload=
"false"
action=
"#"
list-type=
"picture-card
"
:limit=
"item.limitNum || 1"
:fileList=
"formObj[item.name]"
accept=
"image/jpeg,image/png,image/jpg"
:on-change=
"(file, fileList) => handleChangeUpload(file, fileList, item)"
>
<i
slot=
"default"
class=
"el-icon-plus"
></i>
<i
slot=
"default"
class=
"el-icon-plus"
></i>
<div
slot=
"file"
slot-scope=
"{ file }"
>
<div
slot=
"file"
slot-scope=
"{ file }"
>
<img
class=
"el-upload-list__item-thumbnail"
:src=
"file.url"
alt=
""
/>
<img
class=
"el-upload-list__item-thumbnail"
:src=
"file.url"
alt=
""
/>
...
@@ -137,7 +137,12 @@ export default {
...
@@ -137,7 +137,12 @@ export default {
const
limitSize
=
targetItem
.
limitSize
||
10
const
limitSize
=
targetItem
.
limitSize
||
10
const
isType
=
[
'image/jpeg'
,
'image/png'
,
'image/jpg'
].
includes
(
file
.
raw
.
type
)
const
isType
=
[
'image/jpeg'
,
'image/png'
,
'image/jpg'
].
includes
(
file
.
raw
.
type
)
const
isLt10M
=
file
.
size
/
1024
/
1024
<
limitSize
const
isLt10M
=
file
.
size
/
1024
/
1024
<
limitSize
const
limitNum
=
targetItem
.
limitNum
||
1
if
(
limitNum
==
this
.
formObj
[
targetItem
.
name
].
length
)
{
this
.
$message
.
error
(
'只能上传'
+
limitNum
+
'张图片'
)
return
true
}
if
(
!
isType
)
{
if
(
!
isType
)
{
this
.
$message
.
error
(
'上传图片不是jpg、jpeg或png的格式!'
)
this
.
$message
.
error
(
'上传图片不是jpg、jpeg或png的格式!'
)
this
.
formObj
[
targetItem
.
name
]
=
this
.
formObj
[
targetItem
.
name
].
filter
(
item
=>
item
.
uid
!=
file
.
uid
)
this
.
formObj
[
targetItem
.
name
]
=
this
.
formObj
[
targetItem
.
name
].
filter
(
item
=>
item
.
uid
!=
file
.
uid
)
...
...
src/views/cmmodityLibrary/editProduct.vue
View file @
6aad7b3
...
@@ -14,9 +14,9 @@
...
@@ -14,9 +14,9 @@
</tr>
</tr>
<tr>
<tr>
<td><img
:src=
"editForm.selectedProInfo.goodsImage"
/></td>
<td><img
:src=
"editForm.selectedProInfo.goodsImage"
/></td>
<td>
{{
editForm
.
selectedProInfo
.
goodsName
}}
</td>
<td>
{{
editForm
.
selectedProInfo
.
goodsName
}}
</td>
<td>
{{
editForm
.
selectedProInfo
.
goodsCode
}}
</td>
<td>
{{
editForm
.
selectedProInfo
.
goodsCode
}}
</td>
<td>
{{
editForm
.
selectedProInfo
.
goodsCode
}}
</td>
<td>
{{
editForm
.
selectedProInfo
.
goodsCode
}}
</td>
</tr>
</tr>
</table>
</table>
</div>
</div>
...
@@ -34,6 +34,7 @@ import _ from 'lodash'
...
@@ -34,6 +34,7 @@ import _ from 'lodash'
import
'@/assets/css/public.scss'
import
'@/assets/css/public.scss'
import
glsxCombiForm
from
'@/components/glsx-combi-form'
import
glsxCombiForm
from
'@/components/glsx-combi-form'
import
selectSingleProDialog
from
'./selectSingleProDialog'
import
selectSingleProDialog
from
'./selectSingleProDialog'
import
{
uploadImg
}
from
'@/api/modules/cmmodityLibrary'
export
default
{
export
default
{
name
:
'editProduct'
,
name
:
'editProduct'
,
data
()
{
data
()
{
...
@@ -43,7 +44,7 @@ export default {
...
@@ -43,7 +44,7 @@ export default {
editChildRef
:
'editChildRef'
,
editChildRef
:
'editChildRef'
,
editForm
:
{
editForm
:
{
selectedProInfo
:
{},
selectedProInfo
:
{},
thumb
Url
:
[]
coverImg
Url
:
[]
},
},
editRule
:
{
editRule
:
{
title
:
[{
required
:
true
,
message
:
'请输入商品名称'
,
trigger
:
'change'
}],
title
:
[{
required
:
true
,
message
:
'请输入商品名称'
,
trigger
:
'change'
}],
...
@@ -55,13 +56,23 @@ export default {
...
@@ -55,13 +56,23 @@ export default {
editFormData
:
[
editFormData
:
[
{
{
label
:
'商品缩略图'
,
label
:
'商品缩略图'
,
name
:
'
thumb
Url'
,
name
:
'
coverImg
Url'
,
type
:
'upload'
,
type
:
'upload'
,
limitSize
:
1
,
limitSize
:
1
,
tips
:
'建议尺寸:300像素 * 300像素,图片大小不得超过1M'
,
tips
:
'建议尺寸:300像素 * 300像素,图片大小不得超过1M'
,
handleUpload
:
(
file
,
fileList
,
targetItem
)
=>
{
handleUpload
:
(
file
,
fileList
,
targetItem
)
=>
{
this
.
editForm
[
targetItem
.
name
]
=
fileList
//
this.editForm[targetItem.name] = fileList
// this.editForm[targetItem.name].pop()
// this.editForm[targetItem.name].pop()
var
reader
=
new
FileReader
()
var
fileInfo
=
file
.
raw
reader
.
readAsDataURL
(
fileInfo
)
reader
.
onload
=
e
=>
{
const
imgFile
=
e
.
target
.
result
const
base64
=
fileInfo
.
name
.
split
(
'.'
)[
1
]
+
'@'
+
imgFile
.
split
(
','
)[
1
]
uploadImg
({
file
:
base64
,
fileType
:
'image'
}).
then
(
res
=>
{
this
.
editForm
[
targetItem
.
name
]
=
[{
url
:
res
,
uid
:
file
.
uid
}]
})
}
}
}
},
},
{
{
...
@@ -110,6 +121,7 @@ export default {
...
@@ -110,6 +121,7 @@ export default {
this
.
handleSinglePro
()
this
.
handleSinglePro
()
},
},
handleConfirm
()
{
handleConfirm
()
{
console
.
log
(
this
.
editForm
)
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
console
.
log
(
'-----------'
)
console
.
log
(
'-----------'
)
...
...
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