Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jz_Travel
Project
Project
Details
Activity
Releases
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
zhengke
jz_Travel
Commits
d4e185ac
Commit
d4e185ac
authored
Nov 10, 2025
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11
parent
a7d2884d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
117 additions
and
105 deletions
+117
-105
upload.vue
pages/teamLeader/components/upload.vue
+117
-105
No files found.
pages/teamLeader/components/upload.vue
View file @
d4e185ac
<
template
>
<
template
>
<view
class=
"upImg row justify-center items-center"
@
click=
"chooseImg"
>
<view
class=
"upImg row justify-center items-center"
@
click=
"chooseImg"
>
<u-icon
name=
"plus"
color=
"#5B5B5B"
size=
"42"
/>
<u-icon
name=
"plus"
color=
"#5B5B5B"
size=
"42"
/>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
props
:
[],
props
:
[],
components
:
{
},
components
:
{
},
data
()
{
data
()
{
return
{
return
{
...
@@ -23,23 +23,40 @@ export default {
...
@@ -23,23 +23,40 @@ export default {
},
},
methods
:
{
methods
:
{
chooseImg
()
{
chooseImg
()
{
le
t
that
=
this
;
cons
t
that
=
this
;
uni
.
chooseImage
({
uni
.
chooseImage
({
count
:
1
,
//默认9
count
:
1
,
sizeType
:
[
"original"
,
"compressed"
],
//可以指定是原图还是压缩图,默认二者都有
sizeType
:
[
'original'
,
'compressed'
],
sourceType
:
[
"album"
],
//从相册选择
sourceType
:
[
'album'
,
'camera'
],
success
:
function
(
res
)
{
success
(
res
)
{
wx
.
getFileSystemManager
().
readFile
({
const
src
=
res
.
tempFilePaths
[
0
];
filePath
:
res
.
tempFilePaths
[
0
],
const
ext
=
src
.
split
(
'.'
).
pop
().
toLowerCase
();
encoding
:
"base64"
,
//编码格式
if
(
ext
===
'png'
)
{
success
:
(
ans
)
=>
{
// PNG文
that
.
UploadFileMethod
(
src
);
}
else
{
//其他格式(jpg、jpeg、webp)
uni
.
compressImage
({
src
,
quality
:
75
,
success
(
compRes
)
{
that
.
UploadFileMethod
(
compRes
.
tempFilePath
);
},
fail
(
err
)
{
console
.
log
(
ext
+
'格式compressImage失败,使用原图上传'
,
err
);
that
.
UploadFileMethod
(
src
);
}
});
}
}
});
},
UploadFileMethod
(
filePath
)
{
const
that
=
this
;
uni
.
showLoading
({
uni
.
showLoading
({
title
:
"上传中"
,
title
:
"上传中"
,
});
});
uni
.
getImageInfo
({
that
.
upFile
(
filePath
,
(
uploadRes
)
=>
{
src
:
res
.
tempFilePaths
[
0
],
success
:
function
(
image
)
{
that
.
upFile
(
image
.
path
,
(
uploadRes
)
=>
{
let
BusinessLicense
=
JSON
.
parse
(
let
BusinessLicense
=
JSON
.
parse
(
uploadRes
.
data
uploadRes
.
data
);
);
...
@@ -49,25 +66,19 @@ export default {
...
@@ -49,25 +66,19 @@ export default {
}
}
const
tempFilePath
=
BusinessLicense
.
FileName
;
const
tempFilePath
=
BusinessLicense
.
FileName
;
infor
.
name
=
tempFilePath
;
infor
.
name
=
tempFilePath
;
infor
.
url
=
that
.
hostErpFile
+
BusinessLicense
.
FilePath
infor
.
url
=
that
.
hostErpFile
+
BusinessLicense
.
FilePath
that
.
$emit
(
'onSuccess'
,
infor
);
that
.
$emit
(
'onSuccess'
,
infor
);
},
err
=>
{
},
err
=>
{
uni
.
hideLoading
()
uni
.
hideLoading
()
});
});
console
.
log
(
"res.tempFilePaths[0]"
,
res
.
tempFilePaths
[
0
]);
}
});
},
});
},
});
},
},
//图片上传
//图片上传
upFile
(
filePath
,
resCall
)
{
upFile
(
filePath
,
resCall
)
{
let
that
=
this
;
let
that
=
this
;
let
MallBaseId
=
uni
.
getStorageSync
(
"mall_UserInfo"
).
MallBaseId
?
uni
.
getStorageSync
(
"mall_UserInfo"
).
MallBaseId
:
1
;
let
MallBaseId
=
uni
.
getStorageSync
(
"mall_UserInfo"
).
MallBaseId
?
uni
.
getStorageSync
(
"mall_UserInfo"
)
.
MallBaseId
:
1
;
let
path
=
"/Upload/Temporary/"
let
path
=
"/Upload/Temporary/"
let
action
=
this
.
hostErpUpload
+
`/Upload/Index?filePath=
${
path
}
&ocr=1
`
let
action
=
this
.
hostErpUpload
+
`/Upload/Index?filePath=
${
path
}
`
uni
.
uploadFile
({
uni
.
uploadFile
({
url
:
action
,
url
:
action
,
filePath
:
filePath
,
filePath
:
filePath
,
...
@@ -79,7 +90,7 @@ export default {
...
@@ -79,7 +90,7 @@ export default {
if
(
uploadFileRes
.
statusCode
==
200
)
{
if
(
uploadFileRes
.
statusCode
==
200
)
{
uni
.
hideLoading
()
uni
.
hideLoading
()
resCall
(
uploadFileRes
);
resCall
(
uploadFileRes
);
}
else
{
}
else
{
wx
.
showToast
({
wx
.
showToast
({
title
:
uploadFileRes
.
message
,
title
:
uploadFileRes
.
message
,
icon
:
'none'
,
icon
:
'none'
,
...
@@ -91,7 +102,7 @@ export default {
...
@@ -91,7 +102,7 @@ export default {
fail
:
function
(
err
)
{
fail
:
function
(
err
)
{
console
.
log
(
err
)
console
.
log
(
err
)
wx
.
showToast
({
wx
.
showToast
({
title
:
'上传失败!'
+
JSON
.
stringify
(
err
),
title
:
'上传失败!'
+
JSON
.
stringify
(
err
),
icon
:
'none'
,
icon
:
'none'
,
duration
:
1000
duration
:
1000
})
})
...
@@ -99,14 +110,15 @@ export default {
...
@@ -99,14 +110,15 @@ export default {
});
});
},
},
}
}
}
}
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
@import
url("@/asset/css/flex.css")
;
@import
url("@/asset/css/flex.css")
;
.upImg
{
.upImg
{
width
:
208rpx
;
width
:
208rpx
;
height
:
208rpx
;
height
:
208rpx
;
border-radius
:
10rpx
;
border-radius
:
10rpx
;
border
:
1rpx
solid
#ededed
;
border
:
1rpx
solid
#ededed
;
}
}
</
style
>
</
style
>
\ No newline at end of file
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