|
@@ -4,25 +4,29 @@ import * as API_Common from '$project/apis/common'
|
|
|
|
|
|
//获取微信配置
|
|
|
export function getWxConfig(jsApiList) {
|
|
|
- let promise = new Promise((resolve, reject) => {
|
|
|
- var jsApiList = jsApiList || ['chooseImage', 'getLocalImgData'];
|
|
|
- API_WeiXin.getConfig().then(response => {
|
|
|
- var wxconfig = response.wxConfig;
|
|
|
- console.log(wxconfig.nonceStr)
|
|
|
- wx.config({
|
|
|
- debug: false, // 开启调试模式,
|
|
|
- appId: wxconfig.appId, // 必填,企业号的唯一标识,此处填写企业号corpid
|
|
|
- timestamp: wxconfig.timestamp, // 必填,生成签名的时间戳
|
|
|
- nonceStr: wxconfig.nonceStr, // 必填,生成签名的随机串
|
|
|
- signature: wxconfig.signature, // 必填,签名,见附录1
|
|
|
- jsApiList: jsApiList // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
|
|
- });
|
|
|
- resolve(response);
|
|
|
- }).catch(error => {
|
|
|
- mui.toast(error);
|
|
|
- reject(error);
|
|
|
+ var jsApiList = jsApiList || ['chooseImage', 'getLocalImgData'];
|
|
|
+ let promise = (jsApiList => {
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ console.log(jsApiList);
|
|
|
+ API_WeiXin.getConfig().then(response => {
|
|
|
+ var wxconfig = response.wxConfig;
|
|
|
+ console.log(wxconfig.nonceStr)
|
|
|
+ wx.config({
|
|
|
+ debug: false, // 开启调试模式,
|
|
|
+ appId: wxconfig.appId, // 必填,企业号的唯一标识,此处填写企业号corpid
|
|
|
+ timestamp: wxconfig.timestamp, // 必填,生成签名的时间戳
|
|
|
+ nonceStr: wxconfig.nonceStr, // 必填,生成签名的随机串
|
|
|
+ signature: wxconfig.signature, // 必填,签名,见附录1
|
|
|
+ jsApiList: jsApiList // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
|
|
+ });
|
|
|
+ resolve(response);
|
|
|
+ }).catch(error => {
|
|
|
+ mui.toast(error);
|
|
|
+ reject(error);
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
+ })(jsApiList)
|
|
|
+
|
|
|
return promise;
|
|
|
}
|
|
|
|