实现简单登录成功页面并传递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) { .then(function (response) {
var data = response.data; var data = response.data;
if (data.code == 200) { 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 { } else {
alert(data.message) alert(data.message)
} }

View File

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