Commit 66b17ab7 by FE

share

parent 3a79feda
(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),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.replace("/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.5fa83c7f.chunk.js.map
\ No newline at end of file
......@@ -17,7 +17,8 @@ class PythonClass extends Component {
isWechat: browser.isWeixin,
isShare: true,
type: '1', // 1:课后习题,2:课堂习题
entryMode: 0, // 0:扫码页,1:落地页,2:直接进入
entryMode: 0, // 0:扫码页,1:落地页
isGuide: false, // 是否展示引导
isExecute: false,
isCopy: false,
command: '',
......@@ -33,19 +34,19 @@ class PythonClass extends Component {
initCommand = () => {
this.setState({
command: `${API.m}/pythonShare?id=${getParam('id')}&type=${getParam('type')}&ques=${getParam('ques')}&from=python`
command: `${API.m}/pythonShare?id=${getParam('id')}&type=${getParam('type')}&ques=${getParam('ques')}&origin=python`
})
}
initPageStatus = () => {
if(getParam('from') === 'barcode') {
if(getParam('origin') === 'barcode') {
this.setState({
entryMode: 0
});
}
if(getParam('from') === 'python') {
if(getParam('origin') === 'python') {
this.setState({
entryMode: 2
entryMode: 1
});
}
if(getParam('type') === '1') {
......@@ -84,8 +85,9 @@ class PythonClass extends Component {
const { history } = this.props;
const { isShare, entryMode } = this.state;
if(browser.isWeixin) {
history.push(`/pythonShare?id=${getParam('id')}&type=${getParam('type')}&ques=${getParam('ques')}&from=python`);
history.push(`/pythonShare?id=${getParam('id')}&type=${getParam('type')}&ques=${getParam('ques')}&origin=python`);
this.setState({
isGuide: true,
entryMode: 1
});
let title = '';
......@@ -130,12 +132,12 @@ class PythonClass extends Component {
handleToHide = () => {
this.setState({
entryMode: 2
isGuide: false
});
}
render() {
const { isWechat, isShare, isExecute, entryMode, command, isCopy, data } = this.state;
const { isWechat, isShare, isExecute, entryMode, command, isCopy, isGuide, data } = this.state;
return (
<>
<HeaderBar
......@@ -148,6 +150,7 @@ class PythonClass extends Component {
isShare={isShare}
isExecute={isExecute}
entryMode={entryMode}
isGuide={isGuide}
isCopy={isCopy}
command={command}
data={data}
......@@ -187,7 +190,8 @@ function PythonContent(props) {
isCopy,
command,
labelName,
data: { head_img, nickname, code_lines, code, result, ques_name, course_name, course_id, video_name },
isGuide,
data: { head_img, nickname, code_lines, code, result, course_name, course_id },
handleToSend,
copyToSuccess,
handleToExecute,
......@@ -217,7 +221,7 @@ function PythonContent(props) {
}
{
(entryMode === 1 && isWechat) &&
(entryMode === 1 && isWechat && isGuide) &&
<div className="python-popup" onClick={handleToHide}>
<div className="python-header">
<p className="python-wechat__title">请点击右上角分享</p>
......
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