diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index 7b9c86a..91b2b20 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -62,9 +62,9 @@ .then(function (response) { var data = response.data; if (data.code == 200) { - - var param = "?token=" + data.data.token + "&name=" + data.data.name; - window.location.href = encodeURI("success.html" + param) + //中文需要进行两次encodeURI转码( encodeURI:把URI字符串采用UTF-8编码格式转化成escape格式的字符串) + var param = "?token=" + data.data.token + "&name=" + encodeURI(encodeURI(data.data.name)); + window.location.href ="success.html" + param } else { alert(data.message) } diff --git a/src/main/resources/templates/success.html b/src/main/resources/templates/success.html index 8117017..175dcac 100644 --- a/src/main/resources/templates/success.html +++ b/src/main/resources/templates/success.html @@ -26,6 +26,7 @@ }, mounted: function () { this.token = this.getData("token"); + //只需要转一次码 this.name = decodeURI(this.getData("name")); }, methods: {