Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
白杨
/
shrae-app
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit eb22d5b0
authored
7 years ago
by
白杨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改图片上传方法
1 parent
7ba48321
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
21 deletions
dataPage.html
src/js/imgUp.js
src/js/main.js
src/js/saasService.js
dataPage.html
View file @
eb22d5b
...
...
@@ -162,7 +162,7 @@
"\t\t\t<hr class=\"layui-bg-gray\">"
}
for
(
var
i
=
0
;
i
<
photo
.
length
;
i
++
){
photo
[
i
].
photoPath
=
"http://114.55.43.0:16907
/v1/point/getFile?ak=30bdc45ee00940cda7917d134fdb1523&filePath="
+
photo
[
i
].
photoPath
photo
[
i
].
photoPath
=
saas
.
url
+
"
/v1/point/getFile?ak=30bdc45ee00940cda7917d134fdb1523&filePath="
+
photo
[
i
].
photoPath
strImg
+=
"<img src="
+
photo
[
i
].
photoPath
+
" class=\"item\"/>"
}
// localStorage.setItem('strImg',strImg)
...
...
This diff is collapsed.
Click to expand it.
src/js/imgUp.js
View file @
eb22d5b
//网点id
var
pointId
=
localStorage
.
getItem
(
'pointId'
);
$
(
function
(){
var
delParent
;
var
defaults
=
{
fileType
:
[
"jpg"
,
"png"
,
"bmp"
,
"jpeg"
],
// 上传文件的类垿
fileSize
:
1024
*
1024
*
10
// 上传文件的大尿 10M
...
...
@@ -124,19 +128,25 @@ function saveReturn(){
console
.
log
(
"file数据"
+
file
);
var
formData
=
new
FormData
();
formData
.
append
(
'file'
,
file
);
$
.
ajax
({
url
:
"/home/about"
,
type
:
"post"
,
data
:
formData
,
contentType
:
false
,
processData
:
false
,
mimeType
:
"multipart/form-data"
,
success
:
function
(
data
)
{
console
.
log
(
"返回正确数据"
+
data
);
},
error
:
function
(
data
)
{
console
.
log
(
"错误返回数据"
+
data
);
}
});
// $.ajax({
// url: "/home/about",
// type: "post",
// data: formData,
// contentType: false,
// processData: false,
// mimeType: "multipart/form-data",
// success: function (data) {
//
// console.log("返回正确数据"+data);
// },
// error: function (data) {
// console.log("错误返回数据"+data);
// }
// });
var
url
=
"/v1/point/uploadPhoto?ak="
+
saas
.
url
+
"&pointId="
+
pointId
;
saas
.
upLoadHttpRequest
(
url
,
formData
,
function
(
data
)
{
console
.
log
(
"返回正确数据"
+
data
);
},
function
(
error
)
{
console
.
log
(
"错误返回数据"
+
error
);
});
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/js/main.js
View file @
eb22d5b
...
...
@@ -129,8 +129,10 @@ var main = {
//注销控件
// main.dragFeature.deactivate();
main
.
drawPoint
.
deactivate
();
// var point = this.pointFeature.geometry.getCentroid();
// console.log(point.x+","+point.y);
//获取当前feature坐标
var
geometry
=
main
.
currentPoint
.
geometry
.
getCentroid
();
//修改网点坐标
main
.
updatePoint
(
geometry
.
x
,
geometry
.
y
);
}
},
addMarker
:
function
(
pointX
,
pointY
,
code
,
iconPath
)
{
...
...
@@ -163,14 +165,14 @@ var main = {
main
.
currentPoint
=
eventArgs
.
feature
;
main
.
vectorLayer
.
removeAllFeatures
();
main
.
vectorLayer
.
addFeatures
(
main
.
currentPoint
);
var
geometry
=
eventArgs
.
feature
.
geometry
.
getCentroid
();
main
.
updatePoint
(
geometry
.
x
,
geometry
.
y
);
//
var geometry = eventArgs.feature.geometry.getCentroid();
//
main.updatePoint(geometry.x,geometry.y);
},
updatePoint
:
function
(
x
,
y
)
{
var
method
=
"/point/updatePoint"
;
var
parameter
=
{
custom_id
:
"{\"fieldName\":\"名称\",\"fieldValue\":\"网点1\"}"
,
infos
:
"
{\"fieldName\":\"名称\",\"fieldValue\":\"网点1\"}
"
,
infos
:
"
[{\"fieldName\":\"名称\",\"fieldValue\":\"网点1\"}]
"
,
x
:
x
,
y
:
y
,
coord_type
:
"gcj02mc"
...
...
This diff is collapsed.
Click to expand it.
src/js/saasService.js
View file @
eb22d5b
...
...
@@ -37,5 +37,18 @@ var saas = {
error
:
errorComplate
,
};
$
.
ajax
(
config
);
},
upLoadHttpRequest
:
function
(
method
,
formData
,
successComplate
,
errorComplate
)
{
var
config
=
{
url
:
saas
.
url
+
method
,
type
:
"post"
,
data
:
formData
,
contentType
:
false
,
processData
:
false
,
mimeType
:
"multipart/form-data"
,
success
:
successComplate
,
error
:
errorComplate
,
};
$
.
ajax
(
config
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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