12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import BASE_URL from './api.js';
- // jwx.js
- //#ifdef H5
- const jweixin = import('weixin-js-sdk')
- //#endif
- export function configWeiXin(callback) {
- const url = window.location.href.split('#')[0];
- // const url= "https://s.yxin.tech/hello.html"
- // start
- uni.request({
- // url: "/web/sign.php",
- // url:"https://s.yxin.tech/sign.php",
- url: "https://qhome.usky.cn/USKYZHAF/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',
- 'scanQRCode'
- ];
- 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 => {
- alert('config fail:', err);
- return
- });
- jweixin.ready(res => {
- if (callback) callback(jweixin);
- });
- }
- });
- // end
- }
|