@uxda/appkit 4.3.14 → 4.3.16

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
@@ -3483,6 +3483,26 @@ const isIOS = () => {
3483
3483
  }
3484
3484
  return false;
3485
3485
  };
3486
+ const isAndroid = () => {
3487
+ if (typeof window !== "undefined") {
3488
+ return /Android/i.test(window.navigator.userAgent);
3489
+ }
3490
+ return false;
3491
+ };
3492
+ function getBrowser() {
3493
+ if (typeof window === "undefined") return "other";
3494
+ const ua = window.navigator.userAgent.toLowerCase();
3495
+ if (/edg\/|edge\//.test(ua) || /opr\/|opera/.test(ua)) return "other";
3496
+ if (/chrome\/|crios\//.test(ua)) return "chrome";
3497
+ if (/safari\//.test(ua) && !/chrome|crios/.test(ua)) return "safari";
3498
+ return "other";
3499
+ }
3500
+ function isSafari() {
3501
+ return getBrowser() === "safari";
3502
+ }
3503
+ function isChrome() {
3504
+ return getBrowser() === "chrome";
3505
+ }
3486
3506
 
3487
3507
  const _hoisted_1$B = { class: "view recharge-view" };
3488
3508
  const _hoisted_2$r = { class: "flex-grow" };
@@ -3578,7 +3598,7 @@ var script$E = /* @__PURE__ */ defineComponent({
3578
3598
  function getChannelCode() {
3579
3599
  if (isWechat()) {
3580
3600
  return "centergzh";
3581
- } else if (isAlipay()) {
3601
+ } else if (isAlipay() || isAndroid() || isIOS() && !isChrome() && !isSafari()) {
3582
3602
  return "YundouZfb";
3583
3603
  } else {
3584
3604
  return "distributor";
@@ -4015,7 +4035,6 @@ var script$A = /* @__PURE__ */ defineComponent({
4015
4035
  fromMini: !!params.from,
4016
4036
  useCloudBean: isCombinedPayment.value
4017
4037
  }).then((result) => {
4018
- console.log(result, "------requestBrandWCPayByBean");
4019
4038
  state.buttonLoading = false;
4020
4039
  if (typeof result === "boolean" && result) {
4021
4040
  window.location.href = props.payFinishJumpUrl;
@@ -4076,7 +4095,7 @@ var script$A = /* @__PURE__ */ defineComponent({
4076
4095
  function getChannelCode() {
4077
4096
  if (isWechat()) {
4078
4097
  return "centergzh";
4079
- } else if (isAlipay()) {
4098
+ } else if (isAlipay() || isAndroid() || isIOS() && !isChrome() && !isSafari()) {
4080
4099
  return "YundouZfb";
4081
4100
  } else {
4082
4101
  return "distributor";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "4.3.14",
3
+ "version": "4.3.16",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -22,7 +22,7 @@ import AmountPicker from './AmountPicker.vue'
22
22
  import { useHttp, endpoints } from '../api'
23
23
  import { requestBrandWCPay, requestPayment } from '../services'
24
24
  import Taro, { showToast, useRouter } from '@tarojs/taro'
25
- import { isAlipay, isWechat } from '../../shared/composables/useDeviceEnv'
25
+ import { isAlipay, isAndroid, isChrome, isIOS, isSafari, isWechat } from '../../shared/composables/useDeviceEnv'
26
26
 
27
27
  // 充值用户界面
28
28
  // 配置了必须的属性后
@@ -152,7 +152,7 @@ const onPayClick = () => {
152
152
  function getChannelCode() {
153
153
  if (isWechat()) {
154
154
  return 'centergzh';
155
- } else if (isAlipay()) {
155
+ } else if (isAlipay() || isAndroid() || (isIOS() && !isChrome() && !isSafari())) {
156
156
  return 'YundouZfb';
157
157
  } else {
158
158
  return 'distributor';
@@ -102,13 +102,13 @@
102
102
 
103
103
  <script lang="ts" setup>
104
104
  import { computed, onMounted, reactive, ref } from "vue";
105
- import RightsPicker, { Amount } from "./RightsPicker.vue";
106
- import { endpoints, useHttp } from "../api";
105
+ import RightsPicker, { Amount } from './RightsPicker.vue'
106
+ import { endpoints, useHttp } from '../api'
107
107
  import { endpoints as balanceEndpoints } from "../../balance/api";
108
- import { requestBrandWCPayByBean, requestPaymentByBean } from "../services";
109
- import Taro, { showToast, useRouter, showModal } from "@tarojs/taro";
110
- import { useAmount } from "../../shared/composables/useAmount";
111
- import { isAlipay, isWechat } from "../../shared/composables/useDeviceEnv";
108
+ import { requestBrandWCPayByBean, requestPaymentByBean } from '../services'
109
+ import Taro, { showToast, useRouter, showModal } from '@tarojs/taro'
110
+ import { useAmount } from '../../shared/composables/useAmount'
111
+ import { isAlipay,isAndroid,isChrome,isIOS,isSafari,isWechat } from '../../shared/composables/useDeviceEnv'
112
112
 
113
113
  // 充值用户界面
114
114
  // 配置了必须的属性后
@@ -157,7 +157,7 @@ const state = reactive({
157
157
  // agreementOpen: false,
158
158
  buttonLoading: false,
159
159
  thirdPayId: '',
160
- });
160
+ })
161
161
 
162
162
  const balance = ref<number>(0);
163
163
  const amounts = ref<Amount[]>([]);
@@ -215,19 +215,16 @@ const isCombinedPayment = computed(() => {
215
215
  });
216
216
 
217
217
  onMounted(() => {
218
- const $http = useHttp({ Appcode: props.headerApp, Tenant: props.tenant });
219
- $http
220
- .get<any[]>(endpoints.获取增值权益类目, {
221
- rightCode:
222
- props.app === "corporateStar" ? "riskQueryCompany" : "riskQueryMulti",
223
- scene: isWechat() ? '' : 'APP'
224
- })
225
- .then((res: any) => {
226
- balance.value = res.balance;
227
- amounts.value = res.paymentCaseConfigVOS;
228
- emit("loaded");
229
- });
230
- });
218
+ const $http = useHttp({ Appcode: props.headerApp, Tenant: props.tenant })
219
+ $http.get<any[]>(endpoints.获取增值权益类目, {
220
+ rightCode: props.app === 'corporateStar' ? 'riskQueryCompany' : 'riskQueryMulti',
221
+ scene: isWechat() ? '' : 'APP'
222
+ }).then((res: any) => {
223
+ balance.value = res.balance
224
+ amounts.value = res.paymentCaseConfigVOS
225
+ emit('loaded')
226
+ })
227
+ })
231
228
 
232
229
  // 云豆支付对话框
233
230
  const showDialog = ref<boolean>(false);
@@ -290,7 +287,6 @@ function proceedWechatPayment() {
290
287
  useCloudBean: isCombinedPayment.value
291
288
  })
292
289
  .then((result: any) => {
293
- console.log(result, '------requestBrandWCPayByBean')
294
290
  state.buttonLoading = false;
295
291
  if (typeof result === "boolean" && result) {
296
292
  window.location.href = props.payFinishJumpUrl as string;
@@ -356,7 +352,7 @@ function proceedWechatPayment() {
356
352
  function getChannelCode() {
357
353
  if (isWechat()) {
358
354
  return 'centergzh';
359
- } else if (isAlipay()) {
355
+ } else if (isAlipay() || isAndroid() || (isIOS() && !isChrome() && !isSafari())) {
360
356
  return 'YundouZfb';
361
357
  } else {
362
358
  return 'distributor';
@@ -24,4 +24,38 @@ export const isAndroid = () => {
24
24
  return /Android/i.test(window.navigator.userAgent)
25
25
  }
26
26
  return false
27
- }
27
+ }
28
+
29
+ /** 浏览器类型 */
30
+ export type BrowserType = 'safari' | 'chrome' | 'other'
31
+
32
+ /**
33
+ * 获取当前浏览器类型
34
+ * @returns 'safari' | 'chrome' | 'other'
35
+ */
36
+ export function getBrowser(): BrowserType {
37
+ if (typeof window === 'undefined') return 'other'
38
+ const ua = window.navigator.userAgent.toLowerCase()
39
+ // Edge、Opera 等基于 Chromium 的浏览器归为 other,优先判断
40
+ if (/edg\/|edge\//.test(ua) || /opr\/|opera/.test(ua)) return 'other'
41
+ // Chrome(含 iOS 端 CriOS)
42
+ if (/chrome\/|crios\//.test(ua)) return 'chrome'
43
+ // Safari:含 safari 且不含 chrome(Chrome 的 UA 同时包含两者)
44
+ if (/safari\//.test(ua) && !/chrome|crios/.test(ua)) return 'safari'
45
+ return 'other'
46
+ }
47
+
48
+ /** 是否 Safari 浏览器 */
49
+ export function isSafari(): boolean {
50
+ return getBrowser() === 'safari'
51
+ }
52
+
53
+ /** 是否 Chrome 浏览器(含 iOS 端) */
54
+ export function isChrome(): boolean {
55
+ return getBrowser() === 'chrome'
56
+ }
57
+
58
+ /** 是否其他浏览器(非 Safari、非 Chrome) */
59
+ export function isOtherBrowser(): boolean {
60
+ return getBrowser() === 'other'
61
+ }