|
@@ -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>
|