From eeca69ce6d4b1979db0500f6d4f8aca470fb3da1 Mon Sep 17 00:00:00 2001 From: ronger Date: Mon, 29 Jun 2020 16:57:49 +0800 Subject: [PATCH] first commit --- pages/login.vue | 11 +++++------ pages/register.vue | 14 ++++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/pages/login.vue b/pages/login.vue index 12dcfa3..7f0c883 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -77,15 +77,14 @@ password: _ts.user.password } - _ts.axios.post('/console/login', _ts.qs.stringify(data)).then(function (res) { - if (res) { - if (res.message) { - _ts.$message(res.message); + _ts.$axios.$post('/api/v1/console/login', data).then(function (res) { + if (res.data) { + if (res.data.message) { + _ts.$message(res.data.message); return false; } - _ts.$store.commit('initLogin', res.user); _ts.$router.push({ - name: 'home' + name: 'index' }) } }) diff --git a/pages/register.vue b/pages/register.vue index a1feb70..2df10ee 100644 --- a/pages/register.vue +++ b/pages/register.vue @@ -61,9 +61,11 @@ return false } let data = { - email: encodeURI(email) + email: email } - _ts.$axios.$post('/api/v1/console/get-email-code', data).then(response => { + _ts.$axios.$get('/api/v1/console/get-email-code', { + params: data + }).then(response => { if (response.data) { _ts.$message(response.data.message) } @@ -78,10 +80,10 @@ password: _ts.user.password, code: _ts.user.code } - _ts.$axios.$post('/console/register', _ts.qs.stringify(data)).then(function (res) { - if (res) { - _ts.$message(res.message); - if (res.flag && res.flag === 1) { + _ts.$axios.$post('/api/v1/console/register', data).then(function (res) { + if (res.data) { + _ts.$message(res.data.message); + if (res.data.flag && res.data.flag === 1) { setTimeout(function () { _ts.$router.push( {