import BASE_URL from './api.js'; // jwx.js //#ifdef H5 const jweixin = require('jweixin-module') //#endif export function configWeiXin(callback) { const url = window.location.href.split('#')[0]; console.log(111) console.log(BASE_URL.BASE_URL) // start uni.request({ url:"https://wx.ewoogi.com/wx/sign.php", // url:"http://s.yxin.tech/sign.php", // url:`${BASE_URL.BASE_URL}sign.php`, header: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }, data:{"url":url}, method: 'GET', success: (res) => { console.log('请求的签名的参数') console.log(res) let apiList = [ // 可能需要用到的能力 需要啥就写啥。多写也没有坏处 'openLocation', 'getLocation' ]; let info = { debug: false, // 调试,发布的时候改为false appId: res.data.appid, nonceStr: res.data.nonceStr, timestamp: parseInt(res.data.timestamp), signature: res.data.sha_str, jsApiList: apiList }; jweixin.config(info); jweixin.error(err => { console.log('config fail:', err); return }); jweixin.ready(res => { if (callback) callback(jweixin); }); } }); // end }