提交 caad1e2f authored 作者: lihuihui's avatar lihuihui

修改登录

上级 4f3c83c2
...@@ -25,8 +25,17 @@ ...@@ -25,8 +25,17 @@
</li> </li>
</template> </template>
</ul> </ul>
<!-- <div class="login"><span @click="isLogin = true">用户登录</span>/<span @click="$router.push({ path: '/register' })">注册</span></div> -->
<div class="login"> <div class="login">
<template v-if="isLogin">
<span @click="handleLogout">退出</span>
</template>
<template v-else>
<span @click="handleLogin">用户登录</span>
/
<span @click="handleRegister">注册</span>
</template>
</div>
<!-- <div class="login">
<template v-if="isLogin"> <template v-if="isLogin">
<div>{{ user.nickname || user.realname }}</div> <div>{{ user.nickname || user.realname }}</div>
<span>|</span> <span>|</span>
...@@ -37,18 +46,18 @@ ...@@ -37,18 +46,18 @@
<span>|</span> <span>|</span>
<div @click="handleLogin">登录</div> <div @click="handleLogin">登录</div>
</template> </template>
</div> </div> -->
</div> </div>
</div> </div>
<login v-if="isLogin" @reg="reg" @closeMask="closeMask"></login> <vue-passport ref="passport" @ready="onReady" :options="options"></vue-passport>
</header> </header>
</template> </template>
<script> <script>
import login from './login' // import login from './login'
export default { export default {
components: { components: {
login // login
}, },
data() { data() {
return { return {
...@@ -193,7 +202,8 @@ export default { ...@@ -193,7 +202,8 @@ export default {
this.passport.logout() this.passport.logout()
this.isLogin = false this.isLogin = false
window.G.UserInfo = {} window.G.UserInfo = {}
this.$router.push('/') // window.location.href = window.location.href
// this.$router.push('/')
}, },
onReady(isLogin, user = {}) { onReady(isLogin, user = {}) {
// this.isLogin = isLogin // this.isLogin = isLogin
...@@ -202,7 +212,7 @@ export default { ...@@ -202,7 +212,7 @@ export default {
}, },
loginSuccess(data) { loginSuccess(data) {
this.passport.checkLoginStatus((isLogin, user = {}) => { this.passport.checkLoginStatus((isLogin, user = {}) => {
// this.isLogin = isLogin this.isLogin = isLogin
this.user = user this.user = user
this.$router.push('/my') this.$router.push('/my')
}) })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论