Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
陆宇天
/
config-center-front
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit cf403f88
authored
May 09, 2022
by
luyt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:封装axios
1 parent
ed7708e4
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
223 additions
and
57 deletions
auto-imports.d.ts
components.d.ts
package-lock.json
package.json
src/config/index.ts
src/type/index.ts
src/utils/axios.ts
yarn.lock
auto-imports.d.ts
View file @
cf403f8
// Generated by 'unplugin-auto-import'
// Generated by 'unplugin-auto-import'
// We suggest you to commit this file into source control
// We suggest you to commit this file into source control
declare
global
{
declare
global
{
const
ElButton
:
typeof
import
(
'element-plus/es'
)[
'ElButton'
]
const
ElButton
:
typeof
import
(
"element-plus/es"
)[
"ElButton"
];
const
ElCard
:
typeof
import
(
'element-plus/es'
)[
'ElCard'
]
const
ElCard
:
typeof
import
(
"element-plus/es"
)[
"ElCard"
];
const
ElCheckbox
:
typeof
import
(
'element-plus/es'
)[
'ElCheckbox'
]
const
ElCheckbox
:
typeof
import
(
"element-plus/es"
)[
"ElCheckbox"
];
const
ElCheckboxGroup
:
typeof
import
(
'element-plus/es'
)[
'ElCheckboxGroup'
]
const
ElCheckboxGroup
:
typeof
import
(
"element-plus/es"
)[
"ElCheckboxGroup"
];
const
ElCol
:
typeof
import
(
'element-plus/es'
)[
'ElCol'
]
const
ElCol
:
typeof
import
(
"element-plus/es"
)[
"ElCol"
];
const
ElDatePicker
:
typeof
import
(
'element-plus/es'
)[
'ElDatePicker'
]
const
ElDatePicker
:
typeof
import
(
"element-plus/es"
)[
"ElDatePicker"
];
const
ElForm
:
typeof
import
(
'element-plus/es'
)[
'ElForm'
]
const
ElForm
:
typeof
import
(
"element-plus/es"
)[
"ElForm"
];
const
ElFormItem
:
typeof
import
(
'element-plus/es'
)[
'ElFormItem'
]
const
ElFormItem
:
typeof
import
(
"element-plus/es"
)[
"ElFormItem"
];
const
ElInput
:
typeof
import
(
'element-plus/es'
)[
'ElInput'
]
const
ElInput
:
typeof
import
(
"element-plus/es"
)[
"ElInput"
];
const
ElOption
:
typeof
import
(
'element-plus/es'
)[
'ElOption'
]
const
ElOption
:
typeof
import
(
"element-plus/es"
)[
"ElOption"
];
const
ElRadio
:
typeof
import
(
'element-plus/es'
)[
'ElRadio'
]
const
ElRadio
:
typeof
import
(
"element-plus/es"
)[
"ElRadio"
];
const
ElRadioGroup
:
typeof
import
(
'element-plus/es'
)[
'ElRadioGroup'
]
const
ElRadioGroup
:
typeof
import
(
"element-plus/es"
)[
"ElRadioGroup"
];
const
ElRow
:
typeof
import
(
'element-plus/es'
)[
'ElRow'
]
const
ElRow
:
typeof
import
(
"element-plus/es"
)[
"ElRow"
];
const
ElSelect
:
typeof
import
(
'element-plus/es'
)[
'ElSelect'
]
const
ElSelect
:
typeof
import
(
"element-plus/es"
)[
"ElSelect"
];
const
ElSwitch
:
typeof
import
(
'element-plus/es'
)[
'ElSwitch'
]
const
ElSwitch
:
typeof
import
(
"element-plus/es"
)[
"ElSwitch"
];
const
ElTimePicker
:
typeof
import
(
'element-plus/es'
)[
'ElTimePicker'
]
const
ElTimePicker
:
typeof
import
(
"element-plus/es"
)[
"ElTimePicker"
];
}
}
export
{}
export
{}
;
components.d.ts
View file @
cf403f8
// generated by unplugin-vue-components
// generated by unplugin-vue-components
// We suggest you to commit this file into source control
// We suggest you to commit this file into source control
// Read more: https://github.com/vuejs/vue-next/pull/3399
// Read more: https://github.com/vuejs/vue-next/pull/3399
import
'@vue/runtime-core'
import
"@vue/runtime-core"
;
declare
module
'@vue/runtime-core'
{
declare
module
"@vue/runtime-core"
{
export
interface
GlobalComponents
{
export
interface
GlobalComponents
{
AddButton
:
typeof
import
(
'./src/components/AddButton.vue'
)[
'default'
]
// AddButton: typeof import("./src/components/AddButton.vue")["default"];
ElButton
:
typeof
import
(
'element-plus/es'
)[
'ElButton'
]
ElButton
:
typeof
import
(
"element-plus/es"
)[
"ElButton"
];
ElCard
:
typeof
import
(
'element-plus/es'
)[
'ElCard'
]
ElCard
:
typeof
import
(
"element-plus/es"
)[
"ElCard"
];
ElCheckbox
:
typeof
import
(
'element-plus/es'
)[
'ElCheckbox'
]
ElCheckbox
:
typeof
import
(
"element-plus/es"
)[
"ElCheckbox"
];
ElCheckboxGroup
:
typeof
import
(
'element-plus/es'
)[
'ElCheckboxGroup'
]
ElCheckboxGroup
:
typeof
import
(
"element-plus/es"
)[
"ElCheckboxGroup"
];
ElCol
:
typeof
import
(
'element-plus/es'
)[
'ElCol'
]
ElCol
:
typeof
import
(
"element-plus/es"
)[
"ElCol"
];
ElDatePicker
:
typeof
import
(
'element-plus/es'
)[
'ElDatePicker'
]
ElDatePicker
:
typeof
import
(
"element-plus/es"
)[
"ElDatePicker"
];
ElForm
:
typeof
import
(
'element-plus/es'
)[
'ElForm'
]
ElForm
:
typeof
import
(
"element-plus/es"
)[
"ElForm"
];
ElFormItem
:
typeof
import
(
'element-plus/es'
)[
'ElFormItem'
]
ElFormItem
:
typeof
import
(
"element-plus/es"
)[
"ElFormItem"
];
ElInput
:
typeof
import
(
'element-plus/es'
)[
'ElInput'
]
ElInput
:
typeof
import
(
"element-plus/es"
)[
"ElInput"
];
ElOption
:
typeof
import
(
'element-plus/es'
)[
'ElOption'
]
ElOption
:
typeof
import
(
"element-plus/es"
)[
"ElOption"
];
ElRadio
:
typeof
import
(
'element-plus/es'
)[
'ElRadio'
]
ElRadio
:
typeof
import
(
"element-plus/es"
)[
"ElRadio"
];
ElRadioGroup
:
typeof
import
(
'element-plus/es'
)[
'ElRadioGroup'
]
ElRadioGroup
:
typeof
import
(
"element-plus/es"
)[
"ElRadioGroup"
];
ElRow
:
typeof
import
(
'element-plus/es'
)[
'ElRow'
]
ElRow
:
typeof
import
(
"element-plus/es"
)[
"ElRow"
];
ElSelect
:
typeof
import
(
'element-plus/es'
)[
'ElSelect'
]
ElSelect
:
typeof
import
(
"element-plus/es"
)[
"ElSelect"
];
ElSwitch
:
typeof
import
(
'element-plus/es'
)[
'ElSwitch'
]
ElSwitch
:
typeof
import
(
"element-plus/es"
)[
"ElSwitch"
];
ElTimePicker
:
typeof
import
(
'element-plus/es'
)[
'ElTimePicker'
]
ElTimePicker
:
typeof
import
(
"element-plus/es"
)[
"ElTimePicker"
];
HelloWorld
:
typeof
import
(
'./src/components/HelloWorld.vue'
)[
'default'
]
// HelloWorld: typeof import("./src/components/HelloWorld.vue")["default"];
RouterLink
:
typeof
import
(
'vue-router'
)[
'RouterLink'
]
RouterLink
:
typeof
import
(
"vue-router"
)[
"RouterLink"
];
RouterView
:
typeof
import
(
'vue-router'
)[
'RouterView'
]
RouterView
:
typeof
import
(
"vue-router"
)[
"RouterView"
];
}
}
}
}
export
{}
export
{}
;
package-lock.json
View file @
cf403f8
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
"name"
:
"config-center-front"
,
"name"
:
"config-center-front"
,
"version"
:
"0.1.0"
,
"version"
:
"0.1.0"
,
"dependencies"
:
{
"dependencies"
:
{
"axios"
:
"^0.27.2"
,
"core-js"
:
"^3.8.3"
,
"core-js"
:
"^3.8.3"
,
"element-plus"
:
"^2.1.11"
,
"element-plus"
:
"^2.1.11"
,
"vue"
:
"^3.2.13"
,
"vue"
:
"^3.2.13"
,
...
@@ -4696,7 +4697,6 @@
...
@@ -4696,7 +4697,6 @@
"version"
:
"0.4.0"
,
"version"
:
"0.4.0"
,
"resolved"
:
"https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz"
,
"integrity"
:
"sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
,
"integrity"
:
"sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
,
"dev"
:
true
,
"license"
:
"MIT"
"license"
:
"MIT"
},
},
"node_modules/at-least-node"
:
{
"node_modules/at-least-node"
:
{
...
@@ -4756,6 +4756,28 @@
...
@@ -4756,6 +4756,28 @@
"postcss"
:
"^8.1.0"
"postcss"
:
"^8.1.0"
}
}
},
},
"node_modules/axios"
:
{
"version"
:
"0.27.2"
,
"resolved"
:
"https://registry.npmjs.org/axios/-/axios-0.27.2.tgz"
,
"integrity"
:
"sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ=="
,
"dependencies"
:
{
"follow-redirects"
:
"^1.14.9"
,
"form-data"
:
"^4.0.0"
}
},
"node_modules/axios/node_modules/form-data"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz"
,
"integrity"
:
"sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww=="
,
"dependencies"
:
{
"asynckit"
:
"^0.4.0"
,
"combined-stream"
:
"^1.0.8"
,
"mime-types"
:
"^2.1.12"
},
"engines"
:
{
"node"
:
">= 6"
}
},
"node_modules/babel-jest"
:
{
"node_modules/babel-jest"
:
{
"version"
:
"27.5.1"
,
"version"
:
"27.5.1"
,
"resolved"
:
"https://registry.npmmirror.com/babel-jest/-/babel-jest-27.5.1.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/babel-jest/-/babel-jest-27.5.1.tgz"
,
...
@@ -5671,7 +5693,6 @@
...
@@ -5671,7 +5693,6 @@
"version"
:
"1.0.8"
,
"version"
:
"1.0.8"
,
"resolved"
:
"https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz"
,
"integrity"
:
"sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="
,
"integrity"
:
"sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="
,
"dev"
:
true
,
"license"
:
"MIT"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"dependencies"
:
{
"delayed-stream"
:
"~1.0.0"
"delayed-stream"
:
"~1.0.0"
...
@@ -6537,7 +6558,6 @@
...
@@ -6537,7 +6558,6 @@
"version"
:
"1.0.0"
,
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz"
,
"integrity"
:
"sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
,
"integrity"
:
"sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
,
"dev"
:
true
,
"license"
:
"MIT"
,
"license"
:
"MIT"
,
"engines"
:
{
"engines"
:
{
"node"
:
">=0.4.0"
"node"
:
">=0.4.0"
...
@@ -7852,7 +7872,6 @@
...
@@ -7852,7 +7872,6 @@
"version"
:
"1.14.9"
,
"version"
:
"1.14.9"
,
"resolved"
:
"https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.14.9.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.14.9.tgz"
,
"integrity"
:
"sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w=="
,
"integrity"
:
"sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w=="
,
"dev"
:
true
,
"funding"
:
[
"funding"
:
[
{
{
"type"
:
"individual"
,
"type"
:
"individual"
,
...
@@ -10771,7 +10790,6 @@
...
@@ -10771,7 +10790,6 @@
"version"
:
"1.52.0"
,
"version"
:
"1.52.0"
,
"resolved"
:
"https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz"
,
"integrity"
:
"sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
,
"integrity"
:
"sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
,
"dev"
:
true
,
"license"
:
"MIT"
,
"license"
:
"MIT"
,
"engines"
:
{
"engines"
:
{
"node"
:
">= 0.6"
"node"
:
">= 0.6"
...
@@ -10781,7 +10799,6 @@
...
@@ -10781,7 +10799,6 @@
"version"
:
"2.1.35"
,
"version"
:
"2.1.35"
,
"resolved"
:
"https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz"
,
"integrity"
:
"sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="
,
"integrity"
:
"sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="
,
"dev"
:
true
,
"license"
:
"MIT"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"dependencies"
:
{
"mime-db"
:
"1.52.0"
"mime-db"
:
"1.52.0"
...
@@ -18858,8 +18875,7 @@
...
@@ -18858,8 +18875,7 @@
"asynckit"
:
{
"asynckit"
:
{
"version"
:
"0.4.0"
,
"version"
:
"0.4.0"
,
"resolved"
:
"https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz"
,
"integrity"
:
"sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
,
"integrity"
:
"sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
"dev"
:
true
},
},
"at-least-node"
:
{
"at-least-node"
:
{
"version"
:
"1.0.0"
,
"version"
:
"1.0.0"
,
...
@@ -18887,6 +18903,27 @@
...
@@ -18887,6 +18903,27 @@
"postcss-value-parser"
:
"^4.2.0"
"postcss-value-parser"
:
"^4.2.0"
}
}
},
},
"axios"
:
{
"version"
:
"0.27.2"
,
"resolved"
:
"https://registry.npmjs.org/axios/-/axios-0.27.2.tgz"
,
"integrity"
:
"sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ=="
,
"requires"
:
{
"follow-redirects"
:
"^1.14.9"
,
"form-data"
:
"^4.0.0"
},
"dependencies"
:
{
"form-data"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz"
,
"integrity"
:
"sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww=="
,
"requires"
:
{
"asynckit"
:
"^0.4.0"
,
"combined-stream"
:
"^1.0.8"
,
"mime-types"
:
"^2.1.12"
}
}
}
},
"babel-jest"
:
{
"babel-jest"
:
{
"version"
:
"27.5.1"
,
"version"
:
"27.5.1"
,
"resolved"
:
"https://registry.npmmirror.com/babel-jest/-/babel-jest-27.5.1.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/babel-jest/-/babel-jest-27.5.1.tgz"
,
...
@@ -19530,7 +19567,6 @@
...
@@ -19530,7 +19567,6 @@
"version"
:
"1.0.8"
,
"version"
:
"1.0.8"
,
"resolved"
:
"https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz"
,
"integrity"
:
"sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="
,
"integrity"
:
"sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="
,
"dev"
:
true
,
"requires"
:
{
"requires"
:
{
"delayed-stream"
:
"~1.0.0"
"delayed-stream"
:
"~1.0.0"
}
}
...
@@ -20133,8 +20169,7 @@
...
@@ -20133,8 +20169,7 @@
"delayed-stream"
:
{
"delayed-stream"
:
{
"version"
:
"1.0.0"
,
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz"
,
"integrity"
:
"sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
,
"integrity"
:
"sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
"dev"
:
true
},
},
"depd"
:
{
"depd"
:
{
"version"
:
"1.1.2"
,
"version"
:
"1.1.2"
,
...
@@ -21066,8 +21101,7 @@
...
@@ -21066,8 +21101,7 @@
"follow-redirects"
:
{
"follow-redirects"
:
{
"version"
:
"1.14.9"
,
"version"
:
"1.14.9"
,
"resolved"
:
"https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.14.9.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.14.9.tgz"
,
"integrity"
:
"sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w=="
,
"integrity"
:
"sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w=="
"dev"
:
true
},
},
"fork-ts-checker-webpack-plugin"
:
{
"fork-ts-checker-webpack-plugin"
:
{
"version"
:
"6.5.1"
,
"version"
:
"6.5.1"
,
...
@@ -23112,14 +23146,12 @@
...
@@ -23112,14 +23146,12 @@
"mime-db"
:
{
"mime-db"
:
{
"version"
:
"1.52.0"
,
"version"
:
"1.52.0"
,
"resolved"
:
"https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz"
,
"integrity"
:
"sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
,
"integrity"
:
"sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
"dev"
:
true
},
},
"mime-types"
:
{
"mime-types"
:
{
"version"
:
"2.1.35"
,
"version"
:
"2.1.35"
,
"resolved"
:
"https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz"
,
"resolved"
:
"https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz"
,
"integrity"
:
"sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="
,
"integrity"
:
"sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="
,
"dev"
:
true
,
"requires"
:
{
"requires"
:
{
"mime-db"
:
"1.52.0"
"mime-db"
:
"1.52.0"
}
}
...
...
package.json
View file @
cf403f8
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
"lint"
:
"vue-cli-service lint --fix"
"lint"
:
"vue-cli-service lint --fix"
},
},
"dependencies"
:
{
"dependencies"
:
{
"axios"
:
"^0.27.2"
,
"core-js"
:
"^3.8.3"
,
"core-js"
:
"^3.8.3"
,
"element-plus"
:
"^2.1.11"
,
"element-plus"
:
"^2.1.11"
,
"vue"
:
"^3.2.13"
,
"vue"
:
"^3.2.13"
,
...
...
src/config/index.ts
0 → 100644
View file @
cf403f8
/**
* 公共配置模块
*/
export
default
{
baseUrl
:
{
dev
:
"http://localhost:3000"
,
pro
:
"http://xx.com"
,
},
};
src/type/index.ts
View file @
cf403f8
/**
/**
* 存放公共的类型声明文件
* 存放公共的类型声明文件
*/
*/
export
interface
HttpResponse
{
code
?:
number
;
data
?:
any
;
msg
?:
string
|
Record
<
string
,
any
>
;
// 定义 字符串,对象类型
[
propname
:
string
]:
any
;
}
src/utils/axios.ts
0 → 100644
View file @
cf403f8
// 以class类来实现axios实例化
import
axios
,
{
AxiosInstance
,
AxiosRequestConfig
,
AxiosResponse
}
from
"axios"
;
// 自定义 promise interface
import
{
HttpResponse
}
from
"@/type/index"
;
class
HttpRequest
{
private
baseUrl
:
string
;
constructor
(
baseUrl
:
string
)
{
this
.
baseUrl
=
baseUrl
;
}
// 获取axios实例的配置
getInsideConfig
()
{
const
config
=
{
baseURL
:
this
.
baseUrl
,
headers
:
{
"Content-Type"
:
"application/json;charset=utf-8"
,
},
timeout
:
1000
*
10
,
};
return
config
;
}
// 设定拦截器
interceptors
(
instance
:
AxiosInstance
)
{
// 添加请求拦截器
instance
.
interceptors
.
request
.
use
(
(
config
)
=>
{
// 添加token
const
token
=
""
;
if
(
token
)
{
(
config
.
headers
as
any
).
Authorization
=
"Bearer "
+
token
;
}
// console.log('config:' + JSON.stringify(config))
// 在发送请求之前做些什么
return
config
;
},
(
error
:
Error
)
=>
{
// 对请求错误做些什么
return
Promise
.
reject
(
error
);
}
);
// 添加响应拦截器
instance
.
interceptors
.
response
.
use
(
(
response
)
=>
{
// console.log('response:' + JSON.stringify(response))
// 对响应数据做点什么
if
(
response
.
status
===
200
)
{
// return response.data
// 跟上边直接返回都是一样的(也可以不加Promise.resolve)
return
Promise
.
resolve
(
response
.
data
);
}
else
{
return
Promise
.
reject
(
response
);
}
},
(
error
:
Error
)
=>
{
// 对响应错误做点什么
// debugger
return
Promise
.
reject
(
error
);
}
);
}
// 创建实例
request
(
options
:
AxiosRequestConfig
)
{
const
instance
=
axios
.
create
();
const
newOptions
=
Object
.
assign
(
this
.
getInsideConfig
(),
options
);
this
.
interceptors
(
instance
);
return
instance
(
newOptions
);
}
get
(
url
:
string
,
config
?:
AxiosRequestConfig
):
Promise
<
AxiosResponse
>
|
Promise
<
HttpResponse
>
{
const
options
=
Object
.
assign
(
{
method
:
"get"
,
url
:
url
,
},
config
);
return
this
.
request
(
options
);
}
post
(
url
:
string
,
data
?:
any
):
Promise
<
AxiosResponse
>
|
Promise
<
HttpResponse
>
{
return
this
.
request
({
method
:
"post"
,
url
:
url
,
data
:
data
,
});
}
}
export
default
HttpRequest
;
yarn.lock
View file @
cf403f8
...
@@ -2551,6 +2551,14 @@
...
@@ -2551,6 +2551,14 @@
"picocolors" "^1.0.0"
"picocolors" "^1.0.0"
"postcss-value-parser" "^4.2.0"
"postcss-value-parser" "^4.2.0"
"axios@^0.27.2":
"integrity" "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ=="
"resolved" "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz"
"version" "0.27.2"
dependencies:
"follow-redirects" "^1.14.9"
"form-data" "^4.0.0"
"babel-jest@^27.0.6", "babel-jest@^27.1.0", "babel-jest@^27.5.1", "babel-jest@>=27.0.0 <28", "babel-jest@27.x":
"babel-jest@^27.0.6", "babel-jest@^27.1.0", "babel-jest@^27.5.1", "babel-jest@>=27.0.0 <28", "babel-jest@27.x":
"integrity" "sha512-cdQ5dXjGRd0IBRATiQ4mZGlGlRE8kJpjPOixdNRdT+m3UcNqmYWN6rK6nvtXYfY3D76cb8s/O1Ss8ea24PIwcg=="
"integrity" "sha512-cdQ5dXjGRd0IBRATiQ4mZGlGlRE8kJpjPOixdNRdT+m3UcNqmYWN6rK6nvtXYfY3D76cb8s/O1Ss8ea24PIwcg=="
"resolved" "https://registry.npmmirror.com/babel-jest/-/babel-jest-27.5.1.tgz"
"resolved" "https://registry.npmmirror.com/babel-jest/-/babel-jest-27.5.1.tgz"
...
@@ -4208,7 +4216,7 @@
...
@@ -4208,7 +4216,7 @@
"resolved" "https://registry.npmmirror.com/flatted/-/flatted-3.2.5.tgz"
"resolved" "https://registry.npmmirror.com/flatted/-/flatted-3.2.5.tgz"
"version" "3.2.5"
"version" "3.2.5"
"follow-redirects@^1.0.0":
"follow-redirects@^1.0.0"
, "follow-redirects@^1.14.9"
:
"integrity" "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w=="
"integrity" "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w=="
"resolved" "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.14.9.tgz"
"resolved" "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.14.9.tgz"
"version" "1.14.9"
"version" "1.14.9"
...
@@ -4241,6 +4249,15 @@
...
@@ -4241,6 +4249,15 @@
"combined-stream" "^1.0.8"
"combined-stream" "^1.0.8"
"mime-types" "^2.1.12"
"mime-types" "^2.1.12"
"form-data@^4.0.0":
"integrity" "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww=="
"resolved" "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz"
"version" "4.0.0"
dependencies:
"asynckit" "^0.4.0"
"combined-stream" "^1.0.8"
"mime-types" "^2.1.12"
"forwarded@0.2.0":
"forwarded@0.2.0":
"integrity" "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="
"integrity" "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="
"resolved" "https://registry.npmmirror.com/forwarded/-/forwarded-0.2.0.tgz"
"resolved" "https://registry.npmmirror.com/forwarded/-/forwarded-0.2.0.tgz"
...
...
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