@uxda/appkit 1.0.26 → 1.0.30
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 +40 -43
- package/dist/index.js +104 -102
- package/package.json +1 -1
- package/src/Appkit.ts +3 -1
- package/src/balance/api/endpoints.ts +1 -1
- package/src/balance/api/index.ts +3 -0
- package/src/balance/components/BalanceReminder.vue +1 -1
- package/src/index.ts +1 -0
- package/src/payment/api/index.ts +3 -0
- package/src/payment/components/AmountPicker.vue +7 -21
- package/src/payment/components/RechargeResult.vue +5 -1
- package/src/payment/components/RechargeView.vue +5 -14
- package/src/payment/components/index.ts +4 -1
- package/src/shared/components/PageHeader.vue +1 -1
- package/src/shared/http/Http.ts +10 -5
- package/src/shared/weixin/payment.ts +3 -2
package/dist/appkit.css
CHANGED
|
@@ -1,47 +1,38 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
1
|
+
.amount-picker {
|
|
2
|
+
padding: 14px 0 14px 14px;
|
|
3
|
+
}
|
|
4
|
+
.amount-picker .nut-grid-item__content {
|
|
3
5
|
border: 1px solid rgba(204, 204, 204, 0.8);
|
|
4
6
|
background: #F5F5F5;
|
|
7
|
+
border-radius: 8px;
|
|
5
8
|
}
|
|
6
|
-
.
|
|
9
|
+
.amount-picker .tile {
|
|
7
10
|
height: 80px;
|
|
8
11
|
}
|
|
9
|
-
.
|
|
12
|
+
.amount-picker .tile.selected .nut-grid-item__content {
|
|
10
13
|
border-width: 2px;
|
|
11
14
|
border-color: #EFD082;
|
|
12
15
|
background: linear-gradient(180deg, #FFF7E3 0%, #FEFDE6 100%);
|
|
13
16
|
}
|
|
14
|
-
.
|
|
15
|
-
color: #d00;
|
|
16
|
-
font-size: 18px;
|
|
17
|
-
}
|
|
18
|
-
.amounts-picker h5 {
|
|
19
|
-
font-size: 12px;
|
|
20
|
-
}
|
|
21
|
-
.amounts-picker {
|
|
22
|
-
padding-top: 10px;
|
|
23
|
-
}
|
|
24
|
-
.amounts-picker .nut-grid-item__content {
|
|
25
|
-
border-radius: 8px;
|
|
26
|
-
}
|
|
27
|
-
.amounts-picker h4.token-line {
|
|
17
|
+
.amount-picker h4.token-line {
|
|
28
18
|
background-image: url("https://cdn.ddjf.com/static/images/appkit/yundou.png");
|
|
29
19
|
background-size: 20px;
|
|
30
20
|
background-repeat: no-repeat;
|
|
31
21
|
background-position: left center;
|
|
32
22
|
padding-left: 24px;
|
|
33
23
|
color: #FD6701;
|
|
34
|
-
font-size: 18px;
|
|
35
24
|
font-weight: 600;
|
|
36
25
|
line-height: 25px;
|
|
26
|
+
color: #d00;
|
|
27
|
+
font-size: 18px;
|
|
37
28
|
}
|
|
38
|
-
.
|
|
39
|
-
font-size: 14px;
|
|
29
|
+
.amount-picker h5 {
|
|
40
30
|
line-height: 18px;
|
|
41
31
|
color: #353535;
|
|
42
32
|
font-weight: 600;
|
|
43
33
|
opacity: 0.6;
|
|
44
34
|
margin-top: 4px;
|
|
35
|
+
font-size: 12px;
|
|
45
36
|
}
|
|
46
37
|
.agreement-doc {
|
|
47
38
|
padding: 1em;
|
|
@@ -57,27 +48,6 @@
|
|
|
57
48
|
.agreement-doc p {
|
|
58
49
|
margin: 0;
|
|
59
50
|
}
|
|
60
|
-
.recharge-result {
|
|
61
|
-
display: flex;
|
|
62
|
-
width: 100vw;
|
|
63
|
-
height: 100%;
|
|
64
|
-
flex-direction: column;
|
|
65
|
-
justify-content: center;
|
|
66
|
-
align-items: center;
|
|
67
|
-
}
|
|
68
|
-
.recharge-result h2 {
|
|
69
|
-
font-size: 16px;
|
|
70
|
-
font-weight: bold;
|
|
71
|
-
margin: 1em;
|
|
72
|
-
}
|
|
73
|
-
.recharge-result .figure {
|
|
74
|
-
width: 100px;
|
|
75
|
-
height: 100px;
|
|
76
|
-
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmlld0JveD0iMCAwIDEwMCAxMDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIG9wYWNpdHk9IjAuMiIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik01MC41IDEwQzcyLjg2NzUgMTAgOTEgMjcuOTA4NiA5MSA1MEM5MSA3Mi4wOTE0IDcyLjg2NzUgOTAgNTAuNSA5MEMyOC4xMzI1IDkwIDEwIDcyLjA5MTQgMTAgNTBDMTAgMjcuOTA4NiAyOC4xMzI1IDEwIDUwLjUgMTBaIiBmaWxsPSIjOUFFMkNEIi8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNTAuNSAxOEM2OS4wMDE1IDE4IDg0IDMyLjU1MDggODQgNTAuNUM4NCA2OC40NDkyIDY5LjAwMTUgODMgNTAuNSA4M0MzMS45OTg1IDgzIDE3IDY4LjQ0OTIgMTcgNTAuNUMxNyAzMi41NTA4IDMxLjk5ODUgMTggNTAuNSAxOFYxOFoiIGZpbGw9IiNDQUZBRUMiLz4KPHBhdGggZD0iTTM3IDQ5LjVMNDcgNjBMNjcgMzkiIHN0cm9rZT0iIzNEQ0E5RCIgc3Ryb2tlLXdpZHRoPSIxMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xOS4xMjA0IDE2LjI5MTlMNy45OTg4NCAxMi43MzIxTDE1LjkyOTQgNS4wNTg5N0wxOS4xMjA0IDE2LjI5MTlaIiBmaWxsPSIjQ0FGQUVDIi8+CjxwYXRoIGQ9Ik0xMi44MzQgMjMuNDY0Mkw4LjU0NjMxIDI3LjU3NzhMNy4xMjc2NSAyMS44MDc4TDEyLjgzNCAyMy40NjQyWiIgZmlsbD0iI0NBRkFFQyIvPgo8L3N2Zz4K");
|
|
77
|
-
}
|
|
78
|
-
.recharge-result .back-button {
|
|
79
|
-
margin-top: 3em;
|
|
80
|
-
}
|
|
81
51
|
.page-header {
|
|
82
52
|
flex-shrink: 0;
|
|
83
53
|
position: relative;
|
|
@@ -107,7 +77,7 @@
|
|
|
107
77
|
background-position: center center;
|
|
108
78
|
}
|
|
109
79
|
.page-header.color-mode-dark {
|
|
110
|
-
color: var(--text-color-dark-mode,
|
|
80
|
+
color: var(--text-color-dark-mode, #fff);
|
|
111
81
|
}
|
|
112
82
|
.page-header.color-mode-dark .back-button {
|
|
113
83
|
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDIiIGhlaWdodD0iNDIiIHZpZXdCb3g9IjAgMCA0MiA0MiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggb3BhY2l0eT0iMC4wMSIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0wLjk5OTg0NyA0MUw0MC45OTk4IDQxTDQwLjk5OTggMUwwLjk5OTg0NyAxTDAuOTk5ODQ3IDQxWiIgZmlsbD0iI0Q4RDhEOCIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLW9wYWNpdHk9IjAuMDEiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMi45OTM0IDE4Ljk0NzVDMTEuODYzNCAyMC4wMTQzIDExLjgxMjEgMjEuNzk1MiAxMi44Nzg5IDIyLjkyNTJMMjcuOTEwNiAzNy4xMzQzQzI4LjY5MjcgMzcuODczMSAyOS45MjU2IDM3LjgzODIgMzAuNjY0NSAzNy4wNTYyQzMxLjM2ODIgMzYuMzExNCAzMS4zNyAzNS4xNTc2IDMwLjY5MyAzNC40MTExTDE2LjUwMTMgMjAuOTkzNkwzMC41ODU4IDcuNjk3NjFDMzEuMzMwOSA2Ljk5NDI0IDMxLjI5ODMgNS43Mjc3MSAzMC42NjUxIDQuOTQzNzdDMjkuOTYxNyA0LjE5ODcxIDI4LjgwOTkgNC4xMzEwNCAyOC4wMjYgNC43NjQyN0wxMi45OTM0IDE4Ljk0NzVaIiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLW9wYWNpdHk9IjAuMDEiLz4KPC9zdmc+Cg==");
|
|
@@ -138,6 +108,7 @@
|
|
|
138
108
|
}
|
|
139
109
|
.recharge-view .amount-footer {
|
|
140
110
|
padding: 10px;
|
|
111
|
+
padding-bottom: 0;
|
|
141
112
|
}
|
|
142
113
|
.recharge-view .amount-footer .agreement {
|
|
143
114
|
font-size: 12px;
|
|
@@ -151,6 +122,7 @@
|
|
|
151
122
|
color: #353535;
|
|
152
123
|
margin: 12px 0;
|
|
153
124
|
border: 0;
|
|
125
|
+
border-radius: 8px;
|
|
154
126
|
}
|
|
155
127
|
.recharge-view .amount-footer .nut-checkbox {
|
|
156
128
|
line-height: 40px;
|
|
@@ -164,6 +136,31 @@
|
|
|
164
136
|
display: inline;
|
|
165
137
|
color: #FD6701;
|
|
166
138
|
}
|
|
139
|
+
.recharge-result {
|
|
140
|
+
display: flex;
|
|
141
|
+
width: 100vw;
|
|
142
|
+
height: 100vh;
|
|
143
|
+
flex-direction: column;
|
|
144
|
+
justify-content: center;
|
|
145
|
+
align-items: center;
|
|
146
|
+
}
|
|
147
|
+
.recharge-result h2 {
|
|
148
|
+
font-size: 16px;
|
|
149
|
+
font-weight: bold;
|
|
150
|
+
margin: 1em;
|
|
151
|
+
}
|
|
152
|
+
.recharge-result .caption {
|
|
153
|
+
color: #353535;
|
|
154
|
+
opacity: 0.5;
|
|
155
|
+
}
|
|
156
|
+
.recharge-result .figure {
|
|
157
|
+
width: 100px;
|
|
158
|
+
height: 100px;
|
|
159
|
+
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmlld0JveD0iMCAwIDEwMCAxMDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIG9wYWNpdHk9IjAuMiIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik01MC41IDEwQzcyLjg2NzUgMTAgOTEgMjcuOTA4NiA5MSA1MEM5MSA3Mi4wOTE0IDcyLjg2NzUgOTAgNTAuNSA5MEMyOC4xMzI1IDkwIDEwIDcyLjA5MTQgMTAgNTBDMTAgMjcuOTA4NiAyOC4xMzI1IDEwIDUwLjUgMTBaIiBmaWxsPSIjOUFFMkNEIi8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNTAuNSAxOEM2OS4wMDE1IDE4IDg0IDMyLjU1MDggODQgNTAuNUM4NCA2OC40NDkyIDY5LjAwMTUgODMgNTAuNSA4M0MzMS45OTg1IDgzIDE3IDY4LjQ0OTIgMTcgNTAuNUMxNyAzMi41NTA4IDMxLjk5ODUgMTggNTAuNSAxOFYxOFoiIGZpbGw9IiNDQUZBRUMiLz4KPHBhdGggZD0iTTM3IDQ5LjVMNDcgNjBMNjcgMzkiIHN0cm9rZT0iIzNEQ0E5RCIgc3Ryb2tlLXdpZHRoPSIxMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xOS4xMjA0IDE2LjI5MTlMNy45OTg4NCAxMi43MzIxTDE1LjkyOTQgNS4wNTg5N0wxOS4xMjA0IDE2LjI5MTlaIiBmaWxsPSIjQ0FGQUVDIi8+CjxwYXRoIGQ9Ik0xMi44MzQgMjMuNDY0Mkw4LjU0NjMxIDI3LjU3NzhMNy4xMjc2NSAyMS44MDc4TDEyLjgzNCAyMy40NjQyWiIgZmlsbD0iI0NBRkFFQyIvPgo8L3N2Zz4K");
|
|
160
|
+
}
|
|
161
|
+
.recharge-result .back-button {
|
|
162
|
+
margin-top: 3em;
|
|
163
|
+
}
|
|
167
164
|
.account-card .card {
|
|
168
165
|
background: #2F2F2F;
|
|
169
166
|
border-radius: 10px;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, reactive, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString, createStaticVNode,
|
|
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
2
|
import Taro, { usePageScroll } from '@tarojs/taro';
|
|
3
3
|
import { Grid, GridItem, Button, Checkbox, Popup, OverLay, Icon, DatePicker, Picker } from '@nutui/nutui-taro';
|
|
4
4
|
|
|
@@ -28,7 +28,7 @@ var script$b = /* @__PURE__ */ defineComponent({
|
|
|
28
28
|
const _component_nut_grid_item = resolveComponent("nut-grid-item");
|
|
29
29
|
const _component_nut_grid = resolveComponent("nut-grid");
|
|
30
30
|
return openBlock(), createBlock(_component_nut_grid, {
|
|
31
|
-
class: "
|
|
31
|
+
class: "amount-picker",
|
|
32
32
|
"column-num": 3,
|
|
33
33
|
gutter: 10,
|
|
34
34
|
border: false
|
|
@@ -90,66 +90,13 @@ const script$a = {};
|
|
|
90
90
|
script$a.render = render;
|
|
91
91
|
script$a.__file = "src/payment/components/UserAgreement.vue";
|
|
92
92
|
|
|
93
|
-
const _hoisted_1$9 = { class: "recharge-result" };
|
|
94
|
-
const _hoisted_2$7 = /* @__PURE__ */ createElementVNode(
|
|
95
|
-
"div",
|
|
96
|
-
{ class: "figure" },
|
|
97
|
-
null,
|
|
98
|
-
-1
|
|
99
|
-
/* HOISTED */
|
|
100
|
-
);
|
|
101
|
-
const _hoisted_3$7 = /* @__PURE__ */ createElementVNode(
|
|
102
|
-
"h2",
|
|
103
|
-
null,
|
|
104
|
-
"\u5145\u503C\u6210\u529F",
|
|
105
|
-
-1
|
|
106
|
-
/* HOISTED */
|
|
107
|
-
);
|
|
108
|
-
const _hoisted_4$6 = /* @__PURE__ */ createElementVNode(
|
|
109
|
-
"div",
|
|
110
|
-
{ class: "caption" },
|
|
111
|
-
"\u4E91\u8C46\u5C06\u57285\u5206\u949F\u4E4B\u5185\u5230\u8D26",
|
|
112
|
-
-1
|
|
113
|
-
/* HOISTED */
|
|
114
|
-
);
|
|
115
|
-
var script$9 = /* @__PURE__ */ defineComponent({
|
|
116
|
-
__name: "RechargeResult",
|
|
117
|
-
emits: ["dismiss"],
|
|
118
|
-
setup(__props, { emit: __emit }) {
|
|
119
|
-
const emit = __emit;
|
|
120
|
-
function onBackClick() {
|
|
121
|
-
emit("dismiss");
|
|
122
|
-
}
|
|
123
|
-
return (_ctx, _cache) => {
|
|
124
|
-
const _component_nut_button = resolveComponent("nut-button");
|
|
125
|
-
return openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
126
|
-
_hoisted_2$7,
|
|
127
|
-
_hoisted_3$7,
|
|
128
|
-
_hoisted_4$6,
|
|
129
|
-
createVNode(_component_nut_button, {
|
|
130
|
-
class: "back-button",
|
|
131
|
-
type: "default",
|
|
132
|
-
onClick: onBackClick
|
|
133
|
-
}, {
|
|
134
|
-
default: withCtx(() => [
|
|
135
|
-
createTextVNode("\u8FD4\u56DE")
|
|
136
|
-
]),
|
|
137
|
-
_: 1
|
|
138
|
-
/* STABLE */
|
|
139
|
-
})
|
|
140
|
-
]);
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
script$9.__file = "src/payment/components/RechargeResult.vue";
|
|
146
|
-
|
|
147
93
|
function requestPayment$2(json) {
|
|
148
94
|
return new Promise((resolve, reject) => {
|
|
149
|
-
const success = (
|
|
95
|
+
const success = (res) => {
|
|
150
96
|
resolve(true);
|
|
151
97
|
};
|
|
152
|
-
const fail = (
|
|
98
|
+
const fail = (res) => {
|
|
99
|
+
console.log("wx.requestPayment FAIL:", res);
|
|
153
100
|
resolve(false);
|
|
154
101
|
};
|
|
155
102
|
wx.requestPayment({
|
|
@@ -160,11 +107,11 @@ function requestPayment$2(json) {
|
|
|
160
107
|
});
|
|
161
108
|
}
|
|
162
109
|
|
|
163
|
-
const _hoisted_1$
|
|
110
|
+
const _hoisted_1$9 = {
|
|
164
111
|
key: 0,
|
|
165
112
|
class: "page-title"
|
|
166
113
|
};
|
|
167
|
-
var script$
|
|
114
|
+
var script$9 = /* @__PURE__ */ defineComponent({
|
|
168
115
|
__name: "PageHeader",
|
|
169
116
|
props: {
|
|
170
117
|
title: { type: String, required: false, default: "" },
|
|
@@ -188,7 +135,7 @@ var script$8 = /* @__PURE__ */ defineComponent({
|
|
|
188
135
|
[
|
|
189
136
|
_ctx.title ? (openBlock(), createElementBlock(
|
|
190
137
|
"h1",
|
|
191
|
-
_hoisted_1$
|
|
138
|
+
_hoisted_1$9,
|
|
192
139
|
toDisplayString(_ctx.title),
|
|
193
140
|
1
|
|
194
141
|
/* TEXT */
|
|
@@ -206,10 +153,10 @@ var script$8 = /* @__PURE__ */ defineComponent({
|
|
|
206
153
|
}
|
|
207
154
|
});
|
|
208
155
|
|
|
209
|
-
script$
|
|
156
|
+
script$9.__file = "src/shared/components/PageHeader.vue";
|
|
210
157
|
|
|
211
|
-
const _hoisted_1$
|
|
212
|
-
var script$
|
|
158
|
+
const _hoisted_1$8 = { class: "drawer-body" };
|
|
159
|
+
var script$8 = /* @__PURE__ */ defineComponent({
|
|
213
160
|
__name: "AppDrawer",
|
|
214
161
|
props: {
|
|
215
162
|
modelValue: { type: Boolean, required: true },
|
|
@@ -233,11 +180,11 @@ var script$7 = /* @__PURE__ */ defineComponent({
|
|
|
233
180
|
"onUpdate:visible": onVisibleChange
|
|
234
181
|
}, {
|
|
235
182
|
default: withCtx(() => [
|
|
236
|
-
createVNode(script$
|
|
183
|
+
createVNode(script$9, {
|
|
237
184
|
title: _ctx.title,
|
|
238
185
|
onClose: onPageHeaderClose
|
|
239
186
|
}, null, 8, ["title"]),
|
|
240
|
-
createElementVNode("div", _hoisted_1$
|
|
187
|
+
createElementVNode("div", _hoisted_1$8, [
|
|
241
188
|
renderSlot(_ctx.$slots, "default")
|
|
242
189
|
])
|
|
243
190
|
]),
|
|
@@ -248,7 +195,7 @@ var script$7 = /* @__PURE__ */ defineComponent({
|
|
|
248
195
|
}
|
|
249
196
|
});
|
|
250
197
|
|
|
251
|
-
script$
|
|
198
|
+
script$8.__file = "src/shared/components/AppDrawer.vue";
|
|
252
199
|
|
|
253
200
|
var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
|
|
254
201
|
HttpMethod2["get"] = "GET";
|
|
@@ -264,12 +211,20 @@ const defaultClientConfig = {
|
|
|
264
211
|
getCode: (data) => data.code,
|
|
265
212
|
getMessage: (data) => data.msg,
|
|
266
213
|
getData: (data) => data.result
|
|
214
|
+
},
|
|
215
|
+
interceptors: {
|
|
216
|
+
auth: (data) => data.code == "401",
|
|
217
|
+
server: (data) => false
|
|
267
218
|
}
|
|
268
219
|
};
|
|
269
220
|
let clientConfig = {
|
|
270
221
|
...defaultClientConfig
|
|
271
222
|
};
|
|
272
223
|
const request = (config) => {
|
|
224
|
+
clientConfig = {
|
|
225
|
+
...clientConfig,
|
|
226
|
+
...config
|
|
227
|
+
};
|
|
273
228
|
return new Promise((resolve, reject) => {
|
|
274
229
|
const data = config.data && clientConfig.translates && clientConfig.translates[config.url] ? clientConfig.translates[config.url](config.data) : config.data;
|
|
275
230
|
console.log(`[][][][][][][][][][][][] HTTP.${config.method}, ${clientConfig.baseUrl}${config.url}`, data);
|
|
@@ -286,7 +241,7 @@ const request = (config) => {
|
|
|
286
241
|
const { data: raw } = res;
|
|
287
242
|
if (clientConfig.interceptors?.auth(raw)) {
|
|
288
243
|
clientConfig.onAuthError?.();
|
|
289
|
-
reject("
|
|
244
|
+
reject("--- 401 ---");
|
|
290
245
|
}
|
|
291
246
|
if (clientConfig.interceptors?.server(raw)) {
|
|
292
247
|
clientConfig.onServerError?.();
|
|
@@ -330,11 +285,8 @@ function useHttp(config) {
|
|
|
330
285
|
post
|
|
331
286
|
};
|
|
332
287
|
}
|
|
333
|
-
const successResonseCodes = [
|
|
334
|
-
"200"
|
|
335
|
-
];
|
|
336
288
|
function isSuccess(res) {
|
|
337
|
-
return /^2/.test(res.statusCode.toString())
|
|
289
|
+
return /^2/.test(res.statusCode.toString());
|
|
338
290
|
}
|
|
339
291
|
|
|
340
292
|
const endpointsList$1 = {
|
|
@@ -407,7 +359,9 @@ const globalData = {};
|
|
|
407
359
|
|
|
408
360
|
const appKitOptions = {
|
|
409
361
|
token: () => "",
|
|
410
|
-
baseUrl: () => ""
|
|
362
|
+
baseUrl: () => "",
|
|
363
|
+
401() {
|
|
364
|
+
}
|
|
411
365
|
};
|
|
412
366
|
const useAppKitOptions = () => {
|
|
413
367
|
if (!globalData.$appKitOptions) {
|
|
@@ -424,6 +378,9 @@ const makeHttp$1 = () => {
|
|
|
424
378
|
const $http = useHttp({
|
|
425
379
|
baseUrl: appkitOptions.baseUrl(),
|
|
426
380
|
header,
|
|
381
|
+
onAuthError: () => {
|
|
382
|
+
appkitOptions["401"]();
|
|
383
|
+
},
|
|
427
384
|
translates: translates$1,
|
|
428
385
|
transforms: transforms$1
|
|
429
386
|
});
|
|
@@ -479,11 +436,11 @@ const services$1 = [
|
|
|
479
436
|
invokeRecharge$1
|
|
480
437
|
];
|
|
481
438
|
|
|
482
|
-
const _hoisted_1$
|
|
483
|
-
const _hoisted_2$
|
|
484
|
-
const _hoisted_3$
|
|
485
|
-
const _hoisted_4$
|
|
486
|
-
var script$
|
|
439
|
+
const _hoisted_1$7 = { class: "view recharge-view" };
|
|
440
|
+
const _hoisted_2$7 = { class: "flex-grow" };
|
|
441
|
+
const _hoisted_3$7 = { class: "amount-footer" };
|
|
442
|
+
const _hoisted_4$6 = { class: "agreement" };
|
|
443
|
+
var script$7 = /* @__PURE__ */ defineComponent({
|
|
487
444
|
__name: "RechargeView",
|
|
488
445
|
props: {
|
|
489
446
|
app: { type: String, required: true },
|
|
@@ -497,7 +454,6 @@ var script$6 = /* @__PURE__ */ defineComponent({
|
|
|
497
454
|
agreed: false,
|
|
498
455
|
selected: 0,
|
|
499
456
|
agreementOpen: false,
|
|
500
|
-
resultOpen: false,
|
|
501
457
|
buttonLoading: false
|
|
502
458
|
});
|
|
503
459
|
const amounts = ref([
|
|
@@ -531,7 +487,6 @@ var script$6 = /* @__PURE__ */ defineComponent({
|
|
|
531
487
|
return false;
|
|
532
488
|
}
|
|
533
489
|
state.buttonLoading = true;
|
|
534
|
-
console.log("state.selected", state.selected);
|
|
535
490
|
wx.login({
|
|
536
491
|
success({ code }) {
|
|
537
492
|
requestPayment({
|
|
@@ -543,27 +498,26 @@ var script$6 = /* @__PURE__ */ defineComponent({
|
|
|
543
498
|
user: code
|
|
544
499
|
}).then((result) => {
|
|
545
500
|
state.buttonLoading = false;
|
|
546
|
-
|
|
501
|
+
if (result) {
|
|
502
|
+
emit("complete", true);
|
|
503
|
+
}
|
|
547
504
|
});
|
|
548
505
|
}
|
|
549
506
|
});
|
|
550
507
|
};
|
|
551
|
-
const onResultDismiss = () => {
|
|
552
|
-
emit("complete", true);
|
|
553
|
-
};
|
|
554
508
|
return (_ctx, _cache) => {
|
|
555
509
|
const _component_nut_checkbox = resolveComponent("nut-checkbox");
|
|
556
510
|
const _component_nut_button = resolveComponent("nut-button");
|
|
557
|
-
return openBlock(), createElementBlock("view", _hoisted_1$
|
|
558
|
-
createElementVNode("view", _hoisted_2$
|
|
511
|
+
return openBlock(), createElementBlock("view", _hoisted_1$7, [
|
|
512
|
+
createElementVNode("view", _hoisted_2$7, [
|
|
559
513
|
createVNode(script$b, {
|
|
560
514
|
items: amounts.value,
|
|
561
515
|
selected: state.selected,
|
|
562
516
|
onChange: onAmountSelect
|
|
563
517
|
}, null, 8, ["items", "selected"])
|
|
564
518
|
]),
|
|
565
|
-
createElementVNode("view", _hoisted_3$
|
|
566
|
-
createElementVNode("view", _hoisted_4$
|
|
519
|
+
createElementVNode("view", _hoisted_3$7, [
|
|
520
|
+
createElementVNode("view", _hoisted_4$6, [
|
|
567
521
|
createVNode(_component_nut_checkbox, {
|
|
568
522
|
modelValue: state.agreed,
|
|
569
523
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => state.agreed = $event)
|
|
@@ -593,7 +547,7 @@ var script$6 = /* @__PURE__ */ defineComponent({
|
|
|
593
547
|
/* STABLE */
|
|
594
548
|
}, 8, ["loading"])
|
|
595
549
|
]),
|
|
596
|
-
createVNode(unref(script$
|
|
550
|
+
createVNode(unref(script$8), {
|
|
597
551
|
modelValue: state.agreementOpen,
|
|
598
552
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => state.agreementOpen = $event),
|
|
599
553
|
title: "\u5145\u503C\u534F\u8BAE"
|
|
@@ -603,29 +557,73 @@ var script$6 = /* @__PURE__ */ defineComponent({
|
|
|
603
557
|
]),
|
|
604
558
|
_: 1
|
|
605
559
|
/* STABLE */
|
|
606
|
-
}, 8, ["modelValue"])
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
560
|
+
}, 8, ["modelValue"])
|
|
561
|
+
]);
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
script$7.__file = "src/payment/components/RechargeView.vue";
|
|
567
|
+
|
|
568
|
+
const _hoisted_1$6 = { class: "recharge-result" };
|
|
569
|
+
const _hoisted_2$6 = /* @__PURE__ */ createElementVNode(
|
|
570
|
+
"div",
|
|
571
|
+
{ class: "figure" },
|
|
572
|
+
null,
|
|
573
|
+
-1
|
|
574
|
+
/* HOISTED */
|
|
575
|
+
);
|
|
576
|
+
const _hoisted_3$6 = /* @__PURE__ */ createElementVNode(
|
|
577
|
+
"h2",
|
|
578
|
+
null,
|
|
579
|
+
"\u5145\u503C\u6210\u529F",
|
|
580
|
+
-1
|
|
581
|
+
/* HOISTED */
|
|
582
|
+
);
|
|
583
|
+
const _hoisted_4$5 = /* @__PURE__ */ createElementVNode(
|
|
584
|
+
"div",
|
|
585
|
+
{ class: "caption" },
|
|
586
|
+
"\u4E91\u8C46\u5C06\u57285\u5206\u949F\u4E4B\u5185\u5230\u8D26",
|
|
587
|
+
-1
|
|
588
|
+
/* HOISTED */
|
|
589
|
+
);
|
|
590
|
+
var script$6 = /* @__PURE__ */ defineComponent({
|
|
591
|
+
__name: "RechargeResult",
|
|
592
|
+
emits: ["dismiss"],
|
|
593
|
+
setup(__props, { emit: __emit }) {
|
|
594
|
+
const emit = __emit;
|
|
595
|
+
function onBackClick() {
|
|
596
|
+
emit("dismiss");
|
|
597
|
+
}
|
|
598
|
+
return (_ctx, _cache) => {
|
|
599
|
+
const _component_nut_button = resolveComponent("nut-button");
|
|
600
|
+
return openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
601
|
+
_hoisted_2$6,
|
|
602
|
+
_hoisted_3$6,
|
|
603
|
+
_hoisted_4$5,
|
|
604
|
+
createVNode(_component_nut_button, {
|
|
605
|
+
class: "back-button",
|
|
606
|
+
type: "default",
|
|
607
|
+
onClick: onBackClick
|
|
611
608
|
}, {
|
|
612
609
|
default: withCtx(() => [
|
|
613
|
-
|
|
610
|
+
createTextVNode("\u8FD4\u56DE")
|
|
614
611
|
]),
|
|
615
612
|
_: 1
|
|
616
613
|
/* STABLE */
|
|
617
|
-
}
|
|
614
|
+
})
|
|
618
615
|
]);
|
|
619
616
|
};
|
|
620
617
|
}
|
|
621
618
|
});
|
|
622
619
|
|
|
623
|
-
script$6.__file = "src/payment/components/
|
|
620
|
+
script$6.__file = "src/payment/components/RechargeResult.vue";
|
|
624
621
|
|
|
625
622
|
const components = {
|
|
626
623
|
AmountPicker: script$b,
|
|
627
|
-
RechargeView: script$
|
|
628
|
-
UserAgreement: script$a
|
|
624
|
+
RechargeView: script$7,
|
|
625
|
+
UserAgreement: script$a,
|
|
626
|
+
RechargeResult: script$6
|
|
629
627
|
};
|
|
630
628
|
|
|
631
629
|
const typeMappings = {
|
|
@@ -698,7 +696,7 @@ const endpointsList = {
|
|
|
698
696
|
list: result.accountRecordDetailDailyList.map((r) => ({
|
|
699
697
|
date: r.operateTime,
|
|
700
698
|
consumptions: r.accountRecordDetailList.map((d) => ({
|
|
701
|
-
position: positionMappings[d.
|
|
699
|
+
position: positionMappings[d.accountType],
|
|
702
700
|
type: typeMappings[d.changeType],
|
|
703
701
|
direction: directionMappings[d.inOrOut],
|
|
704
702
|
amount: d.changeValue,
|
|
@@ -729,6 +727,9 @@ const makeHttp = () => {
|
|
|
729
727
|
const $http = useHttp({
|
|
730
728
|
baseUrl: appkitOptions.baseUrl(),
|
|
731
729
|
header,
|
|
730
|
+
onAuthError() {
|
|
731
|
+
appkitOptions[401]();
|
|
732
|
+
},
|
|
732
733
|
translates,
|
|
733
734
|
transforms
|
|
734
735
|
});
|
|
@@ -1665,7 +1666,7 @@ const _hoisted_2 = /* @__PURE__ */ createElementVNode(
|
|
|
1665
1666
|
{ class: "body" },
|
|
1666
1667
|
[
|
|
1667
1668
|
/* @__PURE__ */ createElementVNode("h2", null, "\u64CD\u4F5C\u5931\u8D25"),
|
|
1668
|
-
/* @__PURE__ */ createElementVNode("p", null, "\u60A8\u7684\u8D26\u6237\u4F59\u989D\
|
|
1669
|
+
/* @__PURE__ */ createElementVNode("p", null, "\u60A8\u7684\u8D26\u6237\u53EF\u7528\u4F59\u989D\u4E0D\u8DB3\uFF0C\u8BF7\u5145\u503C\u540E\u518D\u8FDB\u884C\u67E5\u8BE2")
|
|
1669
1670
|
],
|
|
1670
1671
|
-1
|
|
1671
1672
|
/* HOISTED */
|
|
@@ -1771,6 +1772,7 @@ const AppKit = {
|
|
|
1771
1772
|
const appKitOptions = useAppKitOptions();
|
|
1772
1773
|
appKitOptions.token = options.token;
|
|
1773
1774
|
appKitOptions.baseUrl = options.baseUrl;
|
|
1775
|
+
appKitOptions[401] = options[401];
|
|
1774
1776
|
nutComponents.forEach((component) => {
|
|
1775
1777
|
app.use(component);
|
|
1776
1778
|
});
|
|
@@ -1780,4 +1782,4 @@ const AppKit = {
|
|
|
1780
1782
|
}
|
|
1781
1783
|
};
|
|
1782
1784
|
|
|
1783
|
-
export { script$1 as AccountView, script$b as AmountPicker, script$
|
|
1785
|
+
export { script$1 as AccountView, script$b as AmountPicker, script$8 as AppDrawer, script$5 as BalanceCard, script as BalanceReminder, script$9 as PageHeader, script$6 as RechargeResult, script$7 as RechargeView, script$a as UserAgreement, components, AppKit as default, requestPayment$2 as requestPayment, services$1 as services, useAppKit, useHttp };
|
package/package.json
CHANGED
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 = () => {
|
|
@@ -75,7 +75,7 @@ const endpointsList: HttpEndpoints = {
|
|
|
75
75
|
list: result.accountRecordDetailDailyList.map((r: any) => ({
|
|
76
76
|
date: r.operateTime,
|
|
77
77
|
consumptions: r.accountRecordDetailList.map((d: any) => ({
|
|
78
|
-
position: positionMappings[d.
|
|
78
|
+
position: positionMappings[d.accountType],
|
|
79
79
|
type: typeMappings[d.changeType],
|
|
80
80
|
direction: directionMappings[d.inOrOut],
|
|
81
81
|
amount: d.changeValue,
|
package/src/balance/api/index.ts
CHANGED
package/src/index.ts
CHANGED
package/src/payment/api/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<nut-grid
|
|
3
|
-
class="
|
|
3
|
+
class="amount-picker"
|
|
4
4
|
:column-num="3"
|
|
5
5
|
:gutter="10"
|
|
6
6
|
:border="false">
|
|
@@ -59,11 +59,12 @@ const onGridItemClick = (index: number) => {
|
|
|
59
59
|
</script>
|
|
60
60
|
|
|
61
61
|
<style lang="scss">
|
|
62
|
-
.
|
|
62
|
+
.amount-picker {
|
|
63
|
+
padding: 14px 0 14px 14px;
|
|
63
64
|
.nut-grid-item__content {
|
|
64
|
-
border-radius: 10px;
|
|
65
65
|
border: 1px solid rgba(204, 204, 204, 0.80);
|
|
66
66
|
background: #F5F5F5;
|
|
67
|
+
border-radius: 8px;
|
|
67
68
|
}
|
|
68
69
|
.tile {
|
|
69
70
|
height: 80px;
|
|
@@ -75,22 +76,6 @@ const onGridItemClick = (index: number) => {
|
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
|
-
h4 {
|
|
79
|
-
color: #d00;
|
|
80
|
-
font-size: 18px;
|
|
81
|
-
}
|
|
82
|
-
h5 {
|
|
83
|
-
font-size: 12px;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
</style>
|
|
87
|
-
|
|
88
|
-
<style lang="scss">
|
|
89
|
-
.amounts-picker {
|
|
90
|
-
padding-top: 10px;
|
|
91
|
-
.nut-grid-item__content {
|
|
92
|
-
border-radius: 8px;
|
|
93
|
-
}
|
|
94
79
|
h4.token-line {
|
|
95
80
|
background-image: url("https://cdn.ddjf.com/static/images/appkit/yundou.png");
|
|
96
81
|
background-size: 20px;
|
|
@@ -98,17 +83,18 @@ const onGridItemClick = (index: number) => {
|
|
|
98
83
|
background-position: left center;
|
|
99
84
|
padding-left: 24px;
|
|
100
85
|
color: #FD6701;
|
|
101
|
-
font-size: 18px;
|
|
102
86
|
font-weight: 600;
|
|
103
87
|
line-height: 25px;
|
|
88
|
+
color: #d00;
|
|
89
|
+
font-size: 18px;
|
|
104
90
|
}
|
|
105
91
|
h5 {
|
|
106
|
-
font-size: 14px;
|
|
107
92
|
line-height: 18px;
|
|
108
93
|
color: #353535;
|
|
109
94
|
font-weight: 600;
|
|
110
95
|
opacity: 0.6;
|
|
111
96
|
margin-top: 4px;
|
|
97
|
+
font-size: 12px;
|
|
112
98
|
}
|
|
113
99
|
}
|
|
114
100
|
</style>
|
|
@@ -20,7 +20,7 @@ function onBackClick () {
|
|
|
20
20
|
.recharge-result {
|
|
21
21
|
display: flex;
|
|
22
22
|
width: 100vw;
|
|
23
|
-
height:
|
|
23
|
+
height: 100vh;
|
|
24
24
|
flex-direction: column;
|
|
25
25
|
justify-content: center;
|
|
26
26
|
align-items: center;
|
|
@@ -29,6 +29,10 @@ function onBackClick () {
|
|
|
29
29
|
font-weight: bold;
|
|
30
30
|
margin: 1em;
|
|
31
31
|
}
|
|
32
|
+
.caption {
|
|
33
|
+
color: #353535;
|
|
34
|
+
opacity: 0.5;
|
|
35
|
+
}
|
|
32
36
|
.figure {
|
|
33
37
|
width: 100px;
|
|
34
38
|
height: 100px;
|
|
@@ -20,11 +20,6 @@
|
|
|
20
20
|
title="充值协议">
|
|
21
21
|
<user-agreement />
|
|
22
22
|
</app-drawer>
|
|
23
|
-
<app-drawer
|
|
24
|
-
v-model="state.resultOpen"
|
|
25
|
-
title="充值">
|
|
26
|
-
<recharge-result @dismiss="onResultDismiss" />
|
|
27
|
-
</app-drawer>
|
|
28
23
|
</view>
|
|
29
24
|
</template>
|
|
30
25
|
|
|
@@ -32,7 +27,6 @@
|
|
|
32
27
|
import { onMounted, reactive, ref } from 'vue'
|
|
33
28
|
import AmountPicker from './AmountPicker.vue'
|
|
34
29
|
import UserAgreement from './UserAgreement.vue'
|
|
35
|
-
import RechargeResult from './RechargeResult.vue'
|
|
36
30
|
import { AppDrawer } from '../../shared'
|
|
37
31
|
import { makeHttp, endpoints } from '../api'
|
|
38
32
|
import { requestPayment } from '../services'
|
|
@@ -68,7 +62,6 @@ const state = reactive({
|
|
|
68
62
|
agreed: false,
|
|
69
63
|
selected: 0,
|
|
70
64
|
agreementOpen: false,
|
|
71
|
-
resultOpen: false,
|
|
72
65
|
buttonLoading: false,
|
|
73
66
|
})
|
|
74
67
|
|
|
@@ -107,7 +100,6 @@ const onPayClick = () => {
|
|
|
107
100
|
return false
|
|
108
101
|
}
|
|
109
102
|
state.buttonLoading = true
|
|
110
|
-
console.log('state.selected', state.selected)
|
|
111
103
|
wx.login({
|
|
112
104
|
success ({code}: {code: string}) {
|
|
113
105
|
requestPayment({
|
|
@@ -117,16 +109,13 @@ const onPayClick = () => {
|
|
|
117
109
|
user: code
|
|
118
110
|
}).then(result => {
|
|
119
111
|
state.buttonLoading = false
|
|
120
|
-
|
|
112
|
+
if (result) {
|
|
113
|
+
emit('complete', true)
|
|
114
|
+
}
|
|
121
115
|
})
|
|
122
116
|
}
|
|
123
117
|
})
|
|
124
118
|
}
|
|
125
|
-
|
|
126
|
-
const onResultDismiss = () => {
|
|
127
|
-
emit('complete', true)
|
|
128
|
-
// Taro.navigateBackMiniProgram({})
|
|
129
|
-
}
|
|
130
119
|
</script>
|
|
131
120
|
|
|
132
121
|
<style lang="scss">
|
|
@@ -139,6 +128,7 @@ const onResultDismiss = () => {
|
|
|
139
128
|
}
|
|
140
129
|
.amount-footer {
|
|
141
130
|
padding: 10px;
|
|
131
|
+
padding-bottom: 0;
|
|
142
132
|
.agreement {
|
|
143
133
|
font-size: 12px;
|
|
144
134
|
display: flex;
|
|
@@ -151,6 +141,7 @@ const onResultDismiss = () => {
|
|
|
151
141
|
color: #353535;
|
|
152
142
|
margin: 12px 0;
|
|
153
143
|
border: 0;
|
|
144
|
+
border-radius: 8px;
|
|
154
145
|
}
|
|
155
146
|
.nut-checkbox {
|
|
156
147
|
line-height: 40px;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import RechargeView from './RechargeView.vue'
|
|
2
2
|
import AmountPicker from './AmountPicker.vue'
|
|
3
3
|
import UserAgreement from './UserAgreement.vue'
|
|
4
|
+
import RechargeResult from './RechargeResult.vue'
|
|
4
5
|
|
|
5
6
|
const components = {
|
|
6
7
|
AmountPicker,
|
|
7
8
|
RechargeView,
|
|
8
|
-
UserAgreement
|
|
9
|
+
UserAgreement,
|
|
10
|
+
RechargeResult
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export {
|
|
12
14
|
AmountPicker,
|
|
13
15
|
RechargeView,
|
|
14
16
|
UserAgreement,
|
|
17
|
+
RechargeResult,
|
|
15
18
|
components
|
|
16
19
|
}
|
|
@@ -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,
|
|
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
|
}
|
package/src/shared/http/Http.ts
CHANGED
|
@@ -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('
|
|
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
|
-
|
|
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 = (
|
|
25
|
+
const success = (res) => {
|
|
26
26
|
resolve(true)
|
|
27
27
|
}
|
|
28
|
-
const fail = (
|
|
28
|
+
const fail = (res) => {
|
|
29
|
+
console.log('wx.requestPayment FAIL:', res)
|
|
29
30
|
resolve(false)
|
|
30
31
|
}
|
|
31
32
|
wx.requestPayment({
|