@lambo-design/shared 1.0.0-beta.149 → 1.0.0-beta.150

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambo-design/shared",
3
- "version": "1.0.0-beta.149",
3
+ "version": "1.0.0-beta.150",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -214,11 +214,16 @@ const generator = (menuData,constantRouterComponents) => {
214
214
  if (target) {
215
215
  if (typeof target.component == "string") {
216
216
  // 解决路由name与组件name不一致导致的keeplive不生效的问题
217
- item.component = resolve =>
218
- require([`@/view/${target.component}`], data => {
219
- data.default.name = item.name;
220
- resolve(data);
221
- });
217
+ try {
218
+ let componentPath = '@/view/' + target.component;
219
+ item.component = resolve =>
220
+ require([`${componentPath}`], data => {
221
+ data.default.name = item.name;
222
+ resolve(data);
223
+ });
224
+ }catch (e) {
225
+ delete item.component
226
+ }
222
227
  } else {
223
228
  item.component = target.component;
224
229
  }
@@ -248,8 +253,9 @@ const generator = (menuData,constantRouterComponents) => {
248
253
  if (item.uri.startsWith("dida/")) {
249
254
  item.meta.notCache = true;
250
255
  try{
256
+ let path = '@/view/dida/dida-page';
251
257
  item.component = resolve => {
252
- require([`@/view/dida/dida-page`], data => {
258
+ require([`${path}`], data => {
253
259
  data.default.name = item.name;
254
260
  resolve(data);
255
261
  });
@@ -270,10 +276,11 @@ const generator = (menuData,constantRouterComponents) => {
270
276
  item.query = query;
271
277
  path = path.substr(0,path.indexOf("?"));
272
278
  }
273
- let component = require(`@/view/${path}`);
279
+ let componentPath = '@/view/' + path;
280
+ let component = require(`${componentPath}`);
274
281
  if (component) {
275
282
  item.component = resolve => {
276
- require([`@/view/${path}`], data => {
283
+ require([`${componentPath}`], data => {
277
284
  data.default.name = item.name;
278
285
  resolve(data);
279
286
  });
package/utils/platform.js CHANGED
@@ -1,3 +1,5 @@
1
+ import {deepCopy} from './assist'
2
+
1
3
  export const TOKEN_KEY = 'lambo-token'
2
4
 
3
5
  export const COOKIE_KEY = 'lambo-sso-key'
@@ -644,6 +646,173 @@ export const isOpenBlank = (menu) => {
644
646
  return false;
645
647
  }
646
648
 
649
+ /**
650
+ * 判断应用是否为移动应用
651
+ * @param menu
652
+ */
653
+ export const isMobileApp = (app) => {
654
+ if (app.extendProps && app.extendProps.is_mobile_app && app.extendProps.is_mobile_app == '1') {
655
+ return true;
656
+ }
657
+ if (app.setting && app.setting.is_mobile_app && app.setting.is_mobile_app == '1') {
658
+ return true;
659
+ }
660
+ return false;
661
+ }
662
+
663
+ /**
664
+ * 获取pc应用列表
665
+ * @param appList
666
+ * @returns {*[]}
667
+ */
668
+ export const getPCAppList = (appList) => {
669
+ let finalList = []
670
+ if(appList) {
671
+ for (let app of appList) {
672
+ if (!isMobileApp(app)) {
673
+ finalList.push(app);
674
+ }
675
+ }
676
+ }
677
+ return finalList;
678
+ }
679
+
680
+ /**
681
+ * 获取移动应用列表
682
+ * @param appList
683
+ * @returns {*[]}
684
+ */
685
+ export const getMobileAppList = (appList) => {
686
+ let finalList = []
687
+ if(appList) {
688
+ for (let app of appList) {
689
+ if (isMobileApp(app)) {
690
+ finalList.push(app);
691
+ }
692
+ }
693
+ }
694
+ return finalList;
695
+ }
696
+
697
+ /**
698
+ * 获取一级菜单作为顶级导航
699
+ * @param permissionList
700
+ * @param appType
701
+ * @returns {*[]}
702
+ */
703
+ export const buildNavListByMenu = (permissionList,appType) => {
704
+ let navList = []
705
+ if (permissionList) {
706
+ let permissions = permissionList.filter(item => item.hasOwnProperty('pid') && item.pid == '0')
707
+ for (let per of permissions) {
708
+ if (appType && appType == 'sc') {
709
+ let nav = {
710
+ "data" : deepCopy(per),
711
+ "orderNo": per.orders,
712
+ "application": {
713
+ "extendProps": per.extension ? JSON.parse(per.extension) : "",
714
+ "appId": per.permissionId,
715
+ "appBizCode": per.permissionValue,
716
+ "appName": per.title,
717
+ "appDesc": per.description,
718
+ "appUrl": per.uri,
719
+ "icon": per.icon,
720
+ "appStatus": 1,
721
+ "manageUnitId": "",
722
+ "protocolType": null,
723
+ "grantTypes": null,
724
+ "logoutUrl": null,
725
+ "redirectUrls": null,
726
+ "codeExpiresIn": null,
727
+ "idTokenExpiresIn": null,
728
+ "accessTokenExpiresIn": null,
729
+ "clientId": "",
730
+ "clientSecret": "",
731
+ "isEnableSso": false,
732
+ "isShare": false,
733
+ "referAppId": null,
734
+ "externalId": null,
735
+ "callerAppId": null,
736
+ "orderNo": 1,
737
+ "parentId": null,
738
+ "appType": null,
739
+ "relativeName": null,
740
+ "shortName": null,
741
+ "authType": "1",
742
+ "isLower": null
743
+ },
744
+ "basepath": per.uri,
745
+ "appId": per.permissionId,
746
+ "icon": per.icon,
747
+ "name": per.name,
748
+ "extendProps": per.extension ? JSON.parse(per.extension) : "",
749
+ "title": per.title,
750
+ "type": "00",
751
+ "status": 1
752
+ }
753
+ navList.push(nav)
754
+ } else {
755
+ let nav = {
756
+ "data" : deepCopy(per),
757
+ "id": per.id,
758
+ "appId": per.permissionId,
759
+ "systemId": per.systemId,
760
+ "icon": per.icon,
761
+ "banner": null,
762
+ "theme": null,
763
+ "basepath": per.uri,
764
+ "status": 1,
765
+ "name": per.name,
766
+ "title": per.type,
767
+ "type": "00",
768
+ "setting": "",
769
+ "description": per.description,
770
+ "orders": per.orders,
771
+ "createTime": 1710772466000,
772
+ "updateTime": 1710772466000
773
+ }
774
+ navList.push(nav)
775
+ }
776
+ }
777
+ }
778
+ return navList;
779
+ }
780
+
781
+ /**
782
+ * 判断是否为子菜单
783
+ * @param permissionList
784
+ * @param pid
785
+ * @param per
786
+ * @returns {boolean|boolean|*}
787
+ */
788
+ export const isChildPermission = (permissionList, pid, per) => {
789
+ if (permissionList && pid && per && per.pid) {
790
+ let res = permissionList.find(item => item.hasOwnProperty('permissionId') && per.hasOwnProperty('pid') && item.permissionId == per.pid)
791
+ if (res && res.permissionId && per.permissionId == pid) {
792
+ return true;
793
+ } else {
794
+ return isChildPermission(permissionList, pid, res)
795
+ }
796
+ }
797
+ return false;
798
+ }
799
+ /**
800
+ * 获取所有子菜单
801
+ * @param permissionList
802
+ * @param pid
803
+ */
804
+ export const getChildPermissions = (permissionList, pid) => {
805
+ let res = []
806
+ if (permissionList && pid) {
807
+ for (let permission of permissionList) {
808
+ if (isChildPermission(permissionList, pid, permission)) {
809
+ res.push(permission);
810
+ }
811
+ }
812
+ }
813
+ return res;
814
+ }
815
+
647
816
  /**
648
817
  * getPreviousTagIndex
649
818
  * @param tagList