方案一:
在 build/webpack.dev.conf.js 的devServer下增加https:true,
devServer: {
clientLogLevel: 'warning',
historyApiFallback: {
rewrites: [
{from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html')},
]
},
https:true,
......
}
方案二:
补全 static/config.js 里的api地址
window.appConfig = {
env: {
'localhost': {
api: 'https//test-api-smarthos.diandianys.com/app',
api2: '//192.168.1.29:8081',
// api2: '//192.168.1.189:8089',
pay_project: 'zsyy_test',
tjyy: 'test-tjyy-api.hztywl.cn',
tjyy_pay_project: 'zsyy_tjyy_test',
// appid: 'wx6e3551dee5f7e716',
appid: 'wxa49f90b4ff678ef2', //标准版
plat: 'dev'
}
}
}
image.png
修改 src/lib/http.js 中的url 去除url头部的双//
return new Promise((resolve, reject) => {
// loading && (load = weuijs.loading('加载中...'));
loading && (bus.$emit('loading', '加载中...'))
let axiosConfig = {
url: `${env.api}`,
method,
data,
headers: {
sign: 'test'
}
}
image.png
网友评论