achievement.jsx 21 KB

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