liangzhaozhou 7 months ago
parent
commit
f95724de2e
1 changed files with 18 additions and 32 deletions
  1. 18 32
      lottery/index.html

+ 18 - 32
lottery/index.html

@@ -10,7 +10,7 @@
 		<script src="js/mui.js"></script>
 		<script src="js/mui.picker.js"></script>
 		<script src="js/mui.poppicker.js"></script>
-		<script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
+		<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
 		<!-- <script src="https://unpkg.com/vconsole/dist/vconsole.min.js"></script>
 		<script>
 		  var vConsole = new window.VConsole();
@@ -1008,51 +1008,37 @@
 		  let shareUrl = `${window.location.origin}?bId=${getQueryParam('bId')}&h5Type=${getQueryParam('h5Type')}`
 		  mui.ajax('https://wlapi.wefanbot.com/scrm/v1/ct-share/p/getSignature',{
 			data:{
-				url: 'https://lottery.camlook.cn'//window.location.origin
+				url: window.location.href
 			},
 			dataType:'json',//服务器返回json格式数据
 			type:'get',//HTTP请求类型
 			success:function(res){
 					if (res.code === 1) {
 						wx.config({
-						  beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
-						  debug: false, // 开启调试模式,
+						  debug: false,
 						  appId: res.data.appId, // 必填,企业号的唯一标识,此处填写企业号corpid
 						  timestamp: res.data.timestamp, // 必填,生成签名的时间戳
 						  nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
 						  signature: res.data.signature, // 必填,签名,见附录1
-						  jsApiList: [
-							'onMenuShareAppMessage',
-							'onMenuShareWechat',
-							'onMenuShareTimeline',
-							'shareAppMessage', // 自定义转发到会话
-							'shareWechatMessage' // 自定义转发到微信
-						  ] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2test
+						  jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData'] // 必填,需要使用的JS接口列表
 						})
 						// 分享接口仅激活的成员数超过200人且已经认证的企业才可在微信上调用。
 						wx.ready(() => {
-						  //   let noSharp = shareUrl
-						  // 微信分享的数据
-						  /*     alert('ready--success') */
-						  let shareData = {
-							link: shareUrl,
-							title: '寻找可靠的伙伴——宝骏14周年车主故事征集', // 分享标题
-							desc: '暨宝骏云海新车上市500万车主送祝福有奖活动,说出你和宝骏的故事', // 分享描述
-							imgUrl: 'https://lottery.camlook.cn/img/blessing.png', // 分享图标
-						  }
-						  wx.onMenuShareAppMessage(shareData) // 获取“转发”按钮点击状态及自定义分享内容接口,即将废弃
-						  wx.onMenuShareWechat(shareData)
-						  wx.onMenuShareTimeline(shareData) // 获取“分享到朋友圈”按钮点击状态及自定义分享内容接口,即将废弃
-						  wx.invoke('shareAppMessage', shareData, function(res) {
-							if (res.err_msg == 'shareAppMessage:ok') {
+							let shareData = {
+								link: shareUrl,
+								title: '寻找可靠的伙伴——宝骏14周年车主故事征集', // 分享标题
+								desc: '暨宝骏云海新车上市500万车主送祝福有奖活动,说出你和宝骏的故事', // 分享描述
+								imgUrl: 'http://wfg-1631.oss.wefanbot.com/imgUrl.jpg',
 							}
-						  }
-						  )
-						  wx.invoke('shareWechatMessage', shareData, function(res) {
-							if (res.err_msg == 'shareWechatMessage:ok') {
-							}
-						  }
-						  )
+						  // 分享到朋友圈
+						  wx.updateAppMessageShareData(shareData)
+						  // 分享给朋友
+						  wx.updateTimelineShareData(shareData);
+						  // 配置失败的回调函数
+						  wx.error(function (res) {
+							  // 配置失败
+							  console.log('配置失败', res);
+						  })
 						})
 					}
 			},