best-unit 0.0.46 → 0.0.48
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/best-unit.cjs +8 -8
- package/dist/best-unit.js +163 -163
- package/package.json +1 -1
- package/src/api/axiosInstance.ts +0 -1
- package/src/demo/App.tsx +36 -3
- package/src/utils/business/index.ts +3 -4
package/package.json
CHANGED
package/src/api/axiosInstance.ts
CHANGED
|
@@ -29,7 +29,6 @@ export function createAxiosInstance(options: CreateAxiosOptions = {}) {
|
|
|
29
29
|
sessionStorage.getItem("fund_unit_params") || "{}"
|
|
30
30
|
);
|
|
31
31
|
const { token, locale } = fundUnitParams;
|
|
32
|
-
console.log(fundUnitParams, "fundUnitParams");
|
|
33
32
|
config.headers = {
|
|
34
33
|
...config.headers,
|
|
35
34
|
Authorization: token,
|
package/src/demo/App.tsx
CHANGED
|
@@ -11,9 +11,21 @@ export default function DemoApp() {
|
|
|
11
11
|
const [currentTheme, setCurrentTheme] = useState<Theme>(Theme.WHITE);
|
|
12
12
|
|
|
13
13
|
const initApp = ({ locale, theme }: { locale?: Locale; theme?: Theme }) => {
|
|
14
|
+
// 测试代码:每次刷新页面时生成不同的 token
|
|
15
|
+
const generateTestToken = () => {
|
|
16
|
+
const timestamp = Date.now();
|
|
17
|
+
const randomId = Math.floor(Math.random() * 1000);
|
|
18
|
+
return `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTM0MTM1MjksIm1lcmNoYW50X2lkIjoxMTI4LCJ0aW1lc3RhbXAiOjE3NTMxNTQzMjl9.${timestamp}_${randomId}_TEST_TOKEN`;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const testToken = generateTestToken();
|
|
22
|
+
console.log("=== 测试 Token 生成 ===");
|
|
23
|
+
console.log("当前时间戳:", Date.now());
|
|
24
|
+
console.log("生成的测试 Token:", testToken);
|
|
25
|
+
console.log("========================");
|
|
26
|
+
|
|
14
27
|
initFundUnit({
|
|
15
|
-
token:
|
|
16
|
-
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTM0MTM1MjksIm1lcmNoYW50X2lkIjoxMTI4LCJ0aW1lc3RhbXAiOjE3NTMxNTQzMjl9.UAvzq0P4HCnbJR1Ga3CgF6q3vk2RHiZRvnAFohBTHpw",
|
|
28
|
+
token: testToken,
|
|
17
29
|
merchant_id: "1128",
|
|
18
30
|
biz_type: "ad",
|
|
19
31
|
locale: locale as Locale,
|
|
@@ -54,9 +66,30 @@ export default function DemoApp() {
|
|
|
54
66
|
borderRadius: isDark ? 8 : undefined,
|
|
55
67
|
}}
|
|
56
68
|
>
|
|
57
|
-
组件库可视化测试
|
|
69
|
+
组件库可视化测试 (Token 测试版本)
|
|
58
70
|
</h2>
|
|
59
71
|
|
|
72
|
+
{/* Token 测试信息显示 */}
|
|
73
|
+
<div
|
|
74
|
+
style={{
|
|
75
|
+
marginBottom: 20,
|
|
76
|
+
padding: 16,
|
|
77
|
+
border: "2px solid #1890ff",
|
|
78
|
+
borderRadius: 8,
|
|
79
|
+
backgroundColor: "#e6f7ff",
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
<h3 style={{ marginTop: 0, marginBottom: 12, color: "#1890ff" }}>
|
|
83
|
+
🧪 Token 测试信息:
|
|
84
|
+
</h3>
|
|
85
|
+
<p style={{ margin: 0, color: "#1890ff" }}>
|
|
86
|
+
每次刷新页面都会生成新的测试 Token,请查看控制台输出。
|
|
87
|
+
</p>
|
|
88
|
+
<p style={{ margin: "8px 0 0 0", color: "#1890ff", fontSize: "12px" }}>
|
|
89
|
+
当前时间戳: {Date.now()}
|
|
90
|
+
</p>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
60
93
|
{/* 国际化切换区域 */}
|
|
61
94
|
<div
|
|
62
95
|
style={{
|
|
@@ -11,10 +11,9 @@ export async function initFundUnit(params: {
|
|
|
11
11
|
theme?: Theme;
|
|
12
12
|
locale?: Locale;
|
|
13
13
|
}) {
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
14
|
+
// 重置状态,允许重新初始化
|
|
15
|
+
isInitialized = false;
|
|
16
|
+
initPromise = null;
|
|
18
17
|
|
|
19
18
|
initPromise = new Promise(async (resolve) => {
|
|
20
19
|
const {
|