Commit dee252cd by FE

share modify

parent 66b17ab7
(window.webpackJsonp=window.webpackJsonp||[]).push([[51],{1228:function(e,t,a){},1285:function(e,t,a){"use strict";a.r(t);a(41);var n=a(12),c=a.n(n),o=a(5),s=a(7),i=a(6),r=a(8),l=a(9),m=a(0),d=a.n(m),h=a(16),u=a(722),p=a(1222),y=a.n(p),E=a(28),_=a(3),b=(a(1228),a(1229),a(1230),function(e){function t(e){var a;return Object(o.a)(this,t),(a=Object(i.a)(this,Object(r.a)(t).call(this,e))).initCommand=function(){a.setState({command:"".concat(API.m,"/pythonShare?id=").concat(Object(_.c)("id"),"&type=").concat(Object(_.c)("type"),"&ques=").concat(Object(_.c)("ques"),"&from=python")})},a.initPageStatus=function(){"barcode"===Object(_.c)("from")&&a.setState({entryMode:0}),"python"===Object(_.c)("from")&&a.setState({entryMode:2}),"1"===Object(_.c)("type")&&a.setState({isShare:!0}),"2"===Object(_.c)("type")&&a.setState({isShare:!1}),a.setState({type:Object(_.c)("ques")||"1"})},a.handleFetchInfo=function(){var e=Object(_.c)("id")||10;_.d.get("".concat(API.home,"/m/it/share/show"),{params:{id:e}}).then(function(e){var t=e.data,n=t.code,c=t.data;200===n&&a.setState({data:c})})},a.handleToSend=function(e){var t=a.props.history,n=a.state,c=n.isShare,o=n.entryMode;if(_.b.isWeixin){t.push("/pythonShare?id=".concat(Object(_.c)("id"),"&type=").concat(Object(_.c)("type"),"&ques=").concat(Object(_.c)("ques"),"&from=python")),a.setState({entryMode:1});var s="",i=a.formatTitle(e);0===o||c||(s="\u6211\u5728".concat(e.course_name,"\u7684").concat(i,"\u9047\u5230\u4e86\u56f0\u96be")),0!==o&&c&&(s="\u6211\u5df2\u5728\u3010".concat(e.course_name,"\u3011\u4e0a\u8fd0\u884c\u4e86\u884c\u4ee3\u7801\u4e86").concat(e.code_lines)),Object(_.i)({title:s,desc:i,link:encodeURI(location.href),imgUrl:e.course_img})}},a.formatTitle=function(e){var t=a.state.type;return"1"===t?"\u7ec3\u4e60-".concat(e.ques_name):"2"===t?"\u8bfe\u5802-".concat(e.video_name):void 0},a.copyToSuccess=function(){c.a.info("\u5df2\u590d\u5236\u94fe\u63a5\uff0c\u5feb\u53bb\u7c98\u8d34\u53d1\u7ed9\u597d\u53cb\u5427\uff5e"),a.setState({isCopy:!0})},a.handleToExecute=function(){a.setState({isExecute:!0})},a.handleToHide=function(){a.setState({entryMode:2})},a.state={isWechat:_.b.isWeixin,isShare:!0,type:"1",entryMode:0,isExecute:!1,isCopy:!1,command:"",data:{}},a}return Object(l.a)(t,e),Object(s.a)(t,[{key:"componentDidMount",value:function(){this.handleFetchInfo(),this.initPageStatus(),this.initCommand()}},{key:"render",value:function(){var e=this.state,t=e.isWechat,a=e.isShare,n=e.isExecute,c=e.entryMode,o=e.command,s=e.isCopy,i=e.data;return d.a.createElement(d.a.Fragment,null,d.a.createElement(E.e,{title:"Python\u57fa\u7840\u8bed\u6cd5",arrow:!0,home:!0}),d.a.createElement(S,{isWechat:t,isShare:a,isExecute:n,entryMode:c,isCopy:s,command:o,data:i,labelName:this.formatTitle(i),handleToExecute:this.handleToExecute,handleToSend:this.handleToSend,copyToSuccess:this.copyToSuccess,handleToHide:this.handleToHide}))}}]),t}(m.Component));function f(e){return d.a.createElement(y.a,{mode:"python",theme:"dracula",readOnly:!0,showPrintMargin:!1,value:e.code,style:{width:"100%",height:"100%"}})}function S(e){var t=e.isWechat,a=e.isShare,n=e.isExecute,c=e.entryMode,o=e.isCopy,s=e.command,i=e.labelName,r=e.data,l=r.head_img,m=r.nickname,p=r.code_lines,y=r.code,E=r.result,_=(r.ques_name,r.course_name),b=r.course_id,S=(r.video_name,e.handleToSend),N=e.copyToSuccess,v=e.handleToExecute,T=e.handleToHide;return d.a.createElement("div",{className:"python-container"},1===c&&t&&d.a.createElement("div",{className:"python-popup",onClick:T},d.a.createElement("div",{className:"python-header"},d.a.createElement("p",{className:"python-wechat__title"},"\u8bf7\u70b9\u51fb\u53f3\u4e0a\u89d2\u5206\u4eab"),d.a.createElement("i",{className:"iconfont iconyindao"}))),d.a.createElement("div",{className:"python-content"},d.a.createElement("div",{className:"python-user"},d.a.createElement("div",{className:"python-user__portrait"},d.a.createElement("img",{src:l,alt:""})),d.a.createElement("h2",{className:"python-user__id"},m),0===c&&a&&d.a.createElement("p",{className:"python-user__desc"},"\u5b8c\u6210\u4e86",d.a.createElement("span",null,"\u3010",i,"\u3011")),0!==c&&a&&d.a.createElement("p",{className:"python-user__desc"},"\u5728",d.a.createElement("span",null,"\u3010",_,"\u3011"),"\u5b8c\u6210\u4e86",d.a.createElement("br",null),i),0===c&&!a&&d.a.createElement("p",{className:"python-user__desc"},"\u5728",d.a.createElement("span",null,"\u3010",i,"\u3011"),"\u9047\u5230\u4e86\u56f0\u96be"),0!==c&&!a&&d.a.createElement("p",{className:"python-user__desc"},"\u5728",d.a.createElement("span",null,"\u3010",_,"\u3011"),"\u7684",d.a.createElement("br",null),d.a.createElement("span",null,i),"\u9047\u5230\u4e86\u56f0\u96be")),d.a.createElement("h4",{className:"python-code__title"},0!==c&&a&&!t?"\u8fd9\u662fTa\u7684\u7b2c".concat(p,"\u884c\u4ee3\u7801"):"\u8fd0\u884c\u7ed3\u679c"),d.a.createElement("div",{className:"python-code__content"},d.a.createElement(f,{code:0!==c&&a&&!t?y:E})),d.a.createElement("h4",{className:"python-code__title"},0!==c&&a&&!t?"\u8fd0\u884c\u7ed3\u679c":"\u4ee3\u7801"),d.a.createElement("div",{className:"python-code__content"},0!==c&&a&&!t?d.a.createElement(f,{code:n?E:""}):d.a.createElement(f,{code:y}),0!==c&&a&&!t&&!n&&d.a.createElement("button",{className:"python-button python-button__execute",onClick:v},"\u8fd0\u884c\u770b\u770b"))),0===c&&t&&d.a.createElement("button",{className:"python-button python-button__study",onClick:S},a?"\u5206\u4eab\u7ed9\u597d\u53cb":"\u53d1\u7ed9\u597d\u53cb\u6c42\u52a9"),0===c&&!t&&!o&&d.a.createElement(u.CopyToClipboard,{text:s,onCopy:N},d.a.createElement("button",{className:"python-button python-button__study"},a?"\u5206\u4eab\u7ed9\u597d\u53cb":"\u53d1\u7ed9\u597d\u53cb\u6c42\u52a9")),0===c&&!t&&o&&d.a.createElement("p",{className:"python-button__tip"},"\u5df2\u590d\u5236\u94fe\u63a5\uff0c\u5feb\u53bb\u7c98\u8d34\u53d1\u7ed9\u597d\u53cb\u5427\uff5e"),0!==c&&d.a.createElement(h.b,{className:"python-button python-button__study",to:"/python?id=".concat(b)},"\u6211\u4e5f\u8981\u5b66Python"))}t.default=b}}]);
//# sourceMappingURL=51.3298534c.chunk.js.map
\ No newline at end of file
(window.webpackJsonp=window.webpackJsonp||[]).push([[51],{1228:function(e,t,a){},1285:function(e,t,a){"use strict";a.r(t);a(41);var n=a(12),c=a.n(n),o=a(5),s=a(7),i=a(6),l=a(8),r=a(9),d=a(0),m=a.n(d),u=a(16),h=a(722),p=a(1222),y=a.n(p),E=a(28),_=a(3),b=(a(1228),a(1229),a(1230),function(e){function t(e){var a;return Object(o.a)(this,t),(a=Object(i.a)(this,Object(l.a)(t).call(this,e))).initCommand=function(){a.setState({command:"".concat(API.m,"/pythonShare?id=").concat(Object(_.c)("id"),"&type=").concat(Object(_.c)("type"),"&ques=").concat(Object(_.c)("ques"),"&origin=python")})},a.initPageStatus=function(){"barcode"===Object(_.c)("origin")&&a.setState({entryMode:0}),"python"===Object(_.c)("origin")&&a.setState({entryMode:1}),"1"===Object(_.c)("type")&&a.setState({isShare:!0}),"2"===Object(_.c)("type")&&a.setState({isShare:!1}),a.setState({type:Object(_.c)("ques")||"1"})},a.handleFetchInfo=function(){var e=Object(_.c)("id")||10;_.d.get("".concat(API.home,"/m/it/share/show"),{params:{id:e}}).then(function(e){var t=e.data,n=t.code,c=t.data;200===n&&a.setState({data:c})})},a.handleToSend=function(e){var t=a.props.history,n=a.state,c=n.isShare,o=n.entryMode;if(_.b.isWeixin){t.push("/pythonShare?id=".concat(Object(_.c)("id"),"&type=").concat(Object(_.c)("type"),"&ques=").concat(Object(_.c)("ques"),"&origin=python")),a.setState({isGuide:!0,entryMode:1});var s="",i=a.formatTitle(e);0===o||c||(s="\u6211\u5728".concat(e.course_name,"\u7684").concat(i,"\u9047\u5230\u4e86\u56f0\u96be")),0!==o&&c&&(s="\u6211\u5df2\u5728\u3010".concat(e.course_name,"\u3011\u4e0a\u8fd0\u884c\u4e86\u884c\u4ee3\u7801\u4e86").concat(e.code_lines)),Object(_.i)({title:s,desc:i,link:encodeURI(location.href),imgUrl:e.course_img})}},a.formatTitle=function(e){var t=a.state.type;return"1"===t?"\u7ec3\u4e60-".concat(e.ques_name):"2"===t?"\u8bfe\u5802-".concat(e.video_name):void 0},a.copyToSuccess=function(){c.a.info("\u5df2\u590d\u5236\u94fe\u63a5\uff0c\u5feb\u53bb\u7c98\u8d34\u53d1\u7ed9\u597d\u53cb\u5427\uff5e"),a.setState({isCopy:!0})},a.handleToExecute=function(){a.setState({isExecute:!0})},a.handleToHide=function(){a.setState({isGuide:!1})},a.state={isWechat:_.b.isWeixin,isShare:!0,type:"1",entryMode:0,isGuide:!1,isExecute:!1,isCopy:!1,command:"",data:{}},a}return Object(r.a)(t,e),Object(s.a)(t,[{key:"componentDidMount",value:function(){this.handleFetchInfo(),this.initPageStatus(),this.initCommand()}},{key:"render",value:function(){var e=this.state,t=e.isWechat,a=e.isShare,n=e.isExecute,c=e.entryMode,o=e.command,s=e.isCopy,i=e.isGuide,l=e.data;return m.a.createElement(m.a.Fragment,null,m.a.createElement(E.e,{title:"Python\u57fa\u7840\u8bed\u6cd5",arrow:!0,home:!0}),m.a.createElement(f,{isWechat:t,isShare:a,isExecute:n,entryMode:c,isGuide:i,isCopy:s,command:o,data:l,labelName:this.formatTitle(l),handleToExecute:this.handleToExecute,handleToSend:this.handleToSend,copyToSuccess:this.copyToSuccess,handleToHide:this.handleToHide}))}}]),t}(d.Component));function S(e){return m.a.createElement(y.a,{mode:"python",theme:"dracula",readOnly:!0,showPrintMargin:!1,value:e.code,style:{width:"100%",height:"100%"}})}function f(e){var t=e.isWechat,a=e.isShare,n=e.isExecute,c=e.entryMode,o=e.isCopy,s=e.command,i=e.labelName,l=e.isGuide,r=e.data,d=r.head_img,p=r.nickname,y=r.code_lines,E=r.code,_=r.result,b=r.course_name,f=r.course_id,N=e.handleToSend,v=e.copyToSuccess,T=e.handleToExecute,O=e.handleToHide;return m.a.createElement("div",{className:"python-container"},1===c&&t&&l&&m.a.createElement("div",{className:"python-popup",onClick:O},m.a.createElement("div",{className:"python-header"},m.a.createElement("p",{className:"python-wechat__title"},"\u8bf7\u70b9\u51fb\u53f3\u4e0a\u89d2\u5206\u4eab"),m.a.createElement("i",{className:"iconfont iconyindao"}))),m.a.createElement("div",{className:"python-content"},m.a.createElement("div",{className:"python-user"},m.a.createElement("div",{className:"python-user__portrait"},m.a.createElement("img",{src:d,alt:""})),m.a.createElement("h2",{className:"python-user__id"},p),0===c&&a&&m.a.createElement("p",{className:"python-user__desc"},"\u5b8c\u6210\u4e86",m.a.createElement("span",null,"\u3010",i,"\u3011")),0!==c&&a&&m.a.createElement("p",{className:"python-user__desc"},"\u5728",m.a.createElement("span",null,"\u3010",b,"\u3011"),"\u5b8c\u6210\u4e86",m.a.createElement("br",null),i),0===c&&!a&&m.a.createElement("p",{className:"python-user__desc"},"\u5728",m.a.createElement("span",null,"\u3010",i,"\u3011"),"\u9047\u5230\u4e86\u56f0\u96be"),0!==c&&!a&&m.a.createElement("p",{className:"python-user__desc"},"\u5728",m.a.createElement("span",null,"\u3010",b,"\u3011"),"\u7684",m.a.createElement("br",null),m.a.createElement("span",null,i),"\u9047\u5230\u4e86\u56f0\u96be")),m.a.createElement("h4",{className:"python-code__title"},0!==c&&a&&!t?"\u8fd9\u662fTa\u7684\u7b2c".concat(y,"\u884c\u4ee3\u7801"):"\u8fd0\u884c\u7ed3\u679c"),m.a.createElement("div",{className:"python-code__content"},m.a.createElement(S,{code:0!==c&&a&&!t?E:_})),m.a.createElement("h4",{className:"python-code__title"},0!==c&&a&&!t?"\u8fd0\u884c\u7ed3\u679c":"\u4ee3\u7801"),m.a.createElement("div",{className:"python-code__content"},0!==c&&a&&!t?m.a.createElement(S,{code:n?_:""}):m.a.createElement(S,{code:E}),0!==c&&a&&!t&&!n&&m.a.createElement("button",{className:"python-button python-button__execute",onClick:T},"\u8fd0\u884c\u770b\u770b"))),0===c&&t&&m.a.createElement("button",{className:"python-button python-button__study",onClick:N},a?"\u5206\u4eab\u7ed9\u597d\u53cb":"\u53d1\u7ed9\u597d\u53cb\u6c42\u52a9"),0===c&&!t&&!o&&m.a.createElement(h.CopyToClipboard,{text:s,onCopy:v},m.a.createElement("button",{className:"python-button python-button__study"},a?"\u5206\u4eab\u7ed9\u597d\u53cb":"\u53d1\u7ed9\u597d\u53cb\u6c42\u52a9")),0===c&&!t&&o&&m.a.createElement("p",{className:"python-button__tip"},"\u5df2\u590d\u5236\u94fe\u63a5\uff0c\u5feb\u53bb\u7c98\u8d34\u53d1\u7ed9\u597d\u53cb\u5427\uff5e"),0!==c&&m.a.createElement(u.b,{className:"python-button python-button__study",to:"/python?id=".concat(f)},"\u6211\u4e5f\u8981\u5b66Python"))}t.default=b}}]);
//# sourceMappingURL=51.d802c6ea.chunk.js.map
\ No newline at end of file
...@@ -87,8 +87,7 @@ class PythonClass extends Component { ...@@ -87,8 +87,7 @@ class PythonClass extends Component {
if(browser.isWeixin) { if(browser.isWeixin) {
history.push(`/pythonShare?id=${getParam('id')}&type=${getParam('type')}&ques=${getParam('ques')}&origin=python`); history.push(`/pythonShare?id=${getParam('id')}&type=${getParam('type')}&ques=${getParam('ques')}&origin=python`);
this.setState({ this.setState({
isGuide: true, isGuide: true
entryMode: 1
}); });
let title = ''; let title = '';
let labelName = this.formatTitle(params); let labelName = this.formatTitle(params);
...@@ -197,31 +196,10 @@ function PythonContent(props) { ...@@ -197,31 +196,10 @@ function PythonContent(props) {
handleToExecute, handleToExecute,
handleToHide handleToHide
} = props; } = props;
return ( return (
<div className="python-container"> <div className="python-container">
{/* 微信 */}
{
// (entryMode === 0 && isWechat) &&
// <div className="python-header">
// <p className="python-wechat__title">请点击右上角分享</p>
// <i className="iconfont iconyindao"></i>
// </div>
}
{/* 非微信 */}
{ {
// (entryMode === 0 && !isWechat) && isGuide &&
// <div className="python-header">
// <p className="python-wechat__title">
// {isShare? '快分享给好友吧' : '快发给好友求助吧'}
// </p>
// </div>
}
{
(entryMode === 1 && isWechat && isGuide) &&
<div className="python-popup" onClick={handleToHide}> <div className="python-popup" onClick={handleToHide}>
<div className="python-header"> <div className="python-header">
<p className="python-wechat__title">请点击右上角分享</p> <p className="python-wechat__title">请点击右上角分享</p>
...@@ -231,9 +209,7 @@ function PythonContent(props) { ...@@ -231,9 +209,7 @@ function PythonContent(props) {
} }
<div className="python-content"> <div className="python-content">
<div className="python-user"> <div className="python-user">
<div className="python-user__portrait"> <i className="python-user__portrait" style={{backgroundImage: `url(${head_img})`}}></i>
<img src={head_img} alt=""/>
</div>
<h2 className="python-user__id">{nickname}</h2> <h2 className="python-user__id">{nickname}</h2>
{/* 分享 */} {/* 分享 */}
...@@ -245,7 +221,7 @@ function PythonContent(props) { ...@@ -245,7 +221,7 @@ function PythonContent(props) {
</p> </p>
} }
{ {
(entryMode !== 0 && isShare) && (entryMode === 1 && isShare) &&
<p className="python-user__desc"> <p className="python-user__desc">
<span>{course_name}</span>完成了<br /> <span>{course_name}</span>完成了<br />
...@@ -263,7 +239,7 @@ function PythonContent(props) { ...@@ -263,7 +239,7 @@ function PythonContent(props) {
</p> </p>
} }
{ {
(entryMode !== 0 && !isShare) && (entryMode === 1 && !isShare) &&
<p className="python-user__desc"> <p className="python-user__desc">
<span>{course_name}</span>的<br /> <span>{course_name}</span>的<br />
...@@ -272,20 +248,22 @@ function PythonContent(props) { ...@@ -272,20 +248,22 @@ function PythonContent(props) {
} }
</div> </div>
<h4 className="python-code__title"> <h4 className="python-code__title">
{entryMode !== 0 && isShare && !isWechat? `这是Ta的第${code_lines}行代码` : '运行结果'} {entryMode === 1 && isShare? `这是Ta的第${code_lines}行代码` : '运行结果'}
</h4> </h4>
<div className="python-code__content"> <div className="python-code__content">
<SelfAceEditor code={entryMode !== 0 && isShare && !isWechat? code : result} /> <SelfAceEditor code={entryMode === 1 && isShare? code : result} />
</div> </div>
<h4 className="python-code__title">{entryMode !== 0 && isShare && !isWechat? '运行结果' : '代码'}</h4> <h4 className="python-code__title">
{entryMode === 1 && isShare? '运行结果' : '代码'}
</h4>
<div className="python-code__content"> <div className="python-code__content">
{ {
entryMode !== 0 && isShare && !isWechat entryMode === 1 && isShare
? <SelfAceEditor code={isExecute? result : ''} /> ? <SelfAceEditor code={isExecute? result : ''} />
: <SelfAceEditor code={code} /> : <SelfAceEditor code={code} />
} }
{ {
(entryMode !== 0 && isShare && !isWechat && !isExecute) && (entryMode === 1 && isShare && !isExecute) &&
<button className="python-button python-button__execute" onClick={handleToExecute}>运行看看</button> <button className="python-button python-button__execute" onClick={handleToExecute}>运行看看</button>
} }
</div> </div>
...@@ -316,7 +294,7 @@ function PythonContent(props) { ...@@ -316,7 +294,7 @@ function PythonContent(props) {
} }
{ {
entryMode !== 0 && entryMode === 1 &&
<Link className="python-button python-button__study" to={`/python?id=${course_id}`}>我也要学Python</Link> <Link className="python-button python-button__study" to={`/python?id=${course_id}`}>我也要学Python</Link>
} }
</div> </div>
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
border-radius: 50%; border-radius: 50%;
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
background-size: cover;
img { img {
display: block; display: block;
......
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