Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhqg-vue
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhqg
zhqg-vue
Commits
85c23e48
Commit
85c23e48
authored
Oct 16, 2020
by
wangyalan-git
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改图片上传/新增佣金
parent
24338677
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
32 deletions
+47
-32
index.vue
src/components/mul-pic-upload/index.vue
+9
-4
index.vue
src/components/pic-upload/index.vue
+35
-25
prodInfo.vue
src/views/modules/prod/prodInfo.vue
+2
-2
index.js
static/config/index.js
+1
-1
No files found.
src/components/mul-pic-upload/index.vue
View file @
85c23e48
<
template
>
<div>
<el-upload
:action=
"$http.adornUrl(
'/admin/file/upload/element'
)"
:action=
"$http.adornUrl(
`/fileBapi/upload`
)"
:headers=
"
{Authorization: $cookie.get('Authorization')}"
list-type="picture-card"
:data="obj"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
:on-success="handleUploadSuccess"
...
...
@@ -23,7 +24,11 @@
return
{
dialogImageUrl
:
''
,
dialogVisible
:
false
,
resourcesUrl
:
window
.
SITE_CONFIG
.
resourcesUrl
resourcesUrl
:
window
.
SITE_CONFIG
.
resourcesUrl
,
obj
:
{
fileType
:
'sku'
,
t
:
new
Date
().
getTime
()
}
}
},
props
:
{
...
...
@@ -38,7 +43,7 @@
if
(
this
.
value
)
{
let
imageArray
=
this
.
value
.
split
(
','
)
for
(
let
i
=
0
;
i
<
imageArray
.
length
;
i
++
)
{
res
.
push
({
url
:
imageArray
[
i
],
response
:
imageArray
[
i
]})
res
.
push
({
url
:
this
.
resourcesUrl
+
imageArray
[
i
],
response
:
imageArray
[
i
]})
}
}
this
.
$emit
(
'input'
,
this
.
value
)
...
...
@@ -49,7 +54,7 @@
// 图片上传
handleUploadSuccess
(
response
,
file
,
fileList
)
{
let
pics
=
fileList
.
map
(
file
=>
{
return
file
.
response
return
file
.
response
.
result
.
filePath
}).
join
(
','
)
this
.
$emit
(
'input'
,
pics
)
},
...
...
src/components/pic-upload/index.vue
View file @
85c23e48
...
...
@@ -2,45 +2,52 @@
<div>
<el-upload
class=
"pic-uploader-component"
:action=
"$http.adornUrl(
'/admin/file/upload/element'
)"
:action=
"$http.adornUrl(
`/fileBapi/upload`
)"
:headers=
"
{Authorization: $cookie.get('Authorization')}"
:show-file-list="false"
:data="obj"
:on-success="handleUploadSuccess"
:before-upload="beforeAvatarUpload">
<img
v-if=
"value"
:src=
"value"
class=
"pic"
>
:before-upload="beforeAvatarUpload"
>
<img
v-if=
"value"
:src=
"resourcesUrl + value"
class=
"pic"
>
<i
v-else
class=
"el-icon-plus pic-uploader-icon"
></i>
</el-upload>
</div>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
resourcesUrl
:
window
.
SITE_CONFIG
.
resourcesUrl
}
},
props
:
{
value
:
{
default
:
''
,
type
:
String
export
default
{
data
()
{
return
{
resourcesUrl
:
window
.
SITE_CONFIG
.
resourcesUrl
,
obj
:
{
fileType
:
'sku'
,
t
:
new
Date
().
getTime
()
}
}
},
props
:
{
value
:
{
default
:
''
,
type
:
String
}
},
methods
:
{
// 图片上传
handleUploadSuccess
(
response
,
file
,
fileList
)
{
console
.
log
(
'file.response'
,
file
.
response
)
this
.
$emit
(
'input'
,
file
.
response
.
result
.
filePath
)
},
methods
:
{
// 图片上传
handleUploadSuccess
(
response
,
file
,
fileList
)
{
this
.
$emit
(
'input'
,
file
.
response
)
},
// 限制图片上传大小
beforeAvatarUpload
(
file
)
{
const
isLt2M
=
file
.
size
/
1024
/
1024
<
2
if
(
!
isLt2M
)
{
this
.
$message
.
error
(
'上传头像图片大小不能超过 2MB!'
)
}
return
isLt2M
// 限制图片上传大小
beforeAvatarUpload
(
file
)
{
const
isLt2M
=
file
.
size
/
1024
/
1024
<
2
if
(
!
isLt2M
)
{
this
.
$message
.
error
(
'上传头像图片大小不能超过 2MB!'
)
}
return
isLt2M
}
}
}
</
script
>
<
style
lang=
"scss"
>
...
...
@@ -50,6 +57,7 @@
cursor
:
pointer
;
position
:
relative
;
overflow
:
hidden
;
.pic-uploader-icon
{
font-size
:
28px
;
color
:
#8c939d
;
...
...
@@ -58,12 +66,14 @@
line-height
:
178px
;
text-align
:
center
;
}
.pic
{
width
:
178px
;
height
:
178px
;
display
:
block
;
}
}
.pic-uploader-component
.el-upload
:hover
{
border-color
:
#409EFF
;
}
...
...
src/views/modules/prod/prodInfo.vue
View file @
85c23e48
...
...
@@ -67,8 +67,8 @@
<el-col
:span=
"8"
>
<el-switch
v-model=
"dataForm.commissionStatus"
active-value=
"1"
inactive-value=
"0"
>
:
active-value=
"1"
:
inactive-value=
"0"
>
</el-switch>
</el-col>
</el-form-item>
...
...
static/config/index.js
View file @
85c23e48
...
...
@@ -8,7 +8,7 @@
window
.
SITE_CONFIG
[
'baseUrl'
]
=
'http://192.168.0.143:8085'
// 静态资源文件url
window
.
SITE_CONFIG
[
'resourcesUrl'
]
=
'http://
img-test.gz-yami.com/
'
window
.
SITE_CONFIG
[
'resourcesUrl'
]
=
'http://
192.168.31.113/zhqgImages
'
// cdn地址 = 域名 + 版本号
window
.
SITE_CONFIG
[
'domain'
]
=
'./'
// 域名
window
.
SITE_CONFIG
[
'version'
]
=
''
// 版本号(年月日时分)
...
...
Write
Preview
Markdown
is supported
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