Commit 357c5e93 authored by haiyoucuv's avatar haiyoucuv

Merge remote-tracking branch 'origin/master'

parents 3657f94c e9030072
// 【开发环境】
export const devOptions = {
BASE_URL: 'https://activity.m.duibadev.com.cn/',
appKey: 'jlg88lyxz7siqtmr',
}
// 【测试环境】
export const testOptions = {
BASE_URL: 'https://activity.m.duibatest.com.cn/',
appKey: '3tWCs93A2ZfuvMyJkWxC7xddg6qA',
}
// 【预发环境】
export const prevOptions = {
BASE_URL: 'https://activity-pre.m.duiba.com.cn/', // 免登接口有预发的环境
appKey: '388ENcX8CGJBEdn2hyZA5zDkqpR6',
}
// 【线上环境】
export const publishOptions = {
BASE_URL: 'https://activity.m.duiba.com.cn/',
appKey: '388ENcX8CGJBEdn2hyZA5zDkqpR6',
}
export default publishOptions
\ No newline at end of file
import env from './config';
const headersConfig = {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
}
export let request = (config: any) => new Promise((resolve, reject) => {
const method = config.method.toUpperCase() || 'GET';
const { BASE_URL } = env;
wx.request({
method,
url: config.url ? `${BASE_URL}${config.url}` : '',
data: config.data,
header: {
...headersConfig,
...config.headers
},
success(response) {
if (+response.statusCode === 200) {
resolve(response.data);
} else {
reject(new Error(`请求失败 statusCode: ${response.statusCode}`));
}
},
fail(error) {
reject(new Error(error.errMsg));
},
})
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment