Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
d55d5d3f
Commit
d55d5d3f
authored
Jun 02, 2018
by
Junling Bu
Browse files
fix[litemall-admin]:修复类目页面图片上传
parent
b48b884d
Changes
1
Hide whitespace changes
Inline
Side-by-side
litemall-admin/src/views/mall/category.vue
View file @
d55d5d3f
...
@@ -102,13 +102,13 @@
...
@@ -102,13 +102,13 @@
</el-form-item>
</el-form-item>
<el-form-item
label=
"图标"
prop=
"iconUrl"
>
<el-form-item
label=
"图标"
prop=
"iconUrl"
>
<el-input
v-model=
"dataForm.iconUrl"
></el-input>
<el-input
v-model=
"dataForm.iconUrl"
></el-input>
<el-upload
action=
"
http://localhost:8080/storage/creat
e"
:show-file-list=
"false"
:
on-succ
es
s
=
"handleIconUrl"
>
<el-upload
action=
"
#"
list-type=
"pictur
e"
:show-file-list=
"false"
:
limit=
"1"
:http-requ
es
t
=
"handleIconUrl"
>
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button>
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button>
</el-upload>
</el-upload>
</el-form-item>
</el-form-item>
<el-form-item
label=
"首页横幅"
prop=
"bannerUrl"
>
<el-form-item
label=
"首页横幅"
prop=
"bannerUrl"
>
<el-input
v-model=
"dataForm.bannerUrl"
></el-input>
<el-input
v-model=
"dataForm.bannerUrl"
></el-input>
<el-upload
action=
"
http://localhost:8080/storage/creat
e"
:show-file-list=
"false"
:
on-succ
es
s
=
"handleBannerUrl"
>
<el-upload
action=
"
#"
list-type=
"pictur
e"
:show-file-list=
"false"
:
limit=
"1"
:http-requ
es
t
=
"handleBannerUrl"
>
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button>
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button>
</el-upload>
</el-upload>
</el-form-item>
</el-form-item>
...
@@ -120,7 +120,7 @@
...
@@ -120,7 +120,7 @@
</el-form-item>
</el-form-item>
<el-form-item
label=
"类目页横幅"
prop=
"wapBannerUrl"
>
<el-form-item
label=
"类目页横幅"
prop=
"wapBannerUrl"
>
<el-input
v-model=
"dataForm.wapBannerUrl"
></el-input>
<el-input
v-model=
"dataForm.wapBannerUrl"
></el-input>
<el-upload
action=
"
http://localhost:8080/storage/creat
e"
:show-file-list=
"false"
:
on-succ
es
s
=
"handleWapBannerUrl"
>
<el-upload
action=
"
#"
list-type=
"pictur
e"
:show-file-list=
"false"
:
limit=
"1"
:http-requ
es
t
=
"handleWapBannerUrl"
>
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button>
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button>
</el-upload>
</el-upload>
</el-form-item>
</el-form-item>
...
@@ -151,6 +151,7 @@
...
@@ -151,6 +151,7 @@
<
script
>
<
script
>
import
{
listCategory
,
listCatL1
,
createCategory
,
updateCategory
,
deleteCategory
}
from
'
@/api/category
'
import
{
listCategory
,
listCatL1
,
createCategory
,
updateCategory
,
deleteCategory
}
from
'
@/api/category
'
import
{
createStorage
}
from
'
@/api/storage
'
import
waves
from
'
@/directive/waves
'
// 水波纹指令
import
waves
from
'
@/directive/waves
'
// 水波纹指令
export
default
{
export
default
{
...
@@ -257,20 +258,32 @@ export default {
...
@@ -257,20 +258,32 @@ export default {
this
.
$refs
[
'
dataForm
'
].
clearValidate
()
this
.
$refs
[
'
dataForm
'
].
clearValidate
()
})
})
},
},
handleIconUrl
(
response
,
file
,
fileList
)
{
handleIconUrl
(
item
)
{
if
(
response
.
errno
===
0
)
{
const
formData
=
new
FormData
()
this
.
dataForm
.
iconUrl
=
response
.
data
.
url
formData
.
append
(
'
file
'
,
item
.
file
)
}
createStorage
(
formData
).
then
(
res
=>
{
this
.
dataForm
.
iconUrl
=
res
.
data
.
data
.
url
}).
catch
(()
=>
{
this
.
$message
.
error
(
'
上传失败,请重新上传
'
)
})
},
},
handleBannerUrl
(
response
,
file
,
fileList
)
{
handleBannerUrl
(
item
)
{
if
(
response
.
errno
===
0
)
{
const
formData
=
new
FormData
()
this
.
dataForm
.
bannerUrl
=
response
.
data
.
url
formData
.
append
(
'
file
'
,
item
.
file
)
}
createStorage
(
formData
).
then
(
res
=>
{
this
.
dataForm
.
bannerUrl
=
res
.
data
.
data
.
url
}).
catch
(()
=>
{
this
.
$message
.
error
(
'
上传失败,请重新上传
'
)
})
},
},
handleWapBannerUrl
(
response
,
file
,
fileList
)
{
handleWapBannerUrl
(
item
)
{
if
(
response
.
errno
===
0
)
{
const
formData
=
new
FormData
()
this
.
dataForm
.
wapBannerUrl
=
response
.
data
.
url
formData
.
append
(
'
file
'
,
item
.
file
)
}
createStorage
(
formData
).
then
(
res
=>
{
this
.
dataForm
.
wapBannerUrl
=
res
.
data
.
data
.
url
}).
catch
(()
=>
{
this
.
$message
.
error
(
'
上传失败,请重新上传
'
)
})
},
},
createData
()
{
createData
()
{
this
.
$refs
[
'
dataForm
'
].
validate
((
valid
)
=>
{
this
.
$refs
[
'
dataForm
'
].
validate
((
valid
)
=>
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment