bmp-layout 0.0.10 → 0.0.12

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/bmp-layout.es.js CHANGED
@@ -3583,7 +3583,7 @@ const getKey = (namespace2, key) => {
3583
3583
  }
3584
3584
  return `${namespace2}.${key}`;
3585
3585
  };
3586
- const useI18n$1 = (namespace2) => {
3586
+ const useI18n = (namespace2) => {
3587
3587
  const normalFn = {
3588
3588
  t: (key) => {
3589
3589
  return getKey(namespace2, key);
@@ -3615,7 +3615,7 @@ const useRenderMenuTitle = () => {
3615
3615
  const renderMenuTitle2 = (meta, level, mode) => {
3616
3616
  const {
3617
3617
  t: t2
3618
- } = useI18n$1();
3618
+ } = useI18n();
3619
3619
  const {
3620
3620
  title = "Please set title",
3621
3621
  icon
@@ -3852,7 +3852,7 @@ const _sfc_main$s = /* @__PURE__ */ Object.assign({ name: "ProductServicePanel"
3852
3852
  setup(__props, { emit: __emit }) {
3853
3853
  const { getPrefixCls: getPrefixCls2 } = useDesign();
3854
3854
  const prefixCls2 = getPrefixCls2("product-service-panel");
3855
- const { t: t2 } = useI18n$1("layout");
3855
+ const { t: t2 } = useI18n("layout");
3856
3856
  const props = __props;
3857
3857
  const emit = __emit;
3858
3858
  const router = useRouter();
@@ -7849,10 +7849,6 @@ typeof process !== "undefined" ? (_a = process.env) === null || _a === void 0 ?
7849
7849
  const { wsCache: wsCache$2 } = useCache();
7850
7850
  const AccessTokenKey = "ACCESS_TOKEN";
7851
7851
  const RefreshTokenKey = "REFRESH_TOKEN";
7852
- const getAccessToken = () => {
7853
- const accessToken = wsCache$2.get(AccessTokenKey);
7854
- return accessToken ? accessToken : wsCache$2.get("ACCESS_TOKEN");
7855
- };
7856
7852
  const removeToken = () => {
7857
7853
  wsCache$2.delete(AccessTokenKey);
7858
7854
  wsCache$2.delete(RefreshTokenKey);
@@ -7893,12 +7889,7 @@ const useUserStore = defineStore("layout-user", {
7893
7889
  },
7894
7890
  actions: {
7895
7891
  // 从缓存加载用户信息到state
7896
- loadUserFromCacheAction() {
7897
- if (!getAccessToken()) {
7898
- this.resetState();
7899
- return null;
7900
- }
7901
- const userInfo = wsCache$1.get(CACHE_KEY.USER);
7892
+ loadUserFromCacheAction(userInfo) {
7902
7893
  this.permissions = new Set(userInfo.permissions);
7903
7894
  this.roles = userInfo.roles;
7904
7895
  this.user = userInfo.user;
@@ -7906,9 +7897,6 @@ const useUserStore = defineStore("layout-user", {
7906
7897
  wsCache$1.set(CACHE_KEY.USER, userInfo);
7907
7898
  wsCache$1.set(CACHE_KEY.ROLE_ROUTERS, userInfo.menus);
7908
7899
  },
7909
- setUserInfoAction(userInfo) {
7910
- wsCache$1.set(CACHE_KEY.USER, userInfo);
7911
- },
7912
7900
  async setUserAvatarAction(avatar) {
7913
7901
  const userInfo = wsCache$1.get(CACHE_KEY.USER);
7914
7902
  this.user.avatar = avatar;
@@ -9377,7 +9365,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
9377
9365
  }, [renderLayout(layout), createVNode(_sfc_main$w, null, null)]);
9378
9366
  }
9379
9367
  });
9380
- const LLayout = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-e261cf16"]]);
9368
+ const BmpLayout = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-e261cf16"]]);
9381
9369
  const _sfc_main$d = {
9382
9370
  __name: "ConfigGlobal",
9383
9371
  props: {
@@ -9487,7 +9475,7 @@ const _sfc_main$b = /* @__PURE__ */ Object.assign({ name: "PageHeader" }, {
9487
9475
  emits: ["back"],
9488
9476
  setup(__props, { emit: __emit }) {
9489
9477
  const route = useRoute();
9490
- const { t: t2 } = useI18n$1();
9478
+ const { t: t2 } = useI18n();
9491
9479
  const { getPrefixCls: getPrefixCls2 } = useDesign();
9492
9480
  const prefixCls2 = getPrefixCls2("page-header");
9493
9481
  const emit = __emit;
@@ -9611,6 +9599,106 @@ function createImageViewer(options) {
9611
9599
  instance = createVNode(_sfc_main$a, propsData);
9612
9600
  render(instance, container);
9613
9601
  }
9602
+ const useMessage = () => {
9603
+ const { t: t2 } = useI18n("layout");
9604
+ const scssVariables = variables$1;
9605
+ return {
9606
+ // 消息提示
9607
+ info(content) {
9608
+ ElMessage.info(content);
9609
+ },
9610
+ // 错误消息
9611
+ error(content) {
9612
+ ElMessage.error(content);
9613
+ },
9614
+ // 成功消息
9615
+ success(content) {
9616
+ ElMessage.success(content);
9617
+ },
9618
+ // 警告消息
9619
+ warning(content) {
9620
+ ElMessage.warning(content);
9621
+ },
9622
+ // 弹出提示
9623
+ alert(content) {
9624
+ ElMessageBox.alert(content, t2("common.confirmTitle"));
9625
+ },
9626
+ // 错误提示
9627
+ alertError(content) {
9628
+ ElMessageBox.alert(content, t2("common.confirmTitle"), { type: "error" });
9629
+ },
9630
+ // 成功提示
9631
+ alertSuccess(content) {
9632
+ ElMessageBox.alert(content, t2("common.confirmTitle"), { type: "success" });
9633
+ },
9634
+ // 警告提示
9635
+ alertWarning(content) {
9636
+ ElMessageBox.alert(content, t2("common.confirmTitle"), { type: "warning" });
9637
+ },
9638
+ // 通知提示
9639
+ notify(content) {
9640
+ ElNotification.info(content);
9641
+ },
9642
+ // 错误通知
9643
+ notifyError(content) {
9644
+ ElNotification.error(content);
9645
+ },
9646
+ // 成功通知
9647
+ notifySuccess(content) {
9648
+ ElNotification.success(content);
9649
+ },
9650
+ // 警告通知
9651
+ notifyWarning(content) {
9652
+ ElNotification.warning(content);
9653
+ },
9654
+ // 确认窗体
9655
+ confirm(content, tip, options = {}) {
9656
+ return ElMessageBox.confirm(content, tip ? tip : t2("common.confirmTitle"), {
9657
+ ...options,
9658
+ customClass: `${options.customClass} ${scssVariables.namespace}-message-box`,
9659
+ confirmButtonText: options.confirmButtonText ?? t2("common.ok"),
9660
+ cancelButtonText: options.cancelButtonText ?? t2("common.cancel"),
9661
+ buttonSize: "default",
9662
+ center: true
9663
+ });
9664
+ },
9665
+ // 删除窗体
9666
+ delConfirm(content, tip) {
9667
+ return ElMessageBox.confirm(
9668
+ content ? content : t2("common.delMessage"),
9669
+ tip ? tip : t2("common.confirmTitle"),
9670
+ {
9671
+ customClass: `${scssVariables.namespace}-message-box`,
9672
+ confirmButtonText: t2("common.ok"),
9673
+ cancelButtonText: t2("common.cancel"),
9674
+ buttonSize: "default",
9675
+ center: true,
9676
+ type: "warning"
9677
+ }
9678
+ );
9679
+ },
9680
+ // 导出窗体
9681
+ exportConfirm(content, tip) {
9682
+ return ElMessageBox.confirm(
9683
+ content ? content : t2("common.exportMessage"),
9684
+ tip ? tip : t2("common.confirmTitle"),
9685
+ {
9686
+ confirmButtonText: t2("common.ok"),
9687
+ cancelButtonText: t2("common.cancel"),
9688
+ type: "warning"
9689
+ }
9690
+ );
9691
+ },
9692
+ // 提交内容
9693
+ prompt(content, tip, options = {}) {
9694
+ return ElMessageBox.prompt(content, tip, {
9695
+ confirmButtonText: t2("common.ok"),
9696
+ cancelButtonText: t2("common.cancel"),
9697
+ ...options
9698
+ });
9699
+ }
9700
+ };
9701
+ };
9614
9702
  const _hoisted_1$4 = { class: "upload-box" };
9615
9703
  const _hoisted_2$4 = ["src"];
9616
9704
  const _hoisted_3$4 = { key: 0 };
@@ -11219,30 +11307,30 @@ function useLayout() {
11219
11307
  };
11220
11308
  }
11221
11309
  export {
11222
- _sfc_main$3 as LAlert,
11223
- _sfc_main$1 as LAnchor,
11224
- _sfc_main$w as LBacktop,
11225
- _sfc_main$6 as LBadge,
11226
- _sfc_main$d as LConfigGlobal,
11227
- createImageViewer as LCreateImageViewer,
11228
- _sfc_main$4 as LDialog,
11229
- _sfc_main$v as LIcon,
11230
- LLayout,
11231
- PageCard as LPageCard,
11232
- PageHeader as LPageHeader,
11233
- _sfc_main$5 as LPagination,
11234
- setI18n as LSetI18n,
11235
- setPinia as LSetPinia,
11236
- Steps as LSteps,
11237
- UploadFile as LUploadFile,
11238
- UploadImg as LUploadImg,
11239
- UploadImgs as LUploadImgs,
11240
- useAppStore as LUseAppStore,
11241
- useAppStoreWithOut as LUseAppStoreWithOut,
11242
- useLayout as LUseLayout,
11243
- usePermissionStore as LUsePermissionStore,
11244
- usePermissionStoreWithOut as LUsePermissionStoreWithOut,
11245
- useUserStore as LUseUserStore,
11246
- useUserStoreWithOut as LUseUserStoreWithOut,
11247
- LLayout as default
11310
+ _sfc_main$3 as BmpAlert,
11311
+ _sfc_main$1 as BmpAnchor,
11312
+ _sfc_main$w as BmpBacktop,
11313
+ _sfc_main$6 as BmpBadge,
11314
+ _sfc_main$d as BmpConfigGlobal,
11315
+ createImageViewer as BmpCreateImageViewer,
11316
+ _sfc_main$4 as BmpDialog,
11317
+ _sfc_main$v as BmpIcon,
11318
+ BmpLayout,
11319
+ PageCard as BmpPageCard,
11320
+ PageHeader as BmpPageHeader,
11321
+ _sfc_main$5 as BmpPagination,
11322
+ setI18n as BmpSetI18n,
11323
+ setPinia as BmpSetPinia,
11324
+ Steps as BmpSteps,
11325
+ UploadFile as BmpUploadFile,
11326
+ UploadImg as BmpUploadImg,
11327
+ UploadImgs as BmpUploadImgs,
11328
+ useAppStore as BmpUseAppStore,
11329
+ useAppStoreWithOut as BmpUseAppStoreWithOut,
11330
+ useLayout as BmpUseLayout,
11331
+ usePermissionStore as BmpUsePermissionStore,
11332
+ usePermissionStoreWithOut as BmpUsePermissionStoreWithOut,
11333
+ useUserStore as BmpUseUserStore,
11334
+ useUserStoreWithOut as BmpUseUserStoreWithOut,
11335
+ BmpLayout as default
11248
11336
  };