achievement.jsx 21 KB

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