✨ 登录后跳转至之前访问界面(暂只支持文章详情页+个人主页)
This commit is contained in:
parent
b79977863c
commit
1335dd9786
@ -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,7 +163,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$store.commit('setActiveMenu', 'login')
|
this.$store.commit('setActiveMenu', 'login');
|
||||||
|
this.$set(this, 'historyUrl', this.$route.query.historyUrl || '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -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