启动icCube报告时如何获取用户名

时间:2017-08-08 13:39:43

标签: iccube-reporting

在ic3Report.html文件中,是否可以在回调函数中获取用户名?

var options = {
        root: "ic3-report/app/",
        rootLocal: "ic3-report/app-local/",
        rootVersion: "_IC3_ROOT_VERSION_",
        callback: function () {
            $('#intro').remove();
            window.ic3application = ic3.startReport(
                    {
                        <!-- ic3-start-report-options (DO NOT REMOVE - USED TO GENERATE FILES) -->
                    });
           // get user name here !
        }

    };

1 个答案:

答案 0 :(得分:2)

为了收集当前用户信息,您应该设置GVI配置。可以用适当的方法完成:

var options = {
    root: "ic3-report/app/",
    rootLocal: "ic3-report/app-local/",
    rootVersion: "_IC3_ROOT_VERSION_",
    callback: function () {
        $('#intro').remove();
        var ic3reporting = new ic3.Reporting(
                    {
                        noticesLevel: ic3.NoticeLevel.INFO,
                        dsSettings: {
                            url: GVI_URL
                        }
                    });
        ic3reporting.setupGVIConfiguration(function () {
            var userName = ic3reporting.userName();
        })
    }
};

之后,用户信息将在上下文中可用。有关详细信息,请参阅上面的代码。

更新

更强大的解决方案是将代码添加到未使用新版本报告覆盖的本地文件中。您可以在管理员&gt;中使用 ic3bootstrapLocal 功能常见JS 配置。

function ic3bootstrapLocal(options) {  
   var ic3reporting = new ic3.Reporting({
       noticesLevel: ic3.NoticeLevel.INFO,
    });

   ic3reporting.setupGVIConfiguration(function(){
      ic3reporting.userName()
      options.callback && options.callback();     
   });        
}