Commit aa468004 by yanglang123

搜索查询

parent 92a20ec6
......@@ -83,7 +83,7 @@ class AllDescribe extends Component {
if (list.pageMode == 3) {
hashHistory.push({
pathname: func.routerBefore() + "/vote",
query: { id: id, name: list.name, voteNum: list.voteNum },
query: { id: id},
});
}
}
......
......@@ -115,7 +115,7 @@ class ChangePassword extends Component {
salt = this.generateCharacter(16)
console.log("validate-salt",salt)
date = this.getCurrentDay()
console.log("validate-date",date)
console.log("validate-date1111",date)
password = sm2.doEncrypt(newPassword+salt, public_key, 1);
confirmedPassword = sm2.doEncrypt(repeatPassword+salt, public_key, 1)
......
......@@ -9,10 +9,13 @@
color: #fff;
}
.myExamBody .am-tabs-default-bar-content .am-tabs-default-bar-tab-active {
border-bottom: 1px solid red !important;
color: #fff;
font-weight: bold;
}
.myExamBody .am-tabs-default-bar-content .am-tabs-default-bar-underline {
bottom: 4%;
border: 4px solid #ffffff !important;
}
.list-view-header {
width: 96%;
margin: 0 auto;
......
......@@ -10,10 +10,13 @@
background: linear-gradient(270deg, #ee4e3c 0%, #d23a29);
color: #fff;
.am-tabs-default-bar-tab-active {
border-bottom: 1px solid red !important;
color: #fff;
font-weight: bold;
}
.am-tabs-default-bar-underline {
bottom: 4%;
border: 4px solid #ffffff !important;
}
}
}
.list-view-header {
......
import excute from '../../util/fetchUtil';
import API from '../../util/urlconfig';
import { Toast } from "antd-mobile";
export function searchApi(params, callback) {
const url = `${API.searchApi}?searchName=${params.searchName}`;
return (dispatch) => {
return excute.get(
url,
(response) => {
if (callback) {
callback(response.data);
}
}
);
};
}
//历史搜索
export function searchHistoryApi(callback) {
return (dispatch) => {
return excute.get(
API.searchHistoryApi,
(response) => {
if (callback) {
callback(response.data);
}
}
);
};
}
//大家都在搜
export function searchListAllApi(callback) {
return (dispatch) => {
return excute.get(
API.searchListAllApi,
(response) => {
if (callback) {
callback(response.data);
}
}
);
};
}
//删除
export function searchDeleteApi(callback) {
return (dispatch) => {
return excute.get(
API.searchDeleteApi,
(response) => {
if (callback) {
callback(response.data);
}
}
);
};
}
\ No newline at end of file
import React, {Component} from 'react';
import './style.less';
import {bindActionCreators} from 'redux';
import {hashHistory} from 'react-router';
import {connect} from 'react-redux';
import {
globalSearchItem,
getSearchCourseList,
getSearchMarketList,
getSearchAlbumList,
getSearchLiveList,
getSearchLiveReview,
} from '../../../../redux/action/globalsearch';
import {
tarinSearchData,
} from '../../../menutrain/TrainSearch/TrainSearchResult/TrainSearchResultAction';
import func from '../../../../util/commonFunc';
import moment from 'moment';
import TrainSearchItem from '../../../common/itemList/ItemList';
import MarketItem from './marketItem';
import jumpToLive from "../../../../util/jumpToLive.js";
import intl from "react-intl-universal";
const mapStateToProps = state => {
return {
caseLibraryList: state.GlobalSearchReducer.caseLibraryList,
caseLibraryTotal: state.GlobalSearchReducer.caseLibraryTotal,
courseList: state.GlobalSearchReducer.courseList,
courseTotal: state.GlobalSearchReducer.courseTotal,
trainList: state.GlobalSearchReducer.trainList,
trainTotal: state.GlobalSearchReducer.trainTotal,
examList: state.GlobalSearchReducer.examList,
examTotal: state.GlobalSearchReducer.examTotal,
homeworkList: state.GlobalSearchReducer.homeworkList,
homeworkTotal: state.GlobalSearchReducer.homeworkTotal,
surveyList: state.GlobalSearchReducer.surveyList,
surveyTotal: state.GlobalSearchReducer.surveyTotal,
teacherList: state.GlobalSearchReducer.teacherList,
teacherTotal: state.GlobalSearchReducer.teacherTotal,
marketingList: state.GlobalSearchReducer.marketingList,
marketingTotal: state.GlobalSearchReducer.marketingTotal,
albumList: state.GlobalSearchReducer.albumList,
albumTotal: state.GlobalSearchReducer.albumTotal,
singleDataList: state.TrainSearchResultReducer.dataList,
singleDataTotal: state.TrainSearchResultReducer.total,
singleCourseList: state.GlobalSearchReducer.singleCourseList,
singleCourseTotal: state.GlobalSearchReducer.singleCourseTotal,
singleMarketList: state.GlobalSearchReducer.singleMarketList,
singleMarketTotal: state.GlobalSearchReducer.singleMarketTotal,
singleAlbumList: state.GlobalSearchReducer.singleAlbumList,
singleAlbumTotal: state.GlobalSearchReducer.singleAlbumTotal,
singleLiveList: state.GlobalSearchReducer.singleLiveList,
singleLiveTotal: state.GlobalSearchReducer.singleLiveTotal,
singleLiveReviewList: state.GlobalSearchReducer.singleLiveReviewList,
singleLiveReviewTotal: state.GlobalSearchReducer.singleLiveReviewTotal,
};
};
const mapDispatchToProps = dispatch => {
return {
globalSearchItem: bindActionCreators (globalSearchItem, dispatch),
tarinSearchData: bindActionCreators (tarinSearchData, dispatch),
getSearchCourseList: bindActionCreators (getSearchCourseList, dispatch),
getSearchMarketList: bindActionCreators (getSearchMarketList, dispatch),
getSearchAlbumList: bindActionCreators (getSearchAlbumList, dispatch),
getSearchLiveList: bindActionCreators (getSearchLiveList, dispatch),
getSearchLiveReview: bindActionCreators (getSearchLiveReview, dispatch),
};
};
class GlobalSearchList extends Component {
constructor (props) {
super (props);
this.state = {
pageNo: 1,
pageSize: 10,
isLoading: false,
hasMore: true,
globalSearchResultList: [],
globalSearchTotal: 0,
singleSearchDataList: [],
singleSearchTotal: 0,
};
this.getGlobalSearchList = this.getGlobalSearchList.bind (this);
this.reachToEnd = this.reachToEnd.bind (this);
this.renderRow = this.renderRow.bind (this);
this.itemClick = this.itemClick.bind (this);
this.getSingleSearchList = this.getSingleSearchList.bind (this);
this.trainItemClick = this.trainItemClick.bind (this);
}
componentDidMount () {
const {keyword, notAll} = this.props;
if (notAll) {
if (keyword) {
this.getSingleSearchList (1);
}
} else {
if (keyword) {
this.getGlobalSearchList (1);
}
}
}
getGlobalSearchList (pageNo) {
const {type, keyword, globalSearchItem} = this.props;
const {pageSize, globalSearchResultList} = this.state;
let _this = this;
this.setState ({isLoading: true});
console.log ('getGlobalSearchList-type-keyword', type, keyword);
globalSearchItem (
{
type,
keyword,
pageNo,
pageSize,
},
() => {
const {
courseList,
courseTotal,
trainList,
trainTotal,
examList,
examTotal,
homeworkList,
homeworkTotal,
surveyList,
surveyTotal,
teacherList,
teacherTotal,
marketingList,
marketingTotal,
caseLibraryList,
caseLibraryTotal,
albumList,
albumTotal,
} = _this.props;
console.log ('********-this.props', _this.props);
switch (type) {
case 'course':
_this.setState ({
globalSearchResultList: globalSearchResultList.length == 0
? courseList
: globalSearchResultList.concat (courseList),
globalSearchTotal: courseTotal,
hasMore: (pageNo - 1) * pageSize + courseList.length >=
courseTotal
? false
: true,
});
break;
case 'trainingProject':
_this.setState ({
globalSearchResultList: globalSearchResultList.length == 0
? trainList
: globalSearchResultList.concat (trainList),
globalSearchTotal: trainTotal,
hasMore: (pageNo - 1) * pageSize + trainList.length >= trainTotal
? false
: true,
});
break;
case 'exam':
_this.setState ({
globalSearchResultList: globalSearchResultList.length == 0
? examList
: globalSearchResultList.concat (examList),
globalSearchTotal: examTotal,
hasMore: (pageNo - 1) * pageSize + examList.length >= examTotal
? false
: true,
});
break;
case 'assignment':
_this.setState ({
globalSearchResultList: globalSearchResultList.length == 0
? homeworkList
: globalSearchResultList.concat (homeworkList),
globalSearchTotal: homeworkTotal,
hasMore: (pageNo - 1) * pageSize + homeworkList.length >=
homeworkTotal
? false
: true,
});
break;
case 'research':
_this.setState ({
globalSearchResultList: globalSearchResultList.length == 0
? surveyList
: globalSearchResultList.concat (surveyList),
globalSearchTotal: surveyTotal,
hasMore: (pageNo - 1) * pageSize + surveyList.length >=
surveyTotal
? false
: true,
});
break;
case 'lecturer':
_this.setState ({
globalSearchResultList: globalSearchResultList.length == 0
? teacherList
: globalSearchResultList.concat (teacherList),
globalSearchTotal: teacherTotal,
hasMore: (pageNo - 1) * pageSize + teacherList.length >=
teacherTotal
? false
: true,
});
break;
case 'marketingCourse':
_this.setState ({
globalSearchResultList: globalSearchResultList.length == 0
? marketingList
: globalSearchResultList.concat (marketingList),
globalSearchTotal: marketingTotal,
hasMore: (pageNo - 1) * pageSize + marketingList.length >=
marketingTotal
? false
: true,
});
break;
case 'studentCase':
_this.setState ({
globalSearchResultList: globalSearchResultList.length == 0
? caseLibraryList
: globalSearchResultList.concat (caseLibraryList),
globalSearchTotal: caseLibraryTotal,
hasMore: (pageNo - 1) * pageSize + caseLibraryList.length >=
caseLibraryTotal
? false
: true,
});
break;
case 'albums':
_this.setState ({
globalSearchResultList: globalSearchResultList.length == 0
? albumList
: globalSearchResultList.concat (albumList),
globalSearchTotal: albumTotal,
hasMore: (pageNo - 1) * pageSize + albumList.length >= albumTotal
? false
: true,
});
break;
}
this.setState ({isLoading: false, pageNo});
}
);
}
async getSingleSearchList (pageNo) {
await this.setState({
isLoading: true
})
const {
searchType,
keyword,
tarinSearchData,
getSearchCourseList,
getSearchMarketList,
classifyId,
getSearchAlbumList,
getSearchLiveList,
getSearchLiveReview
} = this.props;
const {pageSize} = this.state;
let _this = this;
if (searchType == 3) {
tarinSearchData (
{
keyword,
pageNo,
now: moment ().format ('YYYY-MM-DD HH:mm:ss'),
pageSize,
},
() => {
const {singleDataList, singleDataTotal} = _this.props;
const {singleSearchDataList} = _this.state;
_this.setState ({
singleSearchDataList: singleSearchDataList.length == 0
? singleDataList
: singleSearchDataList.concat (singleDataList),
singleSearchTotal: singleDataTotal,
hasMore: (pageNo - 1) * pageSize + singleDataList.length >=
singleDataTotal
? false
: true,
isLoading: false,
pageNo,
});
}
);
} else if (searchType == 2) {
getSearchCourseList (
{
name: keyword,
classifyId,
pageNo,
pageSize,
},
() => {
const {singleCourseList, singleCourseTotal} = _this.props;
const {singleSearchDataList} = _this.state;
_this.setState ({
singleSearchDataList: singleSearchDataList.length == 0
? singleCourseList
: singleSearchDataList.concat (singleCourseList),
singleSearchTotal: singleCourseTotal,
hasMore: (pageNo - 1) * pageSize + singleCourseList.length >=
singleCourseTotal
? false
: true,
isLoading: false,
pageNo,
});
}
);
} else if (searchType == 4) {
getSearchMarketList (
{
nameOrSortNum: keyword,
pageParam: {
pageNo,
pageSize,
},
},
() => {
const {singleMarketList, singleMarketTotal} = _this.props;
const {singleSearchDataList} = _this.state;
_this.setState ({
singleSearchDataList: singleSearchDataList.length == 0
? singleMarketList
: singleSearchDataList.concat (singleMarketList),
singleSearchTotal: singleMarketTotal,
hasMore: (pageNo - 1) * pageSize + singleMarketList.length >=
singleMarketTotal
? false
: true,
isLoading: false,
pageNo,
});
}
);
} else if (searchType == 5) {
getSearchAlbumList (
{
name: keyword,
pageNo,
pageSize,
classifyId: classifyId || '',
},
() => {
const {singleAlbumList, singleAlbumTotal} = _this.props;
const {singleSearchDataList} = _this.state;
_this.setState ({
singleSearchDataList: singleSearchDataList.length == 0
? singleAlbumList
: singleSearchDataList.concat (singleAlbumList),
singleSearchTotal: singleAlbumTotal,
hasMore: (pageNo - 1) * pageSize + singleAlbumList.length >=
singleAlbumTotal
? false
: true,
isLoading: false,
pageNo,
});
}
);
} else if (searchType == 9) {
getSearchLiveList (
{
name: keyword,
pageNo,
pageSize,
},
() => {
const {singleLiveList, singleLiveTotal} = _this.props;
const {singleSearchDataList} = _this.state;
_this.setState ({
singleSearchDataList: singleSearchDataList.length == 0
? singleLiveList
: singleSearchDataList.concat (singleLiveList),
singleSearchTotal: singleLiveTotal,
hasMore: (pageNo - 1) * pageSize + singleLiveList.length >=
singleLiveTotal
? false
: true,
isLoading: false,
pageNo,
});
}
);
} else if (searchType == 10) { //直播回放
getSearchLiveReview (
{
name: keyword,
pageNo,
pageSize,
},
() => {
const {singleLiveReviewList, singleLiveReviewTotal} = _this.props;
const {singleSearchDataList} = _this.state;
let dataSource = [];
if(singleLiveReviewList.length){
for(var i = 0; i<singleLiveReviewList.length; i = i + 2){
dataSource.push([singleLiveReviewList[i], singleLiveReviewList[i+1]])
}
}
_this.setState ({
singleSearchDataList: singleSearchDataList.length == 0
? dataSource
: singleSearchDataList.concat (dataSource),
singleSearchTotal: singleLiveReviewTotal,
hasMore: (pageNo - 1) * pageSize + singleLiveReviewList.length >=
singleLiveReviewTotal
? false
: true,
isLoading: false,
pageNo,
});
}
);
}
}
trainItemClick (item) {
hashHistory.push ({
pathname: func.routerBefore () + '/trainingsteps',
query: {
id: item.id,
finished: item.finished,
},
});
}
renderRow (data) {
console.log('888888888888888------1-----', data)
const {type, keyword, searchType, notAll} = this.props;
if (notAll) {
if (searchType == 3) {
return (
<TrainSearchItem
data={{
text: data.name,
people: data.joinNumber,
start: data.startTime,
end: data.endTime,
image: data.logoImg,
id: data.id,
finished: data.finished,
}}
titleData={{keyword}}
itemClick={data => this.trainItemClick (data)}
/>
);
} else if (searchType == 4) {
return <MarketItem rowData={data} />;
}
} else {
return (
<GlobalSearchResultListItem
type={type}
item={data}
onClick={this.itemClick}
keyword={keyword}
/>
);
}
}
goToLive (item) {
if(item.viewType == 0){ //viewType 0公开直播 1站内直播
location.href = `https://live.polyv.cn/watch/${item.channel}` //应军哥要求,此处地址写死
return
}
jumpToLive.jumpToLive (item.channel);
}
reachToEnd () {
const {isLoading, hasMore, pageNo} = this.state;
const {notAll} = this.props;
if (isLoading || !hasMore) {
return;
}
if (notAll) {
this.getSingleSearchList (pageNo + 1);
} else {
this.getGlobalSearchList (pageNo + 1);
}
}
itemClick (id) {
const {type} = this.props;
switch (type) {
case 'course':
hashHistory.push ({
pathname: func.routerBefore () + '/courseplay',
query: {
id,
},
});
break;
case 'trainingProject':
hashHistory.push ({
pathname: func.routerBefore () + '/trainingsteps',
query: {
id,
finished: false,
},
});
break;
case 'exam':
hashHistory.push ({
pathname: func.routerBefore () + '/examdetail',
query: {
id,
},
});
break;
case 'assignment':
hashHistory.push ({
pathname: func.routerBefore () + '/homeworkdetail',
query: {
id,
},
});
break;
case 'research':
hashHistory.push ({
pathname: func.routerBefore () + '/SurveyDetails',
query: {
id,
},
});
break;
case 'studentCase':
hashHistory.push ({
pathname: func.routerBefore () + '/caseLibraryDetail',
query: {
id,
},
});
break;
case 'albums':
hashHistory.push ({
pathname: func.routerBefore () + '/AlbumDetail',
query: {
id,
},
});
break;
}
}
render () {
const {height, type, notAll} = this.props;
console.log ('render-notAll', notAll);
const {
globalSearchResultList,
isLoading,
globalSearchTotal,
singleSearchTotal,
singleSearchDataList,
} = this.state;
return (
<div className="global-search-list-container" style={{height: height}}>
<div
className="global-search-list-total"
style={{backgroundColor: '#fff', height: '80px'}}
>
{!this.state.isLoading && <span>{intl.get("PublishKey21") || "共搜索到"} {notAll ? singleSearchTotal : globalSearchTotal} {intl.get("forum7") || "个结果"}</span>}
</div>
</div>
);
}
}
class GlobalSearchResultListItem extends Component {
constructor (props) {
super (props);
this.getTimeByTime = this.getTimeByTime.bind (this);
this.titleSolveByKeyword = this.titleSolveByKeyword.bind (this);
}
getTagByType (type) {
switch (type) {
case 'course':
return intl.get("Course") || '课程';
case 'trainingProject':
return intl.get("TrainingProgram2") || '项目';
case 'exam':
return intl.get("Exam") || '考试';
case 'assignment':
return intl.get("Assignment") || '作业';
case 'research':
return intl.get("Research") || '调研';
case 'lecturer':
return intl.get("Lecturer") || '讲师';
case 'studentCase':
return intl.get("case") || '作品';
case 'albums':
return intl.get("Album") || '专辑';
}
}
getTimeByTime () {
const {item, type} = this.props;
switch (type) {
case 'course':
return func.dateFormat (item.releaseTimeLong);
case 'trainingProject':
return func.dateFormat (item.startTimeLong);
case 'exam':
return func.dateFormat (item.startTimeLong);
case 'assignment':
return func.dateFormat (item.endTimeLong);
case 'research':
return func.dateFormat (item.endTimeLong);
case 'lecturer':
return '';
case 'studentCase':
return func.dateFormat (item.endTimeLong);
case 'albums':
return func.dateFormat (item.updateTimeLong);
}
}
titleSolveByKeyword (text) {
const {keyword} = this.props;
if (text.indexOf (keyword) == -1) {
return text;
} else {
let result = text.split (keyword);
let dom = [];
for (let i = 0; i < result.length; i++) {
dom.push (result[i]);
if (i != result.length - 1) {
dom.push (
<span key={i} className="keyword-in-title">{keyword}</span>
);
}
}
return dom;
}
}
render () {
const {item, type} = this.props;
return (
<div
className="global-search-result-list-item"
onClick={() => this.props.onClick (item.id)}
>
<div className="result-title" style={{WebkitBoxOrient: 'vertical'}}>
<span className="result-type-text">{this.getTagByType (type)}</span>
{type == 'lecturer'
? this.titleSolveByKeyword (item.lecturerName)
: this.titleSolveByKeyword (item.name)}
</div>
{type == 'lecturer'
? <div className="result-tag">
{item.title}
</div>
: <div className="result-time">
{this.getTimeByTime ()}
</div>}
<div className="result-line" />
</div>
);
}
}
export default connect (mapStateToProps, mapDispatchToProps) (GlobalSearchList);
import React, { Component } from "react";
import {Icon} from "antd";
import {hashHistory} from "react-router";
import func from "../../../../util/commonFunc.js";
import imageUrl from "../../../../image/coursedefaultlogo.png";
import "./marketItem.less";
import intl from "react-intl-universal";
class MarketItem extends Component {
render() {
const { rowData } = this.props;
let sourceText = '';
switch (rowData.source) {
case 1:
sourceText = intl.get("globalsearch3") || '内部定制';
break;
case 2:
sourceText = intl.get("globalsearch4") || '外部定制';
break;
case 3:
sourceText = intl.get("globalsearch5") || '外部采购';
break;
}
console.log(rowData)
let accountId = sessionStorage.getItem("accountId");
return <div className="market-search-item" >
<img src={rowData.image?rowData.image:imageUrl} alt=""/>
<div className="market-search-item-info">
<div className="title" style={{WebkitBoxOrient:"vertical"}}>{rowData.name}</div>
<div className="teacher">
<Icon type="user" style={{fontSize:30}}/>
<span>{sourceText}</span>
</div>
<div className="look-num">
<Icon type="eye-o" style={{fontSize:30}}/>
<span>{rowData.readCount}</span>
</div>
</div>
</div>
}
}
export default MarketItem;
\ No newline at end of file
.market-search-item {
width : 100%;
height : 220px;
padding : 20px 20px 20px 320px;
position: relative;
img {
width : 300px;
height : 180px;
position : absolute;
top : 20px;
left : 20px;
border-radius: 20px;
}
.market-search-item-info {
width : 100%;
height : 220px;
padding: 0 20px;
.title {
font-size : 32px;
color : #4a4a4a;
overflow : hidden;
text-overflow : ellipsis;
display : -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
word-break : break-word;
}
.teacher {
font-size: 24px;
color : #4a4a4a;
span {
margin-left: 20px;
}
}
.look-num {
font-size: 24px;
color : #4a4a4a;
span {
margin-left: 15px;
}
}
}
}
\ No newline at end of file
@import "../../../../static/theme.less";
.global-search-list-container {
width: 100%;
.global-search-result-list-item {
width : 100%;
padding : 20px 20px 54px 20px;
position: relative;
.result-title {
width : 100%;
line-height : 40px;
max-height : 80px;
font-size : 32px;
color : #4a4a4a;
display : -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow : hidden;
.result-type-text {
font-size : 24px;
color : @themeColor;
border : 2px solid @themeColor;
padding : 2px 8px;
border-radius: 8px;
margin-right : 10px;
}
.keyword-in-title{
color: #F4434B;
}
}
.result-time {
width : 100%;
height : 30px;
line-height: 30px;
font-size : 24px;
color : #999;
margin-top : 16px;
}
.result-tag {
width : 100%;
height : 30px;
line-height : 30px;
font-size : 24px;
color : #999;
margin-top : 16px;
overflow : hidden;
text-overflow: ellipsis;
white-space : nowrap
}
.result-line {
width : 100%;
height : 2px;
background-color: #efeff4;
position : absolute;
left : 0;
bottom : 0;
}
}
.global-search-list-total {
padding : 22px;
font-size : 28px;
color : #999;
line-height: 36px;
}
.listcard-info{
.iconfont{
font-size: 20px
}
}
}
\ No newline at end of file
import React, { Component } from "react";
import { Icon } from "antd";
import { Modal,Toast } from "antd-mobile";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import { getSearchHistoryList,deteleSearchHistory } from "../../../../redux/action/globalsearch";
import intl from "react-intl-universal";
import "./style.less";
const mapStateToProps = (state) => {
return {
list: state.GlobalSearchReducer.searchHistoryList
}
}
const mapDispatchToProps = (dispatch) => {
return {
getSearchHistoryList: bindActionCreators(getSearchHistoryList, dispatch),
deteleSearchHistory:bindActionCreators(deteleSearchHistory,dispatch)
}
}
class GlobalSearchHistory extends Component {
constructor(props) {
super(props)
this.state = {
historyItems: [],
show: false
}
this.clearHistory = this.clearHistory.bind(this);
}
componentDidMount() {
const {type} = this.props;
this.setState({
show: this.props.show
});
let _this = this;
this.props.getSearchHistoryList({ type }, () => {
const { list } = _this.props;
_this.setState({
historyItems: list,
show:list.length>0?_this.props.show:false
})
});
}
componentWillReceiveProps(nextProps){
if(nextProps.show!=this.props.show){
this.setState({
show: nextProps.show
});
if(nextProps.show){
let _this = this;
const {type} = nextProps;
this.props.getSearchHistoryList({ type}, () => {
const { list } = _this.props;
_this.setState({
historyItems: list,
show:list.length>0?nextProps.show:false
})
});
}
}
}
clearHistory() {
let _this = this;
Toast.loading("",0);
const {type} = this.props;
this.props.deteleSearchHistory({type},()=>{
Toast.hide();
_this.setState({
historyItems: [],
show: false
});
});
setTimeout(()=>{
Toast.hide();
},10000);
}
historyItemSolve(name){
if(name.length<=23){
return name;
}else{
return name.slice(0,22)+"...";
}
}
render() {
const { show } = this.state;
return <div className="global-search-history" style={{ display: show ? "block" : "none" }}>
<div className="history-title">
{intl.get("PublishKey107") || "搜索历史"}
</div>
<div className="history-item-container">
{
this.state.historyItems.map((item, index) => {
if (item) {
return <div className="history-item" key={index} onClick={() => this.props.historyClick(item)}>
{this.historyItemSolve(item)}
</div>;
} else {
return <div key={index} style={{ display: "none" }}></div>;
}
})
}
<div style={{clear:"both"}}></div>
</div>
</div>
}
}
export default connect(mapStateToProps, mapDispatchToProps)(GlobalSearchHistory);
\ No newline at end of file
.global-search-history {
width : 100%;
padding: 30px 20px;
.history-title {
width : 100%;
height : 40px;
line-height: 40px;
font-size : 28px;
color : #999;
.history-delete {
font-size : 20px;
color : #999;
width : 30px;
height : 34px;
float : right;
margin-top : 4px;
margin-right: 6px;
}
}
.history-item-container {
width : 100%;
margin-top: 24px;
.history-item {
width : fit-content;
height : 52px;
border-radius : 52px;
line-height : 50px;
background-color: #f7f7f7;
font-size : 28px;
color : #666;
padding : 0 32px;
margin-right : 10px;
margin-bottom : 13px;
float : left;
overflow : hidden;
text-overflow : ellipsis;
white-space : nowrap;
}
}
}
\ No newline at end of file
import React, { Component } from 'react';
// import {Tabs} from 'antd-mobile';
import { Tabs, Radio } from 'antd';
import GlobalSearchHistory from './component/searchHistory';
import './style.less';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { hashHistory } from 'react-router';
import React, { Component } from "react";
import "./style.less";
import { SearchBar } from "antd-mobile";
import { bindActionCreators } from "redux";
import { connect } from "react-redux";
import { hashHistory } from "react-router";
import func from "../../util/commonFunc";
import moment from "moment";
import {
globalSearchAll,
saveSearchHistory,
} from '../../redux/action/globalsearch';
import GlobalSearchResultList from './component/GlobalSearchList/index';
import func from '../../util/commonFunc';
import intl from "react-intl-universal";
const mapStateToProps = state => {
return {
searchResult: state.GlobalSearchReducer.searchResult,
};
searchApi,
searchHistoryApi,
searchDeleteApi,
searchListAllApi,
} from "./action";
const mapStateToProps = (state) => {
return {};
};
const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch) => {
return {
globalSearchAll: bindActionCreators(globalSearchAll, dispatch),
saveSearchHistory: bindActionCreators(saveSearchHistory, dispatch),
searchApi: bindActionCreators(searchApi, dispatch),
searchHistoryApi: bindActionCreators(searchHistoryApi, dispatch),
searchDeleteApi: bindActionCreators(searchDeleteApi, dispatch),
searchListAllApi: bindActionCreators(searchListAllApi, dispatch),
};
};
const screenHeight = document.body.clientHeight;
const { TabPane } = Tabs;
class GlobalSearch extends Component {
constructor(props) {
super(props);
this.state = {
searchWord: '',
searchType: 1,
globalSearchAllResult: {
courses: [1],
trainingProjects: [1],
exams: [1],
assignments: [1],
research: [1],
teacrhers: [1],
marketingCourses: [1],
studentCases: [1],
albums: [1], //专辑
},
searchResultTabs: [
{ key: 'course', title: intl.get("Course") || '课程' },
{ key: 'trainingProject', title: intl.get("TrainingProgram2") || '项目' },
{ key: 'exam', title: intl.get("Exam") || '考试' },
{ key: 'assignment', title: intl.get("Assignment") || '作业' },
{ key: 'lecturer', title: intl.get("Lecturer") || '讲师' },
{ key: 'research', title: intl.get("Research") || '调研' },
{ key: 'studentCase', title: '作品' },
{ key: 'albums', title: '专辑' }, //专辑
],
DyListHeight: 0,
refreshGlobalSearchList: '',
isSearching: true,
refreshSearch: '',
refreshHistory: '',
currentTabKey: 'course',
refreshTab: '',
refreshResultList: '',
resultShow: true,
searchHistoryList: [],
searchAllList: [],
searchResultList: [],
};
this.searchPressEnter = this.searchPressEnter.bind(this);
this.searchStatus = this.searchStatus.bind(this);
this.searchByKeyword = this.searchByKeyword.bind(this);
}
componentWillMount() {
const { type } = this.props;
this.setState({
DyListHeight: screenHeight - 88 * 2,
searchType: type,
});
}
componentWillMount() {}
componentDidMount() {
const { keyword } = this.props;
console.log('开始搜索', keyword);
if (keyword) {
this.searchByKeyword(decodeURIComponent(keyword));
} else {
this.searchByKeyword('');
}
}
searchByKeyword(keyword) {
if (keyword.length == 0) {
this.props.searchHistoryApi((response) => {
this.setState({
isSearching: true,
searchWord: '',
refreshSearch: new Date().getTime(),
});
return;
}
this.props.saveSearchHistory({
type: this.state.searchType,
content: keyword,
});
this.setState({
searchWord: keyword,
isSearching: false,
refreshSearch: new Date().getTime(),
refreshGlobalSearchList: new Date().getTime(),
});
const { globalSearchAll } = this.props;
switch (this.state.searchType) {
case 1:
globalSearchAll(keyword, () => {
const { searchResult } = this.props;
console.log('searchResult', searchResult)
let searchResultTabs = [];
if (searchResult.courses && searchResult.courses.length > 0) {
searchResultTabs.push({ key: 'course', title: intl.get("Course") || '课程' });
}
if (
searchResult.trainingProjects &&
searchResult.trainingProjects.length > 0
) {
searchResultTabs.push({ key: 'trainingProject', title: intl.get("TrainingProgram2") || '项目' });
}
if (searchResult.exams && searchResult.exams.length > 0) {
searchResultTabs.push({ key: 'exam', title: intl.get("Exam") || '考试' });
}
if (searchResult.assignments && searchResult.assignments.length > 0) {
searchResultTabs.push({
key: 'assignment',
title: intl.get("Assignment") || '作业',
searchHistoryList: response,
});
}
if (searchResult.research && searchResult.research.length > 0) {
searchResultTabs.push({ key: 'research', title: intl.get("Research") || '调研' });
}
if (searchResult.lecturers && searchResult.lecturers.length > 0) {
searchResultTabs.push({
key: 'lecturer',
title: intl.get("Lecturer") || '讲师',
});
}
if (
searchResult.studentCases &&
searchResult.studentCases.length > 0
) {
searchResultTabs.push({
key: 'studentCase',
title: intl.get("case") || '作品',
});
}
if (searchResult.albums && searchResult.albums.length > 0) {
searchResultTabs.push({
key: 'albums',
title: intl.get("Album") || '专辑',
});
}
this.props.searchListAllApi((response) => {
this.setState({
searchResultTabs,
refreshTab: new Date().getTime(),
isFetching: false,
currentTabKey: searchResultTabs.length > 0
? searchResultTabs[0].key
: '',
});
searchAllList: response,
});
break;
case 3:
case 2:
case 4:
case 5:
case 9:
case 10:
this.setState({
refreshResultList: new Date().getTime(),
});
break;
}
}
searchPressEnter(keyword) {
this.props.refreshContainerFunc(keyword);
}
onChange = (value) => {
this.setState({ searchWord: value });
};
searchStatus(status) {
let _this = this;
if (status) {
onSubmit = (value) => {
let params = {
searchName: value,
};
this.props.searchApi(params, (response) => {
this.setState({
isSearching: status,
searchResultList: response.classificationVOList,
resultShow: false,
});
} else {
setTimeout(() => {
_this.setState({
isSearching: status,
});
}, 500);
}
}
tabChange(tabkey) {
console.log(tabkey);
};
onCancel = () => {
this.setState({
currentTabKey: tabkey,
resultShow: true,
});
}
};
newsItemClick = (data) => {
hashHistory.push({
pathname: func.routerBefore() + "/NewsMessageResult",
query: { id: data.id},
});
};
render() {
const { isSearching, DyListHeight, refreshSearch, searchWord } = this.state;
let imageWidth = Math.floor(document.body.clientWidth * (220 / 750));
imageWidth = imageWidth < 220 ? 220 : imageWidth;
let { resultShow, searchHistoryList, searchAllList, searchResultList } =
this.state;
return (
<div className="global-search-container">
<div className="global-search-list-container">
<GlobalSearchHistory
historyClick={this.searchPressEnter}
show={isSearching}
type={this.state.searchType}
/>
<div className="global-search-input">
<div
className="global-search-tabs"
style={{
display: isSearching ? 'none' : 'block',
height: DyListHeight + 88,
backgroundColor: this.state.searchResultTabs.length == 0 &&
searchWord.length > 0
? '#f3f3f3'
: '#fff',
width: "95%",
display: "flex",
justifyContent: "space-between",
alignItems: "center",
}}
>
{this.state.searchType == 1
? <GlobalSearchTab
key={this.state.refreshTab}
type={this.state.searchType}
searchResultTabs={this.state.searchResultTabs}
refreshGlobalSearchList={this.state.refreshGlobalSearchList}
DyListHeight={DyListHeight}
searchWord={searchWord}
<SearchBar
onChange={this.onChange}
onSubmit={this.onSubmit}
placeholder="搜索"
maxLength={8}
/>
:
<GlobalSearchResultList
type={''}
key={this.state.refreshResultList}
notAll={true}
searchType={this.state.searchType}
classifyId={this.props.courseClassifyId}
keyword={searchWord}
height={DyListHeight - 10}
/>}
<div
style={{
width: "10%",
color: "#fff",
fontSize: "32px",
fontWeight: "600",
}}
onClick={this.onCancel}
>
取消
</div>
</div>
</div>
{resultShow ? (
<div className="global-search-history">
<div className="global-search-history-tit">历史搜索</div>
<div className="global-search-history-con">
{searchHistoryList.map((item) => {
return (
<div className="global-search-history-con-item">
{item.cnName}
</div>
);
}
}
class GlobalSearchTab extends Component {
constructor(props) {
super(props);
this.state = {
refreshGlobalSearchList: '',
};
}
componentWillReceiveProps(nextProps) {
if (
nextProps.refreshGlobalSearchList != this.props.refreshGlobalSearchList
) {
const { refreshGlobalSearchList } = nextProps;
this.setState({
refreshGlobalSearchList,
});
}
}
render() {
const { searchResultTabs, searchWord, DyListHeight } = this.props;
return searchResultTabs.length > 0
? <Tabs defaultActiveKey="1" tabPosition={'top'} style={{ height: '100vh', fontSize: '0.8rem' }} className={searchResultTabs.length == 1 ? 'only-one-tab' : 'selfTab'} >
{searchResultTabs.length > 0 &&
searchResultTabs.map((tab, index) => {
})}
</div>
<div className="global-search-history-tit">大家都在搜</div>
<div className="global-search-history-con">
{searchAllList.map((item) => {
return (
<TabPane className="selfTab" tab={tab.title} key={index + 1}>
<div
style={{
width: '100%',
height: 10,
backgroundColor: '#f4f4f4',
}}
/>
<GlobalSearchResultList
type={tab.key}
keyword={searchWord}
height={DyListHeight - 10}
/>
</TabPane>
<div className="global-search-history-con-item1">
{item.cnName}
</div>
);
})}
</Tabs>
: <div>
<div
style={{
fontSize: '.28rem',
padding: '.2rem .3rem',
color: 'rgba(155, 155, 155, 1)',
}}
/>
</div>;
}
}
class GlobalSearchContainer extends Component {
constructor(props) {
super(props);
this.state = {
keyword: '',
refreshContainer: '',
searchType: 1,
courseClassifyId: '',
};
this.refreshContainerFunc = this.refreshContainerFunc.bind(this);
}
componentDidMount() {
const { query } = this.props.location;
if (query && query.keyword) {
console.log('关键字', query.keyword);
this.setState({
keyword: decodeURIComponent(query.keyword),
refreshContainer: new Date().getTime(),
});
}
if (query && query.classifyId) {
this.setState({
courseClassifyId: query.classifyId,
refreshContainer: new Date().getTime(),
});
}
if (query && query.type) {
const typeMap = {
course: 2,
train: 3,
market: 4,
albums: 5,
live: 9,
livReview: 10,
};
this.setState({
searchType: typeMap[query.type],
refreshContainer: new Date().getTime(),
});
}
}
refreshContainerFunc(keyword) {
this.setState({
refreshContainer: new Date().getTime(),
keyword,
});
const { query } = this.props.location;
if (keyword) {
if (query && query.type) {
if (query.type == 'course' && query.classifyId) {
hashHistory.replace({
pathname: func.routerBefore() + '/search',
query: {
keyword: encodeURIComponent(keyword),
type: query.type,
classifyId: query.classifyId,
},
});
}else {
hashHistory.replace({
pathname: func.routerBefore() + '/search',
query: {
keyword: encodeURIComponent(keyword),
type: query.type,
},
});
}
} else {
hashHistory.replace({
pathname: func.routerBefore() + '/search',
query: {
keyword: encodeURIComponent(keyword),
},
});
}
} else {
if (query && query.type) {
if (query.type == 'course' && query.classifyId) {
hashHistory.replace({
pathname: func.routerBefore() + '/search',
query: {
type: query.type,
classifyId: query.classifyId,
},
});
} else {
hashHistory.replace({
pathname: func.routerBefore() + '/search',
query: {
type: query.type,
},
});
}
} else {
hashHistory.replace({
pathname: func.routerBefore() + '/search',
});
}
}
}
render() {
</div>
</div>
) : (
<div className="global-search-result">
{searchResultList?.map((list) => {
return (
<div className="global-search-result-con">
<div className="result-tit">
<span></span> {list.name}
</div>
{list.informationVoList?.map((item) => {
return (
<GlobalSearch
key={this.state.refreshContainer}
courseClassifyId={this.state.courseClassifyId}
keyword={this.state.keyword}
refreshContainerFunc={this.refreshContainerFunc}
searchResult={this.props.searchResult}
globalSearchAll={this.props.globalSearchAll}
saveSearchHistory={this.props.saveSearchHistory}
type={this.state.searchType}
<div className="result-content" onClick={()=>this.newsItemClick(item)}>
<div className="result-content-img">
<img
src={item.logoPath}
style={{ width: imageWidth, height: "180px" }}
alt=""
/>
</div>
<div className="result-content-item">
<div className="result-content-item-tit">
{item.fileName}
</div>
<div className="result-content-item-bot">
{moment(item.releaseTime).format("YYYY.MM.DD")}
<span>{item.author}</span>
</div>
</div>
</div>
);
})}
</div>
);
})}
</div>
)}
</div>
);
}
}
export default connect(mapStateToProps, mapDispatchToProps)(
GlobalSearchContainer
);
export default connect(mapStateToProps, mapDispatchToProps)(GlobalSearch);
.global-search-container {
width: 100%;
height: 100%;
background-color: #fff;
.global-search-container .global-search-input {
background: linear-gradient(270deg, #ee4e3c 0%, #d23a29);
padding: 15px 0;
padding-left: 40px;
}
.global-search-container .global-search-list-container {
width: 100%;
height: 100%;
.global-search-container .global-search-input .am-search {
width: 85%;
background-color: #eb7568;
border-radius: 45px;
height: 70px !important;
line-height: 70px !important;
}
.global-search-container .global-search-list-container .teacher-list-search {
margin-bottom: 0;
.global-search-container .global-search-input .am-search-input {
background-color: #eb7568 !important;
border-radius: 56px;
}
.global-search-container .global-search-list-container .am-tabs-bar .am-tabs-tab-active {
color: #4285F4;
.global-search-container .global-search-input .am-search-input .am-search-synthetic-ph {
text-align: left !important;
padding-left: 20px !important;
margin-left: 0 !important;
}
.global-search-container .global-search-list-container .global-search-tabs {
width: 100%;
.global-search-container .global-search-input .am-search-input .am-search-value {
color: #fff !important;
}
.global-search-container .global-search-input .am-search-cancel {
color: #fff !important;
display: none !important;
}
.global-search-container .global-search-history {
padding-left: 40px;
}
.global-search-container .global-search-history .global-search-history-tit {
font-size: 36px;
color: #333333;
font-weight: 600;
margin: 40px 0;
}
.global-search-container .global-search-history .global-search-history-con {
display: flex;
flex-wrap: wrap;
}
.global-search-container .global-search-history .global-search-history-con .global-search-history-con-item {
width: fit-content;
padding: 10px 24px;
color: #666666;
border: 1px solid #dcdee0;
font-size: 30px;
margin-right: 30px;
margin-bottom: 30px;
border-radius: 4px;
}
.global-search-container .global-search-history .global-search-history-con .global-search-history-con-item1 {
width: fit-content;
padding: 10px 24px;
color: #e6624a;
background: rgba(253, 63, 52, 0.1);
font-size: 30px;
margin-right: 30px;
margin-bottom: 30px;
border-radius: 4px;
}
.global-search-container .global-search-result {
padding-left: 40px;
padding-top: 40px;
}
.global-search-container .global-search-result .global-search-result-con .result-tit {
color: #000000;
font-size: 36px;
font-weight: 600;
margin-bottom: 30px;
}
.global-search-container .global-search-result .global-search-result-con .result-tit span {
display: inline-block;
width: 8px;
height: 24px;
background: linear-gradient(180deg, #fe742b, #fc5b2b 100%);
border-radius: 10px;
transform: translateY(-4px);
margin-right: 15px;
}
.global-search-container .global-search-result .global-search-result-con .result-content {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 40px;
}
.global-search-container .global-search-result .global-search-result-con .result-content .result-content-item {
width: 64%;
height: 180px;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.global-search-container .global-search-result .global-search-result-con .result-content .result-content-item .result-content-item-tit {
font-size: 32px;
color: #000;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
/* 定义文本的行数 */
overflow: hidden;
text-overflow: ellipsis;
}
.global-search-container .global-search-result .global-search-result-con .result-content .result-content-item .result-content-item-bot {
font-size: 26px;
color: #ABABAB;
}
.global-search-container .global-search-result .global-search-result-con .result-content .result-content-item .result-content-item-bot span {
margin-left: 20px;
}
@import "../../static/theme.less";
.global-search-container {
width : 100%;
height : 100%;
background-color: #fff;
.global-search-list-container {
width : 100%;
height: 100%;
.teacher-list-search{
margin-bottom: 0;
.global-search-input {
background: linear-gradient(270deg, #ee4e3c 0%, #d23a29);
padding: 15px 0;
padding-left: 40px;
.am-search {
width: 85%;
background-color: #eb7568;
border-radius: 45px;
height: 70px !important;
line-height: 70px !important;
}
.am-search-input {
background-color: #eb7568 !important;
border-radius: 56px;
.am-search-synthetic-ph {
text-align: left !important;
padding-left: 20px !important;
margin-left: 0 !important;
}
.am-search-value {
color: #fff !important;
}
.am-tabs-bar .am-tabs-tab-active {
color: @themeColor;
}
.am-search-cancel {
color: #fff !important;
display: none !important;
}
}
.global-search-history {
padding-left: 40px;
.global-search-tabs {
width: 100%;
.global-search-history-tit {
font-size: 36px;
color: #333333;
font-weight: 600;
margin: 40px 0;
}
.global-search-history-con {
display: flex;
flex-wrap: wrap;
.global-search-history-con-item {
width: fit-content;
padding: 10px 24px;
color: #666666;
border: 1px solid #dcdee0;
font-size: 30px;
margin-right: 30px;
margin-bottom: 30px;
border-radius: 4px;
}
}
.only-one-tab{
.am-tabs-ink-bar{
background-color: unset;
.global-search-history-con-item1 {
width: fit-content;
padding: 10px 24px;
color: #e6624a;
background: rgba(253, 63, 52, 0.1);
font-size: 30px;
margin-right: 30px;
margin-bottom: 30px;
border-radius: 4px;
}
.ant-tabs-nav-container {
font-size: 0.3rem;
}
}
.selfTab {
.ant-tabs-nav-container {
font-size: 0.3rem;
}
.ant-tabs-tab-prev-icon-target {
font-size: 0.3rem!important;
.global-search-result {
padding-left: 40px;
padding-top: 40px;
.global-search-result-con {
.result-tit {
color: #000000;
font-size: 36px;
font-weight: 600;
margin-bottom: 30px;
span {
display: inline-block;
width: 8px;
height: 24px;
background: linear-gradient(180deg, #fe742b, #fc5b2b 100%);
border-radius: 10px;
transform: translateY(-4px);
margin-right: 15px;
}
}
.result-content {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 40px;
.result-content-item {
width: 64%;
height: 180px;
display: flex;
flex-direction: column;
justify-content: space-between;
.result-content-item-tit {
font-size: 32px;
color: #000;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2; /* 定义文本的行数 */
overflow: hidden;
text-overflow: ellipsis;
}
.result-content-item-bot{
font-size: 26px;
color: #ABABAB;
span{
margin-left: 20px;
}
}
}
.ant-tabs-tab-next-icon-target {
font-size: 0.3rem!important;
}
.ant-tabs-tab {
margin-right: 0.42rem!important;
padding: 0.24rem 0.32rem!important;
}
.ant-tabs-bar {
margin: 0;
}
}
......@@ -296,18 +296,14 @@ class LoginForm extends Component {
let account = "";
salt = this.generateCharacter(16);
console.log("validate-salt", salt);
date = this.getCurrentDay();
console.log("validate-date", date);
password = sm2.doEncrypt(this.state.password + salt, public_key, 1);
account = sm2.doEncrypt(this.state.account + salt, public_key, 1);
password = "04" + password;
account = "04" + account;
console.log('1111111~~~~~~~~~~~~~~~~~~~',this.state.account,this.state.password,salt, date, password, account)
if (salt && date) {
key = salt + date;
console.log("validate-key", key);
}
sign =
"account=" +
......@@ -318,9 +314,6 @@ class LoginForm extends Component {
salt +
"&key=" +
key;
console.log("validate-sign", md5(sign));
let parms = {
account,
password,
......
......@@ -295,7 +295,7 @@ class Menulearn extends React.Component {
newsItemClick = (data) => {
hashHistory.push({
pathname: func.routerBefore() + "/NewsMessageResult",
query: { id: data.id, number: data.number },
query: { id: data.id },
});
};
render() {
......@@ -492,9 +492,7 @@ const NewsItemList = ({ list, onClick }) => {
};
const IndexNewsItem = ({ data, onClick }) => {
let imageWidth = Math.floor(document.body.clientWidth * (220 / 750));
let imageHeight = Math.floor(imageWidth * (132 / 220));
imageWidth = imageWidth < 220 ? 220 : imageWidth;
imageHeight = imageHeight < 132 ? 132 : imageHeight;
return (
<div className="index-module-news-item-container" onClick={onClick}>
......
import React from 'react';
import { hashHistory } from 'react-router';
import { NavBar, SearchBar, Popover, Icon, ListView } from 'antd-mobile';
import React from "react";
import { hashHistory } from "react-router";
import { NavBar, SearchBar, Popover, Icon, ListView } from "antd-mobile";
import SecListView from '../common/listview/secListView'
import func from '../../util/commonFunc';
import * as MessageAction from '../../redux/action/newNotice';
import { connect } from 'react-redux';
import './index.less';
import moment from 'moment';
import SecListView from "../common/listview/secListView";
import func from "../../util/commonFunc";
import * as MessageAction from "../../redux/action/newNotice";
import { connect } from "react-redux";
import "./index.less";
import moment from "moment";
import Iconclock from "./iconclock.png";
import intl from "react-intl-universal";
class MessageDetail extends React.Component {
constructor(props) {
super(props);
this.state = {
isLoading: false
}
isLoading: false,
};
// this.props.changeTitle("公告");
}
......@@ -34,43 +33,55 @@ class MessageDetail extends React.Component {
getDate(number) {
let dateNumber = new Number(number);
return moment(dateNumber).format("YYYY-MM-DD HH:mm");
}
componentDidMount() {
let _this = this;
this.props.getMessageDetail(this.props.location.query.id, () => {
});
this.props.getMessageDetail(this.props.location.query.id, () => {});
}
render() {
let {messageDetail } = this.props;
let { messageDetail } = this.props;
console.log(messageDetail);
return (
<div className="news-details" style={{height:"100%"}}>
<div className="news-details" style={{ height: "100%" }}>
<div className="news-details-content">
<p className="news-detail-title">{messageDetail.title}</p>
<p>
<span style={{ marginRight: "1.1rem" }}><img src={Iconclock} style={{ marginRight: "0.15rem", fontSize: "0.3rem" ,width: "fit-content",padding: 0}} />{intl.get("message1") || "通知时间"}{this.getDate(messageDetail.createTime)}</span>
<span style={{ marginRight: "1.1rem" }}>
<img
src={Iconclock}
style={{
marginRight: "0.15rem",
fontSize: "0.3rem",
width: "fit-content",
padding: 0,
}}
/>
{intl.get("message1") || "通知时间"}
{this.getDate(messageDetail.createTime)}
</span>
{/* <span><FontAwesome name="eye" style={{ marginRight: "0.15rem", fontSize: "0.3rem" }} />{10}次阅读</span> */}
</p>
{messageDetail.logoPath?<div className="news-details-img"><img src={messageDetail.logoPath} alt="" /></div>:''}
<div className="news-detail-context" dangerouslySetInnerHTML={{ __html: messageDetail.context }}>
{messageDetail.logoPath ? (
<div className="news-details-img">
<img src={messageDetail.logoPath} alt="" />
</div>
) : (
""
)}
<div
className="news-detail-context"
dangerouslySetInnerHTML={{ __html: messageDetail.context }}
></div>
</div>
</div>
);
}
}
export default connect(state=>{
let {newNotice} = state;
export default connect((state) => {
let { newNotice } = state;
return {
messageDetail:newNotice.messageDetail,
}
},MessageAction)(MessageDetail);
messageDetail: newNotice.messageDetail,
};
}, MessageAction)(MessageDetail);
......@@ -11,30 +11,39 @@ class Mycontribute extends Component {
constructor(props) {
super(props);
this.state = {
activeId:0,
mapList: [
{
name: "党务直通",
activityType:0
},
{
name: "廉洁作风",
activityType:1
},
{
name: "机电视窗",
activityType:2
},
{
name: "支部风采",
activityType:3
},
{
name: "年度专栏",
activityType:4
},
{
name: "工团快讯",
activityType:5
},
{
name: "学习栏目",
activityType:6
},
{
name: "其他",
activityType:7
},
],
};
......@@ -42,23 +51,37 @@ class Mycontribute extends Component {
}
componentDidMount() {}
handleClick = (data) => {
console.log(data, "点击情况~~~~~~~~~");
const { activeId } = this.state;
let _this = this;
if (activeId != data.activityType) {
this.setState(
{
activeId: data.activityType,
childShow:true
},
);
}
};
render() {
let { mapList } = this.state;
let { mapList,activeId } = this.state;
return (
<div className="mycontribute-out">
<div className="mycontribute-tit">请选择投稿类型</div>
<div className="mycontribute-box">
{mapList.map((item) => {
{mapList.map((item,index) => {
return (
<div className="item-box" onClick={() => {
this.handleSumbit(voteNum, oldVoteNum);
}}>
<div className="item-name">{item.name}</div>
</div>
<MycontributeItem
key={index}
data={item}
isActive={activeId == item.activityType ? true : false}
onClick={() => this.handleClick(item)}
/>
);
})}
</div>
<div className="mycontribute-btn">写稿</div>
</div>
);
......@@ -75,3 +98,10 @@ const mapDispatchToProps = (dispatch) => {
};
};
export default connect(mapStateToProps, mapDispatchToProps)(Mycontribute);
const MycontributeItem = ({ data, isActive, onClick }) => {
return (
<div className={isActive?'item-box-active':"item-box"} onClick={onClick}>
{isActive ? <span>{data.name}</span> : data.name}
</div>
);
};
......@@ -19,10 +19,7 @@
}
.mycontribute-out .mycontribute-box .item-box {
width: 48%;
margin-bottom: 20px;
}
.mycontribute-out .mycontribute-box .item-box .item-name {
width: 100%;
margin-bottom: 30px;
height: 80px;
line-height: 80px;
background-color: #f7f7f7;
......@@ -30,6 +27,28 @@
font-size: 38px;
color: #454343;
}
.mycontribute-out .mycontribute-box .item-box-active {
width: 48%;
margin-bottom: 30px;
height: 80px;
line-height: 80px;
background: rgba(253, 63, 52, 0.05);
border: 1px solid #f3ab9f;
border-radius: 4px;
text-align: center;
font-size: 38px;
color: #454343;
}
.mycontribute-out .mycontribute-box span {
width: 100%;
color: #e6624a;
}
.mycontribute-out .mycontribute-child-box {
background-color: #fff;
width: 92%;
margin: 0 auto;
padding: 40px 25px;
}
.mycontribute-out .mycontribute-btn {
width: 92%;
margin: 0 auto;
......
......@@ -17,9 +17,7 @@
justify-content: space-between;
.item-box {
width: 48%;
margin-bottom: 20px;
.item-name {
width: 100%;
margin-bottom: 30px;
height: 80px;
line-height: 80px;
background-color: #f7f7f7;
......@@ -27,7 +25,29 @@
font-size: 38px;
color: #454343;
}
.item-box-active {
width: 48%;
margin-bottom: 30px;
height: 80px;
line-height: 80px;
background: rgba(253, 63, 52, 0.05);
border: 1px solid #f3ab9f;
border-radius: 4px;
text-align: center;
font-size: 38px;
color: #454343;
}
span {
width: 100%;
color: #e6624a;
}
}
.mycontribute-child-box {
background-color: #fff;
width: 92%;
margin: 0 auto;
padding: 40px 25px;
}
.mycontribute-btn {
width: 92%;
......
......@@ -6,7 +6,7 @@ import Network from '../../util/fetchUtil';
import excute from '../../util/fetchUtil';
import API from '../../util/urlconfig';
export const MyInvestigate = (params, isUpData) => {
let url = API.INVESTIGATE_LIST + '?bizType=' + params.bizType + '&pageNo=' + params.pageNo + '&pageSize=20' + '&my=' + params.my;
let url = API.INVESTIGATE_LIST + '?pageNo=' + params.pageNo + '&pageSize=20' + '&my=' + params.my;
return dispatch => {
Network.get(url,
response => {
......
......@@ -39,7 +39,6 @@ class list extends Component {
let params = {
pageNo: 1,
pageSize: 20,
bizType: "1",
my: my ? my : "",
};
this.props.MyInvestigate({ ...params }, false);
......@@ -112,7 +111,11 @@ class list extends Component {
inExamRow = (item, sectionID, rowID) => {
return (
<div key={rowID} className="exam-item-box" style={{marginBottom:'15px'}}>
<div
key={rowID}
className="exam-item-box"
style={{ marginBottom: "15px" }}
>
<div
className="examItem"
style={{ display: "flex", padding: "20px 0" }}
......@@ -129,11 +132,13 @@ class list extends Component {
style={{
display: "flex",
flexDirection: "column",
justifyContent:"space-between",
justifyContent: "space-between",
}}
>
<p className="exam-title" style={{paddingTop:'20px'}}>{item.name}</p>
{/* <p
<p className="exam-title" style={{ paddingTop: "20px" }}>
{item.name}
</p>
<p
className={
item.finishState == "0" || item.finishState == "3"
? "exam-over"
......@@ -153,8 +158,7 @@ class list extends Component {
: item.finishState == "4"
? "参与调查"
: ""}
</p> */}
<p className="exam-start">进行中</p>
</p>
</div>
</div>
</div>
......@@ -204,7 +208,7 @@ class list extends Component {
hashHistory.push({
pathname: func.routerBefore() + "/allDescribe",
// pathname:func.routerBefore()+'/InvestigateFinish',
query: { id: item.id,type:'投票' },
query: { id: item.id, type: "投票" },
});
// if (item.finishState != 3 || item.finishState != 0) {
// if (item.finishState == 1) {
......
......@@ -57,6 +57,7 @@ class mehomeNav extends React.Component {
zIndex: 998,
width: "100%",
}}
>
<div id="hometitle" iconname={""} className="menuhomeNav">
<div
......
......@@ -28,7 +28,7 @@ class NewsDetails extends React.Component {
<p >{data.fileName}</p>
<p>
<span style={{ marginRight: "1.1rem" }}><FontAwesome name="clock-o" style={{ marginRight: "0.15rem", fontSize: "0.3rem" }} />{intl.get('ReleaseTime')||'发布时间'}{this.getDate(data.createTime)}</span>
<span><FontAwesome name="eye" style={{ marginRight: "0.15rem", fontSize: "0.3rem" }} />{data.number}{intl.get('PublishKey165')||'次阅读'}</span>
{/* <span><FontAwesome name="eye" style={{ marginRight: "0.15rem", fontSize: "0.3rem" }} />{data.number}{intl.get('PublishKey165')||'次阅读'}</span> */}
</p>
<div className="news-details-img"><img src={data.logoPath} alt="" /></div>
......
......@@ -127,7 +127,7 @@ class NewsListPage extends Component {
newsItemClick = (data) => {
hashHistory.push({
pathname: func.routerBefore() + "/NewsMessageResult",
query: { id: data.id, number: data.number },
query: { id: data.id },
});
};
newsClassifyClick = (data) => {
......
......@@ -426,10 +426,10 @@ class NewsMessageResult extends Component {
marginRight: "0.15rem",
fontSize: "0.3rem"
}} />{intl.get('PublishKey166') || '发布时间:'}{moment(tmpList.releaseTime).format('YYYY-MM-DD HH:mm')}</span>
<span><img src={Iconlook} style={{
{/* <span><img src={Iconlook} style={{
marginRight: "0.15rem",
fontSize: "0.3rem"
}} />{this.state.number}{intl.get('PublishKey165') || '次阅读'}</span>
}} />{this.state.number}{intl.get('PublishKey165') || '次阅读'}</span> */}
</p>
</div>
</div>
......
import React, { Component } from 'react';
import './hotsearchtags.less';
class HotSearchTags extends Component {
renderTags(tags) {
var dom = [];
for (let i = 0; i < tags.length; i++) {
dom.push(
<div className="search-tags" key={i}>{tags[i]}</div>
);
}
return dom;
}
render() {
const { tags } = this.props;
var dom = this.renderTags(tags);
return (
<div className="hot-search-tags">
{dom}
<div className="clear"></div>
</div>
);
}
}
export default HotSearchTags;
\ No newline at end of file
.hot-search-tags{
width: 100%;
.search-tags{
color: #9b9b9b;
font-size: 28px;
border-radius: 142px;
padding: 12px 32px;
float: left;
border: 2px solid #e3e3e3;
margin-right: 30px;
margin-bottom: 30px;
}
.clear{
clear: both;
}
}
\ No newline at end of file
.homework-search {
width: 100%;
height: 100%;
overflow-y: scroll;
background-color: #f3f3f3;
}
.homework-search .hot-search,
.homework-search .search-history {
width: 100%;
padding-left: 34px;
padding-top: 56px;
background-color: #fff;
}
.homework-search .hot-search h5,
.homework-search .search-history h5 {
font-size: 32px;
color: #4a4a4a;
}
.homework-search .search-history {
margin-top: 10px;
padding-bottom: 0;
}
.homework-search .search-history .am-list-content {
font-size: 28px!important;
color: #9b9b9b!important;
}
.homework-search .clear-history {
width: 100%;
text-align: center;
font-size: 28px;
color: #9b9b9b;
margin-top: 40px;
}
.homework-search .clear-history button {
padding: 12px 26px;
border: 2px solid #e3e3e3;
border-radius: 142px;
background-color: transparent;
}
.homework-search .clear-history .anticon-delete {
font-size: 36px;
margin-right: 10px;
}
.search {
font-size: .28rem;
}
.search .item {
padding: .2rem;
border-bottom: 0.04rem solid #efeff4;
}
.search .item div {
border-bottom: 0.01rem solid #efeff4;
display: flex;
align-items: center;
}
.search .item .type {
border: 0.01rem solid #1c2fdb;
padding: .01rem .02rem;
color: #1c2fdb;
border-radius: .1rem;
}
.search .item .title {
margin-left: .3rem;
font-size: .35rem;
color: #4A4A4A;
}
.search .item .time {
font-size: .24rem;
margin-top: .1rem;
}
.overflowByLine {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
p {
margin-bottom: 0;
}
import React, {Component} from 'react';
import {Icon, Input} from 'antd';
import {List} from 'antd-mobile';
import './search.less';
import SearchHeader from './searchheader/searchheader';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import func from '../../util/commonFunc';
import {hashHistory} from 'react-router';
import {getList} from '../../redux/action/search'
import intl from "react-intl-universal";
const Search = Input.Search;
class MyCourseSearch extends Component {
constructor(props) {
super(props);
this.state = {
reset: false,
value: '',
history: JSON.parse(localStorage.getItem('search')) || []
};
this.search = this.search.bind(this);
this.onInput = this.onInput.bind(this);
this.reset = this.reset.bind(this);
}
componentWillMount() {
}
onInput(e) {
this.setState({
value: e.target.value
});
if (e.target.value) {
this.setState({
reset: true
})
} else {
this.setState({
reset: false
})
}
}
reset = () => {
this.setState({
value: '',
reset: false
});
}
search(value) {
if (!value) return
let historys = JSON.parse(localStorage.getItem('search')) || []
historys = historys.filter(item => item !== value)
historys.unshift(value)
localStorage.setItem('search', JSON.stringify(historys.splice(0, 5)))
hashHistory.replace({
pathname: func.routerBefore() + '/searchresult',
query: {
keyword: value
}
})
}
cancel = () => {
console.log("cancel")
this.setState({
value: '',
reset: false
});
hashHistory.goBack()
}
// 重置搜索记录
resetHistory = () => {
localStorage.removeItem('search')
this.setState({history: []})
}
render() {
// var dom = this.renderHistory();
return (
<div className="homework-search">
<SearchHeader onSearch={this.search} onCancel={this.cancel}/>
<div className="search-history">
<h5>{intl.get('PublishKey26')||"历史搜索"}</h5>
<List>
{this.state.history.map((item, index) => <List.Item key={index}
onClick={() => this.search(item)}>{item}</List.Item>)}
</List>
</div>
<div className="clear-history">
<button onClick={this.resetHistory}>
<Icon type="delete"/>
{intl.get('PublishKey27')||"清空历史搜索"}
</button>
</div>
</div>
);
}
}
const mapStateToProps = state => ({
data: state.search.list
})
const mapDispatchToProps = dispatch => ({
getList: bindActionCreators(getList, dispatch)
})
export default connect(mapStateToProps, mapDispatchToProps)(MyCourseSearch)
\ No newline at end of file
// @import "../../../exam/less/config";
.homework-search{
width: 100%;
height: 100%;
overflow-y: scroll;
background-color: #f3f3f3;
.hot-search,.search-history{
width: 100%;
padding-left: 34px;
padding-top: 56px;
background-color: #fff;
h5{
font-size: 32px;
color: #4a4a4a;
}
}
.search-history{
margin-top: 10px;
padding-bottom: 0;
.am-list-content{
font-size: 28px!important;
color: #9b9b9b!important;
}
}
.clear-history{
width: 100%;
text-align: center;
font-size: 28px;
color: #9b9b9b;
margin-top: 40px;
button{
padding: 12px 26px;
border: 2px solid #e3e3e3;
border-radius: 142px;
background-color: transparent;
}
.anticon-delete{
font-size: 36px;
margin-right: 10px;
}
}
}
.search{
font-size: .28rem;
.item{
padding: .2rem;
border-bottom: 0.04rem solid #efeff4;
div{
border-bottom: 0.01rem solid #efeff4;
display: flex;
align-items: center;
}
.type{
border: 0.01rem solid #1c2fdb;
padding: .01rem .02rem;
color: #1c2fdb;
border-radius: .1rem;
}
.title{
margin-left: .3rem;
font-size: .35rem;
color: #4A4A4A
}
.time{
font-size: .24rem;
margin-top: .1rem;
}
}
}
.overflowByLine{
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
p{
margin-bottom: 0;
}
\ No newline at end of file
import React, {Component} from "react";
import "./style.less";
class SearchItem extends Component {
render() {
const {onClick, type, title, time} = this.props;
let lineWidth = document.body.clientWidth-(26*2);
return <div className="search-result-item" onClick={onClick}>
<div className="result-title">
<span className={"result-item-type"}>{type}</span>
<span className={"result-item-title"} dangerouslySetInnerHTML={{__html: title}}></span>
</div>
<div className="result-time">
{time}
</div>
<div className="result-line" style={{width:lineWidth}}></div>
</div>;
}
}
export default SearchItem;
\ No newline at end of file
@import "../../../static/theme.less";
.search-result-item{
width: 100%;
padding: 18px 26px 52px 26px;
background-color: #fff;
position: relative;
.result-title{
width: 100%;
.result-item-type{
border:2px solid @themeColor;
color: @themeColor;
font-size: 24px;
padding: 0 12px;
line-height: 34px;
border-radius: 6px;
margin-right: 10px;
}
.result-item-title{
font-size: 30px;
color: #4a4a4a;
line-height: 34px;
text-align: justify;
}
}
.result-time{
font-size: 24px;
color: #929292;
margin-top: 16px;
width: 100%;
}
.result-line{
background-color: #EFEFF4;
height: 2px;
bottom: 0;
position: absolute;
left: 26px;
}
}
\ No newline at end of file
import React, {Component} from 'react';
import {Icon, Input} from 'antd';
import {ListView,Toast} from 'antd-mobile';
import './search.less';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import FooterLine from "../../common/footer/footer";
import func from '../../util/commonFunc';
import jumpToLive from '../../util/jumpToLive';
import {hashHistory} from 'react-router';
import {addList, getList} from '../../redux/action/search'
import moment from 'moment';
import SearchItem from "./searchItem";
import intl from "react-intl-universal";
const Search = Input.Search;
const defaultDataSource = new ListView.DataSource({
rowHasChanged: (row1, row2) => row1 !== row2
});
/**
* 项目:项目详情
课程:课程详情
直播:直播详情
考试:考试详情
调研:调研详情
作业:作业详情
新闻:新闻详情
公告:公告详情
做课:不支持搜索
投票:不支持搜索
*/
const typeMap = {
survey: {
name: intl.get('Research')||'调研',
url: '/mysurvey/SurveyDetails',
},
homework: {
name: intl.get('Assignment')||'作业',
url: '/homeworkdetail',
},
news: {
name: intl.get('News')||'新闻',
url: '/mynews/newDetail',
},
course: {
name: intl.get('Course')||'课程',
url: '/courseplay',
},
exam: {
name: intl.get('Exam')||'考试',
url: '/examdetail'
},
train: {
name: intl.get('TrainingProgram2')||'项目',
url: '/trainingsteps'
},
}
class SearchResult extends Component {
constructor(props) {
super(props);
this.state = {
dataSource: defaultDataSource.cloneWithRows([]),
isLoading: true,
reset: false,
value: this.props.data.keyword,
height: document.documentElement.clientHeight,
history: JSON.parse(localStorage.getItem('search')) || [],
total: 0
};
this.search = this.search.bind(this);
this.onInput = this.onInput.bind(this);
this.reset = this.reset.bind(this);
this.renderRow = this.renderRow.bind(this);
}
componentDidMount() {
const lv = ReactDOM.findDOMNode(this.lv)
const hei = lv ? this.state.height - lv.offsetTop : 0;
this.setState({isLoading: false, height: hei});
let {keyword} = this.props.location.query;
let _this = this;
if (keyword) {
this.setState({
value: keyword
});
this.props.getList(keyword, () => {
const {dataSource} = _this.props;
const {total} = _this.props.data;
this.setState({
dataSource: _this.state.dataSource.cloneWithRows(dataSource),
isLoading: false,
total: total
});
});
}
}
onInput(e) {
this.setState({
value: e.target.value
});
if (e.target.value) {
this.setState({
reset: true
})
} else {
this.setState({
reset: false
})
}
}
reset = () => {
this.setState({
value: '',
reset: false
});
}
search(value) {
if (!value) return
let historys = JSON.parse(localStorage.getItem('search')) || []
historys = historys.filter(item => item !== value)
historys.unshift(value)
localStorage.setItem('search', JSON.stringify(historys.splice(0, 5)));
window.history.replaceState(null, null, location.origin + "/#" + func.routerBefore() + "/searchresult?keyword=" + value);
let _this = this;
this.props.getList(value, () => {
const {dataSource} = _this.props;
const {total} = _this.props.data;
let newDataSource = defaultDataSource.cloneWithRows([]);
this.setState({
dataSource: newDataSource.cloneWithRows(dataSource),
total: total,
isLoading: false,
});
})
}
cancel = () => {
this.setState({
value: '',
reset: false
});
hashHistory.goBack()
}
onEndReached = event => {
console.log('reach end', event);
const {page, size, total, keyword, hasMore} = this.props.data;
if (this.state.isLoading || !hasMore) {
return;
}
let _this = this;
this.setState({isLoading: true});
this.props.addList(keyword, page + 1, () => {
const {dataSource} = _this.props;
this.setState({
dataSource: _this.state.dataSource.cloneWithRows(dataSource),
isLoading: false,
});
})
}
getDate(number) {
let dateNumber = new Number(number);
return moment(dateNumber).format("YYYY-MM-DD HH:mm");
}
searchItemClick(type, id, url) {
if(type=="live"){
if(url){
jumpToLive.jumpToLive(url);
}else{
Toast.error(intl.get('forum15')||"直播频道号不存在");
}
}else{
hashHistory.push({
pathname: func.routerBefore() + typeMap[type].url,
query: {id}
});
}
}
renderRow (rowData, sectionID, rowID) {
const {type, title, startDate, id,url} = rowData;
const {keyword = ''} = this.props.data;
const text = title.replace(new RegExp(keyword, 'g'), `<span style='color:red'}} >${keyword}</span>`);
return <SearchItem
onClick={() => this.searchItemClick(type,id,url)}
type={typeMap[type].name}
title={text}
time={this.getDate(startDate)}
/>;
}
render() {
if (this.state.height < 800) {
this.state.height = 1200
}
const {isLoading} = this.state;
const {dataSource = []} = this.props;
const {hasMore} = this.props.data;
return (
<div className="search">
<div className="search-input">
<Search type="search" onSearch={this.search} value={this.state.value} onChange={this.onInput}/>
<Icon type="close-circle" onClick={this.reset}
style={{fontSize: 28, display: this.state.reset ? 'inline' : 'none'}}/>
<div className="cancel" onClick={this.cancel}>{intl.get('Cancel')||"取消"}</div>
</div>
<div style={{padding: '.2rem .3rem'}}>{intl.get('PublishKey21')||"共搜索到"}{intl.get('PublishKey22')||"条结果"}</div>
<ListView
ref={el => this.lv = el}
dataSource={this.state.dataSource}
renderRow={this.renderRow}
pageSize={20}
style={{
height: this.state.height
}}
onScroll={() => {
console.log('scroll');
}}
renderFooter={() =>
(dataSource.length > 0 ?
(
hasMore ?
<div
style={{textAlign: 'center', display: isLoading ? 'block' : 'none'}}>
<Icon type="loading" size={"xs"}/> {isLoading ? 'Loading...' : 'Loaded'}
</div> : <FooterLine onlyText={true} footText={intl.get('PublishKey47')||"没有更多了"}/>) : null)}
scrollRenderAheadDistance={500}
onEndReached={this.onEndReached}
onEndReachedThreshold={10}
/>
{
this.props.dataSource.length > 0 ? null :
<div style={{position: 'fixed', top: '10%', left: 0, right: 0}}>
没找到相关内容
</div>
}
</div>
);
}
}
const mapStateToProps = state => ({
dataSource: state.search.records,
data: state.search
})
const mapDispatchToProps = dispatch => ({
getList: bindActionCreators(getList, dispatch),
addList: bindActionCreators(addList, dispatch)
})
export default connect(mapStateToProps, mapDispatchToProps)(SearchResult)
\ No newline at end of file
import React, { Component } from 'react';
import { Input, Icon } from 'antd';
import './searchheader.less';
const Search = Input.Search;
import intl from "react-intl-universal";
class SearchHeader extends Component {
constructor(props) {
super(props);
this.state = {
reset: false,
value: this.props.value
};
this.onInput = this.onInput.bind(this);
this.reset = this.reset.bind(this);
}
// componentWillReceiveProps(){
// this.setState({
// value:this.props.value
// })
// }
componentDidMount(){
var search = document.getElementById("customSerchBar").focus();
}
onInput(e) {
this.setState({
value: e.target.value
});
if (e.target.value) {
this.setState({
reset: true
})
} else {
this.setState({
reset: false
})
}
}
reset() {
this.setState({
value: '',
reset: false
});
}
render() {
return (
<div className="search-input">
<Search type="search" onSearch={this.props.onSearch} value={this.state.value} onChange={this.onInput} id="customSerchBar" />
<Icon type="close-circle" onClick={this.reset} style={{ fontSize: 28, display: this.state.reset ? 'inline' : 'none' }} />
<div className="cancel" onClick={this.props.onCancel}>{intl.get('Cancel')||"取消"}</div>
</div>
);
}
}
export default SearchHeader;
\ No newline at end of file
// @import "../../../exam/less/config";
.search-input{
width: 100%;
height: 88px;
background-color: #fff;
padding: 17px 138px 17px 20px;
position: relative;
input{
height: 60px;
padding-left: 65px;
font-size: 32px;
border-radius: 30px;
background-color: #f3f3f3;
}
span.ant-input-suffix{
left: 23px;
width: 36px;
font-size: 36px;
}
i.anticon-close-circle{
position: absolute;
top: 33px;
right: 156px;
z-index: 2;
}
.cancel{
font-size: 34px;
// color:@common-blue;
position: absolute;
top: 25px;
right: 42px;
}
}
\ No newline at end of file
......@@ -13,9 +13,8 @@ class Vote extends Component {
this.state = {
list: [],
modalStatu: false,
// oldVoteNum: 0,
oldVoteNum: this.props.location.query.voteNum,
voteNum: this.props.location.query.voteNum,
oldVoteNum: "",
voteNum: "",
};
}
......@@ -34,12 +33,21 @@ class Vote extends Component {
list: list,
});
});
let params1 = {
researchId: id,
};
this.props.voteSumbitSecondApi(params1, (response) => {
console.log(response, "获取投票次数");
_this.setState({
voteNum: response.voteNum,
oldVoteNum: response.voteNum,
name: response.name,
});
});
}
render() {
let { name } = this.props.location.query;
const { list, voteNum, oldVoteNum } = this.state;
console.log(list, "投票数据列表111111111111");
const { list, voteNum, oldVoteNum, name } = this.state;
return (
<div className="vote-out">
<div className="vote-title">{name}</div>
......@@ -226,11 +234,15 @@ class Vote extends Component {
_this.props.voteSumbitApi(params, () => {
_this.props.voteSumbitSecondApi(params, (response) => {
console.log(response);
response.map((item)=>{
list.map((item1)=>{
item1['score']=item.score
})
})
_this.setState({
voteNum: response.voteNum,
oldVoteNum: response.voteNum,
});
// response.map((item) => {
// list.map((item1) => {
// item1["score"] = item.score;
// });
// });
});
});
}
......
export const initial = {
albumUpdateStrategyId: ""
}
export default function (state=initial,action){
switch (action.type) {
case 'ALBUMCLASSIFYDATAID':
return {...state, albumUpdateStrategyId: action.data}
default:
return state;
break;
}
}
\ No newline at end of file
// import { ALBUMLISTBANNER } from '../../action/album/albumList';
export const initial = {
albumBannerList: [],
albumSearchPage: {},
albumClassifyList: [],
albumGetStrategy: {},
albumUpdateStrategyId: "",
albumCommentList: [],
albumCommentReply: {}
}
export default function (state=initial,action){
switch (action.type) {
case 'ALBUMLISTBANNER':
return {...state, albumBannerList: action.data}
case 'ALBUMSEARCHPAGE':
return {...state, albumSearchPage: action.data}
case 'ALBUMCLASSIFYLIST':
return {...state, albumClassifyList: action.data}
case 'ALBUMGETSTRATEGY':
return {...state, albumGetStrategy: action.data}
case 'ALBUMCLASSIFYDATAID':
return {...state, albumUpdateStrategyId: action.data}
case 'ALBUMCOMMENTLIST':
return {...state, albumCommentList: action.data}
case 'ALBUMCOMMENTREPLY':
return {...state, albumCommentReply: action.data}
default:
return state;
break;
}
}
\ No newline at end of file
import { GLOBALSEARCHALL, GLOBALSEARCHITEM, GETSERCHHISTORY, GETSERCHCOURSE, GETSERCHMARKET, GETSERCHALBUM ,GETSERCHLIVE, GETSERCHREVIEWLIVE } from "../action/globalsearch";
const initialState = {
searchResult: {},
courseList: [],
courseTotal: 0,
trainList: [],
trainTotal: 0,
examList: [],
examTotal: 0,
homeworkList: [],
homeworkTotal: 0,
surveyList: [],
surveyTotal: 0,
teacherList: [],
teacherTotal: 0,
marketingList: [],
marketingTotal: 0,
caseLibraryList: [],
caseLibraryTotal: 0,
searchHistoryList: [],
singleCourseList: [],
singleCourseTotal: 0,
singleMarketList: [],
singleMarketTotal: 0,
albumList: [],
albumTotal: 0,
singleAlbumList: [],
singleAlbumTotal: 0,
singleLiveList:[],
singleLiveTotal:0,
singleLiveReviewList: [],
singleLiveReviewTotal: 0
}
const globalSearch = (state = initialState, action) => {
switch (action.type) {
case GLOBALSEARCHALL:
return Object.assign({}, state, { searchResult: action.data });
case GLOBALSEARCHITEM:
switch (action.searchType) {
case "course":
return Object.assign({}, state, { courseList: action.data, courseTotal: action.pageTotal });
case "trainingProject":
return Object.assign({}, state, { trainList: action.data, trainTotal: action.pageTotal });
case "exam":
return Object.assign({}, state, { examList: action.data, examTotal: action.pageTotal });
case "assignment":
return Object.assign({}, state, { homeworkList: action.data, homeworkTotal: action.pageTotal });
case "research":
return Object.assign({}, state, { surveyList: action.data, surveyTotal: action.pageTotal });
case "lecturer":
return Object.assign({}, state, { teacherList: action.data, teacherTotal: action.pageTotal });
case "marketingCourse":
return Object.assign({}, state, { marketingList: action.data, marketingTotal: action.pageTotal });
case "studentCase":
return Object.assign({}, state, { caseLibraryList: action.data, caseLibraryTotal: action.pageTotal });
case "albums":
return Object.assign({}, state, { albumList: action.data, albumTotal: action.pageTotal });
default:
return Object.assign({}, state, { courseList: action.data, courseTotal: action.pageTotal });
}
case GETSERCHHISTORY:
return Object.assign({}, state, { searchHistoryList: action.data });
case GETSERCHCOURSE:
return Object.assign({}, state, { singleCourseList: action.data, singleCourseTotal: action.total });
case GETSERCHMARKET:
return Object.assign({}, state, { singleMarketList: action.data, singleMarketTotal: action.total });
case GETSERCHALBUM:
return Object.assign({}, state, { singleAlbumList: action.data, singleAlbumTotal: action.total });
case GETSERCHLIVE:
return Object.assign({}, state, { singleLiveList: action.data, singleLiveTotal: action.total });
case GETSERCHREVIEWLIVE:
return Object.assign({}, state, { singleLiveReviewList: action.data, singleLiveReviewTotal: action.total });
default:
return state
}
}
export default globalSearch;
\ No newline at end of file
import { CONFIGSWITCH, GETINFO, CONTENTLIST, TOKENLOG, WWALLETLIST, CONFIGRULE, POINTAMOUNT, TOKENAMOUNT, ORDERDETAIL, SETTLEMENTDETAIL } from "../../action/goldMall/boutiqueContent";
const initial = {
configBtn: [],
infoList: {},
contentList: [],
pageTotal: 0,
pageRecords: 0,
tokenLogLists: [],
tokenLogTotal: 0,
walletMoney: {},
walletTotal: 0,
walletList: [],
ruleList: {},
points: 0,
allAmount: 0,
goldDetail: {},
settleInfo: {}
}
export default function (state = initial, action) {
switch (action.type) {
case CONFIGSWITCH:
return Object.assign({}, state, { configBtn: action.data });
case GETINFO:
return Object.assign({}, state, { infoList: action.data });
case CONTENTLIST:
return Object.assign({}, state, { contentList: action.data.records, pageTotal: action.data.pageTotal, pageRecords: action.data.pageRecords });
case TOKENLOG:
return Object.assign({}, state, { tokenLogLists: action.data, tokenLogTotal: action.data.pageTotal });
case WWALLETLIST:
return Object.assign({}, state, { walletMoney: action.data, walletList: action.data.items.records, walletTotal: action.data.items.pageTotal, });
case CONFIGRULE:
return Object.assign({}, state, { ruleList: action.data });
case POINTAMOUNT:
return Object.assign({}, state, { points: action.data });
case TOKENAMOUNT:
return Object.assign({}, state, { allAmount: action.data });
case ORDERDETAIL:
return Object.assign({}, state, { goldDetail: action.data });
case SETTLEMENTDETAIL:
return Object.assign({}, state, { settleInfo: action.data });
default:
return state;
break;
}
}
\ No newline at end of file
/**
* homework reducer
*/
import {
HOMEWORK_IN_PROCESS,
HOMEWORK_COMPLETE,
HOMEWORK_DETAIL, MYMAKECOURSE, SUBMITHOMEWORK, HOMEWORK_SEARCH, HOMEWORKANSWERLIST, HOMEWORK_DETAIL_RESULT,
EXERCISEBOOKLIST,
EXERCISEBOOKCOMMENTLIST
} from '../action/homework';
const initialState = {
inProcess: {
data: [],
page: 1,
hasMore: false,
total: 0
},
complete: {
data: [],
page: 1,
hasMore: false,
total: 0
},
search: {
data: [],
page: 1,
hasMore: false,
total: 0
},
detail: {
"id": "",
"assignmentName": "",
"finishTime": '',
"startTime": "",
"projectName": "",
"assignmentContent": "",
"fileList": [],
"answerFileList": [],
"gradeAndScore": "",
"isRead": ""
},
answerListData: {
"answerResultList": [],
},
detailResult: {
"id": "",
"assignmentName": "",
"finishTime": '',
"startTime": "",
"projectName": "",
"assignmentContent": "",
"fileList": [],
"answerFileList": [],
"backFileList": [],
"gradeAndScore": "",
"isRead": ""
},
myMakeCourse: {
data: [],
page: 1,
hasMore: false,
total: 0
},
exerciseBookList: [],
exerciseBookTotal: 0,
exerciseBookCommentList: [],
exerciseBookCommentTotal: 0,
};
const homework = (state = initialState, action) => {
switch (action.type) {
case HOMEWORK_IN_PROCESS:
return Object.assign({}, state, { inProcess: action.data });
case HOMEWORK_COMPLETE:
return Object.assign({}, state, { complete: action.data });
case HOMEWORK_DETAIL:
let tempData = action.data;
tempData.answerAttachmentNumMax =tempData.answerAttachmentNumMax || 0;
tempData.answerAttachmentNumMin =tempData.answerAttachmentNumMin || 0;
tempData.answerCharaterNumMax =tempData.answerCharaterNumMax || 1000;
tempData.answerCharaterNumMin =tempData.answerCharaterNumMin || 0;
return Object.assign({}, state, { detail: tempData });
case HOMEWORK_DETAIL_RESULT:
return Object.assign({}, state, { detailResult: action.data });
case HOMEWORKANSWERLIST:
return Object.assign({}, state, { answerListData: action.data });
case MYMAKECOURSE:
return Object.assign({}, state, { myMakeCourse: action.data });
case SUBMITHOMEWORK:
return Object.assign({}, state, {});
case HOMEWORK_SEARCH:
return Object.assign({}, state, { search: action.data });
case EXERCISEBOOKLIST:
return Object.assign({}, state, { exerciseBookList: action.data, exerciseBookTotal: action.total });
case EXERCISEBOOKCOMMENTLIST:
return Object.assign({}, state, { exerciseBookCommentList: action.data, exerciseBookCommentTotal: action.total });
default:
return state
}
}
export default homework;
\ No newline at end of file
......@@ -39,7 +39,6 @@ import MyExamQuestionReducer from '../../components/exam/myExamQuestion/MyExamQu
import courseSearch from './courseSearch'
import homework from './homework';
//考题展示页面
import ShowAnswerReducer from '../../components/exam/showAnwser/ShowAnswerReducer';
//考试搜索
......@@ -49,14 +48,6 @@ import ListReducer from '../../components/mysurvey/ListRducer'
//调研答题
import DetailReducer from '../../components/mysurvey/detailsReducer'
//讲师库
import teacherReducer from "./teacher/teacher";
//全局搜索
import GlobalSearchReducer from "./globalsearch";
// 排行榜
import rankingReducer from './ranking';
//课程分类
import courseClassify from "./course/courseclassify";
......@@ -66,17 +57,6 @@ import myReportReducer from './myReport';
//日历任务
import myCalendarTaskReducer from './myCalendarTask'
//专辑
import albumList from './album/albumList';
import albumClassify from './album/albumClassify';
// 智能陪练
import practicesProcess from './smartPractices/practicesProcess';
// 我的钱包-精品推荐
import myWalletInfo from './goldMall/boutiqueContent';
//语言国际化
// import internationLanguage from '../../common/InternationLanguage/redux/reducer';
......@@ -105,24 +85,16 @@ const app = combineReducers({
courserecord,
MyExamQuestionReducer,
courseSearch,
homework,
ShowAnswerReducer,
ListReducer,
DetailReducer,
MyExamSearchResultReducer,
TrainSearchResultReducer,
teacherReducer,
GlobalSearchReducer,
rankingReducer,
courseClassify,
newsMessageReducer,
signPlayCardReducer,
myReportReducer,
myCalendarTaskReducer,
albumList,
albumClassify,
practicesProcess,
myWalletInfo,
// internationLanguage,
});
export default app;
import {
RANKING_LIST,
} from '../action/ranking';
const initalState={
rankingList:'',
}
const rankingReducer =(state=initalState,action)=>{
switch(action.type){
case "RANKING_LIST":
return Object.assign({}, state, {rankingList: action.data});
default:
return state;
}
}
export default rankingReducer;
\ No newline at end of file
import { PRACTICESPROCESSLIST, PRACTICESPROCESSROOT, PRACTICESPROCESSSTUDENTS, PRACTICESPROCESSSVOICE, PRACTICESPROCESSROBOT, PRACTICESPROCESSENDSAVE, PRACTICES_MY_USER_INFO } from "../../action/smartPractices/practicesProcess";
const initial = {
practicesProcessList: [],
PracticesProcessRoot: [],
getPracticesProcessStudents: [],
studentsVoice: {},
robotVoice: {},
endsave: {},
InfoUserData: {}
}
export default function (state = initial, action) {
switch (action.type) {
case PRACTICESPROCESSLIST:
return Object.assign({}, state, { practicesProcessList: action.data });
case PRACTICESPROCESSROOT:
return Object.assign({}, state, { PracticesProcessRoot: action.data });
case PRACTICESPROCESSSTUDENTS:
return Object.assign({}, state, { getPracticesProcessStudents: action.data });
case PRACTICESPROCESSSVOICE:
return Object.assign({}, state, { studentsVoice: action.data });
case PRACTICESPROCESSROBOT:
return Object.assign({}, state, { robotVoice: action.data });
case PRACTICESPROCESSENDSAVE:
return Object.assign({}, state, { endsave: action.data });
case PRACTICES_MY_USER_INFO:
return Object.assign({}, state, { InfoUserData: action.data });
default:
return state;
break;
}
}
\ No newline at end of file
import { TEACHERLIST, TEACHERDETAIL, TEACHERRELATIONCOURSE, TEACHERCLASSIFYLIST } from "../../action/teacher/teacher";
const initial = {
teacherList: [],
teacherDetailInfo: {},
total: 0,
relationCourseList: [],
relationCourseTotal: 0,
teacherClassifyList: []
}
export default function (state = initial, action) {
switch (action.type) {
case TEACHERLIST:
return Object.assign({}, state, { teacherList: action.data.content, total: action.data.totalElements });
case TEACHERDETAIL:
return Object.assign({}, state, { teacherDetailInfo: action.data });
case TEACHERRELATIONCOURSE:
return Object.assign({}, state, { relationCourseList: action.data, relationCourseTotal: action.total });
case TEACHERCLASSIFYLIST:
return Object.assign({}, state, { teacherClassifyList: action.data });
default:
return state;
break;
}
}
\ No newline at end of file
......@@ -19,9 +19,9 @@ if (
host.indexOf("1") != -1 ||
host.indexOf("172.") != -1
) {
//开发环境
//本地环境
// baseUrl = "http://192.168.1.106:8090";
//生产环境
//服务器环境
baseUrl = "http://10.23.1.180:8090";
} else if (
......@@ -446,5 +446,12 @@ const url = {
voteSumbitApi:`${baseUrl}${WEBSTUDENT}api/researchAnswer/submit`,
voteSumbitSecondApi:`${baseUrl}${WEBSTUDENT}api/researchQuestion/getVoteResult`,
voteTopApi:`${baseUrl}${WEBSTUDENT}api/researchQuestion/getVoteTop`,
//搜索接口
searchApi:`${baseUrl}${WEBSTUDENT}api/portal/home/other/search`,
searchHistoryApi:`${baseUrl}${SYSTEM}dictionary/home/searchListByMe`,
searchDeleteApi:`${baseUrl}${SYSTEM}dictionary/home/searchDeleteByMe`,
searchListAllApi:`${baseUrl}${SYSTEM}dictionary/home/searchListByAll`,
};
export default url;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment