Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
educationStu
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
向伟
educationStu
Commits
ceef09d3
Commit
ceef09d3
authored
Jan 06, 2022
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
2da2d653
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
17 deletions
+35
-17
index.js
src/utils/index.js
+0
-9
plugin.js
src/utils/plugin.js
+8
-0
request.js
src/utils/request.js
+27
-8
No files found.
src/utils/index.js
View file @
ceef09d3
...
@@ -217,12 +217,3 @@ export let isLogin = () => {
...
@@ -217,12 +217,3 @@ export let isLogin = () => {
}
}
}
}
//防抖
export
function
debounce
(
func
)
{
let
timer
=
null
;
if
(
timer
)
clearTimeout
(
timer
);
timer
=
setTimeout
(()
=>
{
func
()
},
1000
)
}
\ No newline at end of file
src/utils/plugin.js
View file @
ceef09d3
import
{
isLogin
}
from
'./index'
import
{
isLogin
}
from
'./index'
import
request
from
'./request.js'
export
default
{
export
default
{
install
:
(
app
,
options
)
=>
{
install
:
(
app
,
options
)
=>
{
app
.
config
.
globalProperties
.
$isLogin
=
isLogin
app
.
config
.
globalProperties
.
$isLogin
=
isLogin
app
.
config
.
globalProperties
.
$request
=
(
url
,
data
,
method
)
=>
{
return
request
({
url
,
data
,
method
,
})
}
}
}
}
}
\ No newline at end of file
src/utils/request.js
View file @
ceef09d3
//请求教育接口
//请求教育接口
let
host
=
''
let
host
=
''
if
(
process
.
env
.
NODE_ENV
===
"development"
)
{
if
(
process
.
env
.
NODE_ENV
===
"development"
)
{
host
=
'http://192.168.20.17:8017/api'
//
host = 'http://192.168.20.17:8017/api'
// host = 'http://192.168.20.24:8300
/api'
host
=
'http://192.168.10.65:8085
/api'
// host = 'https://eduapi.oytour.com/api'
// host = 'https://eduapi.oytour.com/api'
}
else
{
}
else
{
host
=
'https://eduapi.oytour.com/api'
host
=
'https://eduapi.oytour.com/api'
...
@@ -26,22 +26,41 @@ let request = (param) => {
...
@@ -26,22 +26,41 @@ let request = (param) => {
if
(
res
.
data
.
Code
===
1
)
{
if
(
res
.
data
.
Code
===
1
)
{
resolve
(
res
.
data
)
resolve
(
res
.
data
)
}
else
{
}
else
{
Toast
({
// Toast({
type
:
'fail'
,
// type: 'fail',
message
:
res
.
data
.
Message
,
// message: res.data.Message,
onClose
:
()
=>
{
// onClose: () => {
// if (res.data.Code === 10001 || res.data.Code === 10000) {
// uni.reLaunch({
// url: '/pages/login/login'
// });
// } else {
// if (res.data.Message.indexOf('用户凭证为空') != -1 || res.data.Message.indexOf('用户凭证失效') != -1) {
// uni.reLaunch({
// url: '/pages/login/login'
// });
// }
// }
// },
// });
uni
.
showToast
({
title
:
res
.
data
.
Message
,
duration
:
2000
,
icon
:
"error"
,
success
()
{
if
(
res
.
data
.
Code
===
10001
||
res
.
data
.
Code
===
10000
)
{
if
(
res
.
data
.
Code
===
10001
||
res
.
data
.
Code
===
10000
)
{
uni
.
reLaunch
({
uni
.
reLaunch
({
url
:
'/pages/login/login'
url
:
'/pages/login/login'
});
});
}
else
{
}
else
{
if
(
res
.
data
.
Message
.
indexOf
(
'用户凭证为空'
)
!=
-
1
||
res
.
data
.
Message
.
indexOf
(
'用户凭证失效'
)
!=
-
1
)
{
if
(
res
.
data
.
Message
.
indexOf
(
'用户凭证为空'
)
!=
-
1
||
res
.
data
.
Message
.
indexOf
(
'用户凭证失效'
)
!=
-
1
)
{
uni
.
reLaunch
({
uni
.
reLaunch
({
url
:
'/pages/login/login'
url
:
'/pages/login/login'
});
});
}
}
}
}
}
,
}
});
});
}
}
},
},
...
...
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