youzanyun-devtool-worker
Version:
- web - ws - proxy
80 lines (79 loc) • 3.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const spring4js_nodejs_1 = require("spring4js-nodejs");
let SideBarService = class SideBarService {
constructor() {
this._requestShowMenu = new spring4js_nodejs_1.Emitter();
this.onRequestShowMenu = this._requestShowMenu.registerEvent;
this._closeMenu = new spring4js_nodejs_1.Emitter();
this.onCloseMenu = this._closeMenu.registerEvent;
}
async requestShowMenu(workbenchId, projectId, menuType) {
let menuItems = await this.getMenu(workbenchId, projectId, menuType);
this._requestShowMenu.fire({
workbenchId,
menuItems
});
}
async closeMenu(workbenchId, projectId) {
this._closeMenu.fire({
workbenchId,
});
}
async getMenu(workbenchId, projectId, menuType) {
let menu;
if (menuType == 'h5-extension') {
menu = await this.h5ExtensionService.getMenu(workbenchId, projectId);
}
else if (['wsc-mp', 'retail-mp', 'beauty-mp'].indexOf(menuType) > -1) {
let appHandler = await this.miniProgramService.getAppCustomHandler({ projectId, youzanMpName: menuType });
menu = await appHandler.getMenu();
}
else if (['wsc-pc'].indexOf(menuType) > -1) {
menu = await this.pcCustomService.getMenu({ projectId, workbenchId, appName: menuType });
}
else if ('backend-helper' === menuType) {
menu = await this.backendHelperService.getMenu({ projectId, workbenchId });
}
else if (menuType == 'design-platform') {
menu = await this.designPlatformService.getMenu({ workbenchId, projectId });
}
else {
menu = [{
key: 'home',
title: '首页',
param: {
contentType: 'webview',
url: `/html/welcome?projectId=${projectId}&workbenchId=${workbenchId}`,
}
}];
}
return menu;
}
};
tslib_1.__decorate([
spring4js_nodejs_1.Resource()
], SideBarService.prototype, "configService", void 0);
tslib_1.__decorate([
spring4js_nodejs_1.Resource()
], SideBarService.prototype, "projectService", void 0);
tslib_1.__decorate([
spring4js_nodejs_1.Resource()
], SideBarService.prototype, "h5ExtensionService", void 0);
tslib_1.__decorate([
spring4js_nodejs_1.Resource()
], SideBarService.prototype, "miniProgramService", void 0);
tslib_1.__decorate([
spring4js_nodejs_1.Resource()
], SideBarService.prototype, "pcCustomService", void 0);
tslib_1.__decorate([
spring4js_nodejs_1.Resource()
], SideBarService.prototype, "backendHelperService", void 0);
tslib_1.__decorate([
spring4js_nodejs_1.Resource()
], SideBarService.prototype, "designPlatformService", void 0);
SideBarService = tslib_1.__decorate([
spring4js_nodejs_1.Service()
], SideBarService);
exports.default = SideBarService;