Commit 880ef959 by zhanghaozhe

更新popup通用组件

parent 89ff55f8
...@@ -85,58 +85,6 @@ class BlessingPreheat extends Component { ...@@ -85,58 +85,6 @@ class BlessingPreheat extends Component {
isApp: false isApp: false
} }
} }
constructor(props) {
super(props)
this.navTop = 183
this.prevY = 0
this.state = {
userInfoList: [],
// userInfoList: [{
// token:'fcfef221e60ab7a2-92a80d5d30196999',
// uid:'545292',
// uname:'xzhtest2',
// avatar_file:''
// }],
isRule: false,
isCourse: false,
inviteVisible: false,
joinLotteryVisible: false,
timelineShareVisible: false,
showRecordList: false,
isFormal: false, // 1正式 0 预热
shareMark: false,
userInfo: {},
isSign: false,
navs: [
{
text: '积福气',
id: 'lucky-value'
},
{
text: '幸运大抽奖',
id: 'lucky-draw'
},
{
text: '预付定金',
id: 'deposit'
},
{
text: '精品特惠',
id: 'best-courses'
},
{
text: 'AI测试',
id: 'ai-test'
},
{
text: '大咖直播',
id: 'live'
},
],
index: 0,
userHasError: props.user.hasError
}
}
componentDidMount() { componentDidMount() {
this.fetchUserBlessing() this.fetchUserBlessing()
...@@ -165,35 +113,33 @@ class BlessingPreheat extends Component { ...@@ -165,35 +113,33 @@ class BlessingPreheat extends Component {
} }
}
// 获取app登录数据 // 获取app登录数据
loginInfo = (result) => { loginInfo = (result) => {
this.setState({ this.setState({
userInfoList: result userInfoList: result
}, () => { }, () => {
if(this.state.userInfoList.length){ if (this.state.userInfoList.length) {
this.props.startFetchUser() this.props.startFetchUser()
this.appLogin() this.appLogin()
} }
}) })
} }
// 保存cookie // 保存cookie
appLogin = () => { appLogin = () => {
let expires = addDays(new Date(), 90) let expires = addDays(new Date(), 90)
this.state.userInfoList.map((item, index) => { this.state.userInfoList.map((item, index) => {
Toast.info(item.uid) Toast.info(item.uid)
cookie.set("token", item.token, {expires, path: '/', domain: '.julyedu.com'}); cookie.set("token", item.token, {expires, path: '/', domain: '.julyedu.com'})
cookie.set("plat", item.plat, {expires, path: '/', domain: '.julyedu.com'}); cookie.set("plat", item.plat, {expires, path: '/', domain: '.julyedu.com'})
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'})
}); })
if (cookie.get("token") && cookie.get("uid")) { if (cookie.get("token") && cookie.get("uid")) {
this.fetchUserBlessing(); this.fetchUserBlessing()
this.setState({ this.setState({
isApp: true isApp: true
}) })
...@@ -267,8 +213,8 @@ class BlessingPreheat extends Component { ...@@ -267,8 +213,8 @@ class BlessingPreheat extends Component {
return findIndex(navs, item => item.id === str) return findIndex(navs, item => item.id === str)
} }
fetchUserBlessing() { fetchUserBlessing = () => {
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) alert(code)
...@@ -342,7 +288,7 @@ class BlessingPreheat extends Component { ...@@ -342,7 +288,7 @@ class BlessingPreheat extends Component {
} }
} }
// 邀请好友注册 // 邀请好友注册
handleToShowInvite = () => { handleToShowInvite = () => {
const isLogin = !this.props.user.hasError const isLogin = !this.props.user.hasError
if (isLogin) { if (isLogin) {
...@@ -480,38 +426,12 @@ class BlessingPreheat extends Component { ...@@ -480,38 +426,12 @@ class BlessingPreheat extends Component {
userInfo, userInfo,
isRule, isRule,
isCourse, isCourse,
inviteUrl,
inviteVisible,
isFormal, isFormal,
isServer,
serverUrl,
isSign, isSign,
showRecordList, showRecordList,
shareMark, shareMark,
index, index,
isApp isApp
} = this.state;
const {history} = this.props;
const isLogin = !this.props.user.hasError
return (
<div id={'blessing-preheat'}>
<Banner
isFormal={isFormal}
navs={navs}
toSection={this.toSection}
index={index}
/>
render() {
const {
navs,
userInfo,
isRule,
isCourse,
isFormal,
isSign,
showRecordList,
shareMark,
index
} = this.state } = this.state
const {history} = this.props const {history} = this.props
const isLogin = !this.props.user.hasError const isLogin = !this.props.user.hasError
...@@ -523,7 +443,6 @@ class BlessingPreheat extends Component { ...@@ -523,7 +443,6 @@ class BlessingPreheat extends Component {
toSection={this.toSection} toSection={this.toSection}
index={index} index={index}
/> />
{/* 积福气 */} {/* 积福气 */}
<ListHeader id={'lucky-value'} text="积福气,享受更多福利" styles={{margin: '60px 0 15px'}}/> <ListHeader id={'lucky-value'} text="积福气,享受更多福利" styles={{margin: '60px 0 15px'}}/>
<Link className="luck-draw__button" to="/blessingRank">福气排行榜></Link> <Link className="luck-draw__button" to="/blessingRank">福气排行榜></Link>
......
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