wxRequest.js
1.28 KB
import axios from './axios'
import sign from './sign'
import RequestMethods from './RequestMethods'
// import config from '@/config/conf.js'
// console.log(config, 'config')
const request = (params = {}, target, method = RequestMethods.POST, noSignAttr = []) => {
// console.log(window.$baseConfig.axios.appkey)
params.method = target
params.source = 'dj-wechat'
// params.appKey = window.$baseConfig.axios.appkey
console.log(window.$fetchConfig, 'window.$fetchConfig')
params.appKey = window.$fetchConfig.sign.appKey
console.log(params.appKey, 'params.appKey')
params.timestamp = new Date().format('yyyy-MM-dd hh:mm:ss')
params.v = '1.0.0'
params.format = 'json'
params.locale = 'zh_CN'
// const url = window.$baseConfig.axios.baseURL
// https://scrm.dev.glsx.com.cn/
// const url = 'http://scrm.dev.glsx.com.cn/rop-scrm-equity/router'
// console.log(window.$fetchConfig, 'url')
let router = target.includes('scrm.api.renewal') ? '/rop-scrm-renewal/router' : '/rop-scrm-equity/router'
const url = window.$fetchConfig.request.baseURL + router
// console.log(window.$fetchConfig.secret, 'window.$fetchConfig.secret')
const secret = window.$fetchConfig.secret
return axios({
url,
method,
data: sign(params, noSignAttr, secret)
})
}
export default request