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