Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #3606 #3609

Merged
merged 3 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apollo-portal/src/main/resources/static/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<!-- bootstrap.js -->
<script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>

<script src="../vendor/lodash.min.js"></script>
<script src="vendor/lodash.min.js"></script>

<!--valdr-->
<script src="vendor/valdr/valdr.min.js" type="text/javascript"></script>
Expand Down
14 changes: 14 additions & 0 deletions apollo-portal/src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,20 @@ <h5 ng-bind="app.name"></h5>
<!-- bootstrap.js -->
<script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>

<script type="application/javascript">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we use the same code as that in login.html?

    <script type="application/javascript">
        $(function () {
            $.get("prefix-path", function (result) {
                window.localStorage.setItem("prefixPath", result);
            });
        });
    </script>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

异步会有加载先后顺序问题,导致prefix-path还未获取,就已经开始加载需要前缀的资源了,从而引起了404问题

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

login.html中的这段代码是否也要做同样的修改?

    <script type="application/javascript">
        $(function () {
            $.get("prefix-path", function (result) {
                window.localStorage.setItem("prefixPath", result);
            });
        });
    </script>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

测试了一下,的确也有上述异步加载问题(会导致zh-CN.json文件404)。又补充提交了 login.html 的修改

function getPrefixPath() {
$.ajax({
method: 'get',
async: false,
url: 'prefix-path',
success: function (res) {
window.localStorage.setItem("prefixPath", res);
}
})
}
getPrefixPath();
</script>

<script type="application/javascript" src="scripts/app.js"></script>
<script type="application/javascript" src="scripts/services/AppService.js"></script>
<script type="application/javascript" src="scripts/services/EnvService.js"></script>
Expand Down
19 changes: 14 additions & 5 deletions apollo-portal/src/main/resources/static/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,20 @@
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script>

<script type="application/javascript">
function getPrefixPath() {
$.ajax({
method: 'get',
async: false,
url: 'prefix-path',
success: function (res) {
window.localStorage.setItem("prefixPath", res);
}
})
}
getPrefixPath();
</script>

<script type="application/javascript" src="scripts/app.js"></script>
<script type="application/javascript" src="scripts/AppUtils.js"></script>
<script type="application/javascript" src="scripts/directive/directive.js"></script>
Expand All @@ -306,11 +320,6 @@
$(this).addClass('active');
e.preventDefault();
});

$.get("prefix-path", function(result){
window.localStorage.setItem("prefixPath",result);
});

});

</script>
Expand Down