liting2017 6 years ago
parent
commit
f7b96f31d9

BIN
image/achievement_26.png


BIN
image/init.png


+ 179 - 40
js/component/account/index/collection.jsx

@@ -9,38 +9,155 @@ class Collection extends Component {
 		this.state = {
             loading:false,
             current:1,
-            nub:'3'
+            nub:'1'
         };
     }
-    loadData(page,nub){
-        // this.setState({
-        //     loading:true,
-        // })
-        //https://www.apiopen.top/satinApi
-        // axios.get('api/tic',{
-        //     params:{
-        //         type:1,
-        //         page:page
-        //     }
-        // })
-        // .then(data=>{
-        //     let thisdata=data.data.data;
-        //     this.setState({
-        //         loading:false,
-        //         thisdata:thisdata,
-        //         total:100
-        //     })
-        // })
-        // .catch(error=>{
-        //     message(error.error)
-        // })
+    //服务
+    loadDataService(page){
+        this.setState({
+            loading:true,
+        })
+        let url = globalConfig.context +  '/api/user/portal/listProjectIInterestedIn' 
+        axios.get(url,{
+            params:{
+                pageNo:page||1,
+                pageSize:8
+            }
+        })
+        .then(data=>{
+            let theData=data.data.data,
+                theArr = [],
+                times = new Date().getTime(),
+                days = parseInt(times / (1000 * 60 * 60 * 24));
+            if (!data.data || !data.data.data.list) {
+                if (data.data.error && data.data.error.length) {
+                    message.warning(data.data.error[0].message);
+                };
+            } else {
+                for (let i = 0; i < theData.list.length; i++) {
+                    let thisdata = theData.list[i],
+                        create = parseInt(thisdata.createTime / (1000 * 60 * 60 * 24));
+                    let newState = (days-create)<7?true:false;
+                    theArr.push({
+                        key: i,
+                        id: thisdata.id,
+                        newState:newState,
+                        name:thisdata.name,
+                        introduce:thisdata.introduce&&thisdata.introduce.length>40?thisdata.introduce.substr(0,40)+'...':'',
+                        img: thisdata.maxImgUrl, //编号
+                    });
+                };
+            };
+            this.setState({
+                loading:false,
+                dataList:theArr,
+                total:data.data.data.totalCount
+            })
+        })
+    }
+    //成果
+    loadDataAchievement(page){
+        this.setState({
+            loading:true,
+        })
+        let url = globalConfig.context +  '/api/user/portal/listAchievementIInterestedIn' 
+        axios.get(url,{
+            params:{
+                pageNo:page||1,
+                pageSize:8
+            }
+        })
+        .then(data=>{
+            let theData=data.data.data,
+                theArr = [],
+                times = new Date().getTime(),
+                days = parseInt(times / (1000 * 60 * 60 * 24));
+            if (!data.data || !data.data.data.list) {
+                if (data.data.error && data.data.error.length) {
+                    message.warning(data.data.error[0].message);
+                };
+            } else {
+                for (let i = 0; i < theData.list.length; i++) {
+                    let thisdata = theData.list[i],
+                        create = parseInt(thisdata.releaseDate / (1000 * 60 * 60 * 24));
+                    let newState = (days-create)<7?true:false;
+                    theArr.push({
+                        key: i,
+                        id: thisdata.id,
+                        newState:newState,
+                        name:thisdata.name,
+                        introduce:thisdata.introduction&&thisdata.introduction.length>40?thisdata.introduction.substr(0,40)+'...':'',
+                        img: thisdata.firstPicture, //编号
+                    });
+                };
+            };
+            this.setState({
+                loading:false,
+                dataList:theArr,
+                total:data.data.data.totalCount
+            })
+        })
+    }
+    //需求
+    loadDataDemand(page){
+        this.setState({
+            loading:true,
+        })
+        let url = globalConfig.context +  '/api/user/portal/listDemandIInterestedIn' 
+        axios.get(url,{
+            params:{
+                pageNo:page||1,
+                pageSize:8
+            }
+        })
+        .then(data=>{
+            let theData=data.data.data,
+                theArr = [],
+                times = new Date().getTime(),
+                days = parseInt(times / (1000 * 60 * 60 * 24));
+            if (!data.data || !data.data.data.list) {
+                if (data.data.error && data.data.error.length) {
+                    message.warning(data.data.error[0].message);
+                };
+            } else {
+                for (let i = 0; i < theData.list.length; i++) {
+                    let thisdata = theData.list[i],
+                        create = parseInt(thisdata.releaseDate / (1000 * 60 * 60 * 24));
+                    let newState = (days-create)<7?true:false;
+                    console.log(thisdata.firstPic)
+                    theArr.push({
+                        key: i,
+                        id: thisdata.id,
+                        newState:newState,
+                        name:thisdata.name,
+                        introduce:thisdata.problemDes&&thisdata.problemDes.length>40?thisdata.problemDes.substr(0,40)+'...':'',
+                        img: thisdata.firstPic, //编号
+                    });
+                };
+            };
+            this.setState({
+                loading:false,
+                dataList:theArr,
+                total:data.data.data.totalCount
+            })
+        })
     }
     componentWillMount(){
-        this.loadData()
+        this.loadDataService(1)
     }
     tabFun(e){
        this.setState({ nub: e.target.value })
-       this.loadData(1,e.target.value)
+       switch(e.target.value){
+           case '1':
+                this.loadDataService(1)
+                break;
+           case '2':
+                this.loadDataDemand(1)
+                 break;
+           case '3':
+                this.loadDataAchievement(1)
+                break;
+       }
     }
     //分页
     onShowSizeChange(current, pageSize){
@@ -48,36 +165,58 @@ class Collection extends Component {
             current:current,
             pageSize:pageSize
         })
-        this.loadData(current);
+        switch(this.state.nub){
+            case '1':
+                 this.loadDataService(current)
+                 break;
+            case '2':
+                 this.loadDataDemand(current)
+                  break;
+            case '3':
+                 this.loadDataAchievement(current)
+                 break;
+        }
     }
     jump(item){
-        console.log(item);
+        let url='';
+        switch(this.state.nub){
+            case '1':
+                url = globalConfig.context+`/portal/service/serviceDetail?id=${item.id}`;
+            break;
+            case '2':
+                url=globalConfig.context+`/portal/technologyTrading/demandDetail?id=${item.id}&type=0`;
+            break;
+            case '3':
+                url=globalConfig.context+`/portal/technologyTrading/achievementDetail?id=${item.id}&type=1`;
+            break;
+        }
+        window.open(url);
     }
 	render() {
-        const thisdata =this.state.thisdata || [];
-        thisdata.length=8;
+        const dataList =this.state.dataList || [];
 		return <div className="user-content">
             <div className="title" >
                 我的收藏
             </div>
             <div>
                 <Radio.Group className="btnGroup" value={this.state.nub} onChange={this.tabFun.bind(this)}>
-                    <Radio.Button value="1">需求中心</Radio.Button>
-                    <Radio.Button value="2">技术市场</Radio.Button>
-                    <Radio.Button value="3">科技服务</Radio.Button>
-                    <Radio.Button value="4">模块名称</Radio.Button>
+                    <Radio.Button value="1">科技服务</Radio.Button>
+                    <Radio.Button value="2">科技需求</Radio.Button>
+                    <Radio.Button value="3">科技成果</Radio.Button>
                 </Radio.Group>
             </div>
             <div className="imgList">
                 <Spin spinning={this.state.loading}>
-                    {thisdata.length?<Row>
-                        {thisdata.map((item,index)=>{
+                    {dataList.length?<Row>
+                        {dataList.map((item,index)=>{
                             return<Col span={6} key={index} onClick={(e)=>{this.jump(item)}}>
                                     <div className="img">
                                         <div className="imgHeader">
-                                            <img src={item.cdn_img}  alt=""/>
-                                            <span className="new"></span>
-                                            <div><p>{item.text}</p></div>
+                                            <div className="imgBj">
+                                                 {item.img?<img src={globalConfig.avatarHost+'/upload'+item.img}  alt=""/>:''}
+                                            </div>
+                                            {item.newState&&<span className="new"></span>}
+                                            <div className="divP"><p>{item.introduce?item.introduce:'暂无'}</p></div>
                                         </div>  
                                         <p className="txt">{item.name}</p>
                                     </div>
@@ -85,9 +224,9 @@ class Collection extends Component {
                         })
                         }   
                     </Row>:
-                    <Row>暂无数据</Row>}
+                    <Row style={{color:'#333'}}>暂无数据</Row>}
                 </Spin>
-                {this.state.total&&<Pagination className="page" current={this.state.current} total={this.state.total} onChange={this.onShowSizeChange.bind(this)}/>}
+                {this.state.total?<Pagination className="page" pageSize={8} current={this.state.current} total={this.state.total} onChange={this.onShowSizeChange.bind(this)}/>:''}
             </div>
            
         </div>

+ 24 - 13
js/component/account/index/collection.less

@@ -34,16 +34,23 @@
 				position: relative;
 				height: 220px;
 				width: 100%;
-				img {
+				.imgBj{
 					box-sizing: border-box;
 					position: absolute;
 					border-radius: 5px;
 					left: 3%;
 					top: 3%;
 					width: 94%;
-					height: 94%;
-                }
-                div{
+					height: 94%; 
+					background: url(../../../../image/init.png)no-repeat;
+					background-size:100% 100%; 
+					img {
+						width: 100%;
+						height: 100%;
+						display: inline-block;
+					}
+				}
+                .divP{
                     opacity: 0;
                     width:300px;
                     height: 0px;
@@ -54,12 +61,13 @@
                     color: #ffff;
                     padding: 15px;
                     background: rgba(12, 12, 12, 0.5);
-                    transition: all .2s ease-out;
+                    transition: all .2s ease-in-out;
                     p{
                         position: absolute;
                         left: 50%;
                         top: 50%;
-                        font-size: 14px;
+						font-size: 14px;
+						text-align: justify;
                         transform: translate(-50%,-50%)
                     }
                 }
@@ -68,7 +76,7 @@
                     width: 46px;
                     height: 40px;
                     display: inline-block;
-                    background: url(../../../../image/achievmentDetail_7.png) no-repeat;
+                    background: url(../../../../image/achievement_26.png) no-repeat;
                     background-size:100% 100%;
                     position: absolute;
                     top: 0;
@@ -78,21 +86,24 @@
 			.txt {
 				height: 40px;
 				line-height: 40px;
-				background: rgba(61, 110, 216, 0.7);
-				color: #fff;
-				text-align: center;
+				color: #000;
+				padding:0 15px; 
+				overflow: hidden;
+				white-space: nowrap;
+				text-overflow: ellipsis;
+				-o-text-overflow: ellipsis;
 			}
         }
         .img:hover{
             cursor: pointer;
             img{
                 transform: scale(1.02);
-                transition: all .3s ease-out;
+                transition: all .2s ease-in-out;
             }
-            .imgHeader div{
+            .imgHeader .divP{
                 opacity: 1;
                 height: 220px;
-                transition: all .3s ease-in
+                transition: all .2s ease-in
             }
         }
 	}

+ 2 - 0
js/component/account/index/content.jsx

@@ -14,6 +14,7 @@ import ConsultList from '@/account/index/consultList';
 import DemandList from '@/account/demand/techDemand';
 import Achievement from '@/account/achievement/techAchievement';
 import BusinessProject from '@/account/business/businessProject'
+import Follow from "@/account/index/follow"
 
 import {hashHistory,Route,Router} from 'react-router';
 import {Layout} from 'antd';
@@ -28,6 +29,7 @@ export default class ContentRouter extends React.Component {
         <Router history={hashHistory}>
             <Route path="/normal" component={Normal} />
             <Route path="/collection" component={Collection} />
+            <Route path="/follow" component={Follow} />
             <Route path="/techList" component={TechList} />
             <Route path="/serviceList" component={ServiceList} />
             <Route path="/consultList" component={ConsultList} />

+ 123 - 0
js/component/account/index/follow.jsx

@@ -0,0 +1,123 @@
+import React, { Component } from 'react';
+import { Button,Radio ,message,Row,Col, Spin,Pagination} from 'antd';
+import axios from 'axios';
+import './collection.less';
+
+class Collection extends Component {
+	constructor(props) {
+		super(props);
+		this.state = {
+            loading:false,
+            current:1,
+            nub:'1'
+        };
+    }
+    //服务
+    loadDataService(page){
+        this.setState({
+            loading:true,
+        })
+        let url = globalConfig.context +  '/api/user/portal/listInterestedInExpert' 
+        axios.get(url,{
+            params:{
+                pageNo:page||1,
+                pageSize:8
+            }
+        })
+        .then(data=>{
+            let theData=data.data.data,
+                theArr = [],
+                times = new Date().getTime(),
+                days = parseInt(times / (1000 * 60 * 60 * 24));
+            if (!data.data || !data.data.data.list) {
+                if (data.data.error && data.data.error.length) {
+                    message.warning(data.data.error[0].message);
+                };
+            } else {
+                console.log(theData)
+                for (let i = 0; i < theData.list.length; i++) {
+                    let thisdata = theData.list[i],
+                        create = parseInt(thisdata.createTime / (1000 * 60 * 60 * 24));
+                    let newState = (days-create)<7?true:false;
+                    theArr.push({
+                        key: i,
+                        id: thisdata.uid,
+                        name:thisdata.username,
+                        introduce:thisdata.introduction&&thisdata.introduction.length>40?thisdata.introduction.substr(0,40)+'...':'',
+                        img: thisdata.headPortraitUrl, //编号
+                    });
+                };
+            };
+            this.setState({
+                loading:false,
+                dataList:theArr,
+                total:data.data.data.totalCount
+            })
+        })
+    }
+    componentWillMount(){
+        this.loadDataService(1)
+    }
+    tabFun(e){
+       this.setState({ nub: e.target.value })
+       switch(e.target.value){
+           case '1':
+                this.loadDataService(1)
+                break;
+       }
+    }
+    //分页
+    onShowSizeChange(current, pageSize){
+        this.setState({
+            current:current,
+            pageSize:pageSize
+        })
+    }
+    jump(item){
+        let url='';
+        switch(this.state.nub){
+            case '1':
+                url = globalConfig.context+`/portal/subscriberDetail.html?uid=${item.id}&type=0`;
+            break;
+        }
+        window.open(url);
+    }
+	render() {
+        const dataList =this.state.dataList || [];
+		return <div className="user-content">
+            <div className="title" >
+                我的关注
+            </div>
+            {/* <div>
+                <Radio.Group className="btnGroup" value={this.state.nub} onChange={this.tabFun.bind(this)}>
+                    <Radio.Button value="1">智者</Radio.Button>
+                </Radio.Group>
+            </div> */}
+            <div className="imgList">
+                <Spin spinning={this.state.loading}>
+                    {dataList.length?<Row>
+                        {dataList.map((item,index)=>{
+                            return<Col span={6} key={index} onClick={(e)=>{this.jump(item)}}>
+                                    <div className="img">
+                                        <div className="imgHeader">
+                                            <div className="imgBj">
+                                                 {item.img?<img src={globalConfig.avatarHost+'/upload'+item.img}  alt=""/>:''}
+                                            </div>
+                                            <div className="divP"><p>{item.introduce?item.introduce:'暂无'}</p></div>
+                                        </div>  
+                                        <p className="txt">{item.name?item.name:'佚名'}</p>
+                                    </div>
+                                </Col>
+                        })
+                        }   
+                    </Row>:
+                    <Row style={{color:'#333'}}>暂无数据</Row>}
+                </Spin>
+                {this.state.total?<Pagination className="page" pageSize={8} current={this.state.current} total={this.state.total} onChange={this.onShowSizeChange.bind(this)}/>:''}
+            </div>
+           
+        </div>
+	}
+}
+
+export default Collection;

+ 4 - 2
js/component/account/menu.jsx

@@ -6,7 +6,8 @@ module.exports = {
         icon: 'home',
         children: [
           { name: '常用功能', url: 'normal' },
-          // { name: '我的收藏', url: 'collection' },
+          { name: '我的收藏', url: 'collection' },
+          { name: '我的关注', url: 'follow' },
           // { name: '科技订单', url: 'techList' },
           // { name: '服务订单', url: 'serviceList' },
           // { name: '咨询订单', url: 'consultList' },
@@ -50,7 +51,8 @@ module.exports = {
         icon: 'home',
         children: [
           { name: '常用功能', url: 'normal' },
-          // { name: '我的收藏', url: 'collection' },
+          { name: '我的收藏', url: 'collection' },
+          { name: '我的关注', url: 'follow' },
           // { name: '科技订单', url: 'techList' },
           // { name: '服务订单', url: 'serviceList' },
           // { name: '咨询订单', url: 'consultList' }