Browse Source

出入校接口对接
课程表接口对接
作业通知接口对接

RaoMeng 6 năm trước cách đây
mục cha
commit
15c27b2a8e

+ 3 - 3
frontend/wechat-web/src/components/HomeWorkItem.jsx

@@ -27,8 +27,8 @@ export default class HomeWorkItem extends Component {
                 <div className='recharge-item-root'>
                     <div className='common-flex-row homework-item-title-layout'>
                         <div className='homework-item-title'>{homeWork.notifyName}</div>
-                        <span className={homeWork.isRead === 1 ? 'homework-item-todo'
-                            : 'homework-item-done'}>{homeWork.readStatus}</span>
+                        <span className={homeWork.taskStatus === 2 ? 'homework-item-done'
+                            : 'homework-item-todo'}>{homeWork.readStatus}</span>
                     </div>
                     <div className='gray-line' style={{height: '1px', marginBottom: '10px'}}></div>
                     <div className='recharge-item-line'>
@@ -43,7 +43,7 @@ export default class HomeWorkItem extends Component {
                         <div className='recharge-item-caption'>发布老师:</div>
                         <div className='recharge-item-value'>{homeWork.notifyCreatorName}</div>
                     </div>
-                    <div className='recharge-item-line' style={{paddingBottom:'20px'}}>
+                    <div className='recharge-item-line' style={{paddingBottom: '20px'}}>
                         <div className='recharge-item-caption'>发布时间:</div>
                         <div className='recharge-item-value'>{homeWork.creatDate}</div>
                     </div>

+ 14 - 7
frontend/wechat-web/src/configs/api.config.js

@@ -9,7 +9,7 @@ import store from './../redux/store/store'
  */
 // export const _baseURL = 'https://tmobile.ubtob.com/school'
 // export const _baseURL = 'http://10.1.80.101:8080/school'
-export const _baseURL = 'http://10.1.80.101:9600'
+export const _baseURL = 'http://10.1.80.101:9560'
 export const API = {
     //获取openId
     GET_OPENID: _baseURL + '/wxPay/getOpenid',
@@ -54,7 +54,6 @@ export const API = {
     notifyMessage: _baseURL + '/notify/getMeetingList',
 
 
-
     homeWorkList: _baseURL + "/notify/getMeetingList",
     homeWorkDetail: _baseURL + "/notify/taskDetail",
 
@@ -127,19 +126,16 @@ export const API = {
     voteDetailTeacher: _baseURL + "/wxSchool/vote/voteDetailTeacher",//教师端投票单详情
     voteActionTeacher: _baseURL + "/wxSchool/vote/voteActionTeacher",//老师投票
     voteActionParent: _baseURL + "/wxSchool/vote/voteActionParent",//家长投票
-    //创建作业发布
-    homeWorkAdd: _baseURL + "/wxSchool/taskNotify/createTask",
 
     //分页显示校长信箱(校长端)
-    MailboxListTeacher :_baseURL + '/wxSchool/principalMailbox/principalMailboxListTeacher',
+    MailboxListTeacher: _baseURL + '/wxSchool/principalMailbox/principalMailboxListTeacher',
     //分页显示校长信箱(家长端)
-    MailboxListParent:_baseURL+'/wxSchool/principalMailbox/principalMailboxListParent',
+    MailboxListParent: _baseURL + '/wxSchool/principalMailbox/principalMailboxListParent',
     //删除校长信箱历史投递
     NOTIFY_DELETEMAIL: _baseURL + '/wxSchool/principalMailbox/deleteMailParent',
     //出入校单次记录详情
 
 
-
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //获取用户是否绑定
     USER_ISBINDING: _baseURL + '/wxSchool/user/isBinding',
@@ -192,6 +188,17 @@ export const API = {
     //获取班级家长手机号
     GET_PARENT_PHONES: _baseURL + '/wxSchool/clazz/getParentByClazzId',
 
+
+    //作业列表家长端
+    HOMEWORK_LIST_PARENT: _baseURL + '/wxSchool/taskNotify/listTaskStu',
+    //作业列表教师端
+    HOMEWORK_LIST_TEACHER: _baseURL + '/wxSchool/taskNotify/listTaskTeacher',
+    //创建作业发布
+    homeWorkAdd: _baseURL + "/wxSchool/taskNotify/createTask",
+    //作业详情
+    HOMEWORK_DETAIL: _baseURL + '/wxSchool/taskNotify/taskDetail',
+    //作业回复
+    HOMEWORK_REPLY: _baseURL + '/wxSchool/taskNotify/taskReply',
 }
 
 

+ 2 - 1
frontend/wechat-web/src/configs/router.config.js

@@ -76,6 +76,7 @@ export default class RouteConfig extends Component {
 
                     {/*饶猛*/}
                     <Route path="/homePage" component={HomePage}/>{/*首页*/}
+                    <Route path='/userInfoPage/:type?' component={UserInfo}/>{/*个人信息*/}
 
                     <Route path='/bindMenu/:type/:openid?/' component={BindMenu}/>{/*绑定菜单页面*/}
                     <Route path='/accountBind/:type?' component={AccountBind}/>{/*绑定页面*/}
@@ -110,10 +111,10 @@ export default class RouteConfig extends Component {
                     <Route path='/notifyBoard/teacher' component={NotifyBoardTeacher}/>{/*教师端通知公告列表*/}
                     <Route path='/notifyDetail/:notifyId' component={NotifyBoardDetail}/>{/*通知公告详情*/}
 
-                    <Route path='/userInfoPage/:type?' component={UserInfo}/>{/*个人信息*/}
                     <Route path='/releaseAssignment' component={ReleaseAssignmentPage}/>{/*作业发布*/}
                     <Route path='/assignmentList/:role' component={HomeWorkList}/>{/*作业列表*/}
                     <Route path='/assignmentDetail/:role/:id' component={AssignmentDetailPage}/>{/*作业详情*/}
+
                     <Route path='/voteList' component={VoteListParent}/>{/*家长端投票列表*/}
                     <Route path='/voteListTab' component={VoteListTeacher}/>{/*教师端投票列表*/}
                     <Route path="/voteDetail/:id/:role?" component={VoteDetailPage}/>{/*投票详情*/}

+ 4 - 0
frontend/wechat-web/src/modules/announce/AnnounceRelease.jsx

@@ -179,6 +179,10 @@ class AnnounceRelease extends Component {
             Toast.fail('请输入通知内容')
             return
         }
+        if (isObjEmpty(this.checkNodes)) {
+            Toast.fail('请选择发布对象')
+            return
+        }
         Toast.loading('正在发布...', 0)
 
         const fileUrls = []

+ 1 - 1
frontend/wechat-web/src/modules/hiPages/access-notice/AccessNotice.css

@@ -1,6 +1,6 @@
 .header_sty1{position: fixed;top: 0px;width: 100%;}
 .header_sty{  position: fixed;top: 0px;height: 97px;width: 100%;background-color:#E7EDF6;align-content: center;display: flex;flex-direction: row;  }
-.header{height: 67px;width: 67px;margin: 10px 10px 0 80px;}
+.header{height: 60px;width: 60px;margin: 10px 10px 0 80px;}
 .timeList_sty{height: auto;display: flex;flex-direction: row;align-items: center}
 .out_in{height: 38px;width: 38px;padding-top: 0px;border: none;}
 .lineimg_sty{height: 24px;width: 2px;margin-left: 18px;}

+ 75 - 52
frontend/wechat-web/src/modules/hiPages/access-notice/AccessNotice.js

@@ -1,98 +1,121 @@
 /**
-*   Created by FANGlh on 2018/11/9 20:09.
-*/
+ *   Created by FANGlh on 2018/11/9 20:09.
+ */
 
-import React,{Component} from 'react';
+import React, {Component} from 'react';
 import './AccessNotice.css';
-import {fetchPost,fetchGet,fetchGetNoSession} from '../../../utils/fetchRequest';
-import {API} from '../../../configs/api.config';
+import {fetchPost, fetchGet, fetchGetNoSession} from '../../../utils/fetchRequest';
+import {_baseURL, API} from '../../../configs/api.config';
 import LoadingMore from "../../../components/LoadingMore";
 import InfiniteScroll from 'react-infinite-scroller';
 import {Toast} from 'antd-mobile';
 import {connect} from 'react-redux';
 import ItemComp from './ItemComp';
+import {Avatar} from 'antd'
 
-
-class AccessNotice extends Component{
+class AccessNotice extends Component {
     componentWillMount() {
         document.title = '出入校通知'
     }
 
-    constructor(){
+    constructor() {
         super();
         this.state = {
-            studentName:null,
-            studentGrade:'三年八班',
-            out_inData:[]
+            studentName: '',
+            studentGrade: '',
+            out_inData: [],
+            stuPhoto: '',
         }
     }
+
     componentDidMount() {
         let stuId = this.props.match.params.stuId
-        if(stuId == null|| stuId.length == 0){
+        if (stuId == null || stuId.length == 0) {
             stuId = this.props.userInfo.user.student.stuId
         }
         this.setState({
-            studentName:this.props.userInfo.user.student.stuName,
+            studentName: this.props.userInfo.user.student.stuName,
         })
-        fetchPost(API.RecordOutgoingList,{
-            stuId:stuId,
-            pageIndex:1,
-            pageSize:10
-        },{})
-            .then((response)=>{
-                console.log('response',response)
-                if (response.success && response.data){
+        fetchPost(API.RecordOutgoingList, {
+            stuId: stuId,
+            pageIndex: 1,
+            pageSize: 10
+        }).then((response) => {
+            if (response.success && response.data) {
+                if (response.data.student) {
                     this.setState({
-                        out_inData:response.data
+                        studentName: response.data.student.stuName,
+                        studentGrade: response.data.student.gradeName + response.data.student.clazzName,
+                        stuPhoto: response.data.student.stuPhoto
                     })
-                }else {
-                    Toast.info("暂无进出校数据",2)
                 }
-            })
-            .catch((error) =>{
-                console.log('error',error)
-                if (typeof error === 'string') {
-                    Toast.fail(error, 2)
-                } else {
-                    Toast.fail('请求异常', 2)
-                }
-            })
+
+                this.setState({
+                    out_inData: response.data.outInRecordDOS
+                })
+            } else {
+                Toast.info("暂无进出校数据", 2)
+            }
+        }).catch((error) => {
+            console.log('error', error)
+            if (typeof error === 'string') {
+                Toast.fail(error, 2)
+            } else {
+                Toast.fail('请求异常', 2)
+            }
+        })
     }
-    render(){
-        return(
-            <div style={{fontFamily:"PingFangSC-Regular",letterSpacing:2.5}}>
+
+    render() {
+        return (
+            <div style={{fontFamily: "PingFangSC-Regular", letterSpacing: 2.5}}>
                 {/*<div className="header_sty1">*/}
-                    <div className="header_sty">
-                        <img className="img-circle header" src={"https://upload-images.jianshu.io/upload_images/1131704-eb8f2d63ed00682d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240"} alt=""/>
-                        <div style={{marginTop:20,marginLeft:10}}>
-                            <div style={{color:"#4087DC",fontSize:18}}>{this.state.studentName}</div>
-                            <div style={{color:"#666666",fontSize:12,marginTop:5}}>{this.state.studentGrade}</div>
-                        </div>
+                <div className="header_sty">
+                    {this.state.stuPhoto ?
+                        <img className="img-circle header"
+                             src={_baseURL + this.state.stuPhoto}
+                             alt=""/> : <div className='header'>
+                            <Avatar size={50} icon='user'/>
+                        </div>}
+
+                    <div style={{marginTop: 20, marginLeft: 10}}>
+                        <div style={{color: "#4087DC", fontSize: 18}}>{this.state.studentName}</div>
+                        <div style={{color: "#666666", fontSize: 12, marginTop: 5}}>{this.state.studentGrade}</div>
                     </div>
+                </div>
                 {/*</div>*/}
                 <div className="center_sty">
-                    <div style={{width:95,color:"#4087DC",fontSize:"20px",paddingLeft:30,paddingTop:60,
-                        position:'fixed',}}>
-                        <div>智</div><div>慧</div><div>校</div><div>园</div>
+                    <div style={{
+                        width: 95, color: "#4087DC", fontSize: "20px", paddingLeft: 30, paddingTop: 60,
+                        position: 'fixed',
+                    }}>
+                        <div>智</div>
+                        <div>慧</div>
+                        <div>校</div>
+                        <div>园</div>
                         <br/>
-                        <div>平</div><div>安</div><div>出</div><div>行</div>
+                        <div>平</div>
+                        <div>安</div>
+                        <div>出</div>
+                        <div>行</div>
                     </div>
-                    <div style={{marginBottom:50,marginLeft:90}}>
-                        {this.state.out_inData.map((itemdata,index) => <ItemComp key ={index} itemdata = {itemdata} handelSItem={this.handelSItem}></ItemComp>)}
+                    <div style={{marginBottom: 50, marginLeft: 90}}>
+                        {this.state.out_inData.map((itemdata, index) => <ItemComp key={index} itemdata={itemdata}
+                                                                                  handelSItem={this.handelSItem}></ItemComp>)}
                     </div>
                 </div>
             </div>
         )
     }
 
-    HttpTest =() =>{
+    HttpTest = () => {
         // httpRuquest.
     }
-    previousDataClick = (event)=>{
-       console.log('previousDataClick')
+    previousDataClick = (event) => {
+        console.log('previousDataClick')
     }
 
-    nextDataClick = (event)=>{
+    nextDataClick = (event) => {
         console.log('nextDataClick')
     }
 }

+ 74 - 17
frontend/wechat-web/src/modules/hiPages/class-schedule/ClassSchedule.css

@@ -1,24 +1,81 @@
-.scheedule_sty1{padding: 0px 20px 20px 20px;}
-.comhline_sty1{background-color:#F2F2F2;width:100%;height:1px;}
-.sch_hang_sty{display: flex;flex-direction: row;}
-.teach_img{height: 27px;width: 27px;margin-left: 30px;border-radius: 100%;}
-.green_point{height: 25px;width: 25px;background-color:#3DAA4F; border-radius: 100%}
-.sch_time_sty{font-size: 15px;color: #333333;margin: 2px 15px;}
-.sch_class_sty{font-family: PingFangSC-Medium;
+.scheedule_sty1 {
+    padding: 0px 20px 20px 20px;
+}
+
+.comhline_sty1 {
+    background-color: #F2F2F2;
+    width: 100%;
+    height: 1px;
+}
+
+.sch_hang_sty {
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+}
+
+.teach_img {
+    height: 27px;
+    width: 27px;
+    margin-left: 30px;
+    border-radius: 100%;
+}
+
+.green_point {
+    height: 14px;
+    width: 14px;
+    background-color: #3DAA4F;
+    border-radius: 100%;
+}
+
+.sch_time_sty {
+    margin: 2px 15px;
+    font-family: PingFangSC-Regular;
+    font-size: 15px;
+    color: #333333;
+    letter-spacing: 2.0px;
+}
+
+.sch_class_sty {
+    font-family: PingFangSC-Medium;
     font-size: 18px;
     color: #0F1011;
     letter-spacing: 0;
-    text-align: right;
 }
-.sch_teacher_sty{font-size: 12px;color: #666666;padding: 5px;}
-.header_days_sty{display: flex;flex-direction: row;}
-.each_day_default{width: 20%;height: 36px;color: #CECECE;font-size: 15px;
-    text-align: center;margin-top:15px;margin:10px 20px 10px 20px;
-    border-radius:100%;line-height: 36px;
+
+.sch_teacher_sty {
+    font-size: 12px;
+    color: #666666;
+    padding: 5px;
 }
-.isday_click{
-    width: 20%;height: 36px;
-    border-radius:100%;color:#FFFFFF;background-color: #4197FC;
-    text-align: center;margin-top:15px;margin:10px 20px 10px 20px;line-height: 36px;
+
+.header_days_sty {
+    display: flex;
+    flex-direction: row;
 }
 
+.each_day_default {
+    width: 20%;
+    height: 36px;
+    color: #CECECE;
+    font-size: 15px;
+    text-align: center;
+    margin-top: 15px;
+    margin: 10px 20px 10px 20px;
+    border-radius: 100%;
+    line-height: 36px;
+}
+
+.isday_click {
+    width: 20%;
+    height: 36px;
+    border-radius: 100%;
+    color: #FFFFFF;
+    background-color: #4197FC;
+    text-align: center;
+    margin-top: 15px;
+    margin: 10px 20px 10px 20px;
+    line-height: 36px;
+}
+
+

+ 110 - 63
frontend/wechat-web/src/modules/hiPages/class-schedule/ClassSchedule.js

@@ -2,10 +2,10 @@
  *   Created by FANGlh on 2018/11/12 15:34.
  */
 
-import React,{Component} from 'react';
-import  './ClassSchedule.css';
+import React, {Component} from 'react';
+import './ClassSchedule.css';
 import line_img from '../../../style/imgs/line_img.png';
-import {fetchPost,fetchGet,fetchGetNoSession} from '../../../utils/fetchRequest';
+import {fetchPost, fetchGet, fetchGetNoSession} from '../../../utils/fetchRequest';
 import {API} from '../../../configs/api.config';
 import {Toast} from 'antd-mobile';
 import moment from 'moment'
@@ -13,61 +13,105 @@ import {connect} from 'react-redux';
 import hi0_img from '../../../style/imgs/ic_head1.png';
 
 function HSItem(props) {
-    return(
-        <div style={{marginTop:0,marginLeft:10}}>
-            <img src={line_img} alt="" style={{width:2,height:25,marginLeft:12}}/>
-            <div className="sch_hang_sty">
+    return (
+        <div className='common-flex-row' style={{height: '60px', paddingLeft: '26px'}}>
+            <div className='common-flex-column'
+                 style={{height: '100%', justifyContent: 'center', alignItems: 'center'}}>
+                {props.isFirst ? <div style={{flex: 1}}></div>
+                    : <div style={{background: '#E9E9E9', flex: '1', width: '2px'}}></div>}
                 <div className="green_point"></div>
-                <div className="sch_time_sty">{moment(props.itemdata.curStartTime).format('HH:mm')}–{moment(props.itemdata.curEndTime).format('HH:mm')}</div>
-                <div className="sch_class_sty">{props.itemdata.curName}</div>
-                <img className="teach_img" src={props.itemdata.userPhoto==""||props.itemdata.userPhoto==null ? hi0_img : props.itemdata.userPhoto}alt=""/>
-                <div className="sch_teacher_sty">{props.itemdata.userName}</div>
+                {props.isLast ? <div style={{flex: 1}}></div>
+                    : <div style={{background: '#E9E9E9', flex: '1', width: '2px'}}></div>}
+
+            </div>
+            <div className="sch_hang_sty">
+                <div
+                    className="sch_time_sty">{props.itemdata.startTime}–{props.itemdata.endTime}</div>
+                <div className="sch_class_sty">{props.itemdata.subjectName}</div>
+                <img className="teach_img"
+                     src={props.itemdata.teacherPhoto == "" || props.itemdata.userPhoto == null ? hi0_img : props.itemdata.userPhoto}
+                     alt=""/>
+                <div className="sch_teacher_sty">{props.itemdata.teacherName}</div>
             </div>
             {/*<img src={line_img} alt="" style={{width:2,height:15,marginLeft:12}}/>*/}
         </div>
     )
 }
-class ClassSchedule extends Component{
 
-    constructor(){
+class ClassSchedule extends Component {
+
+    constructor() {
         super();
         this.state = {
-            curDay:new Date().getDay(),
-            classData:{
-                monday:[],
-                tuesday:[],
-                wednesday:[],
-                thursday:[],
-                friday:[],
-                saturday:[],
-                sunday:[]
+            curDay: new Date().getDay(),
+            classData: {
+                monday: [],
+                tuesday: [],
+                wednesday: [],
+                thursday: [],
+                friday: [],
+                saturday: [],
+                sunday: []
             },
-            curDayData:[],
-            Class_SchData:[1,2,3,4],
+            curDayData: [],
+            Class_SchData: [1, 2, 3, 4],
         }
     }
-    render(){
-        return(
+
+    render() {
+        const courseItems = []
+
+        if (this.state.curDayData) {
+            this.state.curDayData.forEach((itemata, index) => {
+                let isFirst = false
+                let isLast = false
+                if (index === 0) {
+                    isFirst = true
+                    isLast = false
+                }
+                if (index === (this.state.curDayData.length - 1)) {
+                    isFirst = false
+                    isLast = true
+                }
+                courseItems.push(<HSItem key={index} itemdata={itemata}
+                                         handelSItem={this.handelSItem}
+                                         isFirst={isFirst} isLast={isLast}/>)
+
+            })
+        }
+        return (
             <div>
                 <div className="header_days_sty">
-                    <div onClick={this.selectDayClick.bind(this,1)}  className={this.state.CurDay == 1 ? "isday_click" : 'each_day_default'} >一</div>
-                    <div onClick={this.selectDayClick.bind(this,2)}  className={this.state.CurDay == 2 ? "isday_click" : 'each_day_default'}>二</div>
-                    <div onClick={this.selectDayClick.bind(this,3)}  className={this.state.CurDay == 3 ? "isday_click" : 'each_day_default'}>三</div>
-                    <div onClick={this.selectDayClick.bind(this,4)}  className={this.state.CurDay == 4 ? "isday_click" : 'each_day_default'}>四</div>
-                    <div onClick={this.selectDayClick.bind(this,5)}  className={this.state.CurDay == 5 ? "isday_click" : 'each_day_default'}>五</div>
+                    <div onClick={this.selectDayClick.bind(this, 1)}
+                         className={this.state.CurDay == 1 ? "isday_click" : 'each_day_default'}>一
+                    </div>
+                    <div onClick={this.selectDayClick.bind(this, 2)}
+                         className={this.state.CurDay == 2 ? "isday_click" : 'each_day_default'}>二
+                    </div>
+                    <div onClick={this.selectDayClick.bind(this, 3)}
+                         className={this.state.CurDay == 3 ? "isday_click" : 'each_day_default'}>三
+                    </div>
+                    <div onClick={this.selectDayClick.bind(this, 4)}
+                         className={this.state.CurDay == 4 ? "isday_click" : 'each_day_default'}>四
+                    </div>
+                    <div onClick={this.selectDayClick.bind(this, 5)}
+                         className={this.state.CurDay == 5 ? "isday_click" : 'each_day_default'}>五
+                    </div>
                 </div>
-                <div className="comhline_sty"></div>
+                <div className="comhline_sty" style={{marginBottom:'20px'}}></div>
+                {courseItems}
+
                 {/*<div style={{fontSize:14,color:"#333333",margin:20}}>11月12日,<span style={{fontSize:12}}>2018年</span></div>*/}
-                <div className="scheedule_sty1">
-                    {/*<div style={{color:"#333333",fontSize:14,marginBottom:10,marginTop:10}}>上午</div>*/}
+                {/*<div className="scheedule_sty1">
+                    <div style={{color:"#333333",fontSize:14,marginBottom:10,marginTop:10}}>上午</div>
                     <p>{this.state.curWeek}</p>
-                    <div className="comhline_sty1" style={{marginBottom:10}}></div>
+                    <div className="comhline_sty1" style={{marginBottom: 10}}></div>
                     <div>
-                        {/*{this.state.curDayData.map((itemdata,index) => <HSItem key ={index} itemdata = {itemdata} handelSItem={this.handelSItem}></HSItem>)}*/}
+                        {this.state.curDayData.map((itemdata,index) => <HSItem key ={index} itemdata = {itemdata} handelSItem={this.handelSItem}></HSItem>)}
                     </div>
-                </div>
+                </div>*/}
 
-                <div className="comhline_sty"></div>
+                {/*<div className="comhline_sty"></div>*/}
 
                 {/*<div className="scheedule_sty1">*/}
                 {/*<div style={{color:"#333333",fontSize:14,marginBottom:10,marginTop:10}}>下午</div>*/}
@@ -80,45 +124,47 @@ class ClassSchedule extends Component{
         )
     }
 
-    selectDayClick = (value)=>{
-        console.log("value",value)
+    selectDayClick = (value) => {
+        console.log("value", value)
         var Cdata = null
-        if(value == 1){
-            Cdata = this.state.classData.monday
-        }else if(value == 2){
-            Cdata = this.state.classData.tuesday
-        }else if(value == 3){
-            Cdata = this.state.classData.wednesday
-        }else if(value == 4){
-            Cdata = this.state.classData.thursday
-        }else if(value ==  5){
-            Cdata = this.state.classData.friday
+        if (value == 1) {
+            Cdata = this.state.classData.curMons
+        } else if (value == 2) {
+            Cdata = this.state.classData.curTuess
+        } else if (value == 3) {
+            Cdata = this.state.classData.curWeds
+        } else if (value == 4) {
+            Cdata = this.state.classData.curThurs
+        } else if (value == 5) {
+            Cdata = this.state.classData.curFris
+        } else {
+            Cdata = []
         }
         this.setState({
-            CurDay:value,
-            curDayData:Cdata
-        },function (){
-            console.log("curDayData",this.state.curDayData)
+            CurDay: value,
+            curDayData: Cdata
+        }, function () {
+            console.log("curDayData", this.state.curDayData)
         })
     }
 
     componentWillMount() {
         document.title = '课表查询'
     }
+
     componentDidMount() {
-        fetchGet(API.curriculumListByStuId,{
-            stuId:this.props.userInfo.user.student.stuId,
-            curStatus:1
-        },{}).then((response)=>{
-            if(response.success && response.data){
+        fetchGet(API.curriculumListByStuId, {
+            stuId: this.props.userInfo.user.student.stuId,
+            curStatus: 1
+        }, {}).then((response) => {
+            if (response.success && response.data) {
                 this.setState({
-                    classData:response.data
-                },function () {
+                    classData: response.data
+                }, function () {
                     this.selectDayClick(this.state.curDay)
                 })
             }
-        }).catch((error) =>{
-            console.log('error',error)
+        }).catch((error) => {
             if (typeof error === 'string') {
                 Toast.fail(error, 2)
             } else {
@@ -127,6 +173,7 @@ class ClassSchedule extends Component{
         })
     }
 }
+
 let mapStateToProps = (state) => ({
     userInfo: {...state.redUserInfo}
 })

+ 47 - 31
frontend/wechat-web/src/modules/hiPages/score-inquiry/ScoreData.js

@@ -1,45 +1,61 @@
 /**
-*   Created by FANGlh on 2018/11/12 20:13.
-*/
+ *   Created by FANGlh on 2018/11/12 20:13.
+ */
 
-import React,{Component} from 'react';
+import React, {Component} from 'react';
 import './ScoreInquiry.css';
 import moment from 'moment';
 
-export default class ScoreData extends Component{
+export default class ScoreData extends Component {
     componentWillMount() {
         document.title = '成绩查询'
     }
-    constructor(props){
+
+    constructor(props) {
         super();
     }
-    render(){
 
-        return(
-           <div >
-               {/*<div className="top_Time"><span className="top_time_span">2018-10-25 10:20</span></div>*/}
-               <div className="score_data_sty">
-                   <div className="title_sty">{this.props.itemdata.title}</div>
-                   <div className="comhline_sty1"></div>
-                   <div className="left_sty1">
-                       <div style={{width:"50%",margin:10}}>
-                           <div style={{fontSize:11,color:"#333333",margin:10,height:40}}>考试时间<span style={{color:"#666666",marginLeft:5}}>{moment(this.props.itemdata.scoreBasic.scoreDate).format('YYYY-MM-DD')}</span></div>
-                           <div className="left_sty">姓名: <span className="right_sty">{this.props.itemdata.scoreBasic.stuName} </span></div>
-                           <div className="left_sty">科目: <span className="right_sty">{this.props.itemdata.scoreBasic.scoreName}</span></div>
-                           <div className="left_sty">满分: <span className="right_sty">{this.props.itemdata.scoreBasic.scoreTotal}</span></div>
-                           <div className="left_sty">得分: <span className="right_sty">{this.props.itemdata.scoreBasic.scoreNum}</span></div>
-                       </div>
-                       <div style={{height:100,width:1,background:"#F2F2F2",marginTop:80}}></div>
-                       <div style={{width:"50%",margin:10}}>
-                           <div style={{fontSize:11,color:"#333333",margin:10,height:40}}>考试范围<span style={{color:"#666666",marginLeft:5}}>{this.props.itemdata.scoreBasic.scoreScope}</span></div>
-                           <div className="left_sty">班级排名: <span className="right_sty">{this.props.itemdata.classRank}</span></div>
-                           <div className="left_sty">年级排名: <span className="right_sty">{this.props.itemdata.schoolRank}</span></div>
-                           <div className="left_sty">班级平均分: <span className="right_sty">{this.props.itemdata.classAverage}</span></div>
-                           <div className="left_sty">年级平均分: <span className="right_sty">{this.props.itemdata.schoolAverage}</span></div>
-                       </div>
-                   </div>
-               </div>
-           </div>
+    render() {
+
+        return (
+            <div style={{width: '100%'}}>
+                {/*<div className="top_Time"><span className="top_time_span">2018-10-25 10:20</span></div>*/}
+                <div className="score_data_sty">
+                    <div className="title_sty">{this.props.itemdata.title}</div>
+                    <div className="gray-line" style={{height: '1px'}}></div>
+                    <div className="left_sty1">
+                        <div style={{width: "50%", padding: 10}}>
+                            <div style={{fontSize: 12, color: "#333333", padding: 10}}>考试时间:<span style={{
+                                color: "#666666",
+                                marginLeft: 5
+                            }}>{moment(this.props.itemdata.scoreBasic.scoreDate).format('YYYY-MM-DD')}</span></div>
+                            <div className="left_sty">姓名: <span
+                                className="right_sty">{this.props.itemdata.scoreBasic.stuName} </span></div>
+                            <div className="left_sty">科目: <span
+                                className="right_sty">{this.props.itemdata.scoreBasic.scoreName}</span></div>
+                            <div className="left_sty">满分: <span
+                                className="right_sty">{this.props.itemdata.scoreBasic.scoreTotal}</span></div>
+                            <div className="left_sty">得分: <span
+                                className="right_sty">{this.props.itemdata.scoreBasic.scoreNum}</span></div>
+                        </div>
+                        <div style={{height: 100, width: 1, background: "#F2F2F2", marginTop: 60}}></div>
+                        <div style={{width: "50%", padding: 10}}>
+                            <div style={{fontSize: 12, color: "#333333", padding: 10}}>考试范围:<span style={{
+                                color: "#666666",
+                                marginLeft: 5
+                            }}>{this.props.itemdata.scoreBasic.scoreScope}</span></div>
+                            <div className="left_sty">班级排名: <span
+                                className="right_sty">{this.props.itemdata.classRank}</span></div>
+                            <div className="left_sty">年级排名: <span
+                                className="right_sty">{this.props.itemdata.schoolRank}</span></div>
+                            <div className="left_sty">班级平均分: <span
+                                className="right_sty">{this.props.itemdata.classAverage}</span></div>
+                            <div className="left_sty">年级平均分: <span
+                                className="right_sty">{this.props.itemdata.schoolAverage}</span></div>
+                        </div>
+                    </div>
+                </div>
+            </div>
         )
     }
 }

+ 71 - 13
frontend/wechat-web/src/modules/hiPages/score-inquiry/ScoreInquiry.css

@@ -1,17 +1,75 @@
-.this_contaior{background-color: #F2F2F2;height: 100vh;padding: 10px}
-.header_select_sty{display: flex;flex-direction: row;text-align: left;position: fixed;top: 0;background-color: #FFF;width: 100%;}
-.title_sty{font-size: 15px;text-align: center;width: 100%;padding: 10px; font-family: PingFangSC-Regular; color: #4197FC; letter-spacing: 0;}
-.score_data_sty{border-radius: 10px;background-color: #FFFFFF;}
-.comhline_sty {background-color:#F2F2F2;width:100%;height:10px}
-.comhline_sty1{background-color:#F2F2F2;width:100%;height:1px;}
-.left_sty{font-size: 15px;color: #666666;margin: 10px;}
-.right_sty{color: #333333;margin-left: 10px;}
-.left_sty1{display: flex;flex-direction: row;text-align: left;}
-.top_Time{
+.this_contaior {
+    background-color: #F2F2F2;
+    height: 100vh;
+    padding: 10px
+}
+
+.header_select_sty {
+    display: flex;
+    flex-direction: row;
+    text-align: left;
+    position: fixed;
+    top: 0;
+    background-color: #FFF;
+    width: 100%;
+}
+
+.title_sty {
+    font-size: 15px;
+    text-align: center;
+    width: 100%;
+    padding: 10px;
+    font-family: PingFangSC-Regular;
+    color: #4197FC;
+    letter-spacing: 0;
+}
+
+.score_data_sty {
+    border-radius: 6px;
+    background-color: #FFFFFF;
+    width: 100%
+}
+
+.comhline_sty {
+    background-color: #F2F2F2;
+    width: 100%;
+    height: 10px
+}
+
+.comhline_sty1 {
+    background-color: #F2F2F2;
+    width: 100%;
+    height: 1px;
+}
+
+.left_sty {
+    font-size: 14px;
+    color: #666666;
+    margin: 10px;
+}
+
+.right_sty {
+    font-size: 14px;
+    color: #333333;
+    margin-left: 10px;
+}
+
+.left_sty1 {
+    display: flex;
+    flex-direction: row;
+    text-align: left;
+}
+
+.top_Time {
     text-align: center;
     height: 25px;
-    width: 100%;background-color: #F2F2F2;
+    width: 100%;
+    background-color: #F2F2F2;
 }
-.top_time_span{
-    background-color: #FFFFFF;width: 160px;border-radius: 20px;padding: 5px 20px;
+
+.top_time_span {
+    background-color: #FFFFFF;
+    width: 160px;
+    border-radius: 20px;
+    padding: 5px 20px;
 }

+ 41 - 40
frontend/wechat-web/src/modules/hiPages/scorenotification/ScoreNotification.js

@@ -3,32 +3,30 @@
  *   Desc: 成绩通知
  */
 
-import React,{Component} from 'react';
+import React, {Component} from 'react';
 import '../score-inquiry/ScoreInquiry.css';
 import ScoreData from '../score-inquiry/ScoreData';
-import {fetchPost,fetchGet,fetchGetNoSession} from '../../../utils/fetchRequest';
+import {fetchPost, fetchGet, fetchGetNoSession} from '../../../utils/fetchRequest';
 import {API} from '../../../configs/api.config';
-import {Toast,Picker} from 'antd-mobile';
+import {Toast, Picker} from 'antd-mobile';
 import {connect} from 'react-redux';
 import RefreshLayout from "../../../components/RefreshLayout";
-import {Button,Icon,Input,List,Skeleton} from 'antd';
+import {Button, Icon, Input, List, Skeleton} from 'antd';
 import {getIntValue, getStrValue, isObjEmpty} from "../../../utils/common";
 
 let pageIndex = 0
 let pageSize = 10
 
-class ScoreNotification extends Component{
-    constructor(){
+class ScoreNotification extends Component {
+    constructor() {
         super();
         this.state = {
-            stuId:'',
-            selectClass:'',
-            selectTime:'',
-            ScoreDataList:[
-
-            ],
-            scoreNames:[],
-            scoreTypes:[],
+            stuId: '',
+            selectClass: '',
+            selectTime: '',
+            ScoreDataList: [],
+            scoreNames: [],
+            scoreTypes: [],
             isRefreshing: false,
             isLoading: true,
         }
@@ -37,23 +35,25 @@ class ScoreNotification extends Component{
     componentWillMount() {
         document.title = '成绩通知'
     }
+
     componentDidMount() {
         let stuId
-        if (this.props.match.params.stuId){
+        if (this.props.match.params.stuId) {
             stuId = this.props.match.params.stuId
-        }else {
+        } else {
             stuId = this.props.userInfo.user.student.stuId
         }
         this.setState({
-            stuId:stuId
-        },function () {
+            stuId: stuId
+        }, function () {
             this.getScoreData()
-            console.log("stuId",stuId)
+            console.log("stuId", stuId)
         })
     }
-    render(){
-        return(
-            <div className="this_contaior" >
+
+    render() {
+        return (
+            <div className="this_contaior">
                 <RefreshLayout
                     refreshing={this.state.isRefreshing}
                     // ref={el => {
@@ -62,9 +62,9 @@ class ScoreNotification extends Component{
                     onRefresh={this.getScoreData}>
                     <Skeleton loading={this.state.isLoading} active paragraph={{rows: 3}}>
                         <List dataSource={this.state.ScoreDataList}
-                              renderItem={itemdata =>(
-                                  <List.Item   id="row_background"  >
-                                      <ScoreData  itemdata = {itemdata}></ScoreData>
+                              renderItem={itemdata => (
+                                  <List.Item>
+                                      <ScoreData itemdata={itemdata}></ScoreData>
                                   </List.Item>
                               )}/>
                     </Skeleton>
@@ -72,8 +72,9 @@ class ScoreNotification extends Component{
             </div>
         )
     }
-    getScoreData =()=>{
-        if(isObjEmpty(this.state.stuId)){
+
+    getScoreData = () => {
+        if (isObjEmpty(this.state.stuId)) {
             return
         }
         try {
@@ -84,34 +85,34 @@ class ScoreNotification extends Component{
         }
         pageIndex++
         let params = {
-            stuId:this.state.stuId,
+            stuId: this.state.stuId,
             pageIndex: pageIndex,
             pageSize: pageSize
         }
-        console.log('params',params)
-        fetchPost(API.getScoreByStu,params,{})
-            .then((response)=>{
-                console.log('response',response)
-                if(response.success && response.data[0].schoolAverage !=  "NaN"){
-                    if (pageIndex == 1){
+        console.log('params', params)
+        fetchPost(API.getScoreByStu, params, {})
+            .then((response) => {
+                console.log('response', response)
+                if (response.success && response.data[0].schoolAverage != "NaN") {
+                    if (pageIndex == 1) {
                         this.setState({
-                            ScoreDataList:response.data
+                            ScoreDataList: response.data
                         })
-                    }else {
+                    } else {
                         this.setState({
-                            ScoreDataList:this.state.ScoreDataList.push(response.data)
+                            ScoreDataList: this.state.ScoreDataList.push(response.data)
                         })
                     }
 
-                }else {
+                } else {
                     Toast.fail('暂无数据', 2)
                 }
                 this.setState({
                     isRefreshing: false,
                     isLoading: false
                 })
-            }).catch((error) =>{
-            console.log('error',error)
+            }).catch((error) => {
+            console.log('error', error)
             if (typeof error === 'string') {
                 Toast.fail(error, 2)
             } else {

+ 1 - 1
frontend/wechat-web/src/modules/home/HomePage.jsx

@@ -128,7 +128,7 @@ class HomePage extends Component {
         if (!isObjEmpty(albums)) {
             albums.forEach((item, index) => {
                 albumItems.push(<div className="swiper-slide"
-                                     style={{backgroundImage: 'url(' + _baseURL + item.picUrl + ')'}}>
+                                     style={{backgroundImage: 'url(' + _baseURL + item.albumUrl + ')'}}>
                     {/*<img className='home-albums-img' src={_baseURL + item.picUrl}/>*/}
                 </div>)
             })

+ 85 - 64
frontend/wechat-web/src/modules/homework/AssignmentDetailPage.js

@@ -9,12 +9,13 @@ import '../../style/css/app-gloal.css'
 import {List, Input, Button} from 'antd';
 import {fetchPost, fetchGet} from '../../utils/fetchRequest';
 import {API, _baseURL} from '../../configs/api.config';
-import {isObjEmpty} from '../../utils/common';
+import {getIntValue, getStrValue, isObjEmpty} from '../../utils/common';
 import ImagesViewer from "../../components/imagesVIewer/ImagesViewer";
 import {Toast} from 'antd-mobile'
 import {Avatar} from 'antd'
 
 import {connect} from 'react-redux'
+import {saveListState} from "../../redux/actions/listState";
 
 /**
  * 作业详情
@@ -38,38 +39,71 @@ class AssignmentDetailPage extends React.Component {
             content: "",
             messageContent: null,
             files: [],
-            data: [{
-                name: '',
-                content: ''
-            }]
+            data: []
         };
     }
 
-
     componentWillMount() {
         document.title = "作业详情";
     }
 
     componentDidMount() {
-        fetchGet(API.homeWorkDetail, {
-            notifyId: this.state.id,
-            userId: this.props.userInfo.userId
+        Toast.show('', 0)
+        this.getHomeworkDetail()
+    }
+
+    componentWillUnmount() {
+        Toast.hide()
+    }
+
+    onClickImage() {
+        this.setState({
+            previewVisible: true
+        })
+    }
+
+    getHomeworkDetail = () => {
+        fetchPost(API.HOMEWORK_DETAIL, {
+            taskId: this.state.id,
+            stuId: this.props.userInfo.user.student.stuId
         }).then((response) => {
-            let images = [];
-            let temps = response.data.enclosure;
-            for (let i = 0; i < temps.length; i++) {
-                images.push(_baseURL + temps[i]);
-            }
-            response.data.notifyDetails = response.data.notifyDetails.replace(/\r\n/g, '<br/>');
-            this.setState({
-                teachName: response.data.notifyCreatorName,
-                endTime: response.data.endDate,
-                headerUrl: "",
-                title: response.data.notifyName,
-                content: response.data.notifyDetails,
-                files: images,
-            })
+            Toast.hide()
+            if (response && response.data) {
+                let images = [];
+                if (response.data.taskFiles) {
+                    let temps = JSON.parse(response.data.taskFiles);
+                    for (let i = 0; i < temps.length; i++) {
+                        images.push(_baseURL + temps[i]);
+                    }
+                }
+                if (response.data.taskContext) {
+                    response.data.taskContext = response.data.taskContext.replace(/\r\n/g, '<br/>');
+                }
+
+                const taskReplyDOs = response.data.taskReplyDOs
+                if (this.state.data) {
+                    this.state.data.length = 0
+                }
+                if (taskReplyDOs) {
+                    for (let i = 0; i < taskReplyDOs.length; i++) {
+                        let model = {
+                            name: taskReplyDOs[i].stuName,
+                            content: taskReplyDOs[i].replyContext
+                        }
+                        this.state.data.push(model);
+                    }
+                }
 
+                this.setState({
+                    teachName: response.data.teacherName,
+                    endTime: response.data.endDate,
+                    headerUrl: response.data.teacherPhoto,
+                    title: response.data.taskTitle,
+                    content: response.data.taskContext,
+                    files: images,
+                    data: this.state.data
+                })
+            }
         }).catch((error) => {
             Toast.hide()
 
@@ -79,14 +113,23 @@ class AssignmentDetailPage extends React.Component {
                 Toast.fail('请求异常', 2)
             }
         })
-
-        this.getMessage();
     }
 
-    onClickImage() {
-        this.setState({
-            previewVisible: true
-        })
+    refreshListData = () => {
+        if (this.props.listState.itemIndex >= 0) {
+            const homeWorkCache = this.props.listState.listData[this.props.listState.itemIndex]
+            if ("teacher" == this.state.role) {
+                homeWorkCache.readStatus = ''
+                homeWorkCache.taskStatus = 2
+            } else {
+                homeWorkCache.readStatus = '已回复'
+                homeWorkCache.taskStatus = 2
+            }
+            this.props.listState.listData[this.props.listState.itemIndex] = homeWorkCache
+        }
+        saveListState({
+            listData: this.props.listState.listData,
+        })()
     }
 
     onMessageSend = () => {
@@ -94,11 +137,16 @@ class AssignmentDetailPage extends React.Component {
             Toast.info("请输入留言内容")
             return;
         }
-        fetchPost(API.messageCreate, {
-            messName: '这是留言',
-            messContent: this.state.messageContent,
-            userId: this.props.userInfo.userId,
-            notifyId: this.state.id,
+
+        const params = {
+            taskId: this.state.id,
+            replyTitle: '这是作业的回复',
+            replyContext: this.state.messageContent,
+            parentId: this.props.userInfo.user.userFunId,
+            stuId: this.props.userInfo.user.student.stuId
+        }
+        fetchPost(API.HOMEWORK_REPLY, {
+            taskRepayString: JSON.stringify(params)
         }).then((response) => {
             console.log("response:" + JSON.stringify(response));
             if (response.success) {
@@ -106,7 +154,8 @@ class AssignmentDetailPage extends React.Component {
                 this.setState({
                     messageContent: ""
                 });
-                this.getMessage();
+                this.refreshListData()
+                this.getHomeworkDetail()
             }
         }).catch((error) => {
             Toast.hide()
@@ -120,34 +169,6 @@ class AssignmentDetailPage extends React.Component {
 
     }
 
-    getMessage() {
-        fetchGet(API.messageList, {
-            notifyId: this.state.id
-        }).then((response) => {
-            this.state.data.length = 0;
-            for (let i = 0; i < response.data.length; i++) {
-                let model = {
-                    name: response.data[i].userName,
-                    content: response.data[i].messContent
-                }
-                this.state.data.push(model);
-            }
-            this.setState({
-                data: this.state.data
-            })
-
-        }).catch((error) => {
-            Toast.hide()
-
-            if (typeof error === 'string') {
-                Toast.fail(error, 2)
-            } else {
-                Toast.fail('请求异常', 2)
-            }
-        })
-    }
-
-
     onChangeMessage = (event) => {
         let msg = event.target.value;
         this.setState({
@@ -155,7 +176,6 @@ class AssignmentDetailPage extends React.Component {
         })
     }
 
-
     handleCancel = () => this.setState({previewVisible: false})
 
     render() {
@@ -224,6 +244,7 @@ class AssignmentDetailPage extends React.Component {
 
 let mapStateToProps = (state) => ({
     userInfo: {...state.redUserInfo},
+    listState: {...state.redListState}
 })
 
 let mapDispatchToProps = (dispatch) => ({})

+ 34 - 24
frontend/wechat-web/src/modules/homework/HomeWorkList.jsx

@@ -103,43 +103,53 @@ class HomeWorkList extends Component {
             workList.length = 0
         }
 
-        fetchPost(API.homeWorkList, {
-            userId: this.props.userInfo.userId,
-            pageIndex: mPageIndex,
-            pageSize: mPageSize,
-            notifyType: '3',
-        }).then((response) => {
+        let url = '', param = {}
+        if (this.role === 'teacher') {
+            url = API.HOMEWORK_LIST_TEACHER
+            param = {
+                teacherId: this.props.userInfo.user.userFunId,
+                taskStatus: 1,
+                pageIndex: mPageIndex,
+                pageSize: mPageSize,
+            }
+        } else if (this.role === 'parent') {
+            url = API.HOMEWORK_LIST_PARENT
+            param = {
+                stuId: this.props.userInfo.user.student.stuId,
+                taskStatus: 1,
+                pageIndex: mPageIndex,
+                pageSize: mPageSize,
+            }
+        }
+
+        fetchPost(url, param).then((response) => {
             Toast.hide()
 
             if (response && response.data) {
-                let listData
-                if ("teacher" == this.role) {
-                    listData = response.data.creat
-                } else {
-                    listData = response.data.notify
-                }
+                let listData = response.data
+
                 if (listData && listData.length > 0) {
                     for (let i = 0; i < listData.length; i++) {
                         let dataObject = listData[i]
                         if (dataObject) {
                             let workBean = {}
 
-                            workBean.notifyId = getIntValue(dataObject, 'notifyId')
-                            workBean.notifyName = getStrValue(dataObject, 'notifyName')
-                            workBean.notifyType = getIntValue(dataObject, 'notifyType')
-                            workBean.notifyDetails = getIntValue(dataObject, 'notifyDetails')
-                            workBean.notifyCreatorName = getStrValue(dataObject, 'notifyCreatorName')
+                            workBean.notifyId = getIntValue(dataObject, 'taskId')
+                            workBean.notifyName = getStrValue(dataObject, 'taskTitle')
+                            // workBean.notifyType = getIntValue(dataObject, 'notifyType')
+                            workBean.notifyDetails = getIntValue(dataObject, 'taskContext')
+                            workBean.notifyCreatorName = getStrValue(dataObject, 'teacherName')
+                            workBean.taskStatus = getIntValue(dataObject, 'taskStatus')
 
-                            workBean.isRead = getIntValue(dataObject, 'isRead')
                             if ("teacher" == this.role) {
                                 workBean.readStatus = ''
-                            } else if (workBean.isRead === 1) {
-                                workBean.readStatus = '未读'
+                            } else if (workBean.taskStatus === 2) {
+                                workBean.readStatus = '已回复'
                             } else {
-                                workBean.readStatus = '已读'
+                                workBean.readStatus = '未回复'
                             }
                             workBean.endDate = getStrValue(dataObject, 'endDate')
-                            workBean.creatDate = getStrValue(dataObject, 'creatDate')
+                            workBean.creatDate = getStrValue(dataObject, 'createDate')
 
                             workList.push(workBean)
                         }
@@ -179,7 +189,7 @@ class HomeWorkList extends Component {
     }
 
     onItemClick = (index, notifyId) => {
-        const {workList} = this.state
+        /*const {workList} = this.state
 
         workList[index].isRead = 2
         if ("teacher" == this.role) {
@@ -188,7 +198,7 @@ class HomeWorkList extends Component {
             workList[index].readStatus = '已读'
         }
 
-        this.setState({workList})
+        this.setState({workList})*/
 
         saveListState({
             scrollTop: ReactDOM.findDOMNode(this.container).scrollTop,

+ 52 - 101
frontend/wechat-web/src/modules/homework/ReleaseAssignmentPage.js

@@ -18,6 +18,8 @@ import {Toast, DatePicker, List} from 'antd-mobile'
 import {connect} from 'react-redux'
 
 const {TextArea} = Input;
+const nowTimeStamp = Date.now();
+const now = new Date(nowTimeStamp);
 
 /**
  * 发布作业
@@ -28,24 +30,13 @@ class ReleaseAssignmentPage extends React.Component {
         super(props);
         this.state = {
             name: 'ReleaseAssignmentPage',
+            fileList: [],
             targetList: [],
             targetCount: 0,
             targetData: [],
-            checkNodes: [],
-            startDate: null,//当前时间
-            endDate: null,//截止时间
-            data: {
-                notifyName: '',//标题
-                notifyType: '3',//作业发布
-                notifyDetails: '',//内容
-                notifyCreator: '',//创建者
-                notifyStatus: '2',//状态  2发布  1草稿
-                userIds: [],//通知
-                notifyFiles: [],
-                startDate: '',//当前时间
-                endDate: null//截止时间
-            }
-
+            endDate: '',//截止时间
+            taskTitle: '',
+            taskContent: '',
         }
     }
 
@@ -59,18 +50,14 @@ class ReleaseAssignmentPage extends React.Component {
         clearTimeout(this.backTask)
     }
 
-    handleChange = (file, fileList) => {
+    handleChange = (fileList) => {
         if (fileList) {
             fileList.forEach((value, index) => {
                 value.url = value.response ? (_baseURL + value.response.data) : value.url
                 value.picUrl = value.response ? value.response.data : value.picUrl
             })
 
-            this.setState({
-                data: {
-                    notifyFiles: fileList
-                }
-            })
+            this.setState({fileList})
         }
 
         /* this.state.data.notifyFiles.length = 0;
@@ -89,36 +76,16 @@ class ReleaseAssignmentPage extends React.Component {
     }
 
 
-    changeName = (value) => {
+    changeName = (e) => {
         this.setState({
-            data: {
-                notifyName: value.target.value,//标题
-                notifyType: '3',//作业发布
-                notifyDetails: this.state.data.notifyDetails,//内容
-                notifyCreator: '',//创建者
-                notifyStatus: '2',//状态  2发布  1草稿
-                userIds: ['10001', '10000', '10002', '10003'],//通知
-                notifyFiles: [],
-                startDate: '',//当前时间
-                endDate: this.state.data.endDate//截止时间
-            }
+            taskTitle: e.target.value
         })
 
     }
 
-    changeContent = (value) => {
+    changeContent = (e) => {
         this.setState({
-            data: {
-                notifyDetails: value.target.value,//标题
-                notifyName: this.state.data.notifyName,//标题
-                notifyType: '3',//作业发布
-                notifyCreator: '10000',//创建者
-                notifyStatus: '2',//状态  2发布  1草稿
-                userIds: ['10001', '10000', '10002', '10003'],//通知
-                notifyFiles: [],
-                startDate: '',//当前时间
-                endDate: this.state.data.endDate//截止时间
-            }
+            taskContent: e.target.value
         })
     }
     changeEndDateOk = (value) => {
@@ -129,73 +96,63 @@ class ReleaseAssignmentPage extends React.Component {
     }
 
     changeEndDate = (value, dateString) => {
-        this.setState({
-            data: {
-                notifyDetails: this.state.data.notifyDetails,//标题
-                notifyName: this.state.data.notifyName,//标题
-                notifyType: '3',//作业发布
-                notifyCreator: '10000',//创建者
-                notifyStatus: '2',//状态  2发布  1草稿
-                userIds: JSON.stringify([10001, 10000, 10002, 10003]),//通知
-                notifyFiles: [],
-                startDate: '',//当前时间
-                endDate: dateString,//标题
-            }
-        })
+        this.setState({})
     }
 
     onTargetChange = (value, label, checkNodes, count) => {
+        this.checkNodes = checkNodes
         this.setState({
             targetList: value,
             targetCount: count,
-            checkNodes: checkNodes
         });
     }
 
     commitAction = () => {
-        if (isObjEmpty(this.state.data.notifyName)) {
+        const {taskTitle, taskContent, endDate, fileList} = this.state
+
+        if (isObjEmpty(taskTitle)) {
             Toast.fail("请输入作业名称");
             return;
         }
-        if (isObjEmpty(this.state.data.notifyDetails)) {
+        if (isObjEmpty(taskContent)) {
             Toast.fail('请输入作业内容...')
             return;
         }
-        if (isObjEmpty(this.state.endDate)) {
+        if (isObjEmpty(endDate)) {
             Toast.fail("请输入截止时间");
             return;
         }
-        if (isObjEmpty(this.state.targetList)) {
+        if (isObjEmpty(this.checkNodes)) {
             Toast.fail("请选择抄送对象");
             return;
         }
         let personArrays = [];
-        if (!isObjEmpty(this.state.checkNodes)) {
-            this.state.checkNodes.forEach((node) => {
+        if (!isObjEmpty(this.checkNodes)) {
+            this.checkNodes.forEach((node) => {
                 personArrays.push(node.userId)
             })
         }
+        const fileUrls = []
+        if (fileList) {
+            fileList.forEach((value, index) => {
+                fileUrls.push(value.picUrl)
+            })
+        }
         Toast.loading('正在发布...', 0)
-        // String taskString{
-        //     "subjectId": 1,
-        //         "taskTitle": "今晚做完",
-        //         "taskContext": "第一单元第三课默写",
-        //         "taskFiles": "[]",
-        //         "taskStatus": 1,
-        //         "startDate": "2019-01-23 18:25:32",
-        //         "endDate": "2019-01-24 08:30:00",
-        //         "taskCreator": 10001,
-        //         "taskNotifier": "[10001,10002]"
-        // }
+
+        const params = {
+            subjectId: 1,
+            taskTitle: taskTitle,
+            taskContext: taskContent,
+            taskFiles: JSON.stringify(fileUrls),
+            taskStatus: 1,
+            startDate: now.format('yyyy-MM-dd hh:mm:ss'),
+            endDate: moment(endDate).format('YYYY-MM-DD HH:mm:ss'),
+            taskCreator: this.props.userInfo.user.userFunId,
+            taskNotifier: JSON.stringify(personArrays)
+        }
         fetchPost(API.homeWorkAdd, {
-            taskTitle: this.state.data.notifyName,//标题
-            notifyType: '3',//作业发布
-            taskContext: this.state.data.notifyDetails,//内容
-            notifyCreator: this.props.userInfo.userId,//创建者
-            notifyStatus: '2',//状态
-            endDate: moment(this.state.endDate).format('YYYY-MM-DD HH:mm:ss'),
-            userIds: JSON.stringify(personArrays),//通知
-            notifyFiles: JSON.stringify(this.state.data.notifyFiles)
+            taskString: JSON.stringify(params)
         }).then((response) => {
             Toast.hide();
             if (response.success) {
@@ -218,7 +175,6 @@ class ReleaseAssignmentPage extends React.Component {
     }
 
     goListAction = () => {
-        //  this.props.history.push("/assignmentList/teacher");
         this.props.history.goBack();
     }
 
@@ -230,8 +186,7 @@ class ReleaseAssignmentPage extends React.Component {
 
 
     render() {
-        const {targetCount, targetList, targetData, data} = this.state
-        console.log("render()", targetData);
+        const {targetCount, targetList, targetData, fileList} = this.state
         const targetProps = {
             placeholder: '请选择抄送对象',
             targetData: targetData,
@@ -266,19 +221,19 @@ class ReleaseAssignmentPage extends React.Component {
                 <List.Item arrow="horizontal">截止时间</List.Item>
             </DatePicker>
             <div className='gray-line'></div>
-            <input placeholder="请输入作业名称" defaultValue={this.state.data.notifyName}
+            <input placeholder="请输入作业名称" defaultValue={this.state.taskTitle}
                    onChange={this.changeName}
                    className='titleInput'/>
             <div className='gray-line' style={{height: '1px'}}></div>
             <TextArea autosize={{minRows: 6, maxRows: 12}}
-                      value={this.state.data.notifyDetails}
+                      value={this.state.taskContent}
                       onChange={this.changeContent}
                       className='contentInput'
                       placeholder="请输入作业内容"/>
             <div className='gray-line'></div>
             <UploadEnclosure
                 action={API.UPLOAD_FILE}
-                fileList={data.notifyFiles}
+                fileList={fileList}
                 count={9}
                 multiple={true}
                 beforeUpload={this.beforeUpload.bind(this)}
@@ -299,17 +254,13 @@ class ReleaseAssignmentPage extends React.Component {
 
     initPageData = () => {
         this.setState({
-            data: {
-                notifyName: '',//标题
-                notifyType: '3',//作业发布
-                notifyDetails: '',//内容
-                notifyCreator: '',//创建者
-                notifyStatus: '2',//状态  2发布  1草稿
-                userIds: [],//通知
-                notifyFiles: [],
-                startDate: '',//当前时间
-                endDate: null//截止时间
-            }
+            fileList: [],
+            targetList: [],
+            targetCount: 0,
+            targetData: [],
+            endDate: '',//截止时间
+            taskTitle: '',
+            taskContent: '',
         })
     }
 

+ 38 - 30
frontend/wechat-web/src/modules/phonesBook/PhonesSearch.jsx

@@ -10,7 +10,7 @@ import RefreshLayout from "../../components/RefreshLayout";
 import PhonesItem from "../../components/PhonesItem";
 import {Toast, SearchBar} from "antd-mobile";
 import {List, Skeleton} from 'antd'
-import {API} from "../../configs/api.config";
+import {_baseURL, API} from "../../configs/api.config";
 import {fetchGet, fetchPost} from "../../utils/fetchRequest";
 import {connect} from 'react-redux'
 
@@ -32,15 +32,18 @@ class PhonesSearch extends Component {
         }
     }
 
-    componentDidMount() {
-        this.searchInput.focus()
-
+    componentWillMount() {
         this.mType = this.props.match.params.type
         if (this.mType === 'teacher') {
             this.title = '搜索老师'
         } else if (this.mType === 'parent') {
-            this.title = '搜索家长'
+            this.title = '搜索学生'
         }
+    }
+
+    componentDidMount() {
+        this.searchInput.focus()
+
         document.title = this.title
     }
 
@@ -53,7 +56,7 @@ class PhonesSearch extends Component {
 
         return (
             <div className='phone-select-root' style={{height: '100%'}}>
-                <SearchBar placeholder="搜索家长" maxLength={20}
+                <SearchBar placeholder={this.title} maxLength={20}
                            ref={ref => this.searchInput = ref}
                            value={searchText} onSubmit={this.searchSubmit}
                            onChange={this.searchChange} onClear={this.searchClear}
@@ -139,7 +142,7 @@ class PhonesSearch extends Component {
         mPageIndex++
         console.log(mPageIndex)
 
-        const {phonesList} = this.state
+        const {phonesList, searchKey} = this.state
         if (mPageIndex === 1) {
             phonesList.length = 0
         }
@@ -147,37 +150,45 @@ class PhonesSearch extends Component {
         fetchPost(this.url, {
             pageIndex: mPageIndex,
             pageSize: mPageSize,
+            selectKey: searchKey,
             ...this.params
         }).then(response => {
             Toast.hide();
 
             if (response && response.data) {
-                if (this.mType == 'parent') {
-                    if (response.data.teachers && response.data.teachers.length > 0) {
-                        response.data.teachers.forEach((item, index) => {
-                            let phoneBean = new PhonesBean()
-
-                            phoneBean.icon = require('imgs/ic_head' + (index % 15 + 1) + '.png')
-                            phoneBean.name = getStrValue(item, 'userName')
-                            phoneBean.claName = this.title
-                            phoneBean.children = ['']
+                if (this.mType == 'teacher') {
+                    response.data.forEach((item, index) => {
+                        let phoneBean = new PhonesBean()
+
+                        phoneBean.icon = require('imgs/ic_head' + (index % 15 + 1) + '.png')
+                        phoneBean.icon = _baseURL + getStrValue(item, 'teacherPhoto')
+                        phoneBean.name = getStrValue(item, 'teacherName')
+                        phoneBean.phone = [getStrValue(item, 'userPhone')]
+                        // phoneBean.claName = getStrValue(item, 'schName')
+                        phoneBean.children = ['']
+
+                        phonesList.push(phoneBean)
+                    })
+                } else if (this.mType == 'parent') {
+                    let studentList = []
+                    response.data.forEach((item, index) => {
+                        if (item.studentDOS) {
+                            studentList = studentList.concat(item.studentDOS)
+                        }
+                    })
 
-                            phoneBean.phone = [getStrValue(item, 'UserPhone')]
-                            phonesList.push(phoneBean)
-                        })
-                    }
-                } else if (this.mType == 'teacher') {
-                    if (response.data.students && response.data.students.length > 0) {
-                        response.data.students.forEach((item, index) => {
+                    if (!isObjEmpty(studentList)) {
+                        studentList.forEach((item, index) => {
                             let phoneBean = new PhonesBean()
                             let phones = []
                             phoneBean.icon = require('imgs/ic_head' + (index % 15 + 1) + '.png')
+                            phoneBean.icon = _baseURL + getStrValue(item, 'stuPhoto')
                             phoneBean.name = getStrValue(item, 'stuName')
                             phoneBean.claName = this.title
 
-                            if (item.parents && item.parents.length > 0) {
-                                item.parents.forEach((ite, ind) => {
-                                    phoneBean.children.push(getStrValue(ite, 'userName'))
+                            if (item.parentsDOS && item.parentsDOS.length > 0) {
+                                item.parentsDOS.forEach((ite, ind) => {
+                                    phoneBean.children.push(getStrValue(ite, 'parentsName'))
                                     phones.push(getStrValue(ite, 'userPhone'))
                                 })
                             }
@@ -188,11 +199,8 @@ class PhonesSearch extends Component {
 
                             phonesList.push(phoneBean)
                         })
-                    } else {
-                        if (mPageIndex > 1) {
-                            mPageIndex--
-                        }
                     }
+
                 }
             } else {
                 if (mPageIndex > 1) {

+ 2 - 2
frontend/wechat-web/src/utils/common.js

@@ -14,12 +14,12 @@ export function isObjNull(obj) {
  */
 export function isObjEmpty() {
     let args = arguments
-    if (isObjNull(args) || args.length == 0) {
+    if (isObjNull(args) || (args.length == 0)) {
         return true
     } else {
         for (let i = 0; i < args.length; i++) {
             let arg = args[i]
-            if (isObjNull(arg) || arg.length == 0) {
+            if (isObjNull(arg) || (typeof arg === 'string' ? arg.trim().length == 0 : arg.length == 0)) {
                 return true
             }
         }