achievement.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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. };
  200. this.loadData();
  201. this.setState({ industryRadioB: theArr });
  202. },
  203. tableRowClick(record, index) {
  204. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + record.id + '&type=' + record.ownerType);
  205. },
  206. closeDesc(e) {
  207. this.setState({
  208. showDesc: e
  209. });
  210. },
  211. render() {
  212. const { pageNo, pageSize, total } = this.state.pagination;
  213. const _me = this;
  214. return (
  215. <div className="portal-body">
  216. <div className="portal-nav clearfix">
  217. <div className="nav-logoBox">
  218. <img src={logoImg} alt="" />
  219. </div>
  220. <ul className="nav-list clearfix">
  221. <li className={this.props.searchType == 'achievement' ? 'active' : ''}><a href={"/portal/search/achievement.html"}>科技成果</a></li>
  222. <li className={this.props.searchType == 'demand' ? 'active' : ''}><a href={"/portal/search/demand.html"}>科技需求</a></li>
  223. <li className={this.props.searchType == 'subscriber' ? 'active' : ''}><a href={"/portal/search/subscriber.html"}>伙伴/行家</a></li>
  224. </ul>
  225. <div className="nav-search">
  226. <Input onChange={(e) => { this.state.keyword = e.target.value; }} />
  227. <Button onClick={() => { this.loadData() }}>
  228. <img src={searchImg} alt="" />
  229. </Button>
  230. </div>
  231. </div>
  232. <Carousel autoplay className="portal-carousel">
  233. <div className="slide-box"><img src={slideImg} alt="" /></div>
  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. </Carousel>
  238. <div className="portal-content">
  239. <Row className="search-criteria">
  240. <Col className="search-title" span={2}>
  241. <span>行业分类</span>
  242. </Col>
  243. <Col className="search-select" span={22}>
  244. <Radio.Group defaultValue={999} onChange={this.industryChange}>
  245. {this.state.industryRadioA}
  246. </Radio.Group>
  247. </Col>
  248. </Row>
  249. {this.state.industryRadioB.length > 1 ? <Row className="search-criteria">
  250. <Col className="search-title" span={2}>
  251. <span>行业子分类</span>
  252. </Col>
  253. <Col className="search-select" span={22}>
  254. <Radio.Group defaultValue={999} onChange={(e) => { this.state.fieldB = e.target.value; this.loadData() }}>
  255. {this.state.industryRadioB}
  256. </Radio.Group>
  257. </Col>
  258. </Row> : <div></div>}
  259. <Row className="search-criteria">
  260. <Col className="search-title" span={2}>
  261. <span>交易价格</span>
  262. </Col>
  263. <Col className="search-select" span={13}>
  264. <Radio.Group value={this.state.transferPrice}
  265. onChange={(e) => {
  266. this.setState({
  267. transferPrice: e.target.value
  268. });
  269. this.state.transferPrice = e.target.value;
  270. this.loadData();
  271. }}>
  272. <Radio.Button value={999}>不限</Radio.Button>
  273. <Radio.Button value={1}>1-10万元</Radio.Button>
  274. <Radio.Button value={2}>10-50万元</Radio.Button>
  275. <Radio.Button value={3}>50-100万元</Radio.Button>
  276. <Radio.Button value={4}>100-500万元</Radio.Button>
  277. <Radio.Button value={5}>500-1000万元</Radio.Button>
  278. <Radio.Button value={6}>面议</Radio.Button>
  279. </Radio.Group>
  280. </Col>
  281. <Col span={9}>
  282. <Checkbox checked={!this.state.transferPrice} onChange={(e) => { if (e.target.checked) { this.setState({ transferPrice: null }) } }}>自定义金额</Checkbox>
  283. <InputNumber style={{ width: 80 }}
  284. disabled={Boolean(this.state.transferPrice)}
  285. onChange={(e) => { this.state.transferPriceLower = e; }} />
  286. <span> 到 </span>
  287. <InputNumber style={{ width: 80 }}
  288. disabled={Boolean(this.state.transferPrice)}
  289. onChange={(e) => { this.state.transferPriceUpper = e; }} />
  290. <span> 万元</span>
  291. <Button style={{ marginLeft: '20px' }} disabled={Boolean(this.state.transferPrice)} onClick={() => { this.loadData() }}>确定</Button>
  292. </Col>
  293. </Row>
  294. <Row className="search-criteria">
  295. <Col className="search-title" span={2}>
  296. <span>技术类型</span>
  297. </Col>
  298. <Col className="search-select" span={22}>
  299. <Radio.Group defaultValue={999} onChange={(e) => {
  300. this.setState({
  301. category: e.target.value
  302. });
  303. this.state.category = e.target.value;
  304. this.loadData();
  305. }}>
  306. {this.state.categoryRadio}
  307. </Radio.Group>
  308. </Col>
  309. </Row>
  310. <Row className="search-criteria">
  311. <Col className="search-title" span={2}>
  312. <span>交易方式</span>
  313. </Col>
  314. <Col className="search-select" span={22}>
  315. <Radio.Group defaultValue={999} onChange={(e) => {
  316. this.setState({
  317. transferMode: e.target.value
  318. });
  319. this.state.transferMode = e.target.value
  320. this.loadData();
  321. }}>
  322. {this.state.transferModeRadio}
  323. </Radio.Group>
  324. </Col>
  325. </Row>
  326. <Row className="search-criteria">
  327. <Col className="search-title" span={2}>
  328. <span>成熟度</span>
  329. </Col>
  330. <Col className="search-select" span={22}>
  331. <Radio.Group defaultValue={999} onChange={(e) => {
  332. this.setState({
  333. maturity: e.target.value
  334. });
  335. this.state.maturity = e.target.value
  336. this.loadData();
  337. }}>
  338. {this.state.maturityRadio}
  339. </Radio.Group>
  340. </Col>
  341. </Row>
  342. <Spin spinning={this.state.loading} style={{ marginBottom: '40px' }}>
  343. <ul className='detail_interest_sub clearfix' style={{ padding: 0 }}>
  344. {this.state.dataSource.map((item) => {
  345. return <li key={item.id} onClick={() => { this.tableRowClick(item) }}
  346. style={{ float: 'left', marginLeft: '20px', width: '48%' }}>
  347. <div className="interest_list_title" style={{ paddingLeft: '20px' }}>
  348. <span>{item.name}</span>
  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;