@uxda/appkit 4.2.60 → 4.2.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -125,9 +125,10 @@ function requestWxH5Pay(options) {
125
125
  timeStamp: options.timeStamp
126
126
  },
127
127
  function(res) {
128
- console.log(res, "res");
129
128
  if (res.err_msg == "get_brand_wcpay_request:ok") {
130
- resolve(res);
129
+ resolve(true);
130
+ } else {
131
+ resolve(false);
131
132
  }
132
133
  }
133
134
  );
@@ -1714,6 +1715,11 @@ const services$1 = [
1714
1715
  invokeRecharge$1
1715
1716
  ];
1716
1717
 
1718
+ function isWechat() {
1719
+ let ua = window.navigator.userAgent.toLowerCase();
1720
+ return ua.includes("micromessenger");
1721
+ }
1722
+
1717
1723
  const _hoisted_1$y = { class: "view recharge-view" };
1718
1724
  const _hoisted_2$o = { class: "flex-grow" };
1719
1725
  const _hoisted_3$i = { class: "amount-footer" };
@@ -1763,6 +1769,14 @@ var script$B = /* @__PURE__ */ defineComponent({
1763
1769
  }
1764
1770
  state.buttonLoading = true;
1765
1771
  if (Taro.getEnv() === "WEB") {
1772
+ if (!isWechat()) {
1773
+ showToast({
1774
+ title: "\u8BF7\u4F7F\u7528\u5FAE\u4FE1\u6D4F\u89C8\u5668\u6253\u5F00",
1775
+ icon: "none"
1776
+ });
1777
+ state.buttonLoading = false;
1778
+ return false;
1779
+ }
1766
1780
  requestBrandWCPay({
1767
1781
  amount: amounts.value[state.selected].amount,
1768
1782
  app: "loankitMp",
@@ -1771,8 +1785,11 @@ var script$B = /* @__PURE__ */ defineComponent({
1771
1785
  channelCode: "centergzh",
1772
1786
  payFinishJumpUrl: props.payFinishJumpUrl
1773
1787
  }).then((result) => {
1774
- console.log(result);
1775
- window.location.href = props.payFinishJumpUrl;
1788
+ console.log(result, "------requestBrandWCPay");
1789
+ state.buttonLoading = false;
1790
+ if (result) {
1791
+ window.location.href = props.payFinishJumpUrl;
1792
+ }
1776
1793
  });
1777
1794
  } else {
1778
1795
  wx.login({
@@ -2130,6 +2147,14 @@ var script$x = /* @__PURE__ */ defineComponent({
2130
2147
  }
2131
2148
  state.buttonLoading = true;
2132
2149
  if (Taro.getEnv() === "WEB") {
2150
+ if (!isWechat()) {
2151
+ showToast({
2152
+ title: "\u8BF7\u4F7F\u7528\u5FAE\u4FE1\u6D4F\u89C8\u5668\u6253\u5F00",
2153
+ icon: "none"
2154
+ });
2155
+ state.buttonLoading = false;
2156
+ return false;
2157
+ }
2133
2158
  requestBrandWCPayByBean({
2134
2159
  caseConfigId: amounts.value[state.selected].id,
2135
2160
  amount: amounts.value[state.selected].paymentAmount,
@@ -2139,8 +2164,11 @@ var script$x = /* @__PURE__ */ defineComponent({
2139
2164
  channelCode: "centergzh",
2140
2165
  payFinishJumpUrl: props.payFinishJumpUrl
2141
2166
  }).then((result) => {
2142
- console.log(result);
2143
- window.location.href = props.payFinishJumpUrl;
2167
+ console.log(result, "------requestBrandWCPay");
2168
+ state.buttonLoading = false;
2169
+ if (result) {
2170
+ window.location.href = props.payFinishJumpUrl;
2171
+ }
2144
2172
  });
2145
2173
  } else {
2146
2174
  wx.login({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "4.2.60",
3
+ "version": "4.2.62",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -20,6 +20,7 @@ import AmountPicker from './AmountPicker.vue'
20
20
  import { useHttp, endpoints } from '../api'
21
21
  import { requestBrandWCPay, requestPayment } from '../services'
22
22
  import Taro, { showToast } from '@tarojs/taro'
23
+ import { isWechat } from '../../shared/composables/useDeviceEnv'
23
24
 
24
25
  // 充值用户界面
25
26
  // 配置了必须的属性后
@@ -93,6 +94,14 @@ const onPayClick = () => {
93
94
  state.buttonLoading = true
94
95
 
95
96
  if (Taro.getEnv() === 'WEB') {
97
+ if (!isWechat()) {
98
+ showToast({
99
+ title: '请使用微信浏览器打开',
100
+ icon: 'none',
101
+ })
102
+ state.buttonLoading = false
103
+ return false
104
+ }
96
105
  requestBrandWCPay({
97
106
  amount: amounts.value[state.selected].amount,
98
107
  app: 'loankitMp',
@@ -101,8 +110,11 @@ const onPayClick = () => {
101
110
  channelCode: 'centergzh',
102
111
  payFinishJumpUrl: props.payFinishJumpUrl
103
112
  }).then(result => {
104
- console.log(result), 'result'
105
- window.location.href = props.payFinishJumpUrl as string
113
+ console.log(result, '------requestBrandWCPay')
114
+ state.buttonLoading = false
115
+ if (result) {
116
+ window.location.href = props.payFinishJumpUrl as string
117
+ }
106
118
  })
107
119
  } else {
108
120
  wx.login({
@@ -53,6 +53,7 @@ import { endpoints, useHttp } from '../api'
53
53
  import { requestBrandWCPayByBean, requestPaymentByBean } from '../services'
54
54
  import Taro, { showToast } from '@tarojs/taro'
55
55
  import { useAmount } from '../../shared/composables/useAmount'
56
+ import { isWechat } from '../../shared/composables/useDeviceEnv'
56
57
 
57
58
  // 充值用户界面
58
59
  // 配置了必须的属性后
@@ -163,6 +164,14 @@ const onPayClick = () => {
163
164
  state.buttonLoading = true
164
165
 
165
166
  if (Taro.getEnv() === 'WEB') {
167
+ if (!isWechat()) {
168
+ showToast({
169
+ title: '请使用微信浏览器打开',
170
+ icon: 'none',
171
+ })
172
+ state.buttonLoading = false
173
+ return false
174
+ }
166
175
  requestBrandWCPayByBean({
167
176
  caseConfigId: amounts.value[state.selected].id,
168
177
  amount: amounts.value[state.selected].paymentAmount,
@@ -172,8 +181,11 @@ const onPayClick = () => {
172
181
  channelCode: 'centergzh',
173
182
  payFinishJumpUrl: props.payFinishJumpUrl
174
183
  }).then(result => {
175
- console.log(result), 'result'
176
- window.location.href = props.payFinishJumpUrl as string
184
+ console.log(result, '------requestBrandWCPay')
185
+ state.buttonLoading = false
186
+ if (result) {
187
+ window.location.href = props.payFinishJumpUrl as string
188
+ }
177
189
  })
178
190
  } else {
179
191
  wx.login({
@@ -0,0 +1,11 @@
1
+ // 是否微信环境
2
+ export function isWechat() {
3
+ let ua = window.navigator.userAgent.toLowerCase()
4
+ return ua.includes('micromessenger')
5
+ }
6
+
7
+ // 是否支付宝环境
8
+ export function isAlipay() {
9
+ let ua = window.navigator.userAgent.toLowerCase()
10
+ return ua.includes('alipayclient')
11
+ }
@@ -56,10 +56,11 @@ function requestWxH5Pay(options: PrePayOptions) {
56
56
  timeStamp: options.timeStamp,
57
57
  },
58
58
  function (res) {
59
- console.log(res, 'res')
60
59
  if (res.err_msg == 'get_brand_wcpay_request:ok') {
61
- resolve(res)
62
60
  //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠,商户需进一步调用后端查单确认支付结果。
61
+ resolve(true)
62
+ } else {
63
+ resolve(false)
63
64
  }
64
65
  }
65
66
  )