✨ 登录后跳转至之前访问界面(暂只支持文章详情页+个人主页)
This commit is contained in:
parent
b79977863c
commit
1335dd9786
@ -52,10 +52,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapState} from 'vuex';
|
import {mapState} from 'vuex';
|
||||||
|
|
||||||
const Cookie = process.client ? require('js-cookie') : undefined
|
const Cookie = process.client ? require('js-cookie') : undefined
|
||||||
export default {
|
export default {
|
||||||
name: "login",
|
name: "login",
|
||||||
middleware: 'notAuthenticated',
|
middleware: 'notAuthenticated',
|
||||||
data() {
|
data() {
|
||||||
@ -69,7 +69,8 @@
|
|||||||
},
|
},
|
||||||
forget: false,
|
forget: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
loginLoading: false
|
loginLoading: false,
|
||||||
|
historyUrl: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -113,10 +114,14 @@
|
|||||||
localStorage.setItem('user', JSON.stringify(user))
|
localStorage.setItem('user', JSON.stringify(user))
|
||||||
_ts.$store.commit('setUser', user) // mutating to store for client rendering
|
_ts.$store.commit('setUser', user) // mutating to store for client rendering
|
||||||
Cookie.set('auth', auth)
|
Cookie.set('auth', auth)
|
||||||
|
if (_ts.historyUrl) {
|
||||||
|
window.location.href = _ts.historyUrl
|
||||||
|
} else {
|
||||||
_ts.$router.push({
|
_ts.$router.push({
|
||||||
name: 'index'
|
name: 'index'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -158,39 +163,40 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$store.commit('setActiveMenu', 'login')
|
this.$store.commit('setActiveMenu', 'login');
|
||||||
}
|
this.$set(this, 'historyUrl', this.$route.query.historyUrl || '');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.icon-rymcu {
|
.icon-rymcu {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
display: block;
|
display: block;
|
||||||
height: 4rem;
|
height: 4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.verify .verify-wrap {
|
.verify .verify-wrap {
|
||||||
/*width: 60%;*/
|
/*width: 60%;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
.flex-inline {
|
.flex-inline {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.verify .intro {
|
.verify .intro {
|
||||||
padding: 50px;
|
padding: 50px;
|
||||||
background-color: #f1f7fe;
|
background-color: #f1f7fe;
|
||||||
/*width: 40%;*/
|
/*width: 40%;*/
|
||||||
color: #616161;
|
color: #616161;
|
||||||
}
|
}
|
||||||
|
|
||||||
.verify__sign {
|
.verify__sign {
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vditor-reset {
|
.vditor-reset {
|
||||||
font-variant-ligatures: no-common-ligatures;
|
font-variant-ligatures: no-common-ligatures;
|
||||||
font-family: Helvetica Neue, Luxi Sans, DejaVu Sans, Tahoma, Hiragino Sans GB, Microsoft Yahei, sans-serif, Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji, Segoe UI Symbol, Android Emoji, EmojiSymbols;
|
font-family: Helvetica Neue, Luxi Sans, DejaVu Sans, Tahoma, Hiragino Sans GB, Microsoft Yahei, sans-serif, Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji, Segoe UI Symbol, Android Emoji, EmojiSymbols;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
@ -198,5 +204,5 @@
|
|||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -22,12 +22,12 @@
|
|||||||
<div v-if="oauth.idUser !== user.idUser">
|
<div v-if="oauth.idUser !== user.idUser">
|
||||||
<el-button type="primary" v-if="isFollow" @click="cancelFollowUser(user.idUser)" plain>取消关注</el-button>
|
<el-button type="primary" v-if="isFollow" @click="cancelFollowUser(user.idUser)" plain>取消关注</el-button>
|
||||||
<el-button type="primary" v-else @click="followUser(user.idUser)" plain>关注</el-button>
|
<el-button type="primary" v-else @click="followUser(user.idUser)" plain>关注</el-button>
|
||||||
<el-button @click="gotoChats" plain>聊天</el-button>
|
<el-button v-show="false" @click="gotoChats" plain>聊天</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<el-button type="primary" @click="login" plain>关注</el-button>
|
<el-button type="primary" @click="login" plain>关注</el-button>
|
||||||
<el-button @click="login" plain>聊天</el-button>
|
<el-button v-show="false" @click="login" plain>聊天</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -151,7 +151,10 @@ export default {
|
|||||||
},
|
},
|
||||||
login() {
|
login() {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/login'
|
path: '/login',
|
||||||
|
query: {
|
||||||
|
historyUrl: window.location.href
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user