dev_newshixunModel
杨树林 5 years ago
parent 51cf018b12
commit 4e5c983d67

@ -1,58 +1,62 @@
import React, { Component } from 'react';
import React, {Component} from 'react';
import {
Spin,
Pagination,
} from "antd";
import axios from 'axios';
import {getImageUrl,markdownToHTML} from 'educoder';
import {getImageUrl, markdownToHTML} from 'educoder';
import "../css/messagemy.css"
//消息页面
class MessagSub extends Component{
class MessagSub extends Component {
constructor(props) {
super(props);
this.state={
page:1,
limit:10,
typeysl:"",
count:0,
isSpin:false,
data:undefined,
this.state = {
page: 1,
limit: 10,
typeysl: "",
count: 0,
isSpin: false,
data: undefined,
}
}
// 初始化数据
componentDidMount(){
componentDidMount() {
// console.log("初始化数据了MessagSub");
// console.log(this.props);
this.getdata("",this.state.page);
this.getdata("", this.state.page);
// this.Messageprivatemessageunreadmessage();
try {
this.props.Mtab(1);
}catch (e) {
} catch (e) {
}
this.props.triggerRef(this)
}
//塞选页数
paginationonChanges=(pageNumber)=>{
paginationonChanges = (pageNumber) => {
this.setState({
page: pageNumber,
})
this.getdata(this.state.typeysl,pageNumber);
this.getdata(this.state.typeysl, pageNumber);
}
//获取数据源
getdata=(types,page)=>{
getdata = (types, page) => {
this.setState({
isSpin:true,
isSpin: true,
})
let{limit}=this.state;
let {limit} = this.state;
let url = `/users/tidings.json`;
axios.get((url),{params:{
type:types,
page:page,
per_page:limit,
}}).then((result) => {
axios.get((url), {
params: {
type: types,
page: page,
per_page: limit,
}
}).then((result) => {
if (result) {
// if (result.data.status === 0) {
@ -68,21 +72,23 @@ class MessagSub extends Component{
}).catch((error) => {
console.log(error);
this.setState({
isSpin:false,
isSpin: false,
})
})
};
getdatas=()=>{
getdatas = () => {
this.setState({
isSpin:true,
isSpin: true,
})
let{typeysl,page,limit}=this.state;
let {typeysl, page, limit} = this.state;
let url = `/users/tidings.json`;
axios.get((url),{params:{
type:typeysl,
page:page,
per_page:limit,
}}).then((result) => {
axios.get((url), {
params: {
type: typeysl,
page: page,
per_page: limit,
}
}).then((result) => {
if (result) {
// if (result.data.status === 0) {
@ -98,36 +104,36 @@ class MessagSub extends Component{
}).catch((error) => {
console.log(error);
this.setState({
isSpin:false,
isSpin: false,
})
})
}
componentWillUnmount(){
componentWillUnmount() {
// 卸载异步操作设置状态
this.setState = (state, callback) => {
return;
}
}
gettourl=(item)=>{
gettourl = (item) => {
switch (item.container_type) {
case "ApplyUserAuthentication" :
if(item.tiding_type==="Apply"){
if(item.auth_type===1){
if (item.tiding_type === "Apply") {
if (item.auth_type === 1) {
//系统管理页面
return window.open("/managements/identity_authentication");
}
if(item.auth_type===2){
if (item.auth_type === 2) {
//系统管理页面
return window.open("/managements/professional_authentication")
}
}
if(item.tiding_type ==="System"){
if (item.tiding_type === "System") {
// 账号管理页-认证信息
return window.open("/account/certification")
}
return ;
return;
case "CancelUserAuthentication" :
// 账号管理页-认证信息
return window.open("/account/certification")
@ -135,65 +141,65 @@ class MessagSub extends Component{
// 账号管理页-认证信息
return window.open("/account/certification")
case "ApplyAddDepartment" :
if(item.tiding_type==="Apply"){
if (item.tiding_type === "Apply") {
//部门审批
return window.open("/managements/depart")
}
if(item.tiding_type==="System"){
if (item.tiding_type === "System") {
// 账号管理页/account/profile
return window.open("/account/profile")
}
return ;
return;
case "ApplyAddSchools" :
if(item.tiding_type==="Apply"){
if (item.tiding_type === "Apply") {
// 单位审批
return window.open(" /managements/unit")
}
if(item.tiding_type==="System"){
if (item.tiding_type === "System") {
// 账号管理页
return window.open("/account/profile")
}
return ;
return;
case "ApplyAction" :
switch (item.parent_container_type) {
case "ApplyShixun" :
if(item.tiding_type==="Apply"){
if (item.tiding_type === "Apply") {
return window.open("/managements/shixun_authorization")
}
if(item.tiding_type==="System"){
if (item.tiding_type === "System") {
// 实训详情页 :identifier = identifier
return window.open(`/shixuns/${item.identifier}/challenges`)
}
case "ApplySubject" :
if(item.tiding_type==="Apply"){
if (item.tiding_type === "Apply") {
// 实训课程发布
return window.open("/managements/subject_authorization")
}
if(item.tiding_type==="System"){
if (item.tiding_type === "System") {
// 实践课程详情页 :parent_container_id = parent_container_id
return window.open(`/paths/${item.parent_container_id}`)
}
case "TrialAuthorization" :
if(item.tiding_type==="Apply"){
if (item.tiding_type === "Apply") {
// 试用授权页面
return window.open("/managements/trial_authorization")
}
if(item.tiding_type==="System"){
if (item.tiding_type === "System") {
// 账号管理页
return window.open("/account/profile")
}
}
return ;
return;
case 'JoinCourse' :
// 课堂详情页 :id =
return window.open(`/courses/${item.belong_container_id}/teachers`)
case 'StudentJoinCourse':
// 课堂详情页 :id = container_id
if(item.tiding_type === 'Apply') {
if (item.tiding_type === 'Apply') {
return window.open(`/courses/${item.belong_container_id}/teachers`);
}
if(item.tiding_type === 'System'){
if (item.tiding_type === 'System') {
//教学案例详情 :id = container_id
return window.open(`/courses/${item.belong_container_id}/students`);
}
@ -205,7 +211,7 @@ class MessagSub extends Component{
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`)
case 'Course' :
// 课堂详情页 :id = container_id
if(item.tiding_type==="Delete"){
if (item.tiding_type === "Delete") {
return;
}
@ -226,15 +232,15 @@ class MessagSub extends Component{
return '';
case "HomeworkCommon" :
//学生作业页 homework = parent_container_id
if(item.homework_type==="normal"){
if (item.homework_type === "normal") {
//普通作业
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/question`)
}
if(item.homework_type==="group"){
if (item.homework_type === "group") {
//分组作业
return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/question`)
}
if(item.homework_type==="practice"){
if (item.homework_type === "practice") {
//实训作业
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=1`)
}
@ -244,15 +250,15 @@ class MessagSub extends Component{
return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`)
case "StudentWorksScore" :
//学生作业页
if(item.homework_type==="normal"){
if (item.homework_type === "normal") {
//普通作业
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/question`)
}
if(item.homework_type==="group"){
if (item.homework_type === "group") {
//分组作业
return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/question`)
}
if(item.homework_type==="practice"){
if (item.homework_type === "practice") {
//实训作业
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=1`)
}
@ -329,70 +335,70 @@ class MessagSub extends Component{
switch (item.parent_container_type) {
case "AnonymousCommentFail" :
// 课堂-作业列表 homework = container_id
if(item.homework_type==="normal"){
if (item.homework_type === "normal") {
//普通作业
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`)
}
if(item.homework_type==="group"){
if (item.homework_type === "group") {
//分组作业
return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`)
}
if(item.homework_type==="practice"){
if (item.homework_type === "practice") {
//实训作业
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
}
case "HomeworkPublish" :
if(item.homework_type==="normal"){
if (item.homework_type === "normal") {
//普通作业
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`)
}
if(item.homework_type==="group"){
if (item.homework_type === "group") {
//分组作业
return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`)
}
if(item.homework_type==="practice"){
if (item.homework_type === "practice") {
//实训作业
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
}
case "AnonymousAppeal" :
if(item.homework_type==="normal"){
if (item.homework_type === "normal") {
//普通作业
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`)
}
if(item.homework_type==="group"){
if (item.homework_type === "group") {
//分组作业
return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`)
}
if(item.homework_type==="practice"){
if (item.homework_type === "practice") {
//实训作业
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
}
default :
// 课堂-作业列表 homework = container_id
if(item.homework_type==="normal"){
if (item.homework_type === "normal") {
//普通作业
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`)
}
if(item.homework_type==="group"){
if (item.homework_type === "group") {
//分组作业
return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`)
}
if(item.homework_type==="practice"){
if (item.homework_type === "practice") {
//实训作业
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
}
}
case "StudentWork" :
//课堂-作业 :id = container_id
if(item.homework_type==="normal"){
if (item.homework_type === "normal") {
//普通作业
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/${item.container_id}/appraise`)
}
if(item.homework_type==="group"){
if (item.homework_type === "group") {
//分组作业/courses/1208/group_homeworks/22373/1219130/appraise
return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/${item.container_id}/appraise`)
}
if(item.homework_type==="practice"){
if (item.homework_type === "practice") {
//实训作业
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
}
@ -448,17 +454,17 @@ class MessagSub extends Component{
// /managements/library_applies
return window.open(`/managements/library_applies`)
}
if(item.tiding_type === 'System'){
if (item.tiding_type === 'System') {
//教学案例详情 :id = container_id
return window.open(`/moop_cases/${item.container_id}`)
}
case "ProjectPackage" :
if(item.tiding_type==="Destroyed"){
return ;
if (item.tiding_type === "Destroyed") {
return;
}
if(item.tiding_type==="Destroyed_end"){
return ;
}else {
if (item.tiding_type === "Destroyed_end") {
return;
} else {
if (item.tiding_type === 'Apply') {
///managements/project_package_applies
return window.open(`/managements/project_package_applies`)
@ -471,9 +477,9 @@ class MessagSub extends Component{
case "Discuss":
return window.open(`/shixuns/${item.identifier}/shixun_discuss`);
case "Video":
if(item.tiding_type==="Apply"){
if (item.tiding_type === "Apply") {
return window.open(`/managements/video_applies`);
}else if(item.tiding_type==="System"){
} else if (item.tiding_type === "System") {
return window.open(`/users/${this.props.current_user.login}/videos`);
}
return '';
@ -481,34 +487,44 @@ class MessagSub extends Component{
return window.open(`/courses/${item.container_id}/informs`);
case "SubjectStartCourse":
return window.open(`/paths/${item.container_id}`);
case "ResubmitStudentWork":
return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.container_id}/appraise`);
case "AdjustScore":
//belong_container_id course的id
return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.parent_container_id}`);
default :
return window.open("/")
}
}
render() {
let{page,limit,typeysl,count,isSpin,data}=this.state;
let {page, limit, typeysl, count, isSpin, data} = this.state;
// console.log("6868686868");
// console.log(data);
return (
<div className="clearfix ml20">
{/*头部筛选数据*/}
<ul className="pl10 ridingNav clearfix edu-back-white">
<li className={typeysl===""?"active":""}><a onClick={(s,i)=>this.getdata("",1)}>全部</a></li>
<li className={typeysl&&typeysl==="course"?"active":""} ><a onClick={(s,i)=>this.getdata("course",1)}>课堂提醒</a></li>
<li className={typeysl&&typeysl==="project"?"active":""} ><a onClick={(s,i)=>this.getdata("project",1)}>项目提醒</a></li>
<li className={typeysl === "" ? "active" : ""}><a onClick={(s, i) => this.getdata("", 1)}>全部</a></li>
<li className={typeysl&&typeysl==="project_package"?"active":""}><a onClick={(s,i)=>this.getdata("project_package",1)}>众包提醒</a></li>
<li className={typeysl && typeysl === "course" ? "active" : ""}><a
onClick={(s, i) => this.getdata("course", 1)}>课堂提醒</a></li>
<li className={typeysl&&typeysl==="interaction"?"active":""}><a onClick={(s,i)=>this.getdata("interaction",1)}>互动提醒</a></li>
<li className={typeysl && typeysl === "project" ? "active" : ""}><a
onClick={(s, i) => this.getdata("project", 1)}>项目提醒</a></li>
<li className={typeysl&&typeysl==="apply"?"active":""}><a onClick={(s,i)=>this.getdata("apply",1)}>审核</a></li>
<li className={typeysl && typeysl === "project_package" ? "active" : ""}><a
onClick={(s, i) => this.getdata("project_package", 1)}>众包提醒</a></li>
<li className={typeysl&&typeysl==="notice"?"active":""}><a onClick={(s,i)=>this.getdata("notice",1)}>通知</a></li>
<li className={typeysl && typeysl === "interaction" ? "active" : ""}><a
onClick={(s, i) => this.getdata("interaction", 1)}>互动提醒</a></li>
<li className={typeysl && typeysl === "apply" ? "active" : ""}><a
onClick={(s, i) => this.getdata("apply", 1)}>审核</a></li>
<li className={typeysl && typeysl === "notice" ? "active" : ""}><a
onClick={(s, i) => this.getdata("notice", 1)}>通知</a></li>
</ul>
@ -519,25 +535,25 @@ class MessagSub extends Component{
<Spin size="large" className="myw100baifenbi mt10" spinning={isSpin}>
{
data===undefined?"":data.length===0?
data === undefined ? "" : data.length === 0 ?
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">暂无数据哦~</p>
</div>
:data.map((item,key)=>{
: data.map((item, key) => {
// console.log(data)
// ridinglist-subs
var boolps=true;
if(item.container_type==="PraiseTread"||item.container_type==="Grade"||item.container_type==="ChallengeWorkScore"){
boolps=false;
var boolps = true;
if (item.container_type === "PraiseTread" || item.container_type === "Grade" || item.container_type === "ChallengeWorkScore") {
boolps = false;
}
if(item.container_type==="JournalsForMessage"){
if(item.parent_container_type==="Principal"){
boolps=false;
if (item.container_type === "JournalsForMessage") {
if (item.parent_container_type === "Principal") {
boolps = false;
}
if(item.parent_container_type==="HomeworkCommon"){
if(item.homework_type===null||item.homework_type===undefined){
boolps=false;
if (item.parent_container_type === "HomeworkCommon") {
if (item.homework_type === null || item.homework_type === undefined) {
boolps = false;
}
}
}
@ -546,36 +562,41 @@ class MessagSub extends Component{
// boolps=false;
// }
// }
if(item.container_type==="ProjectPackage"){
if(item.tiding_type==="Destroyed_end"){
boolps=false;
if (item.container_type === "ProjectPackage") {
if (item.tiding_type === "Destroyed_end") {
boolps = false;
}
if(item.tiding_type==="Destroyed"){
boolps=false;
if (item.tiding_type === "Destroyed") {
boolps = false;
}
}
if(item.container_type==="Course"){
if(item.tiding_type==="Delete"){
boolps=false;
if (item.container_type === "Course") {
if (item.tiding_type === "Delete") {
boolps = false;
}
}
return(
return (
<div className="pl25 ridinglist edu-back-white" key={key}>
<div className={boolps===true?"ridinglist-sub clearfix df tiding_item":"ridinglist-subs clearfix df tiding_item"} onClick={()=>this.gettourl(item)}>
<img onMouseDown={()=>this.myCome(item)} src={getImageUrl("images/"+item.trigger_user.image_url)} className="radius mr10 fl myimgw48 myimgh48"/>
<div
className={boolps === true ? "ridinglist-sub clearfix df tiding_item" : "ridinglist-subs clearfix df tiding_item"}
onClick={() => this.gettourl(item)}>
<img onMouseDown={() => this.myCome(item)}
src={getImageUrl("images/" + item.trigger_user.image_url)}
className="radius mr10 fl myimgw48 myimgh48"/>
<div className="fl flex1">
<p>
<a className="mr20 private_message_a" onMouseDown={()=>this.myCome(item)}>{item.trigger_user.name}</a>
<a className="mr20 private_message_a"
onMouseDown={() => this.myCome(item)}>{item.trigger_user.name}</a>
<span className="color-grey-c">{item.time}</span>
{item.tiding_type==="Apply"?(
item.status===0?
<span className="edu-filter-btn ml20 edu-filter-btn-red">待处理</span>:""
):""}
{item.tiding_type==="Apply"?(
item.status===1?
<span className="edu-filter-btn ml20 edu-filter-btn-green">已处理</span>:""
):""}
{item.tiding_type === "Apply" ? (
item.status === 0 ?
<span className="edu-filter-btn ml20 edu-filter-btn-red">待处理</span> : ""
) : ""}
{item.tiding_type === "Apply" ? (
item.status === 1 ?
<span className="edu-filter-btn ml20 edu-filter-btn-green">已处理</span> : ""
) : ""}
</p>
<style>
@ -586,10 +607,11 @@ class MessagSub extends Component{
`
}
</style>
<p className="color-grey-6 yslspansk markdown-body mt10" style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML(item.content).replace(/▁/g, "▁▁▁")}} ></p>
<p className="color-grey-6 yslspansk markdown-body mt10" style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML(item.content).replace(/▁/g, "▁▁▁")}}></p>
</div>
<span className={item.new_tiding===true?"new-point fr mr40 mt22":""}></span>
<span className={item.new_tiding === true ? "new-point fr mr40 mt22" : ""}></span>
</div>
</div>
@ -598,16 +620,16 @@ class MessagSub extends Component{
</Spin>
{/*页数*/}
{ data===undefined?""
{data === undefined ? ""
:
(count>10?
(count > 10 ?
<div style={{textAlign: "center"}} className="new_expand mt10">
<div className="edu-txt-center mt30">
<Pagination showQuickJumper current={page}
onChange={this.paginationonChanges} pageSize={limit}
total={count}></Pagination>
</div>
</div>:""
</div> : ""
)
}
@ -618,4 +640,5 @@ class MessagSub extends Component{
)
}
}
export default MessagSub;
Loading…
Cancel
Save