|
@@ -20,13 +20,33 @@
|
|
|
onLoad() {
|
|
|
|
|
|
// #ifdef H5
|
|
|
- let redirect_uri = location.href.split('#')[0]
|
|
|
- this.$http.get('你的接口', {
|
|
|
- sing_url: redirect_uri
|
|
|
- }).then(res => {
|
|
|
- this.wx_co(res.data)
|
|
|
- }).catch(e => {
|
|
|
- console.log('错误信息', e);
|
|
|
+ let url = location.href.split('#')[0]
|
|
|
+ uni.request({
|
|
|
+ url: "https://s.yxin.tech/sign.php",
|
|
|
+ header: {
|
|
|
+ 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ "url": url
|
|
|
+ },
|
|
|
+ method: 'GET',
|
|
|
+ success: (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
|
|
|
+ };
|
|
|
+ this.wx_co(info)
|
|
|
+
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// #endif
|
|
@@ -83,7 +103,7 @@
|
|
|
},
|
|
|
|
|
|
scancode: function() {
|
|
|
- alert(1);
|
|
|
+ // alert(1);
|
|
|
this.$wx.scanQRCode({
|
|
|
|
|
|
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
|
@@ -109,4 +129,4 @@
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
-</style>
|
|
|
+</style>
|