achievement.jsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. import React from 'react';
  2. import { Rate, Icon, message, Row, Col, Radio, Checkbox, Input, InputNumber, Button, Pagination, Spin } from 'antd';
  3. import '../portal.less';
  4. import logoImg from '../../../../image/logo.png';
  5. import searchImg from '../../../../image/search.png';
  6. import demand_ico_5 from '../../../../image/demand_ico_5.png';
  7. import demand_ico_3 from '../../../../image/demand_ico_3.png';
  8. import demand_ico_2 from '../../../../image/demand_ico_2.png';
  9. import demand_ico_1 from '../../../../image/demand_ico_1.png';
  10. import achievement_ico_1 from '../../../../image/achievement_ico_1.png';
  11. import achievement_ico_2 from '../../../../image/achievement_ico_2.png';
  12. import uncertify from '../../../../image/demand_ico_6.png';
  13. import certify from '../../../../image/demand_ico_6_atv.png';
  14. import score_ioc from '../../../../image/score_ioc.png';
  15. import { IndustryObject, getIndustryCategory } from '../../DicIndustryList';
  16. import { achievementCategoryList, transferModeList, maturityList } from '../../dataDic';
  17. import { getAchievementCategory, getTransferMode, getMaturity } from '../../tools';
  18. import ajax from 'jquery/src/ajax/xhr.js'
  19. import $ from 'jquery/src/ajax';
  20. const Content = React.createClass({
  21. loadData(pageNo) {
  22. this.setState({
  23. loading: true
  24. });
  25. switch (this.state.transferPrice) {
  26. case 1:
  27. this.state.transferPriceLower = 1;
  28. this.state.transferPriceUpper = 10;
  29. break;
  30. case 2:
  31. this.state.transferPriceLower = 10;
  32. this.state.transferPriceUpper = 50;
  33. break;
  34. case 3:
  35. this.state.transferPriceLower = 50;
  36. this.state.transferPriceUpper = 100;
  37. break;
  38. case 4:
  39. this.state.transferPriceLower = 100;
  40. this.state.transferPriceUpper = 500;
  41. break;
  42. case 5:
  43. this.state.transferPriceLower = 500;
  44. this.state.transferPriceUpper = 1000;
  45. break;
  46. case 6:
  47. this.state.bargainingMode = 0;
  48. break;
  49. case 999:
  50. this.state.transferPriceLower = null;
  51. this.state.transferPriceUpper = null;
  52. this.state.bargainingMode = null;
  53. break;
  54. }
  55. $.ajax({
  56. method: "get",
  57. dataType: "json",
  58. url: globalConfig.context + "/portal/search/achievementList",
  59. data: {
  60. pageNo: pageNo || 1,
  61. pageSize: this.state.pagination.pageSize,
  62. category: this.state.category == 999 ? null : this.state.category, //技术类型
  63. keyword: this.state.keyword,
  64. maturity: this.state.maturity == 999 ? null : this.state.maturity, //成熟度
  65. transferPriceLower: this.state.transferPriceLower, //交易金额下限
  66. transferPriceUpper: this.state.transferPriceUpper, //交易金额上限
  67. bargainingMode: this.state.bargainingMode,
  68. transferMode: this.state.transferMode == 999 ? null : this.state.transferMode, //交易方式
  69. fieldA: this.state.fieldA, //技术领域(行业类别A)
  70. fieldB: this.state.fieldB == 999 ? null : this.state.fieldB, //技术领域(行业类别B)
  71. },
  72. success: function (data) {
  73. let theArr = [];
  74. if (!data.data || !data.data.list) {
  75. if (data.error && data.error.length) {
  76. message.warning(data.error[0].message);
  77. };
  78. } else {
  79. for (let i = 0; i < data.data.list.length; i++) {
  80. let thisdata = data.data.list[i];
  81. theArr.push({
  82. key: i,
  83. id: thisdata.id,
  84. serialNumber: thisdata.serialNumber,
  85. keyword: thisdata.keyword,
  86. level: thisdata.level,
  87. name: thisdata.name,
  88. dataCategory: thisdata.dataCategory,
  89. category: thisdata.category,
  90. ownerName: thisdata.ownerName,
  91. releaseDate: thisdata.releaseDate,
  92. ownerType: thisdata.ownerType,
  93. fieldA: thisdata.fieldA,
  94. fieldB: thisdata.fieldB,
  95. field: [thisdata.fieldA, thisdata.fieldB],
  96. transferPrice: thisdata.transferPrice,
  97. maturity: thisdata.maturity,
  98. transferMode: thisdata.transferMode,
  99. releaseDateFormattedDate: thisdata.releaseDateFormattedDate
  100. });
  101. };
  102. };
  103. this.state.pagination.pageNo = data.data.pageNo;
  104. this.state.pagination.total = data.data.totalCount;
  105. this.setState({
  106. dataSource: theArr,
  107. pagination: this.state.pagination
  108. });
  109. }.bind(this),
  110. }).done(function (data) {
  111. if (data.error && data.error.length) {
  112. message.warning(data.error[0].message);
  113. };
  114. this.setState({
  115. loading: false
  116. });
  117. this.state.bargainingMode = 1;
  118. }.bind(this));
  119. },
  120. getInitialState() {
  121. return {
  122. loading: false,
  123. showDesc: false,
  124. industryRadioB: [],
  125. transferPrice: 999,
  126. pagination: {
  127. pageNo: 1,
  128. pageSize: 12,
  129. total: 0
  130. },
  131. dataSource: []
  132. };
  133. },
  134. componentWillMount() {
  135. let theArr = [];
  136. let theCategoryArr = [], theTransferModeArr = [], theMaturityArr = [];
  137. //行业分类单选项
  138. theArr.push(
  139. <Radio.Button key={999} value={999}>不限</Radio.Button>
  140. );
  141. IndustryObject.map(function (item) {
  142. theArr.push(
  143. <Radio.Button key={item.value} value={item.value}>{item.label}</Radio.Button>
  144. );
  145. });
  146. //技术类型单选项目
  147. theCategoryArr.push(
  148. <Radio.Button key={999} value={999}>不限</Radio.Button>
  149. );
  150. achievementCategoryList.map(function (item) {
  151. theCategoryArr.push(
  152. <Radio.Button key={item.value} value={item.value}>{item.key}</Radio.Button>
  153. );
  154. });
  155. //交易方式单选项目
  156. theTransferModeArr.push(
  157. <Radio.Button key={999} value={999}>不限</Radio.Button>
  158. );
  159. transferModeList.map(function (item) {
  160. theTransferModeArr.push(
  161. <Radio.Button key={item.value} value={item.value}>{item.key}</Radio.Button>
  162. );
  163. });
  164. //成熟度单选项目
  165. theMaturityArr.push(
  166. <Radio.Button key={999} value={999}>不限</Radio.Button>
  167. );
  168. maturityList.map(function (item) {
  169. theMaturityArr.push(
  170. <Radio.Button key={item.value} value={item.value}>{item.key}</Radio.Button>
  171. );
  172. });
  173. this.state.industryRadioA = theArr;
  174. this.state.categoryRadio = theCategoryArr;
  175. this.state.transferModeRadio = theTransferModeArr;
  176. this.state.maturityRadio = theMaturityArr;
  177. if (window.location.search) {
  178. let theUrl = window.location.search
  179. this.state.keyword = theUrl.substring(1, theUrl.length);
  180. this.state.keyword = decodeURIComponent(this.state.keyword);
  181. };
  182. this.loadData();
  183. },
  184. industryChange(e) {
  185. let theArr = [];
  186. if (e.target.value !== 999) {
  187. theArr.push(
  188. <Radio.Button key={999} value={999}>不限</Radio.Button>
  189. );
  190. IndustryObject.map(function (item1) {
  191. if (item1.value == e.target.value) {
  192. item1.children.map(function (item2) {
  193. theArr.push(
  194. <Radio.Button key={item2.value} value={item2.value}>{item2.label}</Radio.Button>
  195. );
  196. });
  197. }
  198. });
  199. this.state.fieldA = e.target.value;
  200. } else {
  201. this.state.fieldA = null;
  202. this.state.fieldB = null;
  203. };
  204. this.loadData();
  205. this.setState({ industryRadioB: theArr });
  206. },
  207. tableRowClick(record, index) {
  208. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + record.id + '&type=' + record.ownerType);
  209. },
  210. closeDesc(e) {
  211. this.setState({
  212. showDesc: e
  213. });
  214. },
  215. render() {
  216. const { pageNo, pageSize, total } = this.state.pagination;
  217. const _me = this;
  218. return (
  219. <div className="portal-body">
  220. <div className="portal-content">
  221. <Row className="search-criteria">
  222. <Col className="search-title" span={2}>
  223. <span>行业分类</span>
  224. </Col>
  225. <Col className="search-select" span={22}>
  226. <Radio.Group defaultValue={999} onChange={this.industryChange}>
  227. {this.state.industryRadioA}
  228. </Radio.Group>
  229. </Col>
  230. </Row>
  231. {this.state.industryRadioB.length > 1 ? <Row className="search-criteria">
  232. <Col className="search-title" span={2}>
  233. <span>行业子分类</span>
  234. </Col>
  235. <Col className="search-select" span={22}>
  236. <Radio.Group defaultValue={999} onChange={(e) => { this.state.fieldB = e.target.value; this.loadData() }}>
  237. {this.state.industryRadioB}
  238. </Radio.Group>
  239. </Col>
  240. </Row> : <div></div>}
  241. <Row className="search-criteria">
  242. <Col className="search-title" span={2}>
  243. <span>交易方式</span>
  244. </Col>
  245. <Col className="search-select" span={12}>
  246. <Radio.Group defaultValue={999} onChange={(e) => {
  247. this.setState({
  248. transferMode: e.target.value
  249. });
  250. this.state.transferMode = e.target.value
  251. this.loadData();
  252. }}>
  253. {this.state.transferModeRadio}
  254. </Radio.Group>
  255. </Col>
  256. <Col span={10}>
  257. <div className="nav-search">
  258. <Input value={this.state.keyword} placeholder="请输入关键词" onChange={(e) => { this.setState({ keyword: e.target.value }); }} />
  259. <Button onClick={() => { this.loadData() }}>
  260. <img src={searchImg} alt="" />
  261. </Button>
  262. </div>
  263. </Col>
  264. </Row>
  265. <Spin spinning={this.state.loading} style={{ marginBottom: '40px' }}>
  266. <ul className='detail_interest_sub clearfix' >
  267. {this.state.dataSource.map((item) => {
  268. return <li key={item.id} onClick={() => { this.tableRowClick(item) }}>
  269. <div className="interest_list_title" style={{ paddingLeft: '20px' }}>
  270. <p title={item.name}>{item.name}</p>
  271. </div>
  272. <div className="interest_list_name" style={{ paddingLeft: '20px' }}>
  273. <p>{item.ownerName}</p>
  274. <div className="interest_list_confirm">
  275. <span>{item.level ? '身份已验证' : '身份未验证'}</span>
  276. <img src={item.level ? certify : uncertify} alt="" />
  277. </div>
  278. </div>
  279. <div className="detail_sub">
  280. <span className="detail_sub_icon">
  281. <img src={demand_ico_5} alt="成果" />
  282. </span>
  283. <span className="detail_sub_title">关键词: </span>
  284. <span className="detail_sub_text">{item.keyword}</span>
  285. </div>
  286. <div className="detail_sub">
  287. <span className="detail_sub_icon">
  288. <img src={demand_ico_2} alt="类型" />
  289. </span>
  290. <span className="detail_sub_title">技术类型: </span>
  291. <span className="detail_sub_text">{getAchievementCategory(item.category)}</span>
  292. </div>
  293. <div className="detail_sub">
  294. <span className="detail_sub_icon">
  295. <img src={demand_ico_1} alt="行业" />
  296. </span>
  297. <span className="detail_sub_title">行业分类: </span>
  298. <span className="detail_sub_text">{getIndustryCategory(item.fieldA, item.fieldB)}</span>
  299. </div>
  300. <div className="detail_sub">
  301. <span className="detail_sub_icon">
  302. <img src={demand_ico_3} alt="标价" />
  303. </span>
  304. <span className="detail_sub_title">标价: </span>
  305. <span className="money_text">{item.transferPrice ? (item.transferPrice + '万元') : '价格面议'}</span>
  306. </div>
  307. <div className="detail_sub">
  308. <span className="detail_sub_icon">
  309. <img src={achievement_ico_1} alt="交易方式" />
  310. </span>
  311. <span className="detail_sub_title">交易方式: </span>
  312. <span className="money_text">{getTransferMode(item.transferMode)}</span>
  313. </div>
  314. <div className="detail_sub">
  315. <span className="detail_sub_icon">
  316. <img src={achievement_ico_2} alt="成熟度" />
  317. </span>
  318. <span className="detail_sub_title">技术成熟度: </span>
  319. <span className="detail_sub_score" >
  320. <span style={{ width: (item.maturity ? Number(item.maturity) * 20 : 0) + '%' }}>
  321. <img src={score_ioc} alt={getMaturity(item.maturity)} />
  322. </span>
  323. </span>
  324. </div>
  325. </li>
  326. })}
  327. </ul>
  328. <Pagination style={{ float: 'right' }}
  329. onChange={(e) => { this.loadData(e); }}
  330. total={total}
  331. showTotal={() => { return '共' + total + '条数据' }}
  332. current={pageNo}
  333. pageSize={pageSize} />
  334. </Spin>
  335. </div >
  336. </div>
  337. )
  338. }
  339. });
  340. export default Content;
  341. // <Row className="search-criteria">
  342. // <Col className="search-title" span={2}>
  343. // <span>交易价格</span>
  344. // </Col>
  345. // <Col className="search-select" span={13}>
  346. // <Radio.Group value={this.state.transferPrice}
  347. // onChange={(e) => {
  348. // this.setState({
  349. // transferPrice: e.target.value
  350. // });
  351. // this.state.transferPrice = e.target.value;
  352. // this.loadData();
  353. // }}>
  354. // <Radio.Button value={999}>不限</Radio.Button>
  355. // <Radio.Button value={1}>1-10万元</Radio.Button>
  356. // <Radio.Button value={2}>10-50万元</Radio.Button>
  357. // <Radio.Button value={3}>50-100万元</Radio.Button>
  358. // <Radio.Button value={4}>100-500万元</Radio.Button>
  359. // <Radio.Button value={5}>500-1000万元</Radio.Button>
  360. // <Radio.Button value={6}>面议</Radio.Button>
  361. // </Radio.Group>
  362. // </Col>
  363. // <Col span={9}>
  364. // <Checkbox checked={!this.state.transferPrice} onChange={(e) => { if (e.target.checked) { this.setState({ transferPrice: null }) } }}>自定义金额</Checkbox>
  365. // <InputNumber style={{ width: 80 }}
  366. // disabled={Boolean(this.state.transferPrice)}
  367. // onChange={(e) => { this.state.transferPriceLower = e; }} />
  368. // <span> 到 </span>
  369. // <InputNumber style={{ width: 80 }}
  370. // disabled={Boolean(this.state.transferPrice)}
  371. // onChange={(e) => { this.state.transferPriceUpper = e; }} />
  372. // <span> 万元</span>
  373. // <Button style={{ marginLeft: '20px' }} disabled={Boolean(this.state.transferPrice)} onClick={() => { this.loadData() }}>确定</Button>
  374. // </Col>
  375. // </Row>
  376. // <Row className="search-criteria">
  377. // <Col className="search-title" span={2}>
  378. // <span>技术类型</span>
  379. // </Col>
  380. // <Col className="search-select" span={22}>
  381. // <Radio.Group defaultValue={999} onChange={(e) => {
  382. // this.setState({
  383. // category: e.target.value
  384. // });
  385. // this.state.category = e.target.value;
  386. // this.loadData();
  387. // }}>
  388. // {this.state.categoryRadio}
  389. // </Radio.Group>
  390. // </Col>
  391. // </Row>
  392. // <Row className="search-criteria">
  393. // <Col className="search-title" span={2}>
  394. // <span>交易方式</span>
  395. // </Col>
  396. // <Col className="search-select" span={22}>
  397. // <Radio.Group defaultValue={999} onChange={(e) => {
  398. // this.setState({
  399. // transferMode: e.target.value
  400. // });
  401. // this.state.transferMode = e.target.value
  402. // this.loadData();
  403. // }}>
  404. // {this.state.transferModeRadio}
  405. // </Radio.Group>
  406. // </Col>
  407. // </Row>
  408. // <Row className="search-criteria">
  409. // <Col className="search-title" span={2}>
  410. // <span>成熟度</span>
  411. // </Col>
  412. // <Col className="search-select" span={12}>
  413. // <Radio.Group defaultValue={999} onChange={(e) => {
  414. // this.setState({
  415. // maturity: e.target.value
  416. // });
  417. // this.state.maturity = e.target.value
  418. // this.loadData();
  419. // }}>
  420. // {this.state.maturityRadio}
  421. // </Radio.Group>
  422. // </Col>
  423. // <Col span={10}>
  424. // <div className="nav-search">
  425. // <Input onChange={(e) => { this.state.keyword = e.target.value; }} />
  426. // <Button onClick={() => { this.loadData() }}>
  427. // <img src={searchImg} alt="" />
  428. // </Button>
  429. // </div>
  430. // </Col>
  431. // </Row>