实现简单登录成功页面并传递name

This commit is contained in:
xiongfeng
2022-07-05 17:45:57 +08:00
parent c0ef54f9b7
commit 7c45f81cf1
2 changed files with 7 additions and 3 deletions

View File

@@ -62,7 +62,9 @@
.then(function (response) {
var data = response.data;
if (data.code == 200) {
window.location.href = "success.html?token=" + data.data.token
var param = "?token=" + data.data.token + "&name=" + data.data.name;
window.location.href = encodeURI("success.html" + param)
} else {
alert(data.message)
}

View File

@@ -9,7 +9,7 @@
<body>
<div id="app">
<h1>这是登录成功页面</h1>
<h1>欢迎 {{name}} 登录成功~~</h1>
<h1>
token:
<span style="color: forestgreen">{{token}}</span>
@@ -21,10 +21,12 @@
new Vue({
el: '#app',
data: {
token: ''
token: '',
name:''
},
mounted: function () {
this.token = this.getData("token");
this.name = decodeURI(this.getData("name"));
},
methods: {
getData: function (name) {