{"version":3,"sources":["components/activity/invite.js"],"names":["Invite","props","_this","Object","_Users_zhanghaozhe_server_mr_julyedu_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_2__","this","_Users_zhanghaozhe_server_mr_julyedu_node_modules_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__","_Users_zhanghaozhe_server_mr_julyedu_node_modules_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__","call","getUserList","http","get","concat","API","home","then","res","_res$data","data","code","msg","setState","userList","antd_mobile_lib_toast__WEBPACK_IMPORTED_MODULE_1___default","a","info","getHotValue","_res$data2","hotValue","hot_value","inviteFriends","user","hasError","history","push","inviteCode","blessing_invite_code","is_weixin","wxShare","title","desc","link","encodeURI","location","origin","jsCookie","imgUrl","showTip","isWeiXin","replaceState","closeMark","state","uid","shareuid","getParam","nextProps","_this$state","react__WEBPACK_IMPORTED_MODULE_7___default","createElement","className","style","width","onClick","length","Fragment","map","item","index","key","src","avatar","name","Component","connect"],"mappings":"0NAQMA,cACJ,SAAAA,EAAYC,GAAO,IAAAC,EAAA,OAAAC,OAAAC,EAAA,EAAAD,CAAAE,KAAAL,IACjBE,EAAAC,OAAAG,EAAA,EAAAH,CAAAE,KAAAF,OAAAI,EAAA,EAAAJ,CAAAH,GAAAQ,KAAAH,KAAMJ,KAmCRQ,YAAc,WACZC,IAAKC,IAAL,GAAAC,OAAYC,IAAIC,KAAhB,0BAA6CC,KAAK,SAAAC,GAAO,IAAAC,EAC/BD,EAAIE,KAAvBC,EADkDF,EAClDE,KAAMD,EAD4CD,EAC5CC,KAAME,EADsCH,EACtCG,IACL,MAATD,EACDjB,EAAKmB,SAAS,CACZC,SAAUJ,IAGZK,EAAAC,EAAMC,KAAKL,EAAK,MA5CHlB,EAiDnBwB,YAAc,WACZhB,IAAKC,IAAL,GAAAC,OAAYC,IAAIC,KAAhB,wBAA2CC,KAAK,SAAAC,GAAO,IAA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U,aAAb,2CAEC,KAILrC,EAASyC,OAAS,EAChBN,EAAAjC,EAAAkC,cAAA,OAAKC,UAAU,aAES,IAApBrC,EAASyC,QAAgBzC,EAAS2C,IAAI,SAACC,EAAMC,GAC3C,OACEV,EAAAjC,EAAAkC,cAAA,OAAKC,UAAU,iCAAiCS,IAAKD,GACnDV,EAAAjC,EAAAkC,cAAA,OAAKC,UAAU,aACbF,EAAAjC,EAAAkC,cAAA,OAAKC,UAAU,cAAcU,IAAKH,EAAKI,SACvCb,EAAAjC,EAAAkC,cAAA,OAAKC,UAAU,aAAaO,EAAKK,UAQzCjD,EAASyC,OAAS,GAAKzC,EAAS2C,IAAI,SAACC,EAAMC,GACzC,OACEV,EAAAjC,EAAAkC,cAAA,OAAKC,UAAU,kBAAkBS,IAAKD,GACpCV,EAAAjC,EAAAkC,cAAA,OAAKC,UAAU,aACbF,EAAAjC,EAAAkC,cAAA,OAAKC,UAAU,cAAcU,IAAKH,EAAKI,SACvCb,EAAAjC,EAAAkC,cAAA,OAAKC,UAAU,aAAaO,EAAKK,WAQ7C,MAKJxB,GACEU,EAAAjC,EAAAkC,cAAA,OAAKC,UAAU,cAAcG,QAASzD,KAAK6C,WACzCO,EAAAjC,EAAAkC,cAAA,OAAKC,UAAU,cAAf,kFAIEX,EACES,EAAAjC,EAAAkC,cAAA,OAAKC,UAAU,eAEf,cArMGa,aAiNNC,sBACb,SAAAtB,GAAK,MAAK,CAACpB,KAAMoB,EAAMpB,OACvB,KAFa0C,CAGbzE","file":"mrstatic/js/Invite.d0f87368.chunk.js","sourcesContent":["import React, { Component } from 'react';\nimport {connect} from \"react-redux\"\nimport './index.scss';\nimport { http, getParam, is_weixin, wxShare, getC } from '@/utils';\nimport {Toast} from \"antd-mobile\";\nimport jsCookie from 'js-cookie';\n\n\nclass Invite extends Component {\n constructor(props) {\n super(props);\n this.state = {\n isWeiXin: false,\n showTip: false,\n hotValue: 0,\n userList: [],\n }\n }\n\n componentWillMount() {\n let uid = jsCookie.get('uid');\n let shareuid = getParam('shareuid');\n if(uid === shareuid) {\n \n } else {\n if(getParam('new')) {\n this.props.history.push(`/activity?shareuid=${shareuid}&code=${inviteCode}`);\n }\n }\n }\n\n componentDidMount() {\n if(!this.props.user.hasError) {\n this.getUserList();\n this.getHotValue();\n }\n }\n\n componentWillReceiveProps(nextProps) {\n if(!nextProps.user.hasError) {\n this.getUserList();\n this.getHotValue();\n }\n }\n\n getUserList = () => {\n http.get(`${API.home}/sys/user/invite/list`).then(res => {\n let {code, data, msg} = res.data;\n if(code === 200) {\n this.setState({\n userList: data\n });\n } else {\n Toast.info(msg, 2);\n }\n });\n }\n\n getHotValue = () => {\n http.get(`${API.home}/sys/user/hot/value`).then(res => {\n let {code, data, msg} = res.data;\n if(code === 200) {\n this.setState({\n hotValue: data.hot_value\n });\n } else {\n Toast.info(msg, 2);\n }\n });\n }\n\n inviteFriends = () => {\n // 未登录先去登录\n if(this.props.user.hasError) {\n this.props.history.push('/passport');\n } else {\n http.get(`${API.home}/sys/user/invite/link`).then(res => {\n let {code, data, msg} = res;\n if(code === 200) {\n let inviteCode = data.blessing_invite_code;\n if(is_weixin()) {\n // TODO 这里需要运营确定文案\n wxShare({\n title: \"哈哈哈哈哈哈哈\",\n desc: \"你的老相好在七月在线学习呢你来不来\",\n link: encodeURI(location.origin + `/invite?shareuid=${jsCookie.get('uid')}&new=1&code=${inviteCode}`),\n imgUrl: 'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/20a86c1353.jpg'\n });\n this.setState({\n showTip: true,\n isWeiXin: true,\n });\n }else{\n history.replaceState(null,null,`invite?shareuid=${jsCookie.get('uid')}&new=1&code=${inviteCode}`)\n this.setState({\n showTip: true,\n });\n }\n }else{\n Toast.info(msg, 2);\n }\n });\n }\n }\n\n closeMark = () => {\n this.setState({\n showTip: false,\n });\n }\n\n render() {\n let {userList, showTip, hotValue, isWeiXin} = this.state;\n return (\n <div className=\"activity__con\">\n <div className='banner__con'></div>\n <div className=\"invite__content\">\n <div className=\"content__one\">\n <p>邀请好友注册,每增加1人可</p>\n <div className=\"img__con\"></div>\n </div>\n\n <div className=\"content__two\">\n 福气值越高,热力值越高,中奖概率越大!\n </div>\n\n <div className=\"box__out\">\n <div className=\"box__middle\">\n <div className=\"box__inner\">\n <p>当前中奖热力值:</p>\n <p className=\"hot__value\">{hotValue}</p>\n <div className=\"hot__progress\">\n <span>0</span>\n <div className=\"progress__bar\">\n <div className=\"progress__point\" style={{'width': hotValue + '%'}}></div>\n </div>\n <span>3600</span>\n </div>\n </div>\n </div>\n </div>\n \n\n <div className=\"but__con\">\n <div className=\"button__content\" onClick={this.inviteFriends}>\n 立即邀请\n </div>\n </div>\n\n {\n userList.length > 0 ? (\n <>\n <div className=\"list__title\">\n <span>邀请好友列表</span>\n </div>\n\n <p className=\"show__new\">(仅显示新用户)</p>\n </>\n ) : (null)\n }\n\n {\n userList.length > 0 ? (\n <div className=\"list__con\">\n {\n userList.length === 1 && userList.map((item, index) => {\n return (\n <div className=\"user__item-info item__con-only\" key={index}>\n <div className=\"item__con\">\n <img className=\"user_avatar\" src={item.avatar} />\n <div className=\"user_name\">{item.name}</div>\n </div>\n </div>\n )\n })\n }\n\n {\n userList.length > 1 && userList.map((item, index) => {\n return (\n <div className=\"user__item-info\" key={index}>\n <div className=\"item__con\">\n <img className=\"user_avatar\" src={item.avatar} />\n <div className=\"user_name\">{item.name}</div>\n </div>\n </div>\n )\n })\n }\n </div>\n ) : (\n null\n )\n }\n </div>\n {\n showTip && (\n <div className=\"share__mark\" onClick={this.closeMark}>\n <div className=\"share__tip\">\n 立即分享给好友增加中奖概率\n </div>\n {\n isWeiXin ? (\n <div className=\"share__row\"></div>\n ) : (\n null\n )\n }\n </div>\n )\n }\n </div>\n )\n }\n}\n\n\nexport default connect(\n state => ({user: state.user}),\n null\n)(Invite);\n"],"sourceRoot":""}