Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiguangyao
mr-julyedu
Commits
d2a0a612
Commit
d2a0a612
authored
Nov 02, 2022
by
dazhou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拼团文案需改
parent
65ff3993
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
26 deletions
+32
-26
build/mrstaticjs/togroup.013b5bb9.chunk.js.map
+2
-2
src/components/detail/group/togroup.js
+30
-24
No files found.
build/mrstaticjs/togroup.013b5bb9.chunk.js.map
View file @
d2a0a612
{"version":3,"sources":["components/detail/group/togroup.js"],"names":["ToGroup","connect","state","user","props","invitedFriends","pdd_price","number","data","browser","isWeixin","share","setState","wxShare","title","course_title","desc","link","window","location","href","imgUrl","image_name","info","toCourseDetail","id","history","push","handleToGroup","isBuy","hasError","redirectURI","includes","index","lastIndexOf","substr","assign","encodeURIComponent","from","modal","course_id","group","pdd_order_id","pddOrderId","groupon_member","person_num","is_success","is_new_user","user_info_sample_http","http","get","API","getParam","then","res","errno","course_info","course_list","countdown","is_buy","date","end_time","day","hours","minutes","seconds","setInterval","parseInt","padStart","msg","this","home","code","console","log","simpledescription","price0","price1","Info","className","onClick","cart","toHref","transparent","visible","footer","text","onPress","img","toDetail","GorupContent","userInfo","length","course","slice","map","item","weekInfo","key","Component","tip","btn","dec","groupTip","ary","num","justify","Math","random","src","avatar","alt","user_type","flag","forEach","uid","round","to"],"mappings":"iVAUMA,EADLC,aAAQ,SAACC,GAAK,MAAM,C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C5C5G,EAAKqE,OAASvE,EACd,GACD,WACC,mNAEJ+F,EACE,0BAAMtB,UAAU,YAAYC,QAAS5E,EAAMC,gBAAe,wCAChDqD,EAAS,uBAGrB4C,EAAM,uBAAGvB,UAAU,OAAK,iFAa9B,OARmB,IAAfjC,IACFsD,EAAM,uBAAGrB,UAAU,WAAS,4BAC5BsB,EACE,kBAAC,IAAI,CAACgB,GAAE,qBAAgB7G,EAAKgC,WAAauC,UAAU,WAAS,uBAM/D,yBAAKA,UAAU,iBACZpE,EACC,yBAAKoE,UAAU,kBAAkBC,QAAS5E,EAAMC,gBAC9C,yBAAK0E,UAAU,cAAY,sBACnBxE,EAAM,uFAEd,yBAAKwE,UAAU,YACb,uBAAGA,UAAU,0BAGf,KAEHqB,EACD,2BAAYG,GACZ,2BAAYF,GACXC,GACCxD,GACA,yBAAKiC,UAAU,aACb,8BACE,uBAAGA,UAAU,6BAA+B,gGAG9C,0BAAMA,UAAU,UAAQ,sBAAOlC,EAAU,yBAOpC7C,a","file":"mrstaticjs/togroup.013b5bb9.chunk.js","sourcesContent":["/* eslint-disable eqeqeq, jsx-a11y/anchor-is-valid, no-script-url */\r\nimport React, { Component } from \"react\"\r\nimport \"./togroup.scss\"\r\nimport { HeaderBar, VList } from \"../../../common\"\r\nimport { getParam, http, browser, wxShare } from \"src/utils\"\r\nimport { connect } from \"react-redux\"\r\nimport { Link } from \"react-router-dom\"\r\nimport { WingBlank, WhiteSpace, Flex, Toast, Modal } from \"antd-mobile\"\r\n\r\n@connect((state) => ({ user: state.user }))\r\nclass ToGroup extends Component {\r\n constructor(props) {\r\n super(props)\r\n this.state = {\r\n data: {},\r\n share: false,\r\n pdd_price: 0,\r\n groupon_member: [],\r\n person_num: 0, // 共多少人成团\r\n is_success: false, // 是否拼团成功\r\n number: 0, // 差几人成团\r\n isBuy: false,\r\n modal: false,\r\n pddOrderId: \"\",\r\n is_new_user: true,\r\n user_info_sample_http: false\r\n }\r\n }\r\n\r\n invitedFriends = () => {\r\n const { pdd_price, number, data } = this.state\r\n if (browser.isWeixin) {\r\n let share = this.state.share\r\n this.setState({\r\n share: !share,\r\n })\r\n wxShare({\r\n title: `【仅剩${number}个名额】我${pdd_price}元拼了《${data.course_title}》`,\r\n desc: data.course_title,\r\n link: window.location.href + \"&is_originator=1\",\r\n imgUrl: data.image_name,\r\n })\r\n } else {\r\n Toast.info(\"请在微信中使用分享功能!\", 2)\r\n }\r\n }\r\n\r\n componentDidMount() {\r\n http.get(`${API[\"base-api\"]}/pdd/info/${getParam(\"id\")}`).then((res) => {\r\n if (res.data.errno !== 0) {\r\n Toast.info(res.data.msg, 2)\r\n return\r\n }\r\n this.setState({\r\n data: res.data.data.course_info,\r\n pdd_price: res.data.data.pdd_price,\r\n groupon_member: res.data.data.groupon_member,\r\n is_success: res.data.data.is_success,\r\n person_num: res.data.data.person_num,\r\n course_list: res.data.data.course_list,\r\n number: res.data.data.number,\r\n pddOrderId: res.data.data.pdd_order_id,\r\n countdown: \"\",\r\n isBuy: res.data.data.is_buy,\r\n })\r\n\r\n if (res.data.data.is_success === 0) {\r\n let date = res.data.data.end_time * 1000,\r\n day = 0,\r\n hours = 0,\r\n minutes = 0,\r\n seconds = 0\r\n setInterval(() => {\r\n date -= 1000\r\n if (res.data.data.end_time > 86400) {\r\n day = `${parseInt(date / (3600000 * 24))}`.padStart(2, 0)\r\n hours = `${parseInt(\r\n (date - day * 3600000 * 24) / 3600000\r\n )}`.padStart(2, 0)\r\n minutes = `${parseInt(\r\n (date - day * 3600000 * 24 - hours * 3600000) / 60000\r\n )}`.padStart(2, 0)\r\n this.setState({\r\n countdown: `${day}天${hours}时${minutes}分`,\r\n })\r\n } else {\r\n hours = `${parseInt(date / (60 * 60 * 1000))}`.padStart(2, 0)\r\n minutes = `${parseInt((date - hours * 3600000) / 60000)}`.padStart(\r\n 2,\r\n 0\r\n )\r\n seconds = `${parseInt(\r\n (date - hours * 3600000 - minutes * 60000) / 1000\r\n )}`.padStart(2, 0)\r\n this.setState({\r\n countdown: `${hours}:${minutes}:${seconds}`,\r\n })\r\n }\r\n }, 1000)\r\n }\r\n })\r\n if (!this.state.user_info_sample_http) {\r\n http.get(`${API.home}/m/user_info_sample/0`).then((res) => {\r\n if (res.data.code === 200) {\r\n console.log('已经登录');\r\n } else {\r\n //为登录,去登录\r\n console.log('去登录');\r\n // this.props.history.push(\"/passport\", { from: this.props.location })\r\n }\r\n this.setState({ is_new_user: res.data.data.is_new_user, user_info_sample_http: true })\r\n })\r\n }\r\n\r\n }\r\n\r\n toCourseDetail = (id) => {\r\n const { history } = this.props\r\n history.push(`/detail?id=${id}`, { href: \"/classify\" })\r\n return false\r\n }\r\n\r\n handleToGroup = () => {\r\n const { isBuy = false, data = {} } = this.state\r\n const { user, history, location } = this.props\r\n if (user.hasError) {\r\n if (browser.isWeixin) {\r\n let redirectURI = window.location.href\r\n if (\r\n redirectURI.includes(\"code=\") &&\r\n redirectURI.includes(\"state=STATE\")\r\n ) {\r\n let index = redirectURI.lastIndexOf(\"code=\")\r\n redirectURI = redirectURI.substr(0, index - 1)\r\n }\r\n window.location.assign(\r\n `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx23dac6775ac82877&redirect_uri=${encodeURIComponent(\r\n redirectURI\r\n )}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`\r\n )\r\n } else {\r\n history.push(\"/passport\", { from: location })\r\n }\r\n return\r\n }\r\n\r\n if (!isBuy) {\r\n history.push(`/order?id=${data.course_id}`, {\r\n group: 1,\r\n pdd_order_id: this.state.pddOrderId,\r\n })\r\n } else {\r\n this.setState({\r\n modal: true,\r\n })\r\n }\r\n }\r\n\r\n render() {\r\n const {\r\n data: { course_id, course_title, simpledescription, price0, price1 },\r\n is_success,\r\n course_list,\r\n is_new_user\r\n } = this.state\r\n const Info = (\r\n <div className=\"info\">\r\n <p className=\"title\" onClick={() => this.toCourseDetail(course_id)}>\r\n {course_title}\r\n </p>\r\n <p className=\"contact text-overflow-2\">{simpledescription}</p>\r\n <div className=\"des\">\r\n <p className=\"course-price\">\r\n <span className=\"new\">¥{price1}</span>\r\n <span className=\"old\">¥{price0}</span>\r\n </p>\r\n </div>\r\n </div>\r\n )\r\n return (\r\n <div className=\"to-group-box\">\r\n <HeaderBar title=\"拼团\" cart={false} toHref={\"/\"}></HeaderBar>\r\n <Modal\r\n transparent\r\n visible={this.state.modal}\r\n title=\"提示\"\r\n footer={[\r\n {\r\n text: \"确定\",\r\n onPress: () => {\r\n this.setState({\r\n modal: false,\r\n })\r\n this.props.history.push(\"/\")\r\n },\r\n },\r\n ]}\r\n >\r\n <p>您已经购买过该课程~</p>\r\n </Modal>\r\n {!is_success && (\r\n <VList\r\n img={this.state.data.image_name}\r\n id={this.state.data.course_id}\r\n info={Info}\r\n toDetail={this.toCourseDetail}\r\n />\r\n )}\r\n\r\n <GorupContent\r\n data={this.state}\r\n invitedFriends={this.invitedFriends}\r\n handleToGroup={this.handleToGroup}\r\n userInfo={this.props.user}\r\n />\r\n\r\n <WhiteSpace></WhiteSpace>\r\n <div className=\"group-course\">\r\n <div className=\"top-title\">\r\n <span>本周特惠</span>\r\n {/* <Link to={`/preferential`} className=\"more\">\r\n 更多<i className=\"iconfont iconiconfront-70\"></i>\r\n </Link> */}\r\n </div>\r\n {course_list &&\r\n course_list.length > 0 &&\r\n course_list[0].course &&\r\n course_list[0].course.length > 0 &&\r\n course_list[0].course.slice(0, 4).map((item) => {\r\n let weekInfo = (\r\n <div className=\"info\">\r\n <p\r\n className=\"title\"\r\n onClick={() => this.toCourseDetail(item.course_id)}\r\n >\r\n {/* <Link to={`/detail?id=${item.course_id}`}> */}\r\n {item.course_title}\r\n {/* </Link> */}\r\n </p>\r\n <p className=\"contact text-overflow-2\">\r\n {item.simpledescription}\r\n </p>\r\n <div className=\"des\">\r\n <p className=\"course-price\">\r\n <span className=\"new\">¥{item.pdd_price}</span>\r\n <span className=\"old\">¥{item.price0}</span>\r\n </p>\r\n </div>\r\n </div>\r\n )\r\n return (\r\n <VList\r\n img={item.image_name}\r\n key={item.course_id}\r\n id={item.course_id}\r\n info={weekInfo}\r\n toDetail={this.toCourseDetail}\r\n />\r\n )\r\n })}\r\n </div>\r\n </div>\r\n )\r\n }\r\n}\r\n\r\nfunction GorupContent(props) {\r\n console.log('GorupContent------data:',props)\r\n let tip, btn, dec, groupTip\r\n const {\r\n pdd_price,\r\n data,\r\n groupon_member,\r\n is_success,\r\n person_num,\r\n share,\r\n number,\r\n countdown,\r\n is_new_user\r\n } = props.data\r\n const { userInfo } = props\r\n let ary = [],\r\n num = number\r\n\r\n while (num != 0) {\r\n ary.push(num)\r\n num--\r\n }\r\n groupTip = (\r\n <div className=\"group-user-list\">\r\n <Flex justify=\"center\" className=\"imgList\">\r\n {groupon_member.map((item) => {\r\n return (\r\n <div className=\"imgContainer\" key={Math.random()}>\r\n <img className=\"imgname\" src={item.avatar} alt=\"\" />\r\n {item.user_type === 1 ? (\r\n <div className=\"leaderFlag\">\r\n <span>团长</span>\r\n </div>\r\n ) : null}\r\n </div>\r\n )\r\n })}\r\n {ary.map((item) => {\r\n return (\r\n <div className=\"imgContainer\" key={Math.random()}>\r\n <div className=\"imgname\">\r\n <i className=\"iconfont iconwode-xianxing no-body\"></i>\r\n </div>\r\n </div>\r\n )\r\n })}\r\n </Flex>\r\n </div>\r\n )\r\n\r\n if (groupon_member && groupon_member.length > 0) {\r\n let flag = false\r\n !userInfo.hasError &&\r\n groupon_member.forEach((item) => {\r\n if (item.uid == userInfo.data.uid) {\r\n flag = true\r\n }\r\n })\r\n if (flag) {\r\n\r\n tip = (\r\n is_new_user ? <p className=\"tip\">{`拼团省¥${Math.round(\r\n data.price1 - pdd_price,\r\n 2\r\n )}元`}</p> :\r\n <p>您已是七月的老朋友,快开团邀请好友加入吧(老用户自动开新团)</p>\r\n )\r\n btn = (\r\n <span className=\"group-btn\" onClick={props.invitedFriends}>\r\n 邀请好友参团 {countdown} 后结束\r\n </span>\r\n )\r\n dec = <p className=\"dec\">分享到3个群后,成团率高达98%</p>\r\n } else {\r\n if (getParam(\"is_originator\") == 1) {\r\n tip = (\r\n is_new_user ? <p className=\"tip\">{`拼团省¥${Math.round(\r\n data.price1 - pdd_price,\r\n 2\r\n )}元`}</p> :\r\n <p>您已是七月的老朋友,快开团邀请好友加入吧(老用户自动开新团)</p>\r\n )\r\n btn = (\r\n is_new_user ? <a\r\n href=\"javascript:;\"\r\n className=\"group-btn\"\r\n onClick={props.handleToGroup}\r\n >\r\n 一键参团\r\n </a>:<a\r\n href=\"javascript:;\"\r\n className=\"group-btn\"\r\n onClick={props.handleToGroup}\r\n >\r\n 一键开团\r\n </a>\r\n )\r\n } else {\r\n tip = (\r\n is_new_user ? <p className=\"tip\">{`拼团省¥${Math.round(\r\n data.price1 - pdd_price,\r\n 2\r\n )}元`}</p> :\r\n <p>您已是七月的老朋友,快开团邀请好友加入吧(老用户自动开新团)</p>\r\n )\r\n btn = (\r\n <span className=\"group-btn\" onClick={props.invitedFriends}>\r\n 邀请好友参团 {countdown} 后结束\r\n </span>\r\n )\r\n dec = <p className=\"dec\">分享到3个群后,成团率高达98%</p>\r\n }\r\n }\r\n }\r\n\r\n if (is_success === 1) {\r\n tip = <p className=\"success\">拼团成功</p>\r\n btn = (\r\n <Link to={`/detail?id=${data.course_id}`} className=\"tostudy\">\r\n 去学习\r\n </Link>\r\n )\r\n }\r\n return (\r\n <div className=\"gorup-content\">\r\n {share ? (\r\n <div className=\"groupSuccessMbc\" onClick={props.invitedFriends}>\r\n <div className=\"tipContent\">\r\n {`还差${number}人,分享到3个群,成团率高达98%`}\r\n </div>\r\n <div className=\"tipArrow\">\r\n <i className=\"iconfont iconyindao\"></i>\r\n </div>\r\n </div>\r\n ) : null}\r\n\r\n {tip}\r\n <WingBlank>{groupTip}</WingBlank>\r\n <WingBlank>{btn}</WingBlank>\r\n {dec}\r\n {!is_success && (\r\n <div className=\"group-dec\">\r\n <span>\r\n <i className=\"iconfont iconiconfront-1\"></i>\r\n ·好友参团 ·人满成交 ·人不满退款\r\n </span>\r\n <span className=\"allNum\">{`累计${person_num}人成团`}</span>\r\n </div>\r\n )}\r\n </div>\r\n )\r\n}\r\n\r\nexport default ToGroup\r\n"],"sourceRoot":""}
{"version":3,"sources":["components/detail/group/togroup.js"],"names":["ToGroup","connect","state","user","props","invitedFriends","pdd_price","number","data","browser","isWeixin","share","setState","wxShare","title","course_title","desc","link","window","location","href","imgUrl","image_name","info","toCourseDetail","id","history","push","handleToGroup","isBuy","hasError","redirectURI","includes","index","lastIndexOf","substr","assign","encodeURIComponent","from","modal","course_id","group","pdd_order_id","pddOrderId","groupon_member","person_num","is_success","is_new_user","user_info_sample_http","http","get","API","getParam","then","res","errno","course_info","course_list","countdown","is_buy","date","end_time","day","hours","minutes","seconds","setInterval","parseInt","padStart","msg","this","home","code","console","log","simpledescription","price0","price1","Info","className","onClick","cart","toHref","transparent","visible","footer","text","onPress","img","toDetail","GorupContent","userInfo","length","course","slice","map","item","weekInfo","key","Component","tip","btn","dec","groupTip","ary","num","justify","Math","random","src","avatar","alt","user_type","flag","forEach","uid","round","to"],"mappings":"iVAUMA,EADLC,aAAQ,SAACC,GAAK,MAAM,CAAEC,KAAMD,EAAMC,QAAQ,qDAEzC,WAAYC,GAAQ,IAAD,EAehB,OAfgB,qBACjB,cAAMA,IAiBRC,eAAiB,WACf,MAAoC,EAAKH,MAAjCI,EAAS,EAATA,UAAWC,EAAM,EAANA,OAAQC,EAAI,EAAJA,KAC3B,GAAIC,IAAQC,SAAU,CACpB,IAAIC,EAAQ,EAAKT,MAAMS,MACvB,EAAKC,SAAS,CACZD,OAAQA,IAEVE,YAAQ,CACNC,MAAM,qBAAD,OAAQP,EAAM,yCAAQD,EAAS,mCAAOE,EAAKO,aAAY,UAC5DC,KAAMR,EAAKO,aACXE,KAAMC,OAAOC,SAASC,KAAO,mBAC7BC,OAAQb,EAAKc,kBAGf,IAAMC,KAAK,2EAAgB,IAE9B,EAuEDC,eAAiB,SAACC,GAGhB,OAFoB,EAAKrB,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yBAAKiC,UAAU,aACb,8BACE,uBAAGA,UAAU,6BAA+B,gGAG9C,0BAAMA,UAAU,UAAQ,sBAAOlC,EAAU,yBAOpC7C,a","file":"mrstaticjs/togroup.013b5bb9.chunk.js","sourcesContent":["/* eslint-disable eqeqeq, jsx-a11y/anchor-is-valid, no-script-url */\r\nimport React, { Component } from \"react\"\r\nimport \"./togroup.scss\"\r\nimport { HeaderBar, VList } from \"../../../common\"\r\nimport { getParam, http, browser, wxShare } from \"src/utils\"\r\nimport { connect } from \"react-redux\"\r\nimport { Link } from \"react-router-dom\"\r\nimport { WingBlank, WhiteSpace, Flex, Toast, Modal } from \"antd-mobile\"\r\n\r\n@connect((state) => ({ user: state.user }))\r\nclass ToGroup extends Component {\r\n constructor(props) {\r\n super(props)\r\n this.state = {\r\n data: {},\r\n share: false,\r\n pdd_price: 0,\r\n groupon_member: [],\r\n person_num: 0, // 共多少人成团\r\n is_success: false, // 是否拼团成功\r\n number: 0, // 差几人成团\r\n isBuy: false,\r\n modal: false,\r\n pddOrderId: \"\",\r\n is_new_user: true,\r\n user_info_sample_http: false\r\n }\r\n }\r\n\r\n invitedFriends = () => {\r\n const { pdd_price, number, data } = this.state\r\n if (browser.isWeixin) {\r\n let share = this.state.share\r\n this.setState({\r\n share: !share,\r\n })\r\n wxShare({\r\n title: `【仅剩${number}个名额】我${pdd_price}元拼了《${data.course_title}》`,\r\n desc: data.course_title,\r\n link: window.location.href + \"&is_originator=1\",\r\n imgUrl: data.image_name,\r\n })\r\n } else {\r\n Toast.info(\"请在微信中使用分享功能!\", 2)\r\n }\r\n }\r\n\r\n componentDidMount() {\r\n http.get(`${API[\"base-api\"]}/pdd/info/${getParam(\"id\")}`).then((res) => {\r\n if (res.data.errno !== 0) {\r\n Toast.info(res.data.msg, 2)\r\n return\r\n }\r\n this.setState({\r\n data: res.data.data.course_info,\r\n pdd_price: res.data.data.pdd_price,\r\n groupon_member: res.data.data.groupon_member,\r\n is_success: res.data.data.is_success,\r\n person_num: res.data.data.person_num,\r\n course_list: res.data.data.course_list,\r\n number: res.data.data.number,\r\n pddOrderId: res.data.data.pdd_order_id,\r\n countdown: \"\",\r\n isBuy: res.data.data.is_buy,\r\n })\r\n\r\n if (res.data.data.is_success === 0) {\r\n let date = res.data.data.end_time * 1000,\r\n day = 0,\r\n hours = 0,\r\n minutes = 0,\r\n seconds = 0\r\n setInterval(() => {\r\n date -= 1000\r\n if (res.data.data.end_time > 86400) {\r\n day = `${parseInt(date / (3600000 * 24))}`.padStart(2, 0)\r\n hours = `${parseInt(\r\n (date - day * 3600000 * 24) / 3600000\r\n )}`.padStart(2, 0)\r\n minutes = `${parseInt(\r\n (date - day * 3600000 * 24 - hours * 3600000) / 60000\r\n )}`.padStart(2, 0)\r\n this.setState({\r\n countdown: `${day}天${hours}时${minutes}分`,\r\n })\r\n } else {\r\n hours = `${parseInt(date / (60 * 60 * 1000))}`.padStart(2, 0)\r\n minutes = `${parseInt((date - hours * 3600000) / 60000)}`.padStart(\r\n 2,\r\n 0\r\n )\r\n seconds = `${parseInt(\r\n (date - hours * 3600000 - minutes * 60000) / 1000\r\n )}`.padStart(2, 0)\r\n this.setState({\r\n countdown: `${hours}:${minutes}:${seconds}`,\r\n })\r\n }\r\n }, 1000)\r\n }\r\n })\r\n if (!this.state.user_info_sample_http) {\r\n http.get(`${API.home}/m/user_info_sample/0`).then((res) => {\r\n if (res.data.code === 200) {\r\n console.log('已经登录');\r\n } else {\r\n //为登录,去登录\r\n console.log('去登录');\r\n // this.props.history.push(\"/passport\", { from: this.props.location })\r\n }\r\n this.setState({ is_new_user: res.data.data.is_new_user, user_info_sample_http: true })\r\n })\r\n }\r\n\r\n }\r\n\r\n toCourseDetail = (id) => {\r\n const { history } = this.props\r\n history.push(`/detail?id=${id}`, { href: \"/classify\" })\r\n return false\r\n }\r\n\r\n handleToGroup = () => {\r\n const { isBuy = false, data = {} } = this.state\r\n const { user, history, location } = this.props\r\n if (user.hasError) {\r\n if (browser.isWeixin) {\r\n let redirectURI = window.location.href\r\n if (\r\n redirectURI.includes(\"code=\") &&\r\n redirectURI.includes(\"state=STATE\")\r\n ) {\r\n let index = redirectURI.lastIndexOf(\"code=\")\r\n redirectURI = redirectURI.substr(0, index - 1)\r\n }\r\n window.location.assign(\r\n `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx23dac6775ac82877&redirect_uri=${encodeURIComponent(\r\n redirectURI\r\n )}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`\r\n )\r\n } else {\r\n history.push(\"/passport\", { from: location })\r\n }\r\n return\r\n }\r\n\r\n if (!isBuy) {\r\n history.push(`/order?id=${data.course_id}`, {\r\n group: 1,\r\n pdd_order_id: this.state.pddOrderId,\r\n })\r\n } else {\r\n this.setState({\r\n modal: true,\r\n })\r\n }\r\n }\r\n\r\n render() {\r\n const {\r\n data: { course_id, course_title, simpledescription, price0, price1 },\r\n is_success,\r\n course_list,\r\n is_new_user\r\n } = this.state\r\n const Info = (\r\n <div className=\"info\">\r\n <p className=\"title\" onClick={() => this.toCourseDetail(course_id)}>\r\n {course_title}\r\n </p>\r\n <p className=\"contact text-overflow-2\">{simpledescription}</p>\r\n <div className=\"des\">\r\n <p className=\"course-price\">\r\n <span className=\"new\">¥{price1}</span>\r\n <span className=\"old\">¥{price0}</span>\r\n </p>\r\n </div>\r\n </div>\r\n )\r\n return (\r\n <div className=\"to-group-box\">\r\n <HeaderBar title=\"拼团\" cart={false} toHref={\"/\"}></HeaderBar>\r\n <Modal\r\n transparent\r\n visible={this.state.modal}\r\n title=\"提示\"\r\n footer={[\r\n {\r\n text: \"确定\",\r\n onPress: () => {\r\n this.setState({\r\n modal: false,\r\n })\r\n this.props.history.push(\"/\")\r\n },\r\n },\r\n ]}\r\n >\r\n <p>您已经购买过该课程~</p>\r\n </Modal>\r\n {!is_success && (\r\n <VList\r\n img={this.state.data.image_name}\r\n id={this.state.data.course_id}\r\n info={Info}\r\n toDetail={this.toCourseDetail}\r\n />\r\n )}\r\n\r\n <GorupContent\r\n data={this.state}\r\n invitedFriends={this.invitedFriends}\r\n handleToGroup={this.handleToGroup}\r\n userInfo={this.props.user}\r\n />\r\n\r\n <WhiteSpace></WhiteSpace>\r\n <div className=\"group-course\">\r\n <div className=\"top-title\">\r\n <span>本周特惠</span>\r\n {/* <Link to={`/preferential`} className=\"more\">\r\n 更多<i className=\"iconfont iconiconfront-70\"></i>\r\n </Link> */}\r\n </div>\r\n {course_list &&\r\n course_list.length > 0 &&\r\n course_list[0].course &&\r\n course_list[0].course.length > 0 &&\r\n course_list[0].course.slice(0, 4).map((item) => {\r\n let weekInfo = (\r\n <div className=\"info\">\r\n <p\r\n className=\"title\"\r\n onClick={() => this.toCourseDetail(item.course_id)}\r\n >\r\n {/* <Link to={`/detail?id=${item.course_id}`}> */}\r\n {item.course_title}\r\n {/* </Link> */}\r\n </p>\r\n <p className=\"contact text-overflow-2\">\r\n {item.simpledescription}\r\n </p>\r\n <div className=\"des\">\r\n <p className=\"course-price\">\r\n <span className=\"new\">¥{item.pdd_price}</span>\r\n <span className=\"old\">¥{item.price0}</span>\r\n </p>\r\n </div>\r\n </div>\r\n )\r\n return (\r\n <VList\r\n img={item.image_name}\r\n key={item.course_id}\r\n id={item.course_id}\r\n info={weekInfo}\r\n toDetail={this.toCourseDetail}\r\n />\r\n )\r\n })}\r\n </div>\r\n </div>\r\n )\r\n }\r\n}\r\n\r\nfunction GorupContent(props) {\r\n console.log('GorupContent------data:',props)\r\n let tip, btn, dec, groupTip\r\n const {\r\n pdd_price,\r\n data,\r\n groupon_member,\r\n is_success,\r\n person_num,\r\n share,\r\n number,\r\n countdown,\r\n is_new_user\r\n } = props.data\r\n const { userInfo } = props\r\n let ary = [],\r\n num = number\r\n\r\n while (num != 0) {\r\n ary.push(num)\r\n num--\r\n }\r\n groupTip = (\r\n <div className=\"group-user-list\">\r\n <Flex justify=\"center\" className=\"imgList\">\r\n {groupon_member.map((item) => {\r\n return (\r\n <div className=\"imgContainer\" key={Math.random()}>\r\n <img className=\"imgname\" src={item.avatar} alt=\"\" />\r\n {item.user_type === 1 ? (\r\n <div className=\"leaderFlag\">\r\n <span>团长</span>\r\n </div>\r\n ) : null}\r\n </div>\r\n )\r\n })}\r\n {ary.map((item) => {\r\n return (\r\n <div className=\"imgContainer\" key={Math.random()}>\r\n <div className=\"imgname\">\r\n <i className=\"iconfont iconwode-xianxing no-body\"></i>\r\n </div>\r\n </div>\r\n )\r\n })}\r\n </Flex>\r\n </div>\r\n )\r\n\r\n if (groupon_member && groupon_member.length > 0) {\r\n let flag = false\r\n !userInfo.hasError &&\r\n groupon_member.forEach((item) => {\r\n if (item.uid == userInfo.data.uid) {\r\n flag = true\r\n }\r\n })\r\n if (flag) {\r\n\r\n tip = (\r\n is_new_user ? <p className=\"tip\">{`拼团省¥${Math.round(\r\n data.price1 - pdd_price,\r\n 2\r\n )}元`}</p> :\r\n <p>您已是七月用户无法参与该团,开新团邀请尚未注册七月的加入吧</p>\r\n )\r\n btn = (\r\n <span className=\"group-btn\" onClick={props.invitedFriends}>\r\n 邀请好友参团 {countdown} 后结束\r\n </span>\r\n )\r\n dec = <p className=\"dec\">分享到3个群后,成团率高达98%</p>\r\n } else {\r\n if (getParam(\"is_originator\") == 1) {\r\n tip = (\r\n is_new_user ? <p className=\"tip\">{`拼团省¥${Math.round(\r\n data.price1 - pdd_price,\r\n 2\r\n )}元`}</p> :\r\n <p>您已是七月用户无法参与该团,开新团邀请尚未注册七月的加入吧</p>\r\n )\r\n btn = (\r\n is_new_user ? <a\r\n href=\"javascript:;\"\r\n className=\"group-btn\"\r\n onClick={props.handleToGroup}\r\n >\r\n 一键参团\r\n </a>:<a\r\n href=\"javascript:;\"\r\n className=\"group-btn\"\r\n onClick={props.handleToGroup}\r\n >\r\n 一键开团\r\n </a>\r\n )\r\n } else {\r\n tip = (\r\n is_new_user ? <p className=\"tip\">{`拼团省¥${Math.round(\r\n data.price1 - pdd_price,\r\n 2\r\n )}元`}</p> :\r\n <p>您已是七月用户无法参与该团,开新团邀请尚未注册七月的加入吧</p>\r\n )\r\n btn = (\r\n <span className=\"group-btn\" onClick={props.invitedFriends}>\r\n 邀请好友参团 {countdown} 后结束\r\n </span>\r\n )\r\n dec = <p className=\"dec\">分享到3个群后,成团率高达98%</p>\r\n }\r\n }\r\n }\r\n\r\n if (is_success === 1) {\r\n tip = <p className=\"success\">拼团成功</p>\r\n btn = (\r\n <Link to={`/detail?id=${data.course_id}`} className=\"tostudy\">\r\n 去学习\r\n </Link>\r\n )\r\n }\r\n return (\r\n <div className=\"gorup-content\">\r\n {share ? (\r\n <div className=\"groupSuccessMbc\" onClick={props.invitedFriends}>\r\n <div className=\"tipContent\">\r\n {`还差${number}人,分享到3个群,成团率高达98%`}\r\n </div>\r\n <div className=\"tipArrow\">\r\n <i className=\"iconfont iconyindao\"></i>\r\n </div>\r\n </div>\r\n ) : null}\r\n\r\n {tip}\r\n <WingBlank>{groupTip}</WingBlank>\r\n <WingBlank>{btn}</WingBlank>\r\n {dec}\r\n {!is_success && (\r\n <div className=\"group-dec\">\r\n <span>\r\n <i className=\"iconfont iconiconfront-1\"></i>\r\n ·好友参团 ·人满成交 ·人不满退款\r\n </span>\r\n <span className=\"allNum\">{`累计${person_num}人成团`}</span>\r\n </div>\r\n )}\r\n </div>\r\n )\r\n}\r\n\r\nexport default ToGroup\r\n"],"sourceRoot":""}
\ No newline at end of file
\ No newline at end of file
src/components/detail/group/togroup.js
View file @
d2a0a612
...
@@ -23,7 +23,7 @@ class ToGroup extends Component {
...
@@ -23,7 +23,7 @@ class ToGroup extends Component {
modal
:
false
,
modal
:
false
,
pddOrderId
:
""
,
pddOrderId
:
""
,
is_new_user
:
true
,
is_new_user
:
true
,
user_info_sample_http
:
false
user_info_sample_http
:
false
,
}
}
}
}
...
@@ -102,16 +102,18 @@ class ToGroup extends Component {
...
@@ -102,16 +102,18 @@ class ToGroup extends Component {
if
(
!
this
.
state
.
user_info_sample_http
)
{
if
(
!
this
.
state
.
user_info_sample_http
)
{
http
.
get
(
`
${
API
.
home
}
/m/user_info_sample/0`
).
then
((
res
)
=>
{
http
.
get
(
`
${
API
.
home
}
/m/user_info_sample/0`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
console
.
log
(
'已经登录'
);
console
.
log
(
"已经登录"
)
}
else
{
}
else
{
//为登录,去登录
//为登录,去登录
console
.
log
(
'去登录'
);
console
.
log
(
"去登录"
)
// this.props.history.push("/passport", { from: this.props.location })
// this.props.history.push("/passport", { from: this.props.location })
}
}
this
.
setState
({
is_new_user
:
res
.
data
.
data
.
is_new_user
,
user_info_sample_http
:
true
})
this
.
setState
({
is_new_user
:
res
.
data
.
data
.
is_new_user
,
user_info_sample_http
:
true
,
})
})
})
}
}
}
}
toCourseDetail
=
(
id
)
=>
{
toCourseDetail
=
(
id
)
=>
{
...
@@ -161,7 +163,7 @@ class ToGroup extends Component {
...
@@ -161,7 +163,7 @@ class ToGroup extends Component {
data
:
{
course_id
,
course_title
,
simpledescription
,
price0
,
price1
},
data
:
{
course_id
,
course_title
,
simpledescription
,
price0
,
price1
},
is_success
,
is_success
,
course_list
,
course_list
,
is_new_user
is_new_user
,
}
=
this
.
state
}
=
this
.
state
const
Info
=
(
const
Info
=
(
<
div
className
=
"info"
>
<
div
className
=
"info"
>
...
@@ -265,7 +267,7 @@ class ToGroup extends Component {
...
@@ -265,7 +267,7 @@ class ToGroup extends Component {
}
}
function
GorupContent
(
props
)
{
function
GorupContent
(
props
)
{
console
.
log
(
'GorupContent------data:'
,
props
)
console
.
log
(
"GorupContent------data:"
,
props
)
let
tip
,
btn
,
dec
,
groupTip
let
tip
,
btn
,
dec
,
groupTip
const
{
const
{
pdd_price
,
pdd_price
,
...
@@ -276,7 +278,7 @@ function GorupContent(props) {
...
@@ -276,7 +278,7 @@ function GorupContent(props) {
share
,
share
,
number
,
number
,
countdown
,
countdown
,
is_new_user
is_new_user
,
}
=
props
.
data
}
=
props
.
data
const
{
userInfo
}
=
props
const
{
userInfo
}
=
props
let
ary
=
[],
let
ary
=
[],
...
@@ -323,13 +325,13 @@ function GorupContent(props) {
...
@@ -323,13 +325,13 @@ function GorupContent(props) {
}
}
})
})
if
(
flag
)
{
if
(
flag
)
{
tip
=
is_new_user
?
(
tip
=
(
<
p
className
=
"tip"
>
{
`拼团省¥
${
Math
.
round
(
is_new_user
?
<
p
className
=
"tip"
>
{
`拼团省¥
${
Math
.
round
(
data
.
price1
-
pdd_price
,
data
.
price1
-
pdd_price
,
2
2
)}
元`
}
<
/p>
:
)}
元`
}
<
/p
>
<
p
>
您已是七月的老朋友,快开团邀请好友加入吧(老用户自动开新团)
<
/p
>
)
:
(
<
p
>
您已是七月用户无法参与该团,开新团邀请尚未注册七月的加入吧
<
/p
>
)
)
btn
=
(
btn
=
(
<
span
className
=
"group-btn"
onClick
=
{
props
.
invitedFriends
}
>
<
span
className
=
"group-btn"
onClick
=
{
props
.
invitedFriends
}
>
...
@@ -339,21 +341,24 @@ function GorupContent(props) {
...
@@ -339,21 +341,24 @@ function GorupContent(props) {
dec
=
<
p
className
=
"dec"
>
分享到
3
个群后,成团率高达
98
%<
/p
>
dec
=
<
p
className
=
"dec"
>
分享到
3
个群后,成团率高达
98
%<
/p
>
}
else
{
}
else
{
if
(
getParam
(
"is_originator"
)
==
1
)
{
if
(
getParam
(
"is_originator"
)
==
1
)
{
tip
=
(
tip
=
is_new_user
?
(
is_new_user
?
<
p
className
=
"tip"
>
{
`拼团省¥
${
Math
.
round
(
<
p
className
=
"tip"
>
{
`拼团省¥
${
Math
.
round
(
data
.
price1
-
pdd_price
,
data
.
price1
-
pdd_price
,
2
2
)}
元`
}
<
/p>
:
)}
元`
}
<
/p
>
<
p
>
您已是七月的老朋友,快开团邀请好友加入吧(老用户自动开新团)
<
/p
>
)
:
(
<
p
>
您已是七月用户无法参与该团,开新团邀请尚未注册七月的加入吧
<
/p
>
)
)
btn
=
(
btn
=
is_new_user
?
(
is_new_user
?
<
a
<
a
href
=
"javascript:;"
href
=
"javascript:;"
className
=
"group-btn"
className
=
"group-btn"
onClick
=
{
props
.
handleToGroup
}
onClick
=
{
props
.
handleToGroup
}
>
>
一键参团
一键参团
<
/a>:<
a
<
/a
>
)
:
(
<
a
href
=
"javascript:;"
href
=
"javascript:;"
className
=
"group-btn"
className
=
"group-btn"
onClick
=
{
props
.
handleToGroup
}
onClick
=
{
props
.
handleToGroup
}
...
@@ -362,12 +367,13 @@ function GorupContent(props) {
...
@@ -362,12 +367,13 @@ function GorupContent(props) {
<
/a
>
<
/a
>
)
)
}
else
{
}
else
{
tip
=
(
tip
=
is_new_user
?
(
is_new_user
?
<
p
className
=
"tip"
>
{
`拼团省¥
${
Math
.
round
(
<
p
className
=
"tip"
>
{
`拼团省¥
${
Math
.
round
(
data
.
price1
-
pdd_price
,
data
.
price1
-
pdd_price
,
2
2
)}
元`
}
<
/p>
:
)}
元`
}
<
/p
>
<
p
>
您已是七月的老朋友,快开团邀请好友加入吧(老用户自动开新团)
<
/p
>
)
:
(
<
p
>
您已是七月用户无法参与该团,开新团邀请尚未注册七月的加入吧
<
/p
>
)
)
btn
=
(
btn
=
(
<
span
className
=
"group-btn"
onClick
=
{
props
.
invitedFriends
}
>
<
span
className
=
"group-btn"
onClick
=
{
props
.
invitedFriends
}
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment