Commit 7b4a11ae by xuzhenghua

cookie

parent 6ea13222
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -118,11 +118,13 @@ class BlessingPreheat extends Component { ...@@ -118,11 +118,13 @@ class BlessingPreheat extends Component {
loginInfo = (result) => { loginInfo = (result) => {
this.setState({ this.setState({
userInfoList: result userInfoList: result
}) }, () => {
if (this.state.userInfoList.length !== 0) { if(this.state.userInfoList.length){
this.props.startFetchUser() this.props.startFetchUser()
this.appLogin() this.appLogin()
} }
})
} }
// 保存cookie // 保存cookie
appLogin = () => { appLogin = () => {
...@@ -134,8 +136,6 @@ class BlessingPreheat extends Component { ...@@ -134,8 +136,6 @@ class BlessingPreheat extends Component {
cookie.set("uid", item.uid, {expires, path: '/', domain: '.julyedu.com'}); cookie.set("uid", item.uid, {expires, path: '/', domain: '.julyedu.com'});
cookie.set("uname", item.uname, {expires, path: '/', domain: '.julyedu.com'}); cookie.set("uname", item.uname, {expires, path: '/', domain: '.julyedu.com'});
cookie.set("avatar_file", item.avatar_file, {expires, path: '/', domain: '.julyedu.com'}); cookie.set("avatar_file", item.avatar_file, {expires, path: '/', domain: '.julyedu.com'});
alert(cookie.get("uid"))
}); });
if (cookie.get("token") && cookie.get("uid")) { if (cookie.get("token") && cookie.get("uid")) {
...@@ -219,6 +219,7 @@ class BlessingPreheat extends Component { ...@@ -219,6 +219,7 @@ class BlessingPreheat extends Component {
const {userInfo} = this.state; const {userInfo} = this.state;
http.get(`${API.home}/sys/user/blessing`).then(res => { http.get(`${API.home}/sys/user/blessing`).then(res => {
const {code, data} = res.data const {code, data} = res.data
alert(code)
if (code === 200) { if (code === 200) {
this.setState({ this.setState({
isSign: !!data.today_signed, isSign: !!data.today_signed,
...@@ -229,6 +230,7 @@ class BlessingPreheat extends Component { ...@@ -229,6 +230,7 @@ class BlessingPreheat extends Component {
inviteBlessing: (data.types_total_blessing_value && data.types_total_blessing_value.invite) ? data.types_total_blessing_value.invite : 0, inviteBlessing: (data.types_total_blessing_value && data.types_total_blessing_value.invite) ? data.types_total_blessing_value.invite : 0,
}) })
}) })
alert(cookie.get('uid'))
if (data.is_login === 1) { if (data.is_login === 1) {
this.handleToSign() this.handleToSign()
} }
......
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