@skyfox2000/webui 1.4.3 → 1.4.5
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/lib/assets/modules/{baseLayout-C92mDmCL.js → baseLayout-BT7tGUB1.js} +3 -3
- package/lib/assets/modules/{file-upload-DGCoBLP3.js → file-upload-DicHRX1r.js} +27 -28
- package/lib/assets/modules/{index-C_7galsG.js → index-BURe9YrF.js} +2 -2
- package/lib/assets/modules/{index-ChjM1bSE.js → index-BjXLzCF2.js} +2 -2
- package/lib/assets/modules/{index-BrDxf94o.js → index-iozooZXX.js} +1 -1
- package/lib/assets/modules/{menuTabs-Boe_4pzK.js → menuTabs-D_UlXkmm.js} +56 -56
- package/lib/assets/modules/{toolIcon-BddslNsJ.js → toolIcon-BiWBb2pJ.js} +1 -1
- package/lib/assets/modules/{uploadList-3sClH7Na.js → uploadList-61wZlPUk.js} +4 -4
- package/lib/assets/modules/{uploadList-ZGWKyite.js → uploadList-C_hqJ4X1.js} +217 -217
- package/lib/es/AceEditor/index.js +3 -3
- package/lib/es/BasicLayout/index.js +2 -2
- package/lib/es/Error403/index.js +1 -1
- package/lib/es/Error404/index.js +1 -1
- package/lib/es/ExcelForm/index.js +5 -5
- package/lib/es/MenuLayout/index.js +2 -2
- package/lib/es/UploadForm/index.js +4 -4
- package/lib/stores/hostInfo.d.ts +2 -2
- package/lib/utils/micro-openapis.d.ts +7 -6
- package/lib/webui.es.js +12 -12
- package/package.json +1 -1
- package/src/components/layout/header/headerExits.vue +4 -4
- package/src/stores/appInfo.ts +10 -6
- package/src/stores/hostInfo.ts +6 -5
- package/src/utils/file-upload.ts +4 -3
- package/src/utils/micro-openapis.ts +9 -8
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { defineComponent as F, defineAsyncComponent as M, ref as m, watch as V, onMounted as J, createElementBlock as x, openBlock as p, Fragment as K, createElementVNode as v, createVNode as _, toDisplayString as W, unref as i, createBlock as P, withKeys as f, normalizeClass as N, withModifiers as w, withCtx as z, createCommentVNode as L } from "vue";
|
|
2
2
|
import "ant-design-vue";
|
|
3
|
-
import { _ as q } from "../../assets/modules/toolIcon-
|
|
3
|
+
import { _ as q } from "../../assets/modules/toolIcon-BiWBb2pJ.js";
|
|
4
4
|
import "@skyfox2000/fapi";
|
|
5
|
-
import "../../assets/modules/uploadList-
|
|
5
|
+
import "../../assets/modules/uploadList-C_hqJ4X1.js";
|
|
6
6
|
import "@skyfox2000/microbase";
|
|
7
7
|
import "vue-m-message";
|
|
8
8
|
import "async-validator";
|
|
9
9
|
import "dayjs";
|
|
10
|
-
import { _ as D } from "../../assets/modules/index-
|
|
10
|
+
import { _ as D } from "../../assets/modules/index-BURe9YrF.js";
|
|
11
11
|
import "vue-draggable-next";
|
|
12
12
|
const h = async (s) => window.ace ? window.ace : new Promise((l, t) => {
|
|
13
13
|
const o = document.createElement("script");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as f, ref as d, watch as _, onMounted as v, resolveComponent as h, createBlock as o, openBlock as t, withCtx as s, createElementVNode as C, normalizeClass as x, createVNode as w, KeepAlive as y, unref as n, resolveDynamicComponent as I } from "vue";
|
|
2
|
-
import { _ as g } from "../../assets/modules/baseLayout-
|
|
3
|
-
import { af as A, a as S } from "../../assets/modules/uploadList-
|
|
2
|
+
import { _ as g } from "../../assets/modules/baseLayout-BT7tGUB1.js";
|
|
3
|
+
import { af as A, a as S } from "../../assets/modules/uploadList-C_hqJ4X1.js";
|
|
4
4
|
import "@skyfox2000/microbase";
|
|
5
5
|
import "@skyfox2000/fapi";
|
|
6
6
|
import b from "vue-m-message";
|
package/lib/es/Error403/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as i, createBlock as p, openBlock as m, unref as r, withCtx as e, createVNode as n, createTextVNode as a } from "vue";
|
|
2
|
-
import { r as s } from "../../assets/modules/uploadList-
|
|
2
|
+
import { r as s } from "../../assets/modules/uploadList-C_hqJ4X1.js";
|
|
3
3
|
import "@skyfox2000/microbase";
|
|
4
4
|
import "@skyfox2000/fapi";
|
|
5
5
|
import "vue-m-message";
|
package/lib/es/Error404/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as i, createBlock as p, openBlock as m, unref as r, withCtx as e, createVNode as n, createTextVNode as a } from "vue";
|
|
2
|
-
import { r as s } from "../../assets/modules/uploadList-
|
|
2
|
+
import { r as s } from "../../assets/modules/uploadList-C_hqJ4X1.js";
|
|
3
3
|
import "@skyfox2000/microbase";
|
|
4
4
|
import "@skyfox2000/fapi";
|
|
5
5
|
import "vue-m-message";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { defineComponent as we, ref as f, computed as T, watch as W, onMounted as be, createBlock as H, openBlock as d, unref as n, withCtx as S, renderSlot as J, createElementBlock as g, createCommentVNode as K, createElementVNode as h, createVNode as C, createTextVNode as X, toDisplayString as E, normalizeClass as Ce, Fragment as ie, renderList as ne } from "vue";
|
|
2
|
-
import { _ as Y } from "../../assets/modules/index-
|
|
2
|
+
import { _ as Y } from "../../assets/modules/index-iozooZXX.js";
|
|
3
3
|
import { Modal as Fe, Upload as ue, Space as _e } from "ant-design-vue";
|
|
4
4
|
import { httpGet as Ue, ResStatus as fe } from "@skyfox2000/fapi";
|
|
5
|
-
import { E as Te, a2 as Se, a8 as Ee } from "../../assets/modules/uploadList-
|
|
6
|
-
import { A as Re, p as De, U as ce } from "../../assets/modules/file-upload-
|
|
5
|
+
import { E as Te, a2 as Se, a8 as Ee } from "../../assets/modules/uploadList-C_hqJ4X1.js";
|
|
6
|
+
import { A as Re, p as De, U as ce } from "../../assets/modules/file-upload-DicHRX1r.js";
|
|
7
7
|
import "@skyfox2000/microbase";
|
|
8
8
|
import p from "vue-m-message";
|
|
9
|
-
import { c as ke, _ as Z, h as Le, p as Ne, i as Ke } from "../../assets/modules/index-
|
|
9
|
+
import { c as ke, _ as Z, h as Le, p as Ne, i as Ke } from "../../assets/modules/index-BjXLzCF2.js";
|
|
10
10
|
import "dayjs";
|
|
11
11
|
import "vue-draggable-next";
|
|
12
12
|
import "async-validator";
|
|
@@ -306,7 +306,7 @@ const Be = (l) => l.includes(",") || l.includes(`
|
|
|
306
306
|
return p.error(v), ue.LIST_IGNORE;
|
|
307
307
|
try {
|
|
308
308
|
if (A(), y.value = t.name, q.value = u ? "text/csv" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", u) {
|
|
309
|
-
const w = await t.arrayBuffer(), O = new TextDecoder("utf-8").decode(w), { csvToExcelView: G } = await import("../../assets/modules/index-
|
|
309
|
+
const w = await t.arrayBuffer(), O = new TextDecoder("utf-8").decode(w), { csvToExcelView: G } = await import("../../assets/modules/index-BjXLzCF2.js").then((he) => he.j), M = await G(O, t.name);
|
|
310
310
|
if (!M.success)
|
|
311
311
|
throw new Error(M.error || "CSV文件处理失败");
|
|
312
312
|
const oe = await (await fetch(M.blobUrl)).arrayBuffer();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as f, ref as d, watch as _, onMounted as v, resolveComponent as h, createBlock as o, openBlock as t, withCtx as s, createElementVNode as C, normalizeClass as x, createVNode as w, KeepAlive as I, unref as n, resolveDynamicComponent as g } from "vue";
|
|
2
|
-
import { _ as y } from "../../assets/modules/baseLayout-
|
|
3
|
-
import { af as A, a as S } from "../../assets/modules/uploadList-
|
|
2
|
+
import { _ as y } from "../../assets/modules/baseLayout-BT7tGUB1.js";
|
|
3
|
+
import { af as A, a as S } from "../../assets/modules/uploadList-C_hqJ4X1.js";
|
|
4
4
|
import "@skyfox2000/microbase";
|
|
5
5
|
import "@skyfox2000/fapi";
|
|
6
6
|
import k from "vue-m-message";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { defineComponent as y, ref as f, watch as S, onMounted as z, createBlock as D, openBlock as F, unref as u, withCtx as s, createVNode as m, createTextVNode as C } from "vue";
|
|
2
|
-
import { _ as c } from "../../assets/modules/index-
|
|
2
|
+
import { _ as c } from "../../assets/modules/index-iozooZXX.js";
|
|
3
3
|
import { Modal as _, Space as k } from "ant-design-vue";
|
|
4
4
|
import { ResStatus as E } from "@skyfox2000/fapi";
|
|
5
|
-
import { a4 as h } from "../../assets/modules/uploadList-
|
|
5
|
+
import { a4 as h } from "../../assets/modules/uploadList-C_hqJ4X1.js";
|
|
6
6
|
import "@skyfox2000/microbase";
|
|
7
7
|
import L from "vue-m-message";
|
|
8
8
|
import "async-validator";
|
|
9
9
|
import "dayjs";
|
|
10
|
-
import { A as N } from "../../assets/modules/file-upload-
|
|
10
|
+
import { A as N } from "../../assets/modules/file-upload-DicHRX1r.js";
|
|
11
11
|
import "vue-draggable-next";
|
|
12
|
-
import { U as B } from "../../assets/modules/uploadList-
|
|
12
|
+
import { U as B } from "../../assets/modules/uploadList-61wZlPUk.js";
|
|
13
13
|
const K = /* @__PURE__ */ y({
|
|
14
14
|
__name: "uploadForm",
|
|
15
15
|
props: {
|
package/lib/stores/hostInfo.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { HostInfo
|
|
1
|
+
import { HostInfo } from '../../../502424_MicroBase';
|
|
2
2
|
import { StoreDefinition } from 'pinia';
|
|
3
3
|
export declare const useHostInfo: StoreDefinition<"hostInfo", {
|
|
4
4
|
hostInfo: HostInfo;
|
|
5
5
|
}, {}, {
|
|
6
6
|
getSiteHostApi(): string;
|
|
7
|
-
loadHostInfo(hostApi: string, hostKey?: string
|
|
7
|
+
loadHostInfo(hostApi: string, hostKey?: string): Promise<void>;
|
|
8
8
|
clear(): void;
|
|
9
9
|
_setHostInfo(hostInfo: HostInfo | null): void;
|
|
10
10
|
getHostInfo(): HostInfo;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AppInfo, HostInfo, UserInfo } from '../../../502424_MicroBase';
|
|
1
2
|
declare class MicroAppSDK {
|
|
2
3
|
private static messageId;
|
|
3
4
|
private static callbacks;
|
|
@@ -5,12 +6,12 @@ declare class MicroAppSDK {
|
|
|
5
6
|
private static callMainAppMethod;
|
|
6
7
|
static handleResponseData(data: any): void;
|
|
7
8
|
static init(): void;
|
|
8
|
-
static getAppInfo(): Promise<
|
|
9
|
-
static getHostInfo(): Promise<
|
|
10
|
-
static getUserInfo(): Promise<
|
|
11
|
-
static getToken(): Promise<
|
|
12
|
-
static userLogout(): Promise<
|
|
13
|
-
static mainAppPush(
|
|
9
|
+
static getAppInfo(): Promise<AppInfo>;
|
|
10
|
+
static getHostInfo(): Promise<HostInfo>;
|
|
11
|
+
static getUserInfo(): Promise<UserInfo>;
|
|
12
|
+
static getToken(): Promise<string>;
|
|
13
|
+
static userLogout(): Promise<void>;
|
|
14
|
+
static mainAppPush(path: string): Promise<void>;
|
|
14
15
|
}
|
|
15
16
|
export declare const MicroOpenApis: {
|
|
16
17
|
getAppInfo: typeof MicroAppSDK.getAppInfo;
|
package/lib/webui.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { u as Ee, i as Z, a as me, L as Xe, c as Ze, P as j, o as Pe, b as ea, d as aa, e as Fe, r as ce, f as ta, g as la, h as Ne, j as sa, k as ke, l as ra, _ as oa, m as na, O as Me, q as Be, n as ia, p as ca, s as L, t as ua, v as da, w as pa, x as fa, y as va, z as ma, A as Y, B as ha, C as ga, D as ba, E as Re } from "./assets/modules/uploadList-
|
|
2
|
-
import { aa as $l, Q as Il, ac as Dl, R as El, V as Pl, a9 as Fl, a7 as Nl, a8 as Ml, ab as Bl, Y as Rl, T as Ol, a5 as Al, a2 as Ll, M as zl, a4 as Ul, U as Vl, G as Yl, $ as Kl, a3 as Wl, a6 as Hl, N as jl, S as Ql, ad as ql, F as Gl, a1 as Jl, ae as Xl, X as Zl, Z as es, W as as, af as ts, H as ls, I as ss, ag as rs, K as os, ah as ns, J as is, a0 as cs } from "./assets/modules/uploadList-
|
|
3
|
-
import { A as ds, U as ps, p as fs } from "./assets/modules/file-upload-
|
|
1
|
+
import { u as Ee, i as Z, a as me, L as Xe, c as Ze, P as j, o as Pe, b as ea, d as aa, e as Fe, r as ce, f as ta, g as la, h as Ne, j as sa, k as ke, l as ra, _ as oa, m as na, O as Me, q as Be, n as ia, p as ca, s as L, t as ua, v as da, w as pa, x as fa, y as va, z as ma, A as Y, B as ha, C as ga, D as ba, E as Re } from "./assets/modules/uploadList-C_hqJ4X1.js";
|
|
2
|
+
import { aa as $l, Q as Il, ac as Dl, R as El, V as Pl, a9 as Fl, a7 as Nl, a8 as Ml, ab as Bl, Y as Rl, T as Ol, a5 as Al, a2 as Ll, M as zl, a4 as Ul, U as Vl, G as Yl, $ as Kl, a3 as Wl, a6 as Hl, N as jl, S as Ql, ad as ql, F as Gl, a1 as Jl, ae as Xl, X as Zl, Z as es, W as as, af as ts, H as ls, I as ss, ag as rs, K as os, ah as ns, J as is, a0 as cs } from "./assets/modules/uploadList-C_hqJ4X1.js";
|
|
3
|
+
import { A as ds, U as ps, p as fs } from "./assets/modules/file-upload-DicHRX1r.js";
|
|
4
4
|
import { EnvConfig as we } from "@skyfox2000/microbase";
|
|
5
5
|
import { FrontCache as re, httpPost as Oe, ResStatus as Ae, SERVER_HOST as _a, fieldMapping as oe } from "@skyfox2000/fapi";
|
|
6
6
|
import he from "vue-m-message";
|
|
@@ -9,15 +9,15 @@ import "async-validator";
|
|
|
9
9
|
import fe from "dayjs";
|
|
10
10
|
import { Popover as Ca, theme as ze, Drawer as Ta, Space as te, Form as Ue, message as $a, FormItem as Ve, ConfigProvider as Ce, Popconfirm as Ia, Button as Ye, DropdownButton as Da, Menu as _e, MenuItem as xe, Dropdown as ve, Checkbox as Ea, Table as Ke, Tree as Pa, Cascader as Fa, DatePicker as Na, Input as ee, InputPassword as Ma, InputNumber as Ba, RangePicker as Ra, Textarea as Oa, TimePicker as Aa, Transfer as La, TreeSelect as za, LayoutContent as Ua } from "ant-design-vue";
|
|
11
11
|
import { VueDraggableNext as Va } from "vue-draggable-next";
|
|
12
|
-
import { d as We } from "./assets/modules/uploadList-
|
|
13
|
-
import { C as ms, U as hs, a as gs, p as bs } from "./assets/modules/uploadList-
|
|
14
|
-
import { c as He } from "./assets/modules/index-
|
|
15
|
-
import { _ as xs, h as ys, b as ks, a as ws, d as Ss, e as Cs, g as Ts, f as $s, n as Is, p as Ds, t as Es, v as Ps } from "./assets/modules/index-
|
|
16
|
-
import { _ as A } from "./assets/modules/index-
|
|
17
|
-
import { _ as U } from "./assets/modules/toolIcon-
|
|
18
|
-
import { a as Ns } from "./assets/modules/toolIcon-
|
|
19
|
-
import { _ as Bs, b as Rs, c as Os, d as As, e as Ls, I as zs, f as Us, g as Vs, a as Ys } from "./assets/modules/menuTabs-
|
|
20
|
-
import { _ as Ws } from "./assets/modules/index-
|
|
12
|
+
import { d as We } from "./assets/modules/uploadList-61wZlPUk.js";
|
|
13
|
+
import { C as ms, U as hs, a as gs, p as bs } from "./assets/modules/uploadList-61wZlPUk.js";
|
|
14
|
+
import { c as He } from "./assets/modules/index-BjXLzCF2.js";
|
|
15
|
+
import { _ as xs, h as ys, b as ks, a as ws, d as Ss, e as Cs, g as Ts, f as $s, n as Is, p as Ds, t as Es, v as Ps } from "./assets/modules/index-BjXLzCF2.js";
|
|
16
|
+
import { _ as A } from "./assets/modules/index-iozooZXX.js";
|
|
17
|
+
import { _ as U } from "./assets/modules/toolIcon-BiWBb2pJ.js";
|
|
18
|
+
import { a as Ns } from "./assets/modules/toolIcon-BiWBb2pJ.js";
|
|
19
|
+
import { _ as Bs, b as Rs, c as Os, d as As, e as Ls, I as zs, f as Us, g as Vs, a as Ys } from "./assets/modules/menuTabs-D_UlXkmm.js";
|
|
20
|
+
import { _ as Ws } from "./assets/modules/index-BURe9YrF.js";
|
|
21
21
|
import { _ as q } from "./assets/modules/_plugin-vue_export-helper-CHgC5LLL.js";
|
|
22
22
|
const Te = (s, a, e, t = "remove") => {
|
|
23
23
|
if (!e)
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { Modal, Flex } from 'ant-design-vue';
|
|
4
|
-
import { mainAppApis } from '@skyfox2000/microbase';
|
|
5
4
|
import { ToolIcon, Tooltip } from '../../common';
|
|
6
|
-
import { useUserInfo } from '@/index';
|
|
5
|
+
import { MicroOpenApis, useUserInfo } from '@/index';
|
|
6
|
+
import { isMicroApp } from '@skyfox2000/microbase';
|
|
7
7
|
|
|
8
8
|
const userInfoStore = useUserInfo();
|
|
9
9
|
const open = ref(false);
|
|
10
10
|
const confirmExit = () => {
|
|
11
11
|
open.value = false;
|
|
12
|
-
if (
|
|
13
|
-
|
|
12
|
+
if (isMicroApp()) {
|
|
13
|
+
MicroOpenApis.userLogout!();
|
|
14
14
|
} else {
|
|
15
15
|
userInfoStore.logout(true);
|
|
16
16
|
}
|
package/src/stores/appInfo.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
AppSource,
|
|
7
7
|
isBaseMicroApp,
|
|
8
8
|
isMicroApp,
|
|
9
|
-
mainAppApis,
|
|
10
9
|
RouteRecord,
|
|
11
10
|
EnvConfig,
|
|
12
11
|
} from '@skyfox2000/microbase';
|
|
@@ -18,6 +17,7 @@ import { Component, h, nextTick } from 'vue';
|
|
|
18
17
|
import { LoginExpiredError, useUserInfo } from './userInfo';
|
|
19
18
|
import { ApiResponse, httpPost, IUrlInfo, ResStatus } from '@skyfox2000/fapi';
|
|
20
19
|
import message from 'vue-m-message';
|
|
20
|
+
import { MicroOpenApis } from '@/utils/micro-openapis';
|
|
21
21
|
|
|
22
22
|
// const APPINFO_STORE_KEY = 'appInfoStore';
|
|
23
23
|
|
|
@@ -353,9 +353,9 @@ export const useAppInfo = defineStore('appInfo', {
|
|
|
353
353
|
this.appInfo.defaultPage = findFirstPage(filteredRoutes) || '';
|
|
354
354
|
if (this.appInfo.defaultPage) {
|
|
355
355
|
this.menuLoaded = true;
|
|
356
|
-
if (
|
|
356
|
+
if (isMicroApp()) {
|
|
357
357
|
const fullPath = this.formatRoute(this.appInfo.defaultPage);
|
|
358
|
-
|
|
358
|
+
MicroOpenApis.mainAppPush(fullPath);
|
|
359
359
|
}
|
|
360
360
|
continueNavigation(this.appInfo.defaultPage);
|
|
361
361
|
}
|
|
@@ -393,9 +393,9 @@ export const useAppInfo = defineStore('appInfo', {
|
|
|
393
393
|
nextTick(() => {
|
|
394
394
|
// 直接使用当前应用路由AppRouter
|
|
395
395
|
AppRouter.push({ path });
|
|
396
|
-
if (
|
|
396
|
+
if (isMicroApp()) {
|
|
397
397
|
const fullPath = this.formatRoute(path);
|
|
398
|
-
|
|
398
|
+
MicroOpenApis.mainAppPush(fullPath);
|
|
399
399
|
}
|
|
400
400
|
});
|
|
401
401
|
},
|
|
@@ -495,7 +495,11 @@ export const useAppInfo = defineStore('appInfo', {
|
|
|
495
495
|
logout() {
|
|
496
496
|
// 清理应用信息
|
|
497
497
|
this.clean();
|
|
498
|
-
|
|
498
|
+
if (isMicroApp()) {
|
|
499
|
+
MicroOpenApis.mainAppPush('/');
|
|
500
|
+
} else {
|
|
501
|
+
window.location.assign('/');
|
|
502
|
+
}
|
|
499
503
|
},
|
|
500
504
|
},
|
|
501
505
|
persist: false,
|
package/src/stores/hostInfo.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { MicroOpenApis } from '@/utils/micro-openapis';
|
|
1
2
|
import { API_HOST, ApiResponse, httpPost, IUrlInfo, ResStatus, SERVER_HOST } from '@skyfox2000/fapi';
|
|
2
3
|
|
|
3
|
-
import { HostInfo,
|
|
4
|
+
import { HostInfo, isMicroApp } from '@skyfox2000/microbase';
|
|
4
5
|
|
|
5
6
|
import { defineStore } from 'pinia';
|
|
6
7
|
|
|
@@ -57,11 +58,11 @@ export const useHostInfo = defineStore('hostInfo', {
|
|
|
57
58
|
* 加载站点信息
|
|
58
59
|
* @param hostApi 启动配置主机地址
|
|
59
60
|
* @param hostKey 站点信息,默认为当前主域名
|
|
60
|
-
* @param mainOpenApis 宿主机开放接口
|
|
61
61
|
*/
|
|
62
|
-
async loadHostInfo(hostApi: string, hostKey?: string
|
|
63
|
-
if (
|
|
64
|
-
|
|
62
|
+
async loadHostInfo(hostApi: string, hostKey?: string): Promise<void> {
|
|
63
|
+
if (isMicroApp()) {
|
|
64
|
+
const hostInfo = await MicroOpenApis.getHostInfo();
|
|
65
|
+
this._setHostInfo(hostInfo);
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
68
|
|
package/src/utils/file-upload.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { hostUrl, IUrlInfo } from '@skyfox2000/fapi';
|
|
2
2
|
|
|
3
|
-
import { getToken } from '@/utils/main-openapis';
|
|
4
3
|
import { UploadFile, UploadStatus } from '@/typings/upload.d';
|
|
5
4
|
import dayjs from 'dayjs';
|
|
6
5
|
import message from 'vue-m-message';
|
|
7
6
|
import { Ref } from 'vue';
|
|
7
|
+
import { MicroOpenApis } from './micro-openapis';
|
|
8
|
+
import { isMicroApp } from '@skyfox2000/microbase';
|
|
9
|
+
import { useUserInfo } from '@/stores/userInfo';
|
|
8
10
|
|
|
9
11
|
export class path {
|
|
10
12
|
/**
|
|
@@ -233,7 +235,7 @@ export class AsyncUploader {
|
|
|
233
235
|
|
|
234
236
|
// 添加授权 Token(如果需要)
|
|
235
237
|
if (this.urlInfo.authorize) {
|
|
236
|
-
const token = getToken(); // 假设 getToken 是获取 Token 的方法
|
|
238
|
+
const token = isMicroApp() ? MicroOpenApis.getToken() : useUserInfo().getToken(); // 假设 getToken 是获取 Token 的方法
|
|
237
239
|
if (!token) {
|
|
238
240
|
reject(new Error('未授权或授权过期'));
|
|
239
241
|
return;
|
|
@@ -360,4 +362,3 @@ export class AsyncUploader {
|
|
|
360
362
|
// console.error('上传错误:', error);
|
|
361
363
|
// }
|
|
362
364
|
// })();
|
|
363
|
-
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* 提供与主应用的通信接口,基于micro-app框架
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { AppInfo, HostInfo, UserInfo } from '@skyfox2000/microbase';
|
|
7
|
+
|
|
6
8
|
// 定义请求数据格式
|
|
7
9
|
interface ApiRequestData {
|
|
8
10
|
type: 'API_REQUEST';
|
|
@@ -103,7 +105,6 @@ class MicroAppSDK {
|
|
|
103
105
|
if (this.isInMicroApp()) {
|
|
104
106
|
// 添加监听器
|
|
105
107
|
(window as any).microApp.addDataListener((data: any) => {
|
|
106
|
-
console.log('收到来自主应用的数据:', data);
|
|
107
108
|
this.handleResponseData(data);
|
|
108
109
|
});
|
|
109
110
|
}
|
|
@@ -112,43 +113,43 @@ class MicroAppSDK {
|
|
|
112
113
|
/**
|
|
113
114
|
* 获取应用信息
|
|
114
115
|
*/
|
|
115
|
-
static async getAppInfo(): Promise<
|
|
116
|
+
static async getAppInfo(): Promise<AppInfo> {
|
|
116
117
|
return this.callMainAppMethod('getAppInfo');
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
/**
|
|
120
121
|
* 获取主机信息
|
|
121
122
|
*/
|
|
122
|
-
static async getHostInfo(): Promise<
|
|
123
|
+
static async getHostInfo(): Promise<HostInfo> {
|
|
123
124
|
return this.callMainAppMethod('getHostInfo');
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
/**
|
|
127
128
|
* 获取用户信息
|
|
128
129
|
*/
|
|
129
|
-
static async getUserInfo(): Promise<
|
|
130
|
+
static async getUserInfo(): Promise<UserInfo> {
|
|
130
131
|
return this.callMainAppMethod('getUserInfo');
|
|
131
132
|
}
|
|
132
133
|
|
|
133
134
|
/**
|
|
134
135
|
* 获取授权令牌
|
|
135
136
|
*/
|
|
136
|
-
static async getToken(): Promise<
|
|
137
|
+
static async getToken(): Promise<string> {
|
|
137
138
|
return this.callMainAppMethod('getToken');
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
/**
|
|
141
142
|
* 用户登出
|
|
142
143
|
*/
|
|
143
|
-
static async userLogout(): Promise<
|
|
144
|
+
static async userLogout(): Promise<void> {
|
|
144
145
|
return this.callMainAppMethod('userLogout');
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
/**
|
|
148
149
|
* 主应用推送
|
|
149
150
|
*/
|
|
150
|
-
static async mainAppPush(
|
|
151
|
-
return this.callMainAppMethod('mainAppPush',
|
|
151
|
+
static async mainAppPush(path: string): Promise<void> {
|
|
152
|
+
return this.callMainAppMethod('mainAppPush', path);
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
155
|
|