Commit 96011e8a authored by 沈翠玲's avatar 沈翠玲

修改pad点不了退出登录的问题

parent f34a3ca6
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
margin: 0 300px 0 300px; margin: 0 300px 0 300px;
padding: 10px 0 0 0; padding: 10px 0 0 0;
font-weight: 550; font-weight: 550;
font-size: 60px; font-size: 50px;
letter-spacing: 10px; letter-spacing: 10px;
text-align: center; text-align: center;
text-shadow: 0 0 6px #9fc4f5, 0 0 6px #9fc4f5; text-shadow: 0 0 6px #9fc4f5, 0 0 6px #9fc4f5;
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
display: inline-block; display: inline-block;
border-radius: 5px; border-radius: 5px;
cursor: pointer; cursor: pointer;
z-index: 99999;
transition: background-color 0.3s; transition: background-color 0.3s;
font-size: 20px; font-size: 20px;
background-color: rgba(255, 255, 255, 0.1); background-color: rgba(255, 255, 255, 0.1);
......
import React, { useState,useEffect } from 'react'; import React, { useState,useEffect, useCallback } from 'react';
import { useIntl, useModel } from 'umi'; import { useIntl, useModel } from 'umi';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import styles from './Welcome.less'; import styles from './Welcome.less';
...@@ -25,14 +25,23 @@ const Welcome: React.FC = () => { ...@@ -25,14 +25,23 @@ const Welcome: React.FC = () => {
const goToPlaylist = (link: string) => { const goToPlaylist = (link: string) => {
history.push(link); history.push(link);
}; };
/** const tologinOut = async () => {
* 退出登录,并且将当前的 url 保存
*/
const loginOut = async () => {
setInitialState((s) => ({ ...s, currentUser: undefined }));
await outLogin(); await outLogin();
history.replace({ pathname: '/user/login' }); history.replace({ pathname: '/user/login' });
}; };
/**
* 退出登录,并且将当前的 url 保存
*/
const loginOut = useCallback(() => {
try {
console.log('准备退出登录')
setInitialState((s) => ({ ...s, currentUser: undefined }));
tologinOut();
console.log('准备退出登录1')
} catch (e) {
console.log('退出失败', e)
}
}, [setInitialState]);
return ( return (
<div className={styles.container}> <div className={styles.container}>
<div className={styles.logout} onClick={() => loginOut()}> <div className={styles.logout} onClick={() => loginOut()}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment