Skip to content

Commit

Permalink
feat: system setting support web
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Jun 23, 2022
1 parent 720c669 commit 05fb313
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,16 @@ export class SettingComponent implements OnInit {
* 解析所有模块的配置信息
*/
private init() {
if (!window.eo && !window.eo?.getFeature) {
return;
}
// if (!window.eo && !window.eo?.getFeature) {
// return;
// }
// ! this.isVisible = true;
this.settings = {};
this.nestedSettings = {};
// 获取本地设置
this.localSettings = window.eo.getSettings();
this.localSettings = window.eo?.getSettings?.() || JSON.stringify(localStorage.getItem('localSettings') || '{}');
// const featureList = window.eo.getFeature('configuration');
const modules = window.eo?.getModules();
const modules = window.eo?.getModules() || new Map([]);
// const extensitonConfigurations = [...modules.values()].filter((n) => n.contributes?.configuration);
const extensitonConfigurations = [...modules.values()].filter((n) => n.features?.configuration);
const controls = {};
Expand Down Expand Up @@ -364,8 +364,11 @@ export class SettingComponent implements OnInit {
// if (this.validateForm.status === 'INVALID') {
// return;
// }
const data = { settings: this.settings, nestedSettings: this.nestedSettings };
// 加入根据返回显示提示消息
const saved = window.eo.saveSettings({ settings: this.settings, nestedSettings: this.nestedSettings });
const saved = window.eo?.saveSettings
? window.eo.saveSettings(data)
: localStorage.setItem('localSettings', JSON.stringify(data));
if (saved) {
// this.handleCancel();
}
Expand Down

0 comments on commit 05fb313

Please sign in to comment.