@uxda/appkit 1.0.28 → 1.0.32

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/appkit.css CHANGED
@@ -77,7 +77,7 @@
77
77
  background-position: center center;
78
78
  }
79
79
  .page-header.color-mode-dark {
80
- color: var(--text-color-dark-mode, "#fff");
80
+ color: var(--text-color-dark-mode, #fff);
81
81
  }
82
82
  .page-header.color-mode-dark .back-button {
83
83
  background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDIiIGhlaWdodD0iNDIiIHZpZXdCb3g9IjAgMCA0MiA0MiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggb3BhY2l0eT0iMC4wMSIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0wLjk5OTg0NyA0MUw0MC45OTk4IDQxTDQwLjk5OTggMUwwLjk5OTg0NyAxTDAuOTk5ODQ3IDQxWiIgZmlsbD0iI0Q4RDhEOCIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLW9wYWNpdHk9IjAuMDEiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMi45OTM0IDE4Ljk0NzVDMTEuODYzNCAyMC4wMTQzIDExLjgxMjEgMjEuNzk1MiAxMi44Nzg5IDIyLjkyNTJMMjcuOTEwNiAzNy4xMzQzQzI4LjY5MjcgMzcuODczMSAyOS45MjU2IDM3LjgzODIgMzAuNjY0NSAzNy4wNTYyQzMxLjM2ODIgMzYuMzExNCAzMS4zNyAzNS4xNTc2IDMwLjY5MyAzNC40MTExTDE2LjUwMTMgMjAuOTkzNkwzMC41ODU4IDcuNjk3NjFDMzEuMzMwOSA2Ljk5NDI0IDMxLjI5ODMgNS43Mjc3MSAzMC42NjUxIDQuOTQzNzdDMjkuOTYxNyA0LjE5ODcxIDI4LjgwOTkgNC4xMzEwNCAyOC4wMjYgNC43NjQyN0wxMi45OTM0IDE4Ljk0NzVaIiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLW9wYWNpdHk9IjAuMDEiLz4KPC9zdmc+Cg==");
@@ -161,6 +161,13 @@
161
161
  .recharge-result .back-button {
162
162
  margin-top: 3em;
163
163
  }
164
+ page {
165
+ --text-color: #333;
166
+ --text-color-dark-mode: #eee;
167
+ }
168
+ .number {
169
+ font-family: 'DIN alternate';
170
+ }
164
171
  .account-card .card {
165
172
  background: #2F2F2F;
166
173
  border-radius: 10px;
@@ -673,7 +680,6 @@
673
680
  font-size: 12px;
674
681
  line-height: 28px;
675
682
  }
676
-
677
683
  .consumption-rules-popup {
678
684
  border-radius: 16px;
679
685
  width: 70%;
@@ -687,11 +693,13 @@
687
693
  .balance-reminder {
688
694
  --primary-button-background: linear-gradient(135deg, #098C9D 0%, #66BF97 100%);
689
695
  }
696
+
690
697
  .balance-reminder h2 {
691
698
  font-size: 16px;
692
699
  font-weight: bold;
693
700
  margin-bottom: 14px;
694
701
  }
702
+
695
703
  .balance-reminder .body {
696
704
  height: 120px;
697
705
  box-sizing: border-box;
@@ -704,6 +712,7 @@
704
712
  text-align: center;
705
713
  color: #666;
706
714
  }
715
+
707
716
  .balance-reminder .footer {
708
717
  display: flex;
709
718
  flex-direction: row;
@@ -711,10 +720,12 @@
711
720
  align-items: center;
712
721
  padding: 10px 20px 20px 20px;
713
722
  }
723
+
714
724
  .balance-reminder .footer .col {
715
725
  flex-grow: 1;
716
726
  padding: 6px;
717
727
  }
728
+
718
729
  .balance-reminder .footer .recharge-button {
719
730
  color: #fff;
720
731
  background: var(--primary-button-background);
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
- import { defineComponent, reactive, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString, createStaticVNode, createCommentVNode, renderSlot, createVNode, ref, onMounted, createTextVNode, unref, computed, withDirectives, vShow } from 'vue';
2
- import Taro, { usePageScroll } from '@tarojs/taro';
1
+ import { defineComponent, reactive, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString, createTextVNode, createStaticVNode, createCommentVNode, renderSlot, createVNode, ref, onMounted, unref, computed, withDirectives, vShow } from 'vue';
2
+ import Taro, { useDidShow, usePageScroll } from '@tarojs/taro';
3
3
  import { Grid, GridItem, Button, Checkbox, Popup, OverLay, Icon, DatePicker, Picker } from '@nutui/nutui-taro';
4
4
 
5
- const _hoisted_1$b = { class: "token-line" };
5
+ const _hoisted_1$b = { class: "token-line number" };
6
+ const _hoisted_2$9 = { class: "number" };
6
7
  var script$b = /* @__PURE__ */ defineComponent({
7
8
  __name: "AmountPicker",
8
9
  props: {
@@ -51,13 +52,16 @@ var script$b = /* @__PURE__ */ defineComponent({
51
52
  1
52
53
  /* TEXT */
53
54
  ),
54
- createElementVNode(
55
- "h5",
56
- null,
57
- "\xA5" + toDisplayString(amount.amount),
58
- 1
59
- /* TEXT */
60
- )
55
+ createElementVNode("h5", null, [
56
+ createTextVNode("\xA5"),
57
+ createElementVNode(
58
+ "span",
59
+ _hoisted_2$9,
60
+ toDisplayString(amount.amount),
61
+ 1
62
+ /* TEXT */
63
+ )
64
+ ])
61
65
  ]),
62
66
  _: 2
63
67
  /* DYNAMIC */
@@ -92,10 +96,11 @@ script$a.__file = "src/payment/components/UserAgreement.vue";
92
96
 
93
97
  function requestPayment$2(json) {
94
98
  return new Promise((resolve, reject) => {
95
- const success = (message) => {
99
+ const success = (res) => {
96
100
  resolve(true);
97
101
  };
98
- const fail = (message) => {
102
+ const fail = (res) => {
103
+ console.log("wx.requestPayment FAIL:", res);
99
104
  resolve(false);
100
105
  };
101
106
  wx.requestPayment({
@@ -210,12 +215,20 @@ const defaultClientConfig = {
210
215
  getCode: (data) => data.code,
211
216
  getMessage: (data) => data.msg,
212
217
  getData: (data) => data.result
218
+ },
219
+ interceptors: {
220
+ auth: (data) => data.code == "401",
221
+ server: (data) => false
213
222
  }
214
223
  };
215
224
  let clientConfig = {
216
225
  ...defaultClientConfig
217
226
  };
218
227
  const request = (config) => {
228
+ clientConfig = {
229
+ ...clientConfig,
230
+ ...config
231
+ };
219
232
  return new Promise((resolve, reject) => {
220
233
  const data = config.data && clientConfig.translates && clientConfig.translates[config.url] ? clientConfig.translates[config.url](config.data) : config.data;
221
234
  console.log(`[][][][][][][][][][][][] HTTP.${config.method}, ${clientConfig.baseUrl}${config.url}`, data);
@@ -232,7 +245,7 @@ const request = (config) => {
232
245
  const { data: raw } = res;
233
246
  if (clientConfig.interceptors?.auth(raw)) {
234
247
  clientConfig.onAuthError?.();
235
- reject("auth failed");
248
+ reject("--- 401 ---");
236
249
  }
237
250
  if (clientConfig.interceptors?.server(raw)) {
238
251
  clientConfig.onServerError?.();
@@ -276,11 +289,8 @@ function useHttp(config) {
276
289
  post
277
290
  };
278
291
  }
279
- const successResonseCodes = [
280
- "200"
281
- ];
282
292
  function isSuccess(res) {
283
- return /^2/.test(res.statusCode.toString()) && successResonseCodes.includes(`${clientConfig.response?.getCode(res.data)}`);
293
+ return /^2/.test(res.statusCode.toString());
284
294
  }
285
295
 
286
296
  const endpointsList$1 = {
@@ -353,7 +363,9 @@ const globalData = {};
353
363
 
354
364
  const appKitOptions = {
355
365
  token: () => "",
356
- baseUrl: () => ""
366
+ baseUrl: () => "",
367
+ 401() {
368
+ }
357
369
  };
358
370
  const useAppKitOptions = () => {
359
371
  if (!globalData.$appKitOptions) {
@@ -370,6 +382,9 @@ const makeHttp$1 = () => {
370
382
  const $http = useHttp({
371
383
  baseUrl: appkitOptions.baseUrl(),
372
384
  header,
385
+ onAuthError: () => {
386
+ appkitOptions["401"]();
387
+ },
373
388
  translates: translates$1,
374
389
  transforms: transforms$1
375
390
  });
@@ -476,7 +491,6 @@ var script$7 = /* @__PURE__ */ defineComponent({
476
491
  return false;
477
492
  }
478
493
  state.buttonLoading = true;
479
- console.log("state.selected", state.selected);
480
494
  wx.login({
481
495
  success({ code }) {
482
496
  requestPayment({
@@ -717,6 +731,9 @@ const makeHttp = () => {
717
731
  const $http = useHttp({
718
732
  baseUrl: appkitOptions.baseUrl(),
719
733
  header,
734
+ onAuthError() {
735
+ appkitOptions[401]();
736
+ },
720
737
  translates,
721
738
  transforms
722
739
  });
@@ -742,7 +759,7 @@ const _hoisted_5$4 = /* @__PURE__ */ createElementVNode(
742
759
  -1
743
760
  /* HOISTED */
744
761
  );
745
- const _hoisted_6$3 = { class: "bean-nums" };
762
+ const _hoisted_6$3 = { class: "bean-nums number" };
746
763
  const _hoisted_7$3 = /* @__PURE__ */ createElementVNode(
747
764
  "div",
748
765
  { class: "account-info-name" },
@@ -831,7 +848,7 @@ var script$5 = /* @__PURE__ */ defineComponent({
831
848
  function gotoDetail() {
832
849
  emit("drill");
833
850
  }
834
- onMounted(() => {
851
+ useDidShow(() => {
835
852
  loadBalance();
836
853
  });
837
854
  return (_ctx, _cache) => {
@@ -1214,7 +1231,7 @@ const _hoisted_6 = /* @__PURE__ */ createElementVNode(
1214
1231
  /* HOISTED */
1215
1232
  );
1216
1233
  const _hoisted_7 = { class: "bean-counts spa-between" };
1217
- const _hoisted_8 = { class: "counts" };
1234
+ const _hoisted_8 = { class: "counts number" };
1218
1235
  const _hoisted_9 = /* @__PURE__ */ createElementVNode(
1219
1236
  "div",
1220
1237
  { class: "line" },
@@ -1238,7 +1255,7 @@ const _hoisted_11 = /* @__PURE__ */ createElementVNode(
1238
1255
  /* HOISTED */
1239
1256
  );
1240
1257
  const _hoisted_12 = { class: "bean-list" };
1241
- const _hoisted_13 = { class: "counts" };
1258
+ const _hoisted_13 = { class: "counts number" };
1242
1259
  const _hoisted_14 = { class: "title" };
1243
1260
  const _hoisted_15 = { class: "operation-title spa-between" };
1244
1261
  const _hoisted_16 = { class: "search-time" };
@@ -1292,7 +1309,7 @@ const _hoisted_27 = { class: "item-detail" };
1292
1309
  const _hoisted_28 = { class: "item-info spa-between" };
1293
1310
  const _hoisted_29 = { class: "item-info-type" };
1294
1311
  const _hoisted_30 = { class: "item-info-title" };
1295
- const _hoisted_31 = { class: "item-info-amount" };
1312
+ const _hoisted_31 = { class: "item-info-amount number" };
1296
1313
  const _hoisted_32 = { class: "item-detail-remark" };
1297
1314
  const _hoisted_33 = /* @__PURE__ */ createElementVNode(
1298
1315
  "div",
@@ -1358,7 +1375,7 @@ var script$1 = /* @__PURE__ */ defineComponent({
1358
1375
  total: 0,
1359
1376
  privileges: []
1360
1377
  });
1361
- onMounted(() => {
1378
+ useDidShow(() => {
1362
1379
  Taro.setNavigationBarTitle({
1363
1380
  title: "\u6211\u7684\u8D26\u6237"
1364
1381
  });
@@ -1653,7 +1670,7 @@ const _hoisted_2 = /* @__PURE__ */ createElementVNode(
1653
1670
  { class: "body" },
1654
1671
  [
1655
1672
  /* @__PURE__ */ createElementVNode("h2", null, "\u64CD\u4F5C\u5931\u8D25"),
1656
- /* @__PURE__ */ createElementVNode("p", null, "\u60A8\u7684\u8D26\u6237\u4F59\u989D\u53EF\u80FD\u4E0D\u8DB3\uFF0C\u8BF7\u5145\u503C\u540E\u518D\u8FDB\u884C\u67E5\u8BE2")
1673
+ /* @__PURE__ */ createElementVNode("p", null, "\u60A8\u7684\u8D26\u6237\u53EF\u7528\u4F59\u989D\u4E0D\u8DB3\uFF0C\u8BF7\u5145\u503C\u540E\u518D\u8FDB\u884C\u67E5\u8BE2")
1657
1674
  ],
1658
1675
  -1
1659
1676
  /* HOISTED */
@@ -1759,6 +1776,7 @@ const AppKit = {
1759
1776
  const appKitOptions = useAppKitOptions();
1760
1777
  appKitOptions.token = options.token;
1761
1778
  appKitOptions.baseUrl = options.baseUrl;
1779
+ appKitOptions[401] = options[401];
1762
1780
  nutComponents.forEach((component) => {
1763
1781
  app.use(component);
1764
1782
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "1.0.28",
3
+ "version": "1.0.32",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -58,6 +58,7 @@
58
58
  "eslint-config-taro": "^3.5.6",
59
59
  "eslint-plugin-vue": "^8.0.0",
60
60
  "postcss": "^8.4.32",
61
+ "postcss-import": "^15.1.0",
61
62
  "rollup": "^4.6.1",
62
63
  "rollup-plugin-css-only": "^4.5.2",
63
64
  "rollup-plugin-dts": "^6.1.0",
package/rollup.config.mjs CHANGED
@@ -2,7 +2,7 @@ import vue from 'rollup-plugin-vue'
2
2
  import css from 'rollup-plugin-css-only'
3
3
  import esbuild from 'rollup-plugin-esbuild'
4
4
  import postcss from 'rollup-plugin-postcss'
5
- import { resolve } from 'path'
5
+ import atImport from 'postcss-import'
6
6
 
7
7
  export default [
8
8
  {
@@ -29,23 +29,26 @@ export default [
29
29
  }),
30
30
  postcss({
31
31
  include: /\.scss/,
32
- extract: 'appkit.css'
32
+ extract: 'appkit.css',
33
+ plugins: [
34
+ atImport()
35
+ ]
33
36
  }),
34
37
  esbuild({
35
38
  })
36
39
  ],
37
40
  external: ['vue', '@nutui/nutui-taro']
38
41
  },
39
- {
40
- input: './src/main.scss',
41
- output: {
42
- file: 'dist/main.css',
43
- },
44
- plugins: [
45
- postcss({
46
- use: ['sass'],
47
- extract: resolve('./dist/styles.css'),
48
- })
49
- ]
50
- },
42
+ // {
43
+ // input: './src/main.scss',
44
+ // output: {
45
+ // file: 'dist/main.css',
46
+ // },
47
+ // plugins: [
48
+ // postcss({
49
+ // use: ['sass'],
50
+ // extract: resolve('./dist/styles.css'),
51
+ // })
52
+ // ]
53
+ // },
51
54
  ]
package/src/Appkit.ts CHANGED
@@ -14,6 +14,7 @@ export type AppKitOptions = {
14
14
  * 调用 API 时使用的 base url
15
15
  */
16
16
  baseUrl (): string,
17
+ 401 (): void
17
18
  }
18
19
 
19
20
  export type DollarApp = {
@@ -27,7 +28,8 @@ export type DollarApp = {
27
28
  */
28
29
  const appKitOptions: AppKitOptions = {
29
30
  token: () => '',
30
- baseUrl: () => ''
31
+ baseUrl: () => '',
32
+ 401 () {}
31
33
  }
32
34
 
33
35
  const useAppKitOptions = () => {
@@ -12,6 +12,9 @@ const makeHttp = () => {
12
12
  const $http = useHttp({
13
13
  baseUrl: appkitOptions.baseUrl(),
14
14
  header,
15
+ onAuthError () {
16
+ appkitOptions[401]()
17
+ },
15
18
  translates,
16
19
  transforms,
17
20
  })
@@ -13,7 +13,7 @@
13
13
  <div class="rule" @click="rulesPopupOpen = true">规则说明</div>
14
14
  </div>
15
15
  <div class="bean-counts spa-between">
16
- <div class="counts">{{ balance.total || 0 }}</div>
16
+ <div class="counts number">{{ balance.total || 0 }}</div>
17
17
  <div class="pay" @click="gotoRecharge">云豆充值</div>
18
18
  </div>
19
19
  </div>
@@ -29,7 +29,7 @@
29
29
  <div class="bean-list">
30
30
  <template v-for="item in balance.privileges" :key="item">
31
31
  <div class="bean-list-item">
32
- <div class="counts">
32
+ <div class="counts number">
33
33
  {{ item.amount }}
34
34
  </div>
35
35
  <div class="title">
@@ -77,7 +77,7 @@
77
77
  </div>
78
78
  <div class="item-info-title">{{ it.title }}</div>
79
79
  </div>
80
- <div class="item-info-amount">
80
+ <div class="item-info-amount number">
81
81
  {{ it.direction == '支出' ? '-' : '+' }}{{ it.amount }}
82
82
  </div>
83
83
  </div>
@@ -128,8 +128,8 @@
128
128
  </template>
129
129
 
130
130
  <script lang="ts" setup>
131
- import Taro, { usePageScroll } from '@tarojs/taro'
132
- import { computed, onMounted, reactive, ref } from 'vue'
131
+ import Taro, { useDidShow, usePageScroll } from '@tarojs/taro'
132
+ import { computed, reactive, ref } from 'vue'
133
133
  import { endpoints, makeHttp } from '../api'
134
134
  import { ConsumptionFiltering, ConsumptionGroups, Balance } from '../types'
135
135
  import ConsumptionFilter from './ConsumptionFilter.vue'
@@ -175,7 +175,7 @@ const balance = ref<Balance>({
175
175
  privileges: []
176
176
  })
177
177
 
178
- onMounted(() => {
178
+ useDidShow(() => {
179
179
  Taro.setNavigationBarTitle({
180
180
  title: '我的账户',
181
181
  })
@@ -9,7 +9,7 @@
9
9
  </div>
10
10
  <span class="baan-name">云豆</span>
11
11
  </div>
12
- <div class="bean-nums">{{ balance.total }}</div>
12
+ <div class="bean-nums number">{{ balance.total }}</div>
13
13
  </div>
14
14
  <div class="card-row-right">
15
15
  <div class="account-info-entry" @click="gotoDetail">
@@ -35,9 +35,10 @@
35
35
  </template>
36
36
 
37
37
  <script setup lang="ts">
38
- import { onMounted, ref } from 'vue'
38
+ import { ref } from 'vue'
39
39
  import { endpoints, makeHttp } from '../api'
40
40
  import { Balance } from '../types'
41
+ import { useDidShow } from '@tarojs/taro'
41
42
 
42
43
  const balance = ref<Balance>({
43
44
  total: 0,
@@ -71,7 +72,7 @@ function gotoDetail () {
71
72
  emit('drill')
72
73
  }
73
74
 
74
- onMounted(() => {
75
+ useDidShow(() => {
75
76
  loadBalance()
76
77
  })
77
78
 
@@ -8,7 +8,7 @@
8
8
  <div class="balance-reminder">
9
9
  <div class="body">
10
10
  <h2>操作失败</h2>
11
- <p>您的账户余额可能不足,请充值后再进行查询</p>
11
+ <p>您的账户可用余额不足,请充值后再进行查询</p>
12
12
  </div>
13
13
  <div class="footer">
14
14
  <div class="col">
package/src/index.ts CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  } from '@nutui/nutui-taro'
15
15
  import { type AppKitOptions, useAppKitOptions, DollarApp } from './Appkit'
16
16
  import { PaymentParams, RechargeParams } from './payment/types'
17
+ import './main.scss'
17
18
 
18
19
  const nutComponents = [
19
20
  Grid,
@@ -57,6 +58,7 @@ const AppKit = {
57
58
  const appKitOptions = useAppKitOptions()
58
59
  appKitOptions.token = options.token
59
60
  appKitOptions.baseUrl = options.baseUrl
61
+ appKitOptions[401] = options[401]
60
62
  nutComponents.forEach(component => {
61
63
  app.use(component)
62
64
  })
package/src/main.scss CHANGED
@@ -1 +1,2 @@
1
- @import url(./styles/vars.scss);
1
+ @import url(./styles/vars.scss);
2
+ @import url(./styles/fonts.scss);
@@ -12,6 +12,9 @@ const makeHttp = () => {
12
12
  const $http = useHttp({
13
13
  baseUrl: appkitOptions.baseUrl(),
14
14
  header,
15
+ onAuthError: () => {
16
+ appkitOptions['401']()
17
+ },
15
18
  translates,
16
19
  transforms,
17
20
  })
@@ -10,8 +10,8 @@
10
10
  :class="{selected: state.selected === index}"
11
11
  @click="() => onGridItemClick(index)"
12
12
  :key="index">
13
- <h4 class="token-line">{{ amount.token }}</h4>
14
- <h5{{ amount.amount }}</h5>
13
+ <h4 class="token-line number">{{ amount.token }}</h4>
14
+ <h5>¥<span class="number">{{ amount.amount }}</span></h5>
15
15
  </nut-grid-item>
16
16
  </nut-grid>
17
17
  </template>
@@ -100,7 +100,6 @@ const onPayClick = () => {
100
100
  return false
101
101
  }
102
102
  state.buttonLoading = true
103
- console.log('state.selected', state.selected)
104
103
  wx.login({
105
104
  success ({code}: {code: string}) {
106
105
  requestPayment({
@@ -63,7 +63,7 @@ const onBackButtonClick = () => {
63
63
  background-position: center center;
64
64
  }
65
65
  &.color-mode-dark {
66
- color: var(--text-color-dark-mode, '#fff');
66
+ color: var(--text-color-dark-mode, #fff);
67
67
  .back-button {
68
68
  background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDIiIGhlaWdodD0iNDIiIHZpZXdCb3g9IjAgMCA0MiA0MiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggb3BhY2l0eT0iMC4wMSIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0wLjk5OTg0NyA0MUw0MC45OTk4IDQxTDQwLjk5OTggMUwwLjk5OTg0NyAxTDAuOTk5ODQ3IDQxWiIgZmlsbD0iI0Q4RDhEOCIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLW9wYWNpdHk9IjAuMDEiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMi45OTM0IDE4Ljk0NzVDMTEuODYzNCAyMC4wMTQzIDExLjgxMjEgMjEuNzk1MiAxMi44Nzg5IDIyLjkyNTJMMjcuOTEwNiAzNy4xMzQzQzI4LjY5MjcgMzcuODczMSAyOS45MjU2IDM3LjgzODIgMzAuNjY0NSAzNy4wNTYyQzMxLjM2ODIgMzYuMzExNCAzMS4zNyAzNS4xNTc2IDMwLjY5MyAzNC40MTExTDE2LjUwMTMgMjAuOTkzNkwzMC41ODU4IDcuNjk3NjFDMzEuMzMwOSA2Ljk5NDI0IDMxLjI5ODMgNS43Mjc3MSAzMC42NjUxIDQuOTQzNzdDMjkuOTYxNyA0LjE5ODcxIDI4LjgwOTkgNC4xMzEwNCAyOC4wMjYgNC43NjQyN0wxMi45OTM0IDE4Ljk0NzVaIiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLW9wYWNpdHk9IjAuMDEiLz4KPC9zdmc+Cg==");
69
69
  }
@@ -24,6 +24,10 @@ const defaultClientConfig: HttpClientConfig = {
24
24
  getCode: (data: ResponseRaw) => data.code,
25
25
  getMessage: (data: ResponseRaw) => data.msg,
26
26
  getData: (data: ResponseRaw) => data.result
27
+ },
28
+ interceptors: {
29
+ auth: (data) => data.code == '401',
30
+ server: (data) => false,
27
31
  }
28
32
  }
29
33
 
@@ -37,6 +41,10 @@ let clientConfig = {
37
41
  * @returns
38
42
  */
39
43
  const request: Http['request'] = <T>(config: HttpRequestConfig) => {
44
+ clientConfig = {
45
+ ...clientConfig,
46
+ ...config,
47
+ }
40
48
  return new Promise<T>((resolve, reject) => {
41
49
  const data = config.data
42
50
  && clientConfig.translates
@@ -57,7 +65,7 @@ const request: Http['request'] = <T>(config: HttpRequestConfig) => {
57
65
  const { data: raw } = res
58
66
  if (clientConfig.interceptors?.auth(raw)) {
59
67
  clientConfig.onAuthError?.()
60
- reject('auth failed')
68
+ reject('--- 401 ---')
61
69
  }
62
70
  if (clientConfig.interceptors?.server(raw)) {
63
71
  clientConfig.onServerError?.()
@@ -118,11 +126,8 @@ export function useHttp (config: HttpClientConfig): Http {
118
126
  }
119
127
  }
120
128
 
121
- const successResonseCodes = [
122
- '200'
123
- ]
129
+
124
130
 
125
131
  function isSuccess (res: Taro.request.SuccessCallbackResult<ResponseRaw>) {
126
132
  return /^2/.test(res.statusCode.toString())
127
- && successResonseCodes.includes(`${clientConfig.response?.getCode(res.data)}`)
128
133
  }
@@ -22,10 +22,11 @@ export function requestPayment(json: any): Promise<boolean> {
22
22
  // /**接口调用结束的回调函数(调用成功、失败都会执行)*/
23
23
  // complete = () => {}
24
24
  return new Promise<boolean>((resolve, reject) => {
25
- const success = (message: string) => {
25
+ const success = (res) => {
26
26
  resolve(true)
27
27
  }
28
- const fail = (message: string) => {
28
+ const fail = (res) => {
29
+ console.log('wx.requestPayment FAIL:', res)
29
30
  resolve(false)
30
31
  }
31
32
  wx.requestPayment({
@@ -0,0 +1,3 @@
1
+ .number {
2
+ font-family: 'DIN alternate';
3
+ }
package/dist/main.css DELETED
@@ -1,3 +0,0 @@
1
- var undefined$1 = undefined;
2
-
3
- export { undefined$1 as default };
package/dist/styles.css DELETED
@@ -1 +0,0 @@
1
- @import url(./styles/vars.scss);