Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
thinkApp
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
游洁
thinkApp
Commits
8a808686
Commit
8a808686
authored
May 30, 2022
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
37bfab8e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
52 deletions
+62
-52
examList.vue
src/components/index/workSituation/examList.vue
+28
-20
index.js
src/utils/index.js
+34
-32
No files found.
src/components/index/workSituation/examList.vue
View file @
8a808686
...
...
@@ -131,45 +131,53 @@
let
host
=
''
if
(
process
.
env
.
NODE_ENV
===
"development"
)
{
host
=
'http://192.168.10.36:8082/api'
// host = 'http://192.168.10.65:8085/api'
}
else
{
host
=
'https://eduapi.oytour.com/api'
}
const
{
file
}
=
event
.
detail
;
if
(
file
[
0
].
url
.
indexOf
(
'xls'
)
==-
1
||
file
[
0
].
url
.
indexOf
(
'xlsx'
)
==-
1
){
uni
.
showToast
({
title
:
'请上传xls、xlsx格式的文件'
,
icon
:
'none'
,
duration
:
500
})
return
}
let
params
=
{
// Uid: data.params.Uid,
// CourseId: data.params.CourseId,
// ExamName: data.params.ExamName,
Uid
:
1
,
CourseId
:
null
,
ExamName
:
''
CourseId
:
1
,
ExamName
:
''
,
}
uni
.
uploadFile
({
url
:
host
+
'/Upload/UploadStuExamScore
?Files='
+
file
+
'¶ms='
+
JSON
.
stringify
(
params
)
,
url
:
host
+
'/Upload/UploadStuExamScore
'
,
filePath
:
file
[
0
].
url
,
name
:
'file'
,
formData
:
{
'myfile'
:
file
[
0
]
'myfile'
:
file
[
0
],
'params'
:
JSON
.
stringify
(
params
)
},
success
(
res
)
{
uni
.
hideLoading
();
let
jsonObj
=
JSON
.
parse
(
res
.
data
)
let
index
=
jsonObj
.
FilePath
.
indexOf
(
"."
)
let
suffix
=
jsonObj
.
FilePath
.
slice
(
index
+
1
)
let
uploadResult
=
{
name
:
fileObj
.
name
,
url
:
uploadConfig
.
CustomDomain
+
'/'
+
jsonObj
.
FilePath
,
type
:
fileObj
.
type
,
suffix
:
suffix
,
// VideoCoverImg: uploadConfig.CustomDomain + jsonObj.VideoCoverImg,
}
successCall
(
uploadResult
);
uni
.
showToast
({
title
:
res
.
Message
,
icon
:
'none'
,
duration
:
500
})
},
fail
(
err
)
{
console
.
log
(
"uploadErr"
,
err
)
}
});
return
uploadFile
(
"stueave"
,
file
,
(
res
)
=>
{
console
.
log
(
res
,
'----'
)
});
// uploadFile(params, file, (res) => {
// uni.showModal({
// title:res.Message
// })
// });
// return
}
};
...
...
src/utils/index.js
View file @
8a808686
...
...
@@ -8,9 +8,9 @@ export let desensitization = (str, beginLen, endLen) => {
return
tempStr
;
}
export
let
uploadFile
=
(
pa
th
,
file
,
successCallback
)
=>
{
export
let
uploadFile
=
(
pa
rams
,
file
,
successCallback
)
=>
{
for
(
let
i
=
0
;
i
<
file
.
length
;
i
++
)
{
UploadSelfFile
(
path
,
file
[
i
],
successCallback
)
UploadSelfFile
(
JSON
.
stringify
(
params
),
file
[
i
],
successCallback
)
}
}
...
...
@@ -31,64 +31,66 @@ export let urlTobase64 = (file, suc) => {
/**
* 上传文件
*/
export
function
UploadSelfFile
(
path
,
file
,
callback
,
configObj
)
{
if
(
file
.
url
.
indexOf
(
'.xls'
)
==
-
1
||
file
.
url
.
indexOf
(
'.xlsx'
)
==-
1
)
{
uni
.
showToast
({
title
:
'请上传 excel 格式文件'
,
icon
:
'none'
,
duration
:
2000
});
return
false
;
export
function
UploadSelfFile
(
params
,
file
,
callback
,
configObj
)
{
if
(
file
.
url
.
indexOf
(
'xls'
)
==-
1
&&
file
.
url
.
indexOf
(
'xlsx'
)
==-
1
){
uni
.
showModal
({
title
:
'请上传xls、xlsx格式的文件'
})
return
}
uni
.
showLoading
({
title
:
'文件上传中...'
});
UploadFileToSystem
(
uploadConfig
,
newPath
,
file
,
callback
,
configObj
);
UploadFileToSystem
(
params
,
file
,
callback
,
configObj
);
return
if
(
uploadConfig
)
{
switch
(
uploadConfig
.
StoreType
)
{
//上传文件到腾讯云
case
1
:
newPath
+=
"/"
+
timestamp1
+
""
+
suffix
;
UploadFileToTencent
(
uploadConfig
,
newPath
,
file
,
callback
);
break
;
//上传文件到阿里云
case
2
:
newPath
+=
"/"
+
timestamp1
+
""
+
suffix
;
UploadFileToALi
(
uploadConfig
,
newPath
,
file
,
callback
);
break
;
//上传文件到自己文件服务器
case
3
:
UploadFileToSystem
(
uploadConfig
,
newPath
,
file
,
callback
,
configObj
);
break
;
}
}
}
/**
* 上传文件到本地文件系统
*/
export
function
UploadFileToSystem
(
uploadConfig
,
fileFullPath
,
fileObj
,
successCall
,
configObj
)
{
// let url = uploadConfig.UploadDomain + "/Upload?filePath=" + fileFullPath;
console
.
log
(
fileFullPath
,
'------==='
)
export
function
UploadFileToSystem
(
paramsObj
,
fileObj
,
successCall
,
configObj
)
{
console
.
log
(
paramsObj
,
'-----paramsObj'
)
let
host
=
''
if
(
process
.
env
.
NODE_ENV
===
"development"
)
{
host
=
'http://192.168.10.36:8082/api'
}
else
{
host
=
'https://eduapi.oytour.com/api'
}
let
params
=
{
Uid
:
1
,
CourseId
:
1
,
ExamName
:
''
}
let
url
=
host
+
"/Upload/UploadStuExamScore?Files="
+
fileObj
+
'¶ms='
+
JSON
.
stringify
(
params
)
;
uni
.
uploadFile
({
url
:
url
,
url
:
host
+
'/Upload/UploadStuExamScore'
,
filePath
:
fileObj
.
url
,
name
:
'file'
,
formData
:
{
'myfile'
:
fileObj
'myfile'
:
fileObj
,
params
:
paramsObj
},
success
(
res
)
{
uni
.
hideLoading
();
return
uni
.
hideLoading
();
let
jsonObj
=
JSON
.
parse
(
res
.
data
)
let
index
=
jsonObj
.
FilePath
.
indexOf
(
"."
)
let
suffix
=
jsonObj
.
FilePath
.
slice
(
index
+
1
)
let
uploadResult
=
{
name
:
fileObj
.
name
,
url
:
uploadConfig
.
CustomDomain
+
'/'
+
jsonObj
.
FilePath
,
type
:
fileObj
.
type
,
suffix
:
suffix
,
// VideoCoverImg: uploadConfig.CustomDomain + jsonObj.VideoCoverImg,
Message
:
jsonObj
.
Message
}
successCall
(
uploadResult
);
},
fail
(
err
)
{
uni
.
hideLoading
();
console
.
log
(
"uploadErr"
,
err
)
}
});
...
...
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