{"version":3,"sources":["components/examination/OpenApp/index.js","components/examination/index.js"],"names":["OpenApp","className","Examination","PureComponent","constructor","props","super","showAnswer","this","setState","isShowAnswer","state","questionData","componentDidMount","http","get","API","home","then","res","data","code","newData","Object","assign","analysis","length","split","render","ques","type_id","options","category","title","arrow","cart","dangerouslySetInnerHTML","__html","MultiChoice","showCorrect","onClick","Answer","content","React","memo","map","item","index","key","classnames","is_ans","String","fromCharCode","des","scale"],"mappings":"8NAaeA,MATC,IAER,yBAAKC,UAAU,YACX,uBAAGA,UAAU,QAAb,6DACA,kBAAC,IAAD,CAASA,UAAU,SAAnB,0B,gBCIG,MAAMC,UAAoBC,gBAErCC,YAAYC,GACRC,MAAMD,GADS,KAqBnBE,WAAa,KACTC,KAAKC,SAAS,CAACC,cAAeF,KAAKG,MAAMD,gBApBzCF,KAAKG,MAAQ,CACTD,cAAc,EACdE,aAAc,IAItBC,oBACIC,IAAKC,IAAL,UAAYC,IAAIC,KAAhB,qBACKC,KAAKC,IAAQ,MAAD,EACwBA,EAAzBC,KAAQA,EADP,EACOA,KAChB,GAAY,MAFH,EACaC,KACL,CACb,MAAMC,EAAUC,SAAOC,OAAOJ,EAAM,CAACK,SAAUL,EAAKK,SAASC,OAAQ,EAAGN,EAAKK,SAASE,MAAM,MAAO,KACnGnB,KAAKC,SAAS,CACVG,aAAcU,OAUlCM,SAAU,IAAD,EAMDpB,KAAKG,MANJ,IAEDC,aACIiB,EAHH,EAGGA,KAAMC,EAHT,EAGSA,QAASC,EAHlB,EAGkBA,QAASN,EAH3B,EAG2BA,SAAUO,EAHrC,EAGqCA,SAEtCtB,EALC,EAKDA,aAEJ,OACI,yBAAKT,UAAU,eACX,kBAAC,IAAD,CAAWgC,MAAM,2BAAOC,OAAO,EAAMC,MAAM,IAC3C,yBAAKlC,UAAU,sBACX,yBAAKA,UAAU,SACX,kBAAC,IAAD,CAAKA,UAAU,gBAAgB+B,GAC/B,0BAAMI,wBAAyB,CAACC,OAAQR,MAG5B,IAAZC,GAAiB,kBAACQ,EAAD,CAAarC,UAAU,UAAU8B,QAASA,EAC7BQ,YAAa/B,KAAKG,MAAMD,gBAIrDA,GAEG,yBAAKT,UAAU,cAAcuC,QAAShC,KAAKD,YACvC,yDAAU,uBAAGN,UAAU,iCAMnCS,GAAgB,kBAAC+B,EAAD,CAAQC,QAASjB,EAAUf,cAAY,IAE3D,kBAAC,EAAD,QAMhB,MAAM4B,EAAcK,IAAMC,KAAK,EAAEb,UAASQ,iBAElC,wBAAItC,UAAU,WAEN8B,EAAQc,IAAI,CAACC,EAAMC,IACf,wBAAIC,IAAKD,EAAO9C,UAAWgD,IAAW,SAAU,CAAC,OAA0B,IAAhBH,EAAKI,QAAgBX,KAC5E,0BAAMtC,UAAU,YAAYkD,OAAOC,aAAa,GAAKL,IACpDD,EAAKO,QAQxBZ,EAASE,IAAMC,KAAK,EAAEF,UAAShC,kBAE7B,yBAAKT,UAAWgD,IAAW,SAAU,CAACK,MAAO5C,KACzC,uBAAGT,UAAU,UAAb,gBACCyC,EAAQhB,OAAO,GAAKgB,EAAQG,IAAI,CAACC,EAAMC,IAAU,uBAAGC,IAAKD,EAAO9C,UAAU,UAAUmC,wBAAyB,CAACC,OAAQS,S","file":"mrstaticjs/Examination.d0ac3841.chunk.js","sourcesContent":["import React from 'react'\nimport './index.scss'\nimport { CallApp} from '../../../common'\n\nconst OpenApp = () => {\n return (\n <div className='open-app'>\n <p className='left'>更多试题请前往App查看</p>\n <CallApp className='right'>在APP打开</CallApp>\n </div>\n )\n}\n\nexport default OpenApp","import React, { PureComponent } from 'react'\nimport './examination.scss'\nimport classnames from 'classnames'\n\nimport {HeaderBar, Tag} from '../../common'\nimport OpenApp from './OpenApp'\nimport { http, html, htmlDecode} from 'src/utils'\nimport { config } from 'rxjs';\nimport { Object } from 'core-js';\n\n\n\nexport default class Examination extends PureComponent {\n\n constructor(props) {\n super(props)\n this.state = {\n isShowAnswer: false,\n questionData: {}\n }\n }\n\n componentDidMount() {\n http.get(`${API.home}/m/dailyQuestion`)\n .then(res => {\n const { data: { data, code } } = res;\n if(code === 200) {\n const newData = Object.assign(data, {analysis: data.analysis.length> 0? data.analysis.split('\\n'): []})\n this.setState({\n questionData: newData\n })\n }\n })\n }\n\n showAnswer = () => {\n this.setState({isShowAnswer: !this.state.isShowAnswer})\n }\n\n render() {\n let {\n questionData: {\n ques, type_id, options, analysis, category\n },\n isShowAnswer\n } = this.state\n return (\n <div className='examination'>\n <HeaderBar title='每日一题' arrow={true} cart={false}></HeaderBar>\n <div className=\"question-container\">\n <div className=\"topic\">\n <Tag className='category-tag'>{category}</Tag>\n <span dangerouslySetInnerHTML={{__html: ques}}/>\n </div>\n {\n type_id === 1 && <MultiChoice className='options' options={options}\n showCorrect={this.state.isShowAnswer}\n />\n }\n {\n !isShowAnswer &&\n (\n <div className=\"show-answer\" onClick={this.showAnswer}>\n <span>查看解析<i className='iconfont iconiconfront-69'></i></span>\n </div>\n )\n }\n </div>\n {\n isShowAnswer && <Answer content={analysis} isShowAnswer/>\n }\n <OpenApp/>\n </div>\n )\n }\n}\n\nconst MultiChoice = React.memo(({options, showCorrect}) => {\n return (\n <ul className='options'>\n {\n options.map((item, index) => (\n <li key={index} className={classnames('option', {'active': item.is_ans === 1 && showCorrect})}>\n <span className=\"alphabet\">{String.fromCharCode(65 + index)}</span>\n {item.des}\n </li>\n ))\n }\n </ul>\n )\n})\n\nconst Answer = React.memo(({content, isShowAnswer}) => {\n return (\n <div className={classnames('answer', {scale: isShowAnswer})}>\n <p className='legend'>解析</p>\n {content.length>0 && content.map((item, index) => <p key={index} className='content' dangerouslySetInnerHTML={{__html: item}}/>)}\n </div>\n )\n})\n"],"sourceRoot":""}