The new Java project studies online notes -day17 (IX)

3.4 front-end
3.4.1 Needs Analysis
in the user front-end engineering center (xc-ui-pc-learning ) to develop exit pages. 3.4.2 Api method of
increasing a user exit in the center api engineering methods
in a method of increasing base module login.js follows:
[mw_shl_code = AppleScript, to true] / Exit / Export = const Zimbabwe Logout the params => {
return http.requestPost ( '/ OpenAPI / the auth / userLogout ');}
[/ mw_shl_code]
3.4.3 exit page
1, the user exits the page created in the center of engineering
reference:
The new Java project studies online notes -day17 (IX)

2, routing configuration

[mw_shl_code=applescript,true]import Logout from '@/module/home/page/logout.vue';
import order_pay from '@/module/order/page/order_pay.vue';
// import LoginMini from '@/module/home/page/login_mini.vue';
export default [{
path: '/',
component: Home,
name: '个人中心',
hidden: true
},
{
path: '/login',
component: Login,
name: 'Login',
hidden: true
},
{
path: '/logout',[/mw_shl_code]
[mw_shl_code=applescript,true] component: Logout,
name: 'Logout',
hidden: true
},
....[/mw_shl_code]
3、退出方法 退出成功清除页面的sessionStorage 参考logout.vue
in the hook method created withdraw the request method

[mw_shl_code=applescript,true]created(){ loginApi.logout({}).then((res) => {
if(res.success){ sessionStorage.removeItem('activeUser');
this.$message('退出成功');
this.logoutsuccess = true
}else{
this.logoutsuccess = false
}
},
(res) => {
this.logoutsuccess = false
}); },
[/mw_shl_code]
3.4.4连接到退出页面
修改include/header.html

[mw_shl_code=applescript,true]<a href="javascript:;" @click="logout" v‐if="logined == true">退出</a>
[/mw_shl_code]
在include/header.html中添加element-ui库:

[mw_shl_code = applescript, true] < script src = "/ css / el / index.js"> </ script> js added to this head of the lowermost [/ mw_shl_code]
Zimbabwe Logout follows:

[mw_shl_code = AppleScript, to true] Zimbabwe Logout: function () {
. the this $ Confirm The ( 'confirmation to quit?', 'tips', {
}) the then (() => {.
// Jump to unify landing
window.location = " http://ucenter.xuecheng.com/#/logout "
}) the catch (() => {.
});
},
[/ mw_shl_code]
3.4.5 test
1, the user is logged
2, click exit

Guess you like

Origin blog.51cto.com/13517854/2425675