12345678910111213141516171819202122232425262728293031323334353637383940 |
- const httpApi = {}
- import store from '@/store'
- httpApi.get = ((url, params) => {
- let baseUrl = store.state.common.host
- return new Promise(resolve => {
- uni.request({
- url: baseUrl + url,
- data: params,
- method: 'get',
- header: {
- 'token': null
- },
- success: (res) => {
- resolve(res.data)
- }
- })
- })
- })
- httpApi.post = ((url, params) => {
- let baseUrl = store.state.common.host
- return new Promise(resolve => {
- uni.request({
- url: baseUrl + url,
- data: params,
- header: 'application/json',
- method: 'post',
- header: {
- 'token': null
- },
- success: (res) => {
- resolve(res.data)
- }
- })
- })
- })
- export default httpApi
|