Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue-composition-api
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
宁路鹏
vue-composition-api
Commits
9c1ea2ce
Commit
9c1ea2ce
authored
Mar 07, 2023
by
tangyufeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iconfont.css
parent
08b47a3e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
31 deletions
+47
-31
src/styles/media/components/outClinicalpathway.scss
+0
-0
src/utils/http.js
+47
-31
src/views/Entrypath.vue
+0
-0
src/views/outClinicalpathway.vue
+0
-0
No files found.
src/styles/media/components/outClinicalpathway.scss
View file @
9c1ea2ce
This diff is collapsed.
Click to expand it.
src/utils/http.js
View file @
9c1ea2ce
import
Vue
from
'vue'
import
Vue
from
"vue"
;
import
axios
from
'axios'
import
axios
from
"axios"
;
import
'element-ui/lib/theme-chalk/index.css'
;
import
"element-ui/lib/theme-chalk/index.css"
;
import
{
getItem
}
from
'@/utils/auth'
import
{
getItem
}
from
"@/utils/auth"
;
axios
.
defaults
.
timeout
=
120000
axios
.
defaults
.
timeout
=
120000
;
axios
.
defaults
.
headers
.
post
[
'Content-Type'
]
=
'application/json;charset=utf-8'
axios
.
defaults
.
headers
.
post
[
"Content-Type"
]
=
"application/json;charset=utf-8"
;
var
domain
=
"/api/api"
;
var
domain
=
'/api/api'
function
createHeader
()
{
function
createHeader
()
{
const
token
=
getItem
(
'svToken'
);
const
token
=
getItem
(
"svToken"
);
return
token
?
{
Authorization
:
`Bearer
${
token
}
`
}
:
{};
return
token
?
{
Authorization
:
`Bearer
${
token
}
`
}
:
{};
}
}
function
errorMsg
(
d
)
{
function
errorMsg
(
d
)
{
console
.
log
(
d
.
response
);
if
(
d
.
response
.
status
==
'401'
)
{
if
(
d
.
response
.
status
==
"401"
)
{
Vue
.
prototype
.
$message
.
error
(
'登录信息失效,重新登录!'
);
Vue
.
prototype
.
$message
.
error
(
"登录信息失效,重新登录!"
);
sessionStorage
.
clear
();
sessionStorage
.
clear
();
this
.
$router
.
push
(
"/login"
).
catch
((
err
)
=>
{
this
.
$router
.
push
(
"/login"
).
catch
((
err
)
=>
{
...
@@ -29,30 +28,26 @@ function errorMsg(d) {
...
@@ -29,30 +28,26 @@ function errorMsg(d) {
});
//改变路由
});
//改变路由
}
}
if
(
d
.
response
)
{
if
(
d
.
response
)
{
// 请求已发出,但服务器响应的状态码不在 2xx 范围内
// 请求已发出,但服务器响应的状态码不在 2xx 范围内
console
.
log
(
d
.
response
);
console
.
log
(
d
.
response
);
}
}
if
(
Vue
.
prototype
.
$notify
)
{
if
(
Vue
.
prototype
.
$notify
)
{
Vue
.
prototype
.
$message
.
error
(
d
?
d
.
response
.
data
.
message
:
"服务器端错误"
);
Vue
.
prototype
.
$message
.
error
(
d
?
d
.
response
.
data
.
message
:
'服务器端错误'
);
}
else
{
}
else
{
alert
(
d
?
d
.
response
.
data
.
message
:
'服务器端错误'
)
alert
(
d
?
d
.
response
.
data
.
message
||
d
.
response
.
data
:
"服务器端错误"
);
}
}
}
}
let
loadingInstance
;
let
loadingInstance
;
let
loadingOption
=
{
let
loadingOption
=
{
//加载loading
//加载loading
fullscreen
:
true
,
fullscreen
:
true
,
text
:
'正在加载...'
,
text
:
"正在加载..."
,
spinner
:
'el-icon-loading'
,
spinner
:
"el-icon-loading"
,
background
:
'rgba(0, 0, 0, 0.5)'
background
:
"rgba(0, 0, 0, 0.5)"
,
}
}
;
axios
.
interceptors
.
response
.
use
(
axios
.
interceptors
.
response
.
use
(
(
response
)
=>
{
(
response
)
=>
{
if
(
response
.
status
===
200
)
{
if
(
response
.
status
===
200
)
{
...
@@ -64,7 +59,7 @@ axios.interceptors.response.use(
...
@@ -64,7 +59,7 @@ axios.interceptors.response.use(
(
error
)
=>
{
(
error
)
=>
{
if
(
error
.
response
.
status
==
401
)
{
if
(
error
.
response
.
status
==
401
)
{
window
.
sessionStorage
.
clear
();
window
.
sessionStorage
.
clear
();
window
.
location
.
href
=
'/'
;
window
.
location
.
href
=
"/"
;
}
}
return
Promise
.
reject
(
error
);
return
Promise
.
reject
(
error
);
...
@@ -72,14 +67,12 @@ axios.interceptors.response.use(
...
@@ -72,14 +67,12 @@ axios.interceptors.response.use(
);
);
export
default
{
export
default
{
post
(
url
,
params
,
option
)
{
post
(
url
,
params
,
option
)
{
loadingInstance
=
Vue
.
prototype
.
$loading
(
loadingOption
);
loadingInstance
=
Vue
.
prototype
.
$loading
(
loadingOption
);
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
axios
.
post
(
domain
+
url
,
params
,
{
...
{
headers
:
createHeader
()
},
...
option
})
.
post
(
domain
+
url
,
params
,
{
...
{
headers
:
createHeader
()
},
...
option
})
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
.
status
!==
200
)
{
if
(
res
.
status
!==
200
)
{
errorMsg
(
res
.
data
);
errorMsg
(
res
.
data
);
...
@@ -92,7 +85,31 @@ export default {
...
@@ -92,7 +85,31 @@ export default {
resolve
(
res
.
data
.
data
||
res
.
data
);
resolve
(
res
.
data
.
data
||
res
.
data
);
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
loadingInstance
.
close
();
errorMsg
(
error
);
reject
(
error
);
});
});
},
//医院的接口数据用
postFn
(
url
,
params
,
option
)
{
loadingInstance
=
Vue
.
prototype
.
$loading
(
loadingOption
);
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
.
post
(
domain
+
url
,
params
,
{
...{
headers
:
createHeader
()
},
...
option
})
.
then
((
res
)
=>
{
console
.
log
(
res
);
if
(
res
.
status
!==
200
)
{
errorMsg
(
res
.
data
);
reject
(
res
.
data
);
return
;
}
loadingInstance
.
close
();
resolve
(
res
.
data
);
})
.
catch
((
error
)
=>
{
loadingInstance
.
close
();
loadingInstance
.
close
();
errorMsg
(
error
);
errorMsg
(
error
);
...
@@ -104,7 +121,7 @@ export default {
...
@@ -104,7 +121,7 @@ export default {
loadingInstance
=
Vue
.
prototype
.
$loading
(
loadingOption
);
loadingInstance
=
Vue
.
prototype
.
$loading
(
loadingOption
);
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
axios
.
get
(
domain
+
url
,
{
...
{
headers
:
createHeader
()
},
...
option
})
.
get
(
domain
+
url
,
{
...
{
headers
:
createHeader
()
},
...
option
})
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
.
status
!==
200
)
{
if
(
res
.
status
!==
200
)
{
errorMsg
(
res
.
data
);
errorMsg
(
res
.
data
);
...
@@ -121,4 +138,4 @@ export default {
...
@@ -121,4 +138,4 @@ export default {
});
});
});
});
},
},
}
};
\ No newline at end of file
src/views/Entrypath.vue
View file @
9c1ea2ce
This diff is collapsed.
Click to expand it.
src/views/outClinicalpathway.vue
View file @
9c1ea2ce
This diff is collapsed.
Click to expand it.
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