pfs.jsx 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. import React from 'react';
  2. import { Input, Button, Form, Select, Upload, Icon, Spin, message, Radio , InputNumber } from 'antd';
  3. import './pfs.less';
  4. import YearSelect from '../../yearSelect.jsx';
  5. const FormItem = Form.Item;
  6. const RadioButton = Radio.Button;
  7. const RadioGroup = Radio.Group;
  8. const jingli_yuanxiao = 'XXX年获得博士学位,师从XXX名师;\nXXX年入职厦门大学,XXX年获评教授职称;\nXXX年成为厦门大学材料学院副院长;\n曾担任XXX届人大代表;\n曾担任XXX名企的科研顾问;\n从事科研研究8年,累计发表论文xxx篇,获得专利xx项。';
  9. const jingli_shehui = 'XXX年毕业于XXX名校,获得XXX学位;\nXXX年就职于XXX企业,担任XXX岗位;\nXXX年创办XXX企业或机构;\n曾担任XXX届人大代表。';
  10. const chengjiu_yuanxiao = '案例1:XXX年,主持(参与)XXX重大科研项目,该项目在XXX领域取了xxx成果,获得了xxx奖项。(纵向科研课题)\n案例2:XXX年,因为在xxx方面的科研成就,获得了xxx奖项。(科研奖项)\n案例3:XXX年,获得了XXX专利,该专利具有xxx价值。(专利,重点展现最核心最有价值的专利即可)\n案例4:XXX年,在XXX核心刊物上发表XXX论文,在XXX方面的研究上取得突破性成就。(科研成果,体现最有核心价值的即可)\n案例5:XXX年,与XXX企业合作进行XXX项目的研究,该项目投产后,实现了xxx的经济效益。(横向科研课题)\n案例6:XXX年,因xxx项目,获得厦门双百人才计划项目支持,该项目于XXX年正式投产,取得XXX经济效益。(技术创业)\n案例7:XXX年,担任xxx企业的技术总监,主持研发了XXX项目,该项目获得了xxx成就(经济效益、社会效益等)。(企业成就)';
  11. const chengjiu_shehui = '案例1:XXX年,担任xxx企业的XXX岗位,在该岗位上实现了XXX业绩。(职业经理人成就)\n案例2:XXX年,因xxx项目,获得厦门双百人才计划项目支持,该项目于XXX年正式投产,取得xxx经济效益或社会效益。(重大人才项目成就)\n案例3:XXX年,创办了XXX企业,该企业取得了xxx成就(经济效益、社会效益等)。(创业成就)\n案例4:XXX年,因为在xxx方面成就,被评为xxx风云人物。(社会荣誉成就)\n案例5:XXX年,曾主持xxx国家课题项目,该项目取得xxx成果。(重大课题成就)\n案例6:从业xxx年以来,为xxx企业提供过各类管理咨询和政策指导服务,其中,为xxx家企业服务,帮助其实现xxx效果。(服务类成就)'
  12. function getBase64(img, callback) {
  13. const reader = new FileReader();
  14. reader.addEventListener('load', () => callback(reader.result));
  15. reader.readAsDataURL(img);
  16. };
  17. function beforeUpload(file) {
  18. const isJPG = file.type === 'image/jpeg';
  19. if (!isJPG) {
  20. message.error('You can only upload JPG file!');
  21. }
  22. const isLt2M = file.size / 1024 / 1024 < 2;
  23. if (!isLt2M) {
  24. message.error('Image must smaller than 2MB!');
  25. }
  26. return isJPG && isLt2M;
  27. };
  28. class Avatar extends React.Component {
  29. constructor(props) {
  30. super(props);
  31. this.state = {
  32. imageUrl: ''
  33. }
  34. }
  35. handleChange(info) {
  36. if (info.file.status === 'done') {
  37. // Get this url from response in real world.
  38. getBase64(info.file.originFileObj, imageUrl => this.setState({ imageUrl }));
  39. }
  40. }
  41. render() {
  42. const imageUrl = this.state.imageUrl;
  43. return (
  44. <Upload
  45. className="avatar-uploader"
  46. name={this.props.name}
  47. showUploadList={false}
  48. action="/upload.do"
  49. beforeUpload={beforeUpload}
  50. onChange={this.handleChange}
  51. >
  52. {
  53. imageUrl ?
  54. <img src={imageUrl} role="presentation" id={this.props.name} /> :
  55. <Icon type="plus" className="avatar-uploader-trigger" />
  56. }
  57. </Upload>
  58. );
  59. }
  60. };
  61. const PfsFrom = Form.create()(React.createClass({
  62. getInitialState() {
  63. return {
  64. loading: false,
  65. };
  66. },
  67. handleSubmit(e) {
  68. e.preventDefault();
  69. this.props.form.validateFields((err, values) => {
  70. if (!err) {
  71. console.log('Received values of form: ', values);
  72. }
  73. });
  74. },
  75. normFile(e) {
  76. if (Array.isArray(e)) {
  77. return e;
  78. }
  79. return e && e.fileList;
  80. },
  81. zhichengyear(e) {
  82. this.state.zhichengyear = e;
  83. },
  84. zigeyear(e) {
  85. this.state.zigeyear = e;
  86. },
  87. jingliChange(e) {
  88. if (e.target.value == "a") {
  89. this.props.form.setFieldsValue({ 'jingli': "" })
  90. } else if (e.target.value == "b") {
  91. this.props.form.setFieldsValue({
  92. 'jingli': jingli_yuanxiao
  93. })
  94. } else if (e.target.value == "c") {
  95. this.props.form.setFieldsValue({
  96. 'jingli': jingli_shehui
  97. })
  98. }
  99. },
  100. chengjiuChange(e) {
  101. if (e.target.value == "a") {
  102. this.props.form.setFieldsValue({ 'chengjiu': "" })
  103. } else if (e.target.value == "b") {
  104. this.props.form.setFieldsValue({
  105. 'chengjiu': chengjiu_yuanxiao
  106. })
  107. } else if (e.target.value == "c") {
  108. this.props.form.setFieldsValue({
  109. 'chengjiu': chengjiu_shehui
  110. })
  111. }
  112. },
  113. render() {
  114. const { getFieldDecorator } = this.props.form;
  115. const formItemLayout = {
  116. labelCol: { span: 3 },
  117. wrapperCol: { span: 12 },
  118. };
  119. const _me = this;
  120. return (
  121. <Form horizontal onSubmit={this.handleSubmit} className="pfs-form">
  122. <FormItem
  123. {...formItemLayout}
  124. label="从事领域"
  125. help={'请输入所从事领域的名称,多个领域请以逗号隔开'}
  126. >
  127. {getFieldDecorator('lingyu')(
  128. <Input />
  129. )}
  130. </FormItem>
  131. <FormItem
  132. labelCol={{ span: 3 }}
  133. wrapperCol={{ span: 4 }}
  134. label="从业工龄"
  135. >
  136. {getFieldDecorator('gongling')(
  137. <div>
  138. <InputNumber /><span>年</span>
  139. </div>
  140. )}
  141. </FormItem>
  142. <FormItem
  143. {...formItemLayout}
  144. label="职称名字"
  145. >
  146. {getFieldDecorator('zhichengname')(
  147. <Input />
  148. )}
  149. </FormItem>
  150. <FormItem
  151. labelCol={{ span: 3 }}
  152. wrapperCol={{ span: 6 }}
  153. label="取得时间"
  154. hasFeedback
  155. >
  156. {getFieldDecorator('zhichengyear')(
  157. <YearSelect handleyear={this.zhichengyear} />
  158. )}
  159. </FormItem>
  160. <FormItem
  161. {...formItemLayout}
  162. label="职称证书"
  163. hasFeedback
  164. >
  165. {getFieldDecorator('zhichengimg')(
  166. <Avatar name="zhichengimg" />
  167. )}
  168. </FormItem>
  169. <div className="set-explain">
  170. <p>要求2M 以下的jpg、jpeg格式的图片。该资料不会公开展示,仅作为审核材料使用。</p>
  171. </div>
  172. <FormItem
  173. {...formItemLayout}
  174. label="执业资格"
  175. >
  176. {getFieldDecorator('zige')(
  177. <Input />
  178. )}
  179. </FormItem>
  180. <FormItem
  181. labelCol={{ span: 3 }}
  182. wrapperCol={{ span: 6 }}
  183. label="取得时间"
  184. hasFeedback
  185. >
  186. {getFieldDecorator('zigeyear')(
  187. <YearSelect handleyear={this.zigeyear} />
  188. )}
  189. </FormItem>
  190. <FormItem
  191. {...formItemLayout}
  192. label="资格证明"
  193. hasFeedback
  194. >
  195. {getFieldDecorator('zigeimg')(
  196. <Avatar name="zigeimg" />
  197. )}
  198. </FormItem>
  199. <div className="set-explain">
  200. <p>要求2M 以下的jpg、jpeg格式的图片。该资料不会公开展示,仅作为审核材料使用。</p>
  201. </div>
  202. <FormItem
  203. {...formItemLayout}
  204. label="工作单位"
  205. >
  206. {getFieldDecorator('danwei')(
  207. <Input />
  208. )}
  209. </FormItem>
  210. <FormItem
  211. {...formItemLayout}
  212. label="职位头衔"
  213. >
  214. {getFieldDecorator('touxian')(
  215. <Input />
  216. )}
  217. </FormItem>
  218. <div className="textarea-title">
  219. <span>从业经历</span>
  220. <RadioGroup className="set-radio-button" onChange={this.jingliChange} defaultValue="a">
  221. <RadioButton value="a">自定义</RadioButton>
  222. <RadioButton value="b">院校专家模板</RadioButton>
  223. <RadioButton value="c">企业或社会专家模板</RadioButton>
  224. </RadioGroup>
  225. </div>
  226. <div className="set-explain">
  227. <p>您可使用模板直接编辑调整!</p>
  228. </div>
  229. <FormItem
  230. labelCol={{ span: 3 }}
  231. wrapperCol={{ span: 20, offset: 3 }}
  232. help={
  233. <div>
  234. <p>还可输入{
  235. (() => {
  236. if (_me.props.form.getFieldValue('jingli') && _me.props.form.getFieldValue('jingli').length) {
  237. return 1000 - _me.props.form.getFieldValue('jingli').length;
  238. } else {
  239. return 1000;
  240. }
  241. })()
  242. }字/1000</p>
  243. <p>描述您主要的从业履历,包括职业,最有亮点的社会兼职。可自定义或选择模板后直接编辑</p>
  244. </div>
  245. }
  246. label=""
  247. >
  248. {getFieldDecorator('jingli')(
  249. <Input type="textarea"
  250. rows={6} />
  251. )}
  252. </FormItem>
  253. <div className="textarea-title">
  254. <span>从业经历</span>
  255. <RadioGroup className="set-radio-button" onChange={this.chengjiuChange} defaultValue="a">
  256. <RadioButton value="a">自定义</RadioButton>
  257. <RadioButton value="b">院校专家模板</RadioButton>
  258. <RadioButton value="c">企业或社会专家模板</RadioButton>
  259. </RadioGroup>
  260. </div>
  261. <div className="set-explain">
  262. <p>您可使用模板直接编辑调整!</p>
  263. </div>
  264. <FormItem
  265. labelCol={{ span: 3 }}
  266. wrapperCol={{ span: 20, offset: 3 }}
  267. help={
  268. <div>
  269. <p>还可输入{
  270. (() => {
  271. if (_me.props.form.getFieldValue('chengjiu') && _me.props.form.getFieldValue('chengjiu').length) {
  272. return 1000 - _me.props.form.getFieldValue('chengjiu').length;
  273. } else {
  274. return 1000;
  275. }
  276. })()
  277. }字/1000</p>
  278. <p>描述您主要的从业履历,包括职业,最有亮点的社会兼职。可自定义或选择模板后直接编辑</p>
  279. </div>
  280. }
  281. label=""
  282. >
  283. {getFieldDecorator('chengjiu')(
  284. <Input type="textarea"
  285. rows={6} />
  286. )}
  287. </FormItem>
  288. <FormItem wrapperCol={{ span: 12, offset: 3 }}>
  289. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  290. </FormItem>
  291. </Form >
  292. );
  293. },
  294. }));
  295. const Pfs = React.createClass({
  296. getInitialState() {
  297. return {
  298. loading: false
  299. };
  300. },
  301. render() {
  302. return (
  303. <Spin spinning={this.state.loading} className='spin-box'>
  304. <div className="set-pfs">
  305. <div className="acc-detail">
  306. <p className="acc-title">职业信息</p>
  307. <PfsFrom />
  308. </div>
  309. </div>
  310. </Spin>
  311. )
  312. }
  313. });
  314. export default Pfs;