增加mqtt
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
import config from '../config/index.js';
|
||||
|
||||
const env = 'development';//production //开发of线上 改这里就行
|
||||
const BASE = config[env];
|
||||
const request = (options) => {
|
||||
console.log("options"+JSON.stringify(options))
|
||||
console.log("options"+JSON.stringify(options),BASE.BASE_URL)
|
||||
return new Promise((resolve, reject) => {
|
||||
// 处理GET请求参数
|
||||
let url = config.BASE_URL + options.url;
|
||||
let url = BASE.BASE_URL + options.url;
|
||||
console.log("url"+url)
|
||||
if (options.method === 'GET' && options.data) {
|
||||
// 使用qs序列化参数
|
||||
const params = Object.keys(options.data)
|
||||
@ -42,7 +44,7 @@ const request = (options) => {
|
||||
});
|
||||
};
|
||||
// 导出基础URL以便其他地方使用
|
||||
export const baseURL = config.BASE_URL
|
||||
export const baseURL = BASE.BASE_URL
|
||||
export const getToken = () => uni.getStorageSync('token') // 获取token的方法
|
||||
export const clientid =() => uni.getStorageSync('clientID');
|
||||
export default request;
|
Reference in New Issue
Block a user