@lambo-design/shared 1.0.0-beta.202 → 1.0.0-beta.204

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.202",
3
+ "version": "1.0.0-beta.204",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
Binary file
package/utils/platform.js CHANGED
@@ -1,6 +1,9 @@
1
- import {deepCopy} from './assist'
2
- import _ from 'lodash'
3
- import {formatTimestamp} from "./date";
1
+ import {deepCopy} from './assist';
2
+ import _ from 'lodash';
3
+ import config from "../config/config";
4
+ import systemLogo from '../styles/image/inspur.png';
5
+ import {changeByThemeKey, changeThemeByThemeId} from "./theme";
6
+ import ajax from "./ajax";
4
7
 
5
8
  export const TOKEN_KEY = 'lambo-token'
6
9
 
@@ -745,11 +748,12 @@ export const isMobileApp = (app) => {
745
748
  * @param appList
746
749
  * @returns {*[]}
747
750
  */
748
- export const getPCAppList = (appList) => {
751
+ export const getPCAppList = (appList,filterCenter = false) => {
749
752
  let finalList = []
750
753
  if(appList) {
751
754
  for (let app of appList) {
752
- if (!isMobileApp(app)) {
755
+ if ((!isMobileApp(app) && filterCenter && isCenterApp(app))
756
+ || (!isMobileApp(app) && !filterCenter)) {
753
757
  finalList.push(app);
754
758
  }
755
759
  }
@@ -762,17 +766,31 @@ export const getPCAppList = (appList) => {
762
766
  * @param appList
763
767
  * @returns {*[]}
764
768
  */
765
- export const getMobileAppList = (appList) => {
769
+ export const getMobileAppList = (appList,filterCenter= false) => {
766
770
  let finalList = []
767
771
  if(appList) {
768
772
  for (let app of appList) {
769
- if (isMobileApp(app)) {
773
+ if ((isMobileApp(app) && filterCenter && isCenterApp(app))
774
+ || (isMobileApp(app) && !filterCenter)) {
770
775
  finalList.push(app);
771
776
  }
772
777
  }
773
778
  }
774
779
  return finalList;
775
780
  }
781
+ /**
782
+ * 判断应用是否门户应用
783
+ * @param menu
784
+ */
785
+ export const isCenterApp = (app) => {
786
+ if (app.extendProps && app.extendProps.is_center_app && app.extendProps.is_center_app == '1') {
787
+ return true;
788
+ }
789
+ if (app.setting && app.setting.is_center_app && app.setting.is_center_app == '1') {
790
+ return true;
791
+ }
792
+ return false;
793
+ }
776
794
 
777
795
  /**
778
796
  * 获取一级菜单作为顶级导航
@@ -1147,3 +1165,116 @@ export const addTimestamp = ($route) => {
1147
1165
  $route.query = query;
1148
1166
  return $route;
1149
1167
  }
1168
+ /**
1169
+ * 根据配置信息修改系统信息
1170
+ * @param systemInfo
1171
+ */
1172
+ export const changeSystemInfo = async (systemInfo) => {
1173
+ let defaultSystemInfo = {
1174
+ layoutSize: 'small',
1175
+ systemLogo: systemLogo,
1176
+ logoWidth: '150px',
1177
+ systemName: sessionStorage.getItem('systemName') ? sessionStorage.getItem('systemName') : config.title,
1178
+ nameSize: 1,
1179
+ navType: 'dropdown',
1180
+ rightTopOptButtonList: ['collect', 'fullScreen'],
1181
+ rightTopShowFunList: ['theme', 'personalCenter', 'noticeList', 'logout'],
1182
+ menuLogo: '1',
1183
+ titleShow: 'wrap',
1184
+ menuScaling: '1',
1185
+ footerInfo: 'Copyright © 2021 浪潮数字商业科技有限公司 版权所有<br> 辽ICP备11001865号-3',
1186
+ showTheme: '',
1187
+ theme: 'default',
1188
+ tabNum: 5,
1189
+ topMenu: 4,
1190
+ };
1191
+ if (systemInfo) {
1192
+ systemInfo = Object.assign(defaultSystemInfo, systemInfo);
1193
+ } else {
1194
+ systemInfo = defaultSystemInfo;
1195
+ }
1196
+ if (systemInfo.logo) {
1197
+ systemInfo.systemLogo = config.ossServerContext + '/anon/system/file/get/' + systemInfo.logo
1198
+ } else {
1199
+ systemInfo.systemLogo = ''
1200
+ }
1201
+ sessionStorage.setItem('systemLogo', systemInfo.systemLogo)
1202
+ if (systemInfo.systemLogo) {
1203
+ let link = document.querySelector("link[rel*='icon']") || document.createElement('link');
1204
+ link.setAttribute('href', systemInfo.systemLogo);
1205
+ if (!link.getAttribute('rel')) {
1206
+ link.setAttribute('rel', 'icon');
1207
+ }
1208
+ if (!link.getAttribute('type')) {
1209
+ link.setAttribute('type', 'image/png');
1210
+ }
1211
+ }
1212
+ if (systemInfo.logoWidth) {
1213
+ systemInfo.logoWidth = systemInfo.logoWidth + ''
1214
+ }
1215
+ if (systemInfo.systemName) {
1216
+ document.title = systemInfo.systemName
1217
+ sessionStorage.setItem('systemName', systemInfo.systemName)
1218
+ }
1219
+ if (localStorage.getItem('theme')) {
1220
+ systemInfo.theme = localStorage.getItem('theme')
1221
+ }
1222
+ changeByThemeKey(systemInfo.theme)
1223
+ if (localStorage.getItem('themeIdCurrent')) {
1224
+ systemInfo.showTheme = localStorage.getItem('themeIdCurrent')
1225
+ }
1226
+ if (systemInfo.showTheme) {
1227
+ let showTheme = systemInfo.showTheme
1228
+ let split = showTheme.split('-')
1229
+ let systemForm = null
1230
+ if (split[0]) {
1231
+ let res = await ajax.get(config.upmsServerContext + '/anon/system/themeLineList?themeId=' + split[0])
1232
+ if (res.data.code == 1) {
1233
+ systemForm = res.data.data[0]
1234
+ }
1235
+ }
1236
+ if (systemForm) {
1237
+ changeThemeByThemeId(split[0], split[1], split[2], systemForm)
1238
+ }
1239
+ }
1240
+ if (!systemInfo.rightTopOptButtonList || systemInfo.rightTopOptButtonList.length <= 0) {
1241
+ systemInfo.rightTopOptButtonList = ['collect', 'fullScreen'];
1242
+ }
1243
+ if (!systemInfo.rightTopShowFunList || systemInfo.rightTopShowFunList.length <= 0) {
1244
+ systemInfo.rightTopShowFunList = ['theme', 'personalCenter', 'noticeList', 'logout']
1245
+ }
1246
+ return systemInfo;
1247
+ }
1248
+
1249
+ export const buildHomeConfigs = (settings) => {
1250
+ let result = [];
1251
+ if (settings && settings.length > 0) {
1252
+ let settingMap = {}
1253
+ for (let st of settings) {
1254
+ let key = st.categoryCode;
1255
+ if (!key) {
1256
+ key = "otherCategory";
1257
+ }
1258
+ if (settingMap[key]) {
1259
+ let oldSt = settingMap[key];
1260
+ if (st.permit && oldSt.permit
1261
+ && (st.permit.permissionType > oldSt.permit.permissionType
1262
+ || (st.permit.permissionType == oldSt.permit.permissionType
1263
+ && st.permit.createTime > oldSt.permit.createTime))) {
1264
+ settingMap[key] = st;
1265
+ }
1266
+ } else {
1267
+ settingMap[key] = st;
1268
+ }
1269
+ }
1270
+ if (settingMap['default']) {
1271
+ result.push(settingMap['default']);
1272
+ }
1273
+ for(let key in settingMap) {
1274
+ if (key != 'default') {
1275
+ result.push(settingMap[key])
1276
+ }
1277
+ }
1278
+ }
1279
+ return result;
1280
+ }
package/utils/theme.js CHANGED
@@ -13,6 +13,7 @@ const changeByThemeKey = (themeKey) => {
13
13
  changeByTheme(theme);
14
14
  if (typeof window !== 'undefined') {
15
15
  localStorage.setItem("theme", themeKey);
16
+ localStorage.setItem('themeInStyle', '1');
16
17
  }
17
18
  }
18
19
  });