小程序配置请求地址

const domain = 'https://msinterface-jd.herokuapp.com';
const domain2 = "https://www.thenewstep.cn"
在until里面新建js
const interfaces = {
// 返回的首页请求的json数据
homepage: domain + '/api/profiles/homepage',

// 返回的商品的json数据
productions: domain + '/api/profiles/productions',

// 返回的商品列表的json数据
productionsList: domain + '/api/profiles/productionsList',

// 返回的商品详情的json数据
productionDetail: domain + '/api/profiles/productionDetail',

// 获取openid 参数: code appid secret
getOpenid: domain + '/api/profiles/getOpenid/',

// 微信支付
wechatPay: domain2 + '/xcxzf/jsapi.php',
};

module.exports = interfaces; 暴露这个方法
// 引入接口配置文件urlconfig
const interfaces = require('../../utils/urlconfig.js');
wx.request({
url: interfaces.homepage,
header: {
'content-type': 'application/json' // 默认值,返回的数据设置为json数组格式
},
原文地址:https://www.cnblogs.com/xzhce/p/13335367.html