Browse Source

添加调试日志

harryYao 2 years ago
parent
commit
ff2a70f175
2 changed files with 13 additions and 3 deletions
  1. 1 1
      public/index.html
  2. 12 2
      src/App.vue

+ 1 - 1
public/index.html

@@ -5,7 +5,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
-    <title><%= htmlWebpackPlugin.options.title %></title>
+    <title>AI降临派</title>
     <script src="http://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
   </head>
   <body>

+ 12 - 2
src/App.vue

@@ -10,6 +10,8 @@
         </div> -->
       </div>
 			<div>{{chatToken}}</div>
+			<div>{{step}}</div>
+			<div>{{error}}</div>
 			<div class="vip-info vip-rights">
 				<div class="title-view">
 					<div class="tabitem" :class="{active: ctype == 1}" @click="ctype = 1">
@@ -85,6 +87,8 @@ export default {
 				],
 				orderList: [],
 				page: 1,
+				step: 1,
+				error: ''
     }
   },
   created() {
@@ -129,11 +133,13 @@ export default {
 					data: {
 						type: type
 					}
-			})
+			}) 
+			this.step = 2
 			if (res.code === 0) {
 				// eslint-disable-next-line
 				this.payObj = res.data
 				if (typeof WeixinJSBridge == "undefined") {
+					this.error = 'WeixinJSBridge is undefined'
 					if (document.addEventListener) {
 						document.addEventListener(
 							"WeixinJSBridgeReady",
@@ -152,6 +158,8 @@ export default {
     },
 
 		onBridgeReady() {
+			
+			this.step = 3
 			const that = this
 			// eslint-disable-next-line
       WeixinJSBridge.invoke(
@@ -165,13 +173,15 @@ export default {
           paySign: this.payObj.paySign, //微信签名
         },
         function (res) {
+					that.error = JSON.stringify(res)
+					that.step = 4
 					console.log('支付结果:', res)
           if (res.err_msg == "get_brand_wcpay_request:ok") {
             // 使用以上方式判断前端返回,微信团队郑重提示:
             //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
             alert("支付成功");
           }
-          that.closePage();
+          // that.closePage();
         }
       );
     },