了解最新公司动态及行业资讯
接口名称:获取公司信息
接口标识:company
接口url:https://你的网站/api.php/index/company
接口参数:无
小程序代码
code腾石建站
swan.request({
url: that.globalData.api + "company",
data: {
aid: that.globalData.aid
},
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded', // 默认值
'x-safecode': that.globalData.safecode
},
success: function (res) {
console.log(res)
let system = res.data.data;
that.globalData.system = system;
try {
swan.setStorageSync('system', system)
} catch (e) {
}
resolve(system);
console.log("promise读取system")
}
})
}
该接口直接存入storage缓存了,调用方式为:
code腾石建站
var system = swan.getStorageSync('system');//获取system缓存配置
调用电话:{{ssytem.phone}}
调用名称:{{system.name}}
调用地址:{{system.address}}
......