achievement.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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. this.loadData();
  178. },
  179. industryChange(e) {
  180. let theArr = [];
  181. if (e.target.value !== 999) {
  182. theArr.push(
  183. <Radio.Button key={999} value={999}>不限</Radio.Button>
  184. );
  185. IndustryObject.map(function (item1) {
  186. if (item1.value == e.target.value) {
  187. item1.children.map(function (item2) {
  188. theArr.push(
  189. <Radio.Button key={item2.value} value={item2.value}>{item2.label}</Radio.Button>
  190. );
  191. });
  192. }
  193. });
  194. this.state.fieldA = e.target.value;
  195. } else {
  196. this.state.fieldA = null;
  197. this.state.fieldB = null;
  198. };
  199. this.loadData();
  200. this.setState({ industryRadioB: theArr });
  201. },
  202. tableRowClick(record, index) {
  203. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + record.id + '&type=' + record.ownerType);
  204. },
  205. closeDesc(e) {
  206. this.setState({
  207. showDesc: e
  208. });
  209. },
  210. render() {
  211. const { pageNo, pageSize, total } = this.state.pagination;
  212. const _me = this;
  213. return (
  214. <div className="portal-body">
  215. <div className="portal-nav clearfix">
  216. <div className="nav-logoBox">
  217. <img src={logoImg} alt="" />
  218. </div>
  219. <ul className="nav-list clearfix">
  220. <li className={this.props.searchType == 'achievement' ? 'active' : ''}><a href={"/portal/search/achievement.html"}>科技成果</a></li>
  221. <li className={this.props.searchType == 'demand' ? 'active' : ''}><a href={"/portal/search/demand.html"}>科技需求</a></li>
  222. <li className={this.props.searchType == 'subscriber' ? 'active' : ''}><a href={"/portal/search/subscriber.html"}>伙伴/行家</a></li>
  223. </ul>
  224. <div className="nav-search">
  225. <Input onChange={(e) => { this.state.keyword = e.target.value; }} />
  226. <Button onClick={() => { this.loadData() }}>
  227. <img src={searchImg} alt="" />
  228. </Button>
  229. </div>
  230. </div>
  231. <div className="portal-content">
  232. <Row className="search-criteria">
  233. <Col className="search-title" span={2}>
  234. <span>行业分类</span>
  235. </Col>
  236. <Col className="search-select" span={22}>
  237. <Radio.Group defaultValue={999} onChange={this.industryChange}>
  238. {this.state.industryRadioA}
  239. </Radio.Group>
  240. </Col>
  241. </Row>
  242. {this.state.industryRadioB.length > 1 ? <Row className="search-criteria">
  243. <Col className="search-title" span={2}>
  244. <span>行业子分类</span>
  245. </Col>
  246. <Col className="search-select" span={22}>
  247. <Radio.Group defaultValue={999} onChange={(e) => { this.state.fieldB = e.target.value; this.loadData() }}>
  248. {this.state.industryRadioB}
  249. </Radio.Group>
  250. </Col>
  251. </Row> : <div></div>}
  252. <Row className="search-criteria">
  253. <Col className="search-title" span={2}>
  254. <span>交易价格</span>
  255. </Col>
  256. <Col className="search-select" span={13}>
  257. <Radio.Group value={this.state.transferPrice}
  258. onChange={(e) => {
  259. this.setState({
  260. transferPrice: e.target.value
  261. });
  262. this.state.transferPrice = e.target.value;
  263. this.loadData();
  264. }}>
  265. <Radio.Button value={999}>不限</Radio.Button>
  266. <Radio.Button value={1}>1-10万元</Radio.Button>
  267. <Radio.Button value={2}>10-50万元</Radio.Button>
  268. <Radio.Button value={3}>50-100万元</Radio.Button>
  269. <Radio.Button value={4}>100-500万元</Radio.Button>
  270. <Radio.Button value={5}>500-1000万元</Radio.Button>
  271. <Radio.Button value={6}>面议</Radio.Button>
  272. </Radio.Group>
  273. </Col>
  274. <Col span={9}>
  275. <Checkbox checked={!this.state.transferPrice} onChange={(e) => { if (e.target.checked) { this.setState({ transferPrice: null }) } }}>自定义金额</Checkbox>
  276. <InputNumber style={{ width: 80 }}
  277. disabled={Boolean(this.state.transferPrice)}
  278. onChange={(e) => { this.state.transferPriceLower = e; }} />
  279. <span> 到 </span>
  280. <InputNumber style={{ width: 80 }}
  281. disabled={Boolean(this.state.transferPrice)}
  282. onChange={(e) => { this.state.transferPriceUpper = e; }} />
  283. <span> 万元</span>
  284. <Button style={{ marginLeft: '20px' }} disabled={Boolean(this.state.transferPrice)} onClick={() => { this.loadData() }}>确定</Button>
  285. </Col>
  286. </Row>
  287. <Row className="search-criteria">
  288. <Col className="search-title" span={2}>
  289. <span>技术类型</span>
  290. </Col>
  291. <Col className="search-select" span={22}>
  292. <Radio.Group defaultValue={999} onChange={(e) => {
  293. this.setState({
  294. category: e.target.value
  295. });
  296. this.state.category = e.target.value;
  297. this.loadData();
  298. }}>
  299. {this.state.categoryRadio}
  300. </Radio.Group>
  301. </Col>
  302. </Row>
  303. <Row className="search-criteria">
  304. <Col className="search-title" span={2}>
  305. <span>交易方式</span>
  306. </Col>
  307. <Col className="search-select" span={22}>
  308. <Radio.Group defaultValue={999} onChange={(e) => {
  309. this.setState({
  310. transferMode: e.target.value
  311. });
  312. this.state.transferMode = e.target.value
  313. this.loadData();
  314. }}>
  315. {this.state.transferModeRadio}
  316. </Radio.Group>
  317. </Col>
  318. </Row>
  319. <Row className="search-criteria">
  320. <Col className="search-title" span={2}>
  321. <span>成熟度</span>
  322. </Col>
  323. <Col className="search-select" span={22}>
  324. <Radio.Group defaultValue={999} onChange={(e) => {
  325. this.setState({
  326. maturity: e.target.value
  327. });
  328. this.state.maturity = e.target.value
  329. this.loadData();
  330. }}>
  331. {this.state.maturityRadio}
  332. </Radio.Group>
  333. </Col>
  334. </Row>
  335. <Spin spinning={this.state.loading} style={{ marginBottom: '40px' }}>
  336. <ul className='detail_interest_sub clearfix' style={{ padding: 0 }}>
  337. {this.state.dataSource.map((item) => {
  338. return <li key={item.id} onClick={() => { this.tableRowClick(item) }}
  339. style={{ float: 'left', marginLeft: '20px', width: '48%' }}>
  340. <div className="interest_list_title" style={{ paddingLeft: '20px' }}>
  341. <span>{item.name}</span>
  342. </div>
  343. <div className="interest_list_name" style={{ paddingLeft: '20px' }}>
  344. <p>{item.ownerName}</p>
  345. <div className="interest_list_confirm">
  346. <span>{item.level ? '身份已验证' : '身份未验证'}</span>
  347. <img src={item.level ? certify : uncertify} alt="" />
  348. </div>
  349. </div>
  350. <div className="detial_sub">
  351. <span className="detial_sub_icon">
  352. <img src={demand_ico_5} alt="成果" />
  353. </span>
  354. <span className="detial_sub_title">关键词: </span>
  355. <span className="detial_sub_text">{item.keyword}</span>
  356. </div>
  357. <div className="detial_sub">
  358. <span className="detial_sub_icon">
  359. <img src={demand_ico_2} alt="类型" />
  360. </span>
  361. <span className="detial_sub_title">技术类型: </span>
  362. <span className="detial_sub_text">{getAchievementCategory(item.category)}</span>
  363. </div>
  364. <div className="detial_sub">
  365. <span className="detial_sub_icon">
  366. <img src={demand_ico_1} alt="行业" />
  367. </span>
  368. <span className="detial_sub_title">行业分类: </span>
  369. <span className="detial_sub_text">{getIndustryCategory(item.fieldA, item.fieldB)}</span>
  370. </div>
  371. <div className="detial_sub">
  372. <span className="detial_sub_icon">
  373. <img src={demand_ico_3} alt="标价" />
  374. </span>
  375. <span className="detial_sub_title">标价: </span>
  376. <span className="money_text">{item.transferPrice ? (item.transferPrice + '万元') : '价格面议'}</span>
  377. </div>
  378. <div className="detial_sub">
  379. <span className="detial_sub_icon">
  380. <img src={achievement_ico_1} alt="交易方式" />
  381. </span>
  382. <span className="detial_sub_title">交易方式: </span>
  383. <span className="money_text">{getTransferMode(item.transferMode)}</span>
  384. </div>
  385. <div className="detial_sub">
  386. <span className="detial_sub_icon">
  387. <img src={achievement_ico_2} alt="成熟度" />
  388. </span>
  389. <span className="detial_sub_title">技术成熟度: </span>
  390. <span className="detial_sub_score" >
  391. <span style={{ width: (item.maturity ? Number(item.maturity) * 20 : 0) + '%' }}>
  392. <img src={score_ioc} alt={getMaturity(item.maturity)} />
  393. </span>
  394. </span>
  395. </div>
  396. </li>
  397. })}
  398. </ul>
  399. <Pagination style={{ float: 'right' }}
  400. onChange={(e) => { this.loadData(e); }}
  401. total={total}
  402. showTotal={() => { return '共' + total + '条数据' }}
  403. current={pageNo}
  404. pageSize={pageSize} />
  405. </Spin>
  406. </div >
  407. </div>
  408. )
  409. }
  410. });
  411. export default Content;