From 2bc6d220a88e786bcbeb50712cacf55168b98382 Mon Sep 17 00:00:00 2001 From: xd <402868507@qq.com> Date: Wed, 25 Mar 2020 15:42:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=8D=93=E6=97=A0=E6=B3=95=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E9=97=AE=E9=A2=98git=20commit=20-m=20=E5=AE=89?= =?UTF-8?q?=E5=8D=93=E6=97=A0=E6=B3=95=E4=B8=8A=E4=BC=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wx_application/public/index.html | 4 +- ybf_wx/public/index.html | 2 +- ybf_wx/src/utils/aCommon.js | 14 +++-- ybf_wx/src/views/sideNav/discount/index.vue | 65 ++++++++------------- ybf_wx/src/views/sideNav/register/index.vue | 17 +++++- 5 files changed, 50 insertions(+), 52 deletions(-) diff --git a/wx_application/public/index.html b/wx_application/public/index.html index d6ab233..d6c02fc 100644 --- a/wx_application/public/index.html +++ b/wx_application/public/index.html @@ -7,7 +7,7 @@ <link rel="icon" href="<%= BASE_URL %>favicon.ico"> <title>亿百分</title> <script type="text/javascript" src="js/jquery-3.4.1.min.js"></script> - <script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script> + <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> </head> <body> <noscript> @@ -15,6 +15,6 @@ </noscript> <div id="app"></div> <!-- built files will be auto injected --> - <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> + <!-- <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> --> </body> </html> diff --git a/ybf_wx/public/index.html b/ybf_wx/public/index.html index d6ab233..ee9f7f6 100644 --- a/ybf_wx/public/index.html +++ b/ybf_wx/public/index.html @@ -7,7 +7,7 @@ <link rel="icon" href="<%= BASE_URL %>favicon.ico"> <title>亿百分</title> <script type="text/javascript" src="js/jquery-3.4.1.min.js"></script> - <script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script> + <!-- <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> --> </head> <body> <noscript> diff --git a/ybf_wx/src/utils/aCommon.js b/ybf_wx/src/utils/aCommon.js index 53fddc1..5da6c26 100644 --- a/ybf_wx/src/utils/aCommon.js +++ b/ybf_wx/src/utils/aCommon.js @@ -55,7 +55,6 @@ function isIosOrAndroid() { Vue.prototype.getAgentAuth = function () { zlog('%c--->IN: getAgentAuth: location.href =', 'color: orange;', location.href) // alert(`--->zCommon.js: IN.`) - let postData = { // businessId: sessionStorage.getItem('businessId'), // pageUrl: encodeURIComponent(this.isIosOrAndroid() === 'android' ? location.href.split('#')[0] : window.initUrl) @@ -90,7 +89,11 @@ Vue.prototype.getAgentAuth = function () { nonceStr: config.jsApiSignature.nonceStr, // 必填,生æˆç¾åçš„éšæœºä¸² signature: config.jsApiSignature.signature, // 必填,ç¾å // æ ¹æ®è‡ªå·±çš„需求,填写 jsapilist 内容 - jsApiList: ['agentConfig'] + jsApiList: ['agentConfig', 'sendChatMessage'], + success: function(res) { + }, + fail: function(err) { + } }) // alert(`--->zCommon.js: getJsSdkSignature: then: wx.config: end.`) @@ -100,16 +103,15 @@ Vue.prototype.getAgentAuth = function () { // JS-SDKé…置信æ¯éªŒè¯å¤±è´¥æ—¶ä¼šè¿›å…¥æ¤æ–¹æ³• wx.error(function (res) { - // alert("JS-SDKé…置信æ¯éªŒè¯å¤±è´¥ \r\n" + JSON.stringify(res)); }) // é…ç½®æˆåŠŸåŽéªŒè¯API接å£åœ¨å½“å‰å®¢æˆ·ç«¯æ˜¯å¦æ”¯æŒï¼šåˆ¤æ–当å‰å®¢æˆ·ç«¯ç‰ˆæœ¬æ˜¯å¦æ”¯æŒæŒ‡å®šJSæŽ¥å£ wx.checkJsApi( { - jsApiList: ['agentConfig', 'sendChatMessage'], + jsApiList: ['config', 'agentConfig', 'sendChatMessage'], success: function (res) { if (res.errMsg != "checkJsApi:ok") { - // alert("JS-SDKæŽ¥å£æ£€æµ‹å¤±è´¥:" + JSON.stringify(res)); + alert("JS-SDKæŽ¥å£æ£€æµ‹å¤±è´¥:" + JSON.stringify(res)); return false; } else { wxRequest('/workWx/auth/base/getAgentJsSdkSignature', qs.stringify(postData), header) @@ -128,6 +130,7 @@ Vue.prototype.getAgentAuth = function () { signature: agentConfig.agentJsApiSignature.signature,// 必填,ç¾å,agentConfig所以为应用ç¾å jsApiList: ['sendChatMessage'], //å¿…å¡« success: function (res) { + alert('agentConfigSuccess') // alert(`!-->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: wx.agentConfig: res.`) // alert(`!-->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: wx.agentConfig: res =${JSON.stringify(res)}`) // alert('agentConfig:ok') @@ -138,6 +141,7 @@ Vue.prototype.getAgentAuth = function () { // alert('wx.agentConfig 回调'+res.errMsg); }, fail: function (res) { + alert('agentConfigFailed') // alert('回调失败:'+res.errMsg) if (res.errMsg.indexOf('is not a function') > -1) { alert('<i class="weui-icon-warn">版本过低请å‡çº§</i>') diff --git a/ybf_wx/src/views/sideNav/discount/index.vue b/ybf_wx/src/views/sideNav/discount/index.vue index 66c3504..7629c3a 100644 --- a/ybf_wx/src/views/sideNav/discount/index.vue +++ b/ybf_wx/src/views/sideNav/discount/index.vue @@ -91,6 +91,7 @@ export default { this.zcache.userId = this.$route.params.userId; this.zReadyGetUserFromId(); this.getAgentAuth(); + this.zReadySetVoucherList() }, mounted() { }, @@ -128,8 +129,7 @@ export default { let postData = { param: this.zcache.userId // param: 'ZhouHeQiang' - }; - // alert(`--->userInfoFromId: postData = ${JSON.stringify(postData)}`); + } getUserInfoByUserId(postData) .then(res => { // alert(`--->userInfoFromId: res = ${JSON.stringify(res.data[0])}`); @@ -139,37 +139,33 @@ export default { // this.zcache.storeId = Number(res.data[0].stall); this.zReadySetVoucherList(); }) - .catch(err => {}); + .catch(err => {}) }, // 获å–ä¼˜æƒ åˆ¸åˆ—è¡¨ zReadySetVoucherList() { + alert('获å–ä¼˜æƒ åˆ¸') this.zReadyDelVoucherList(); const postData = { appCode: "0696", // j接å£ç¼–ç - mdid: this.zcache.storeId - }; - - // alert(`--->PostToEA: postData = ${JSON.stringify(postData)}`); - zlog("%c--->VoucherList: PD =", "background: orange;", postData); - - getVoucherList(postData) - .then(res => { - zlog("%c--->VoucherList: RD =", "background: limegreen;", res); - // alert(`--->PostToEA: Res = ${JSON.stringify(res)}`); - - this.zVoucherSet(res.result.coupons); + // mdid: this.zcache.storeId + mdid: 1 + } + alert('å‡†å¤‡è¿›å…¥è¯·æ±‚ä¼˜æƒ åˆ¸åˆ—è¡¨') + getVoucherList(postData).then(res => { + alert('getVoucherList') + zlog("%c--->VoucherList: RD =", "background: limegreen;", res); + this.zVoucherSet(res.result.coupons); }) .catch(err => { - // alert(`--->PostToEA: err = ${JSON.stringify(err)}`); }); }, - zReadyDelVoucherList() { this.zVoucherDel(); this.zVoucherUrlDel(); }, zVoucherPick(inActiveId, inVoucherId) { + alert('推é€') this.zcache.now.activeId = String(inActiveId) this.zcache.now.voucherId = String(inVoucherId) @@ -184,15 +180,12 @@ export default { zlog("%c--->VoucherWxUrl: PD =", "background: red;", postData); getVoucherWxUrl(postData).then(res => { - zlog("%c--->VoucherWxUrl: RD =", "background: green;", res); - - this.zVoucherUrlSet(res.result.link); + this.zVoucherUrlSet(res.result.link) + alert('获å–列表æˆåŠŸ') }); }, zpick(inMsgType, inUrl) { - // alert(`--->discount.vue: zpick: IN.`); - switch (inMsgType) { case "text": @@ -206,23 +199,21 @@ export default { }, function(res) { if (res.err_msg == "sendChatMessage:ok") { - // alert("--->discount.vue: zpick: text 分享æˆåŠŸï¼"); + alert("--->discount.vue: zpick: text 分享æˆåŠŸï¼") } else if (res.err_msg != "sendChatMessage:ok") { - // alert( - // `--->discount.vue: zpick: text 分享失败: res =${res.err_msg}` - // ); + alert('分享失败') } } ); break; case "h5": // alert(`--->discount.vue: zpick: H5: IN.`); - + alert('zpick') wx.invoke( "sendChatMessage", { - msgtype: "text", //消æ¯ç±»åž‹ï¼Œå¿…å¡« - news: { + msgtype: "news", //消æ¯ç±»åž‹ï¼Œå¿…å¡« + news: { link: `http://qywx2.100smartdata.com/qrCode?Url=${inUrl}&activeId=${this.zcache.now.activeId}&voucherId=${this.zcache.now.voucherId}&unionId=1234`, //H5消æ¯é¡µé¢url å¿…å¡« title: "领å–ä¼˜æƒ åˆ¸", //H5æ¶ˆæ¯æ ‡é¢˜ desc: inUrl, //H5æ¶ˆæ¯æ‘˜è¦ @@ -230,10 +221,11 @@ export default { } }, function(res) { + alert('sendChatMessage') if (res.err_msg == "sendChatMessage:ok") { - // alert("--->discount.vue: zpick: h5 分享æˆåŠŸï¼"); + alert("--->discount.vue: zpick: h5 分享æˆåŠŸï¼") } else if (res.err_msg != "sendChatMessage:ok") { - // alert(`--->discount.vue: zpick: h5 分享失败.`); + alert(`--->discount.vue: zpick: h5 分享失败.`) // alert( // `--->discount.vue: zpick: h5 分享失败: res =${res.err_msg}` // ); @@ -241,21 +233,12 @@ export default { } ); break; - default: break; } - - // zlog( - // "%c--->Click: Url =", - // "background: orange;", - // String(this.zlist.voucherUrl) - // ); - // window.wx.miniProgram.navigateTo({ - // url: this.zlist.voucherUrl - // }); }, zVoucherSet(inArray) { + alert('zVoucherSet') this.zlist.voucher = inArray; }, diff --git a/ybf_wx/src/views/sideNav/register/index.vue b/ybf_wx/src/views/sideNav/register/index.vue index c1bf5c2..ec5c4dd 100644 --- a/ybf_wx/src/views/sideNav/register/index.vue +++ b/ybf_wx/src/views/sideNav/register/index.vue @@ -36,21 +36,32 @@ }, methods:{ sendMessage(){ + const url = 'http://www.baidu.com' wx.invoke( "sendChatMessage", { - msgtype: "text", //消æ¯ç±»åž‹ï¼Œå¿…å¡« + msgtype: "news", //消æ¯ç±»åž‹ï¼Œå¿…å¡« news: { - link: `http://qywx2.100smartdata.com/register`, //H5消æ¯é¡µé¢url å¿…å¡« + link: "http://qywx2.100smartdata.com/register", //H5消æ¯é¡µé¢url å¿…å¡« title: "会员拉新", //H5æ¶ˆæ¯æ ‡é¢˜ - desc: '注册æˆä¸ºæ¬§äºšä¼šå‘˜', //H5æ¶ˆæ¯æ‘˜è¦ + desc: "注册æˆä¸ºæ¬§äºšä¼šå‘˜", //H5æ¶ˆæ¯æ‘˜è¦ imgUrl: "" //H5消æ¯å°é¢å›¾ç‰‡URL } + /* news: + { + link: url, //H5消æ¯é¡µé¢url å¿…å¡« + title: "", //H5æ¶ˆæ¯æ ‡é¢˜ + desc: "", //H5æ¶ˆæ¯æ‘˜è¦ + imgUrl: "", //H5消æ¯å°é¢å›¾ç‰‡URL + } */ }, function(res) { + alert('sendChatMessage') if (res.err_msg == "sendChatMessage:ok") { + alert('å‘逿ˆåŠŸ') // alert("--->register.vue: zpick: h5 分享æˆåŠŸï¼"); } else if (res.err_msg != "sendChatMessage:ok") { + alert('å‘é€å¤±è´¥') // alert(`--->register.vue: zpick: h5 分享失败.`); } } -- 2.18.1