Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
glsx-oss-merchant-data
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 2b7b1622
authored
Jun 28, 2019
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
图片上传
1 parent
cebc6e7e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
2 deletions
src/views/customer/businessDetails/index.vue
src/views/customer/businessDetails/index.vue
View file @
2b7b162
...
@@ -60,9 +60,10 @@
...
@@ -60,9 +60,10 @@
@
click=
"handleImg()"
@
click=
"handleImg()"
>
>
<gl-upload
<gl-upload
id=
"upload"
v-if=
"isEdit"
v-if=
"isEdit"
class=
"upload-demo"
class=
"upload-demo"
name=
"file
s
"
name=
"file"
:action=
"uploadAction"
:action=
"uploadAction"
:limit=
"2"
:limit=
"2"
:before-upload=
"beforeUpload"
:before-upload=
"beforeUpload"
...
@@ -74,6 +75,7 @@
...
@@ -74,6 +75,7 @@
size=
"small"
size=
"small"
>
上传图片
</gl-button>
>
上传图片
</gl-button>
</gl-upload>
</gl-upload>
<input
type=
"file"
id=
"id"
name=
"image"
class=
"getImgUrl_file"
@
change=
"shangc($event)"
accept=
"image/jpg,image/jpeg,image/png"
>
</span>
</span>
<gl-select
<gl-select
v-else-if=
"i.name == 'merchantChannelName' && isEdit"
v-else-if=
"i.name == 'merchantChannelName' && isEdit"
...
@@ -171,6 +173,7 @@
...
@@ -171,6 +173,7 @@
<
script
>
<
script
>
import
VueAMap
from
'vue-amap'
import
VueAMap
from
'vue-amap'
import
Vue
from
'vue'
import
Vue
from
'vue'
import
axios
from
'axios'
import
{
businessManagenMethods
,
bizMethods
,
request
}
from
'@/api'
import
{
businessManagenMethods
,
bizMethods
,
request
}
from
'@/api'
import
notice
from
'@/common/notice'
import
notice
from
'@/common/notice'
var
marker
=
[]
var
marker
=
[]
...
@@ -207,6 +210,7 @@ export default {
...
@@ -207,6 +210,7 @@ export default {
isMarkAddr
:
false
,
isMarkAddr
:
false
,
editOptions
:
[
'address'
,
'contactor'
,
'contactPhone'
,
'phone'
,
'email'
],
editOptions
:
[
'address'
,
'contactor'
,
'contactPhone'
,
'phone'
,
'email'
],
channelList
:
[],
channelList
:
[],
fileInfo
:
{
fileType
:
''
,
fileBase
:
''
},
List
:
[
List
:
[
{
{
name
:
'merchantName'
,
name
:
'merchantName'
,
...
@@ -398,7 +402,7 @@ export default {
...
@@ -398,7 +402,7 @@ export default {
// }/gps/common/uploadFile`
// }/gps/common/uploadFile`
// this.uploadAction = 'http://192.168.2.109:8085/customer/gfs.test.glsx.com.cn'
// this.uploadAction = 'http://192.168.2.109:8085/customer/gfs.test.glsx.com.cn'
// this.uploadAction = 'https://jsonplaceholder.typicode.com/posts/'
// this.uploadAction = 'https://jsonplaceholder.typicode.com/posts/'
console
.
log
(
this
.
$get_session_common_config
())
//
console.log(this.$get_session_common_config())
this
.
uploadAction
=
'http://192.168.3.217:9220/file/upstring'
this
.
uploadAction
=
'http://192.168.3.217:9220/file/upstring'
this
.
$root
.
eventBus
.
$on
(
'params'
,
(
params
)
=>
{
this
.
$root
.
eventBus
.
$on
(
'params'
,
(
params
)
=>
{
this
.
activeName
=
'first'
this
.
activeName
=
'first'
...
@@ -602,6 +606,8 @@ export default {
...
@@ -602,6 +606,8 @@ export default {
// 上传附件,限制用户上传的附件格式和大小
// 上传附件,限制用户上传的附件格式和大小
beforeUpload
(
file
)
{
beforeUpload
(
file
)
{
console
.
log
(
file
)
console
.
log
(
file
)
// const files = document.getElementById('upload')
// console.log(files)
const
fileType
=
[
'image/jpeg'
,
'image/jpg'
,
'image/gif'
,
'image/png'
]
const
fileType
=
[
'image/jpeg'
,
'image/jpg'
,
'image/gif'
,
'image/png'
]
const
isFileType
=
fileType
.
includes
(
file
.
type
)
const
isFileType
=
fileType
.
includes
(
file
.
type
)
const
isLT20M
=
file
.
size
/
1024
/
1024
<
20
const
isLT20M
=
file
.
size
/
1024
/
1024
<
20
...
@@ -619,6 +625,61 @@ export default {
...
@@ -619,6 +625,61 @@ export default {
},
},
handleRemove
(
file
,
fileList
)
{
handleRemove
(
file
,
fileList
)
{
this
.
merchantInfo
.
merchantPortrait
=
''
this
.
merchantInfo
.
merchantPortrait
=
''
},
shangc
(
e
)
{
const
_this
=
this
console
.
log
(
e
)
const
files
=
document
.
getElementById
(
'id'
).
files
[
0
]
// const name = document.getElementById('id').files[0].name
// const arr = name.split('.')
// this.fileInfo.name = arr[0]
// console.log(arr)
this
.
fileInfo
.
fileType
=
document
.
getElementById
(
'id'
).
files
[
0
].
name
let
fileSize
=
0
// const fileMaxSize = 10240 // 1M
if
(
files
)
{
console
.
log
(
files
)
fileSize
=
files
.
size
if
(
fileSize
>
5
*
1024
*
1024
)
{
alert
(
'文件大小不能大于5M!'
)
// file.value = ''
return
false
}
else
if
(
fileSize
<=
0
)
{
alert
(
'文件大小不能为0M!'
)
// file.value = ''
return
false
}
}
else
{
return
false
}
// // 转码base64
const
reader
=
new
FileReader
()
// let imgFile = ''
// let that = this
reader
.
readAsDataURL
(
files
)
reader
.
onload
=
e
=>
{
console
.
log
(
e
)
// imgFile = e.target.result
// const arrBase64 = imgFile.split(',')
this
.
fileInfo
.
fileBase
=
e
.
target
.
result
console
.
log
(
this
.
fileInfo
.
fileType
)
console
.
log
(
this
.
fileInfo
.
fileBase
)
axios
.
post
(
'http://192.168.3.217:9220/file/upstring'
,
{
systemSign
:
'/mechantData'
,
fileType
:
_this
.
fileInfo
.
fileType
,
uploadData
:
_this
.
fileInfo
.
fileBase
},
{
headers
:
{
'Content-Type'
:
'application/json; charset=utf-8'
},
requestType
:
'jsonString'
}).
then
(
res
=>
{
console
.
log
(
res
)
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
}
}
}
}
}
}
}
...
...
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