| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- const base_url = 'https://api.xyyxt.net' //release
- // const base_url = 'http://42.192.164.187:19005' //test
- // export const base_url = 'http://api.xyyxt.net:19009' //
- // export const base_url = 'https://test.xyyxt.net' //预发布
- // const base_url = 'http://192.168.1.24:5055' //dev
- // export const base_url = 'http://120.79.166.78:19012' // 测试环境
- export const BASE_IMG_URL = 'https://file.xyyxt.net/' //release
- // export const BASE_IMG_URL = 'https://file-dev.xyyxt.net/' //test
- const tenantId = uni.getStorageSync('tid') // 祥粤云学堂:867735392558919680,祥粤学堂:667735392758919630,中建云学堂-567735392758918520,中正-141250585240548145,山西-471722209971055962
- export const http = (option) => {
- if (option.loading) {
- uni.showLoading({
- mask: true,
- title: '拼命加载中...'
- })
- }
- return new Promise((resolve, reject) => {
- let token = uni.getStorageSync('token')
- uni.request({
- url: base_url + option.url,
- data: option.data,
- method: option.method || 'get',
- header: {
- TenantId: option.tenantIdHide ? '' : uni.getStorageSync('tid'),
- // 'Content-Type': 'application/json',
- AuthorizationToken: token ? 'WX ' + token : '',
- },
- success: (res) => {
- if (res.data.code == 401) {
- uni.removeStorageSync('user_account')
- }
- resolve(res)
- },
- fail: (err) => {
- uni.showToast({
- title: "请求接口失败",
- icon: 'none'
- })
- reject(JSON.stringify(err))
- },
- complete: () => {
- uni.hideLoading()
- }
- })
- })
- }
|