feat: 首次提交
This commit is contained in:
30
common/fui-request.js
Normal file
30
common/fui-request.js
Normal file
@ -0,0 +1,30 @@
|
||||
// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 86 14 0 725 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
|
||||
import http from '@/components/firstui/fui-request'
|
||||
|
||||
//初始化请求配置项
|
||||
http.create({
|
||||
host: 'https://ffa.firstui.cn',
|
||||
header: {
|
||||
// 'content-type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
})
|
||||
//请求拦截
|
||||
http.interceptors.request.use(config => {
|
||||
//请求之前可在请求头中加入token等信息
|
||||
let token = uni.getStorageSync('firstui_token') || 'testToken';
|
||||
if (config.header) {
|
||||
config.header['token'] = token
|
||||
} else {
|
||||
config.header = {
|
||||
'token': token
|
||||
}
|
||||
}
|
||||
return config
|
||||
})
|
||||
//响应拦截
|
||||
http.interceptors.response.use(response => {
|
||||
//TODO
|
||||
return response
|
||||
})
|
||||
|
||||
export default http
|
Reference in New Issue
Block a user