@lambo-design/shared 1.0.0-beta.202 → 1.0.0-beta.203
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 +1 -1
- package/styles/image/inspur.png +0 -0
- package/utils/platform.js +119 -3
- package/utils/theme.js +1 -0
package/package.json
CHANGED
|
Binary file
|
package/utils/platform.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {deepCopy} from './assist'
|
|
2
|
-
import _ from 'lodash'
|
|
3
|
-
import
|
|
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
|
|
|
@@ -1147,3 +1150,116 @@ export const addTimestamp = ($route) => {
|
|
|
1147
1150
|
$route.query = query;
|
|
1148
1151
|
return $route;
|
|
1149
1152
|
}
|
|
1153
|
+
/**
|
|
1154
|
+
* 根据配置信息修改系统信息
|
|
1155
|
+
* @param systemInfo
|
|
1156
|
+
*/
|
|
1157
|
+
export const changeSystemInfo = async (systemInfo) => {
|
|
1158
|
+
let defaultSystemInfo = {
|
|
1159
|
+
layoutSize: 'small',
|
|
1160
|
+
systemLogo: systemLogo,
|
|
1161
|
+
logoWidth: '150px',
|
|
1162
|
+
systemName: sessionStorage.getItem('systemName') ? sessionStorage.getItem('systemName') : config.title,
|
|
1163
|
+
nameSize: 1,
|
|
1164
|
+
navType: 'dropdown',
|
|
1165
|
+
rightTopOptButtonList: ['collect', 'fullScreen'],
|
|
1166
|
+
rightTopShowFunList: ['theme', 'personalCenter', 'noticeList', 'logout'],
|
|
1167
|
+
menuLogo: '1',
|
|
1168
|
+
titleShow: 'wrap',
|
|
1169
|
+
menuScaling: '1',
|
|
1170
|
+
footerInfo: 'Copyright © 2021 浪潮数字商业科技有限公司 版权所有<br> 辽ICP备11001865号-3',
|
|
1171
|
+
showTheme: '',
|
|
1172
|
+
theme: 'default',
|
|
1173
|
+
tabNum: 5,
|
|
1174
|
+
topMenu: 4,
|
|
1175
|
+
};
|
|
1176
|
+
if (systemInfo) {
|
|
1177
|
+
systemInfo = Object.assign(defaultSystemInfo, systemInfo);
|
|
1178
|
+
} else {
|
|
1179
|
+
systemInfo = defaultSystemInfo;
|
|
1180
|
+
}
|
|
1181
|
+
if (systemInfo.logo) {
|
|
1182
|
+
systemInfo.systemLogo = config.ossServerContext + '/anon/system/file/get/' + systemInfo.logo
|
|
1183
|
+
} else {
|
|
1184
|
+
systemInfo.systemLogo = ''
|
|
1185
|
+
}
|
|
1186
|
+
sessionStorage.setItem('systemLogo', systemInfo.systemLogo)
|
|
1187
|
+
if (systemInfo.systemLogo) {
|
|
1188
|
+
let link = document.querySelector("link[rel*='icon']") || document.createElement('link');
|
|
1189
|
+
link.setAttribute('href', systemInfo.systemLogo);
|
|
1190
|
+
if (!link.getAttribute('rel')) {
|
|
1191
|
+
link.setAttribute('rel', 'icon');
|
|
1192
|
+
}
|
|
1193
|
+
if (!link.getAttribute('type')) {
|
|
1194
|
+
link.setAttribute('type', 'image/png');
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
if (systemInfo.logoWidth) {
|
|
1198
|
+
systemInfo.logoWidth = systemInfo.logoWidth + ''
|
|
1199
|
+
}
|
|
1200
|
+
if (systemInfo.systemName) {
|
|
1201
|
+
document.title = systemInfo.systemName
|
|
1202
|
+
sessionStorage.setItem('systemName', systemInfo.systemName)
|
|
1203
|
+
}
|
|
1204
|
+
if (localStorage.getItem('theme')) {
|
|
1205
|
+
systemInfo.theme = localStorage.getItem('theme')
|
|
1206
|
+
}
|
|
1207
|
+
changeByThemeKey(systemInfo.theme)
|
|
1208
|
+
if (localStorage.getItem('themeIdCurrent')) {
|
|
1209
|
+
systemInfo.showTheme = localStorage.getItem('themeIdCurrent')
|
|
1210
|
+
}
|
|
1211
|
+
if (systemInfo.showTheme) {
|
|
1212
|
+
let showTheme = systemInfo.showTheme
|
|
1213
|
+
let split = showTheme.split('-')
|
|
1214
|
+
let systemForm = null
|
|
1215
|
+
if (split[0]) {
|
|
1216
|
+
let res = await ajax.get(config.upmsServerContext + '/anon/system/themeLineList?themeId=' + split[0])
|
|
1217
|
+
if (res.data.code == 200) {
|
|
1218
|
+
systemForm = res.data.data[0]
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
if (systemForm) {
|
|
1222
|
+
changeThemeByThemeId(split[0], split[1], split[2], systemForm)
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
if (!systemInfo.rightTopOptButtonList || systemInfo.rightTopOptButtonList.length <= 0) {
|
|
1226
|
+
systemInfo.rightTopOptButtonList = ['collect', 'fullScreen'];
|
|
1227
|
+
}
|
|
1228
|
+
if (!systemInfo.rightTopShowFunList || systemInfo.rightTopShowFunList.length <= 0) {
|
|
1229
|
+
systemInfo.rightTopShowFunList = ['theme', 'personalCenter', 'noticeList', 'logout']
|
|
1230
|
+
}
|
|
1231
|
+
return systemInfo;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
export const buildHomeConfigs = (settings) => {
|
|
1235
|
+
let result = [];
|
|
1236
|
+
if (settings && settings.length > 0) {
|
|
1237
|
+
let settingMap = {}
|
|
1238
|
+
for (let st of settings) {
|
|
1239
|
+
let key = st.categoryCode;
|
|
1240
|
+
if (!key) {
|
|
1241
|
+
key = "otherCategory";
|
|
1242
|
+
}
|
|
1243
|
+
if (settingMap[key]) {
|
|
1244
|
+
let oldSt = settingMap[key];
|
|
1245
|
+
if (st.permit && oldSt.permit
|
|
1246
|
+
&& (st.permit.permissionType > oldSt.permit.permissionType
|
|
1247
|
+
|| (st.permit.permissionType == oldSt.permit.permissionType
|
|
1248
|
+
&& st.permit.createTime > oldSt.permit.createTime))) {
|
|
1249
|
+
settingMap[key] = st;
|
|
1250
|
+
}
|
|
1251
|
+
} else {
|
|
1252
|
+
settingMap[key] = st;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
if (settingMap['default']) {
|
|
1256
|
+
result.push(settingMap['default']);
|
|
1257
|
+
}
|
|
1258
|
+
for(let key in settingMap) {
|
|
1259
|
+
if (key != 'default') {
|
|
1260
|
+
result.push(settingMap[key])
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
return result;
|
|
1265
|
+
}
|