Case 1 -- Extend a new management page via iFrame

Feedback


The iPortal back-end management module supports adding a specified HTML page to the management menu via iFrame. The customized effect is as follows. In the following figure, a new management item named "iFrame Embedded Page" is added.

The process of extending the management menu via iFrame is as follows:

Step 1: Coding the js file of the extension development page as follows:

function GenerateRoutes(UserAddVue) {

  const route = [

    {

      path: '/user-add-page-children1',

      name: 'UserAddPage',

      component: UserAddVue,

      meta: { icon: 'select', title: 'iFrame Embedded Page', keepAlive: true, src: 'https://iportal.supermap.io/iportal' ,permission: ['portal:custom:extendsPage:viewPage1']}

    }

  ];

  return route;

}

let addByUrl = {

  GenerateRoutes: GenerateRoutes

};

window.addByUrl = addByUrl;

The GenerateRoutes in the above code is the routing function, which is described as follows:

For more information about the routing function, please refer to: Vue Router.

Step 2: Find the index.json file in the %SuperMap iPortal_HOME%\webapps\iportal\resources\admin-ui\extend directory (if there is no such file, create one with the same name) and write the contents as follows:

{

    "routerName": "GenerateRoutes",

    "libraryName": "addByUrl",

    "addDependsToVue": "",

    "jsUrl": [

        "/iportal/resources/admin-ui/extend/addByUrl.js"

    ]

}

Step 3 (Optional): Edit the permissions.json in the %SuperMap iPortal_HOME%\webapps\iportal\resources\admin-ui\extend directory, write the custom permission expressions in the first step in json format. The permissions list of Roles Management can automatically add the custom permissions set in the permission.json file. Both Chinese and English are supported. The example is as follows:

{

    "permissions":[

      {

        "permission": "portal:custom:admin:extendsPage:viewPage1",

        "label": {

          "zh": "查看iframe扩展示例页面",

          "en": "View iframe extended page"

        }

      }

    ]

}

When complete, save the files. Log in iPortal as an administrator, you can see the extended content in the menu of the management page.

Note:

1)If garbed characters occur, please change the encoding format of the file to UTF-8.

2)If an HTTP 404 problem occurs when refreshed the newly extended management page, you need to add the following configuration in the urlrewrite.xml file in the %SuperMap iPortal_HOME%\webapps\iportal\WEB-INF directory:

<rule>

        <name>addPage</name>

        <from>/admin-ui/user-add-page-children1$</from>

        <to>/admin-ui/index-iPortal.html</to>

</rule>