فهرست منبع

支付功能开发5

JXDS18FUJT 1 سال پیش
والد
کامیت
cb55340e01
3فایلهای تغییر یافته به همراه15 افزوده شده و 9 حذف شده
  1. 0 0
      src/views/examRoad/index.less
  2. 0 0
      src/views/examRoad/index.tsx
  3. 15 9
      src/views/home/index.tsx

+ 0 - 0
src/views/examRoad/index.less


+ 0 - 0
src/views/examRoad/index.tsx


+ 15 - 9
src/views/home/index.tsx

@@ -32,14 +32,20 @@ export const Home: React.FC = (props: any) => {
       "goodsId": 5,
       "goodsType": 1,
       "phoneType": 2
-    }).then(res=>{
-      WeixinJSBridge.invoke("getBrandWCPayRequest", res.data.data, async function (res: any) {
-        if (res.err_msg == "get_brand_wcpay_request:ok") {
-          // 使用以上方式判断前端返回,微信团队郑重提示:
-          //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
-         console.log('支付成功')
-        }
-      });
+    }).then(res => {
+      if (WeixinJSBridge) { 
+        WeixinJSBridge.invoke("getBrandWCPayRequest", res.data.data, async function (res: any) {
+          if (res.err_msg == "get_brand_wcpay_request:ok") {
+            // 使用以上方式判断前端返回,微信团队郑重提示:
+            //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
+            console.log('支付成功')
+          }
+        });
+      }
+      else {
+        alert('请用微信浏览器打开网页')
+      }
+
       //  WX.chooseWXPay({...res.data.data})
     })
     // wx.chooseWXPay()
@@ -114,7 +120,7 @@ export const Home: React.FC = (props: any) => {
               <div>熟记考场</div>
               <div>考试不用慌</div>
             </span>
-            <div onClick={wxPay} className='look'>去看考场</div>
+            <div  className='look'>去看考场</div>
           </div>
         </div>
       </div>