Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
vite-integral
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7e4c34ca
authored
Aug 17, 2022
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复bug
1 parent
4d66a493
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
src/main.ts
src/utils/http.ts
src/main.ts
View file @
7e4c34c
...
...
@@ -11,7 +11,7 @@ import fetchConfig from './utils/config'
import
VConsole
from
'vconsole'
import
'assets/styles/common.scss'
const
app
=
createApp
(
App
)
const
vConsole
=
new
VConsole
()
let
vConsole
:
object
=
{}
import
{
components
}
from
'./libs/vant'
components
.
forEach
(
component
=>
app
.
use
(
component
));
app
.
component
(
'svg-icon'
,
SvgIcon
)
...
...
@@ -19,6 +19,7 @@ app.component('svg-icon', SvgIcon)
fetchConfig
().
then
(
res
=>
{
// axios.defaults.baseURL = res.request.baseURL
localStorage
.
setItem
(
'config'
,
JSON
.
stringify
(
res
))
if
(
res
.
vconsole
)
vConsole
=
new
VConsole
()
})
// app.config.globalProperties.$axios = apis
// setupStore(app)
...
...
src/utils/http.ts
View file @
7e4c34c
...
...
@@ -6,7 +6,12 @@ import { createSign } from './util'
const
options
:
any
=
localStorage
.
getItem
(
'config'
)
interface
Config
{
response
:
object
,
response
:
{
'code_key'
:
string
,
'code_success_value'
:
0
,
'data_key'
:
string
,
'errId_logout_value'
:
string
},
request
:
{
baseURL
:
string
},
...
...
@@ -48,7 +53,7 @@ service.interceptors.request.use((config: AxiosRequestConfig) => {
service
.
interceptors
.
response
.
use
((
r
)
=>
{
console
.
log
(
r
)
const
{
data
:
res
,
config
:
{
returnAll
}
}
=
r
const
{
code_key
,
code_success_value
=
'0'
,
data_key
=
'data'
,
errId_logout_value
,
logout_function
=
'logout'
}
=
response
const
{
code_key
,
code_success_value
,
data_key
=
'data'
,
errId_logout_value
}
=
response
const
errId
=
'errId'
if
(
returnAll
)
{
return
res
...
...
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