@uxda/appkit 4.2.67 → 4.2.69

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
@@ -4,7 +4,7 @@ import '@nutui/nutui-taro/dist/packages/checkbox/style/css';
4
4
  import { defineComponent, reactive, createBlock, openBlock, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString, createTextVNode, ref, computed, onUnmounted, createCommentVNode, renderSlot, createVNode, normalizeStyle, unref, isRef, onMounted, createStaticVNode, watch, withDirectives, vShow, useModel, mergeModels, resolveComponent, vModelText, watchPostEffect, withModifiers } from 'vue';
5
5
  import '@nutui/nutui-taro/dist/packages/grid/style/css';
6
6
  import '@nutui/nutui-taro/dist/packages/griditem/style/css';
7
- import Taro, { getSystemInfoSync, getMenuButtonBoundingClientRect, uploadFile, request as request$1, showToast, chooseMedia, chooseMessageFile, showLoading, hideLoading, useDidShow, showModal, getStorageSync, useRouter } from '@tarojs/taro';
7
+ import Taro, { showModal, getSystemInfoSync, getMenuButtonBoundingClientRect, uploadFile, request as request$1, showToast, chooseMedia, chooseMessageFile, showLoading, hideLoading, useRouter, useDidShow, getStorageSync } from '@tarojs/taro';
8
8
  import '@nutui/nutui-taro/dist/packages/popup/style/css';
9
9
  import isMobilePhone from 'validator/es/lib/isMobilePhone';
10
10
  import isIdentityCard from 'validator/es/lib/isIdentityCard';
@@ -114,6 +114,16 @@ const getSdkConfig = (appCode, url) => {
114
114
  function requestWxH5Pay(options) {
115
115
  return new Promise((resolve, reject) => {
116
116
  function onBridgeReady() {
117
+ if (typeof WeixinJSBridge === "undefined") {
118
+ showModal({
119
+ title: "\u63D0\u793A",
120
+ content: "\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u5FAE\u4FE1\u652F\u4ED8\uFF0C\u8BF7\u5728\u5FAE\u4FE1\u5185\u7F6E\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00",
121
+ confirmText: "\u786E\u5B9A",
122
+ success: () => {
123
+ }
124
+ });
125
+ return;
126
+ }
117
127
  WeixinJSBridge.invoke(
118
128
  "getBrandWCPayRequest",
119
129
  {
@@ -1676,6 +1686,8 @@ const requestBrandWCPay = (params, Appcode = "") => {
1676
1686
  icon: "none"
1677
1687
  });
1678
1688
  resolve(false);
1689
+ } else if (params.fromMini) {
1690
+ resolve(response.json);
1679
1691
  } else {
1680
1692
  requestWxH5Pay(response.json).then((result) => {
1681
1693
  if (result) {
@@ -1703,6 +1715,8 @@ const requestBrandWCPayByBean = (params, Appcode = "") => {
1703
1715
  icon: "none"
1704
1716
  });
1705
1717
  resolve(false);
1718
+ } else if (params.fromMini) {
1719
+ resolve(response.json);
1706
1720
  } else {
1707
1721
  requestWxH5Pay(response.json).then((result) => {
1708
1722
  if (result) {
@@ -1745,6 +1759,7 @@ var script$B = /* @__PURE__ */ defineComponent({
1745
1759
  emits: ["complete", "agree"],
1746
1760
  setup(__props, { emit: __emit }) {
1747
1761
  const props = __props;
1762
+ const { params } = useRouter();
1748
1763
  const emit = __emit;
1749
1764
  const state = reactive({
1750
1765
  agreed: false,
@@ -1794,12 +1809,15 @@ var script$B = /* @__PURE__ */ defineComponent({
1794
1809
  tenant: props.tenant,
1795
1810
  accountAuthFlag: false,
1796
1811
  channelCode: "centergzh",
1797
- payFinishJumpUrl: props.payFinishJumpUrl
1812
+ payFinishJumpUrl: props.payFinishJumpUrl,
1813
+ fromMini: !!params.from
1798
1814
  }).then((result) => {
1799
1815
  console.log(result, "------requestBrandWCPay");
1800
1816
  state.buttonLoading = false;
1801
- if (result) {
1817
+ if (typeof result === "boolean") {
1802
1818
  window.location.href = props.payFinishJumpUrl;
1819
+ } else {
1820
+ emit("complete", result);
1803
1821
  }
1804
1822
  });
1805
1823
  } else {
@@ -2098,6 +2116,7 @@ var script$x = /* @__PURE__ */ defineComponent({
2098
2116
  setup(__props, { emit: __emit }) {
2099
2117
  const props = __props;
2100
2118
  const { formatAmount } = useAmount();
2119
+ const { params } = useRouter();
2101
2120
  const emit = __emit;
2102
2121
  const state = reactive({
2103
2122
  agreed: false,
@@ -2173,12 +2192,15 @@ var script$x = /* @__PURE__ */ defineComponent({
2173
2192
  tenant: props.tenant,
2174
2193
  accountAuthFlag: false,
2175
2194
  channelCode: "centergzh",
2176
- payFinishJumpUrl: props.payFinishJumpUrl
2195
+ payFinishJumpUrl: props.payFinishJumpUrl,
2196
+ fromMini: !!params.from
2177
2197
  }).then((result) => {
2178
2198
  console.log(result, "------requestBrandWCPay");
2179
2199
  state.buttonLoading = false;
2180
- if (result) {
2200
+ if (typeof result === "boolean") {
2181
2201
  window.location.href = props.payFinishJumpUrl;
2202
+ } else {
2203
+ emit("complete", { result, type: "wePay" });
2182
2204
  }
2183
2205
  });
2184
2206
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "4.2.67",
3
+ "version": "4.2.69",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -19,7 +19,7 @@ import { onMounted, reactive, ref } from 'vue'
19
19
  import AmountPicker from './AmountPicker.vue'
20
20
  import { useHttp, endpoints } from '../api'
21
21
  import { requestBrandWCPay, requestPayment } from '../services'
22
- import Taro, { showToast } from '@tarojs/taro'
22
+ import Taro, { showToast, useRouter } from '@tarojs/taro'
23
23
  import { isWechat } from '../../shared/composables/useDeviceEnv'
24
24
 
25
25
  // 充值用户界面
@@ -46,6 +46,7 @@ export interface RechargeViewProps {
46
46
  }
47
47
 
48
48
  const props = defineProps<RechargeViewProps>()
49
+ const { params } = useRouter()
49
50
 
50
51
  const emit = defineEmits<{
51
52
  (event: 'complete', value: boolean): void,
@@ -108,12 +109,15 @@ const onPayClick = () => {
108
109
  tenant: props.tenant,
109
110
  accountAuthFlag: false,
110
111
  channelCode: 'centergzh',
111
- payFinishJumpUrl: props.payFinishJumpUrl
112
+ payFinishJumpUrl: props.payFinishJumpUrl,
113
+ fromMini: !!params.from
112
114
  }).then(result => {
113
115
  console.log(result, '------requestBrandWCPay')
114
116
  state.buttonLoading = false
115
- if (result) {
117
+ if (typeof result === 'boolean') {
116
118
  window.location.href = props.payFinishJumpUrl as string
119
+ } else {
120
+ emit('complete', result)
117
121
  }
118
122
  })
119
123
  } else {
@@ -51,7 +51,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
51
51
  import RightsPicker, { Amount } from './RightsPicker.vue'
52
52
  import { endpoints, useHttp } from '../api'
53
53
  import { requestBrandWCPayByBean, requestPaymentByBean } from '../services'
54
- import Taro, { showToast } from '@tarojs/taro'
54
+ import Taro, { showToast, useRouter } from '@tarojs/taro'
55
55
  import { useAmount } from '../../shared/composables/useAmount'
56
56
  import { isWechat } from '../../shared/composables/useDeviceEnv'
57
57
 
@@ -84,6 +84,7 @@ export interface RechargeViewProps {
84
84
 
85
85
  const props = defineProps<RechargeViewProps>()
86
86
  const { formatAmount } = useAmount()
87
+ const { params } = useRouter()
87
88
 
88
89
  const emit = defineEmits<{
89
90
  (event: 'complete', value: { result: boolean, type: string }): void,
@@ -179,12 +180,15 @@ const onPayClick = () => {
179
180
  tenant: props.tenant,
180
181
  accountAuthFlag: false,
181
182
  channelCode: 'centergzh',
182
- payFinishJumpUrl: props.payFinishJumpUrl
183
+ payFinishJumpUrl: props.payFinishJumpUrl,
184
+ fromMini: !!params.from
183
185
  }).then(result => {
184
186
  console.log(result, '------requestBrandWCPay')
185
187
  state.buttonLoading = false
186
- if (result) {
188
+ if (typeof result === 'boolean') {
187
189
  window.location.href = props.payFinishJumpUrl as string
190
+ } else {
191
+ emit('complete', { result, type: 'wePay' })
188
192
  }
189
193
  })
190
194
  } else {
@@ -75,6 +75,8 @@ const requestBrandWCPay = (params: PaymentParams, Appcode = '') => {
75
75
  icon: 'none',
76
76
  })
77
77
  resolve(false)
78
+ } else if (params.fromMini) {
79
+ resolve(response.json)
78
80
  } else {
79
81
  requestWxH5Pay(response.json).then((result) => {
80
82
  if (result) {
@@ -105,6 +107,8 @@ const requestBrandWCPayByBean = (params: PaymentParams, Appcode = '') => {
105
107
  icon: 'none',
106
108
  })
107
109
  resolve(false)
110
+ } else if (params.fromMini) {
111
+ resolve(response.json)
108
112
  } else {
109
113
  requestWxH5Pay(response.json).then((result) => {
110
114
  if (result) {
@@ -26,6 +26,7 @@ export type PaymentParams = {
26
26
  accountAuthFlag?: boolean
27
27
  channelCode?: string
28
28
  payFinishJumpUrl?: string
29
+ fromMini?: Boolean
29
30
  }
30
31
 
31
32
  export type RechargeParams = Pick<PaymentParams, 'app' | 'tenant'>
@@ -1,5 +1,6 @@
1
1
  import { DollarApp } from '../../Appkit'
2
2
  import { useHttp } from '../../payment/api'
3
+ import { showModal } from '@tarojs/taro'
3
4
 
4
5
  interface JssdkConfig {
5
6
  appId: string
@@ -44,6 +45,16 @@ const getSdkConfig = (appCode?: string, url?: string): Promise<JssdkConfig> => {
44
45
  function requestWxH5Pay(options: PrePayOptions) {
45
46
  return new Promise<boolean>((resolve, reject) => {
46
47
  function onBridgeReady() {
48
+ // @ts-ignore
49
+ if (typeof WeixinJSBridge === 'undefined') {
50
+ showModal({
51
+ title: '提示',
52
+ content: '当前环境不支持微信支付,请在微信内置浏览器中打开',
53
+ confirmText: '确定',
54
+ success: () => {},
55
+ })
56
+ return
57
+ }
47
58
  // @ts-ignore
48
59
  WeixinJSBridge.invoke(
49
60
  'getBrandWCPayRequest',