Selaa lähdekoodia

Merge branches 'dev' and 'master' of ssh://10.10.100.21/source/smartschool-platform into dev

FANGLH 7 vuotta sitten
vanhempi
commit
5ea4668d5f
16 muutettua tiedostoa jossa 126 lisäystä ja 157 poistoa
  1. 2 2
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/controller/WxClazzController.java
  2. 11 2
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/controller/WxUserController.java
  3. 1 1
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/WxClazzService.java
  4. 3 2
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxClazzServiceImpl.java
  5. 1 1
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/mapper/WxTeacherMapper.java
  6. 2 0
      applications/school/school-server/src/main/resources/mapper/WxTeacherMapper.xml
  7. 1 1
      frontend/wechat-web/src/configs/router.config.js
  8. 16 2
      frontend/wechat-web/src/modules/accountBind/BindMenu.jsx
  9. 40 37
      frontend/wechat-web/src/modules/hiPages/accessnoticedetail/AccessNoticeDetail.js
  10. 4 7
      frontend/wechat-web/src/modules/home/HomePage.jsx
  11. 0 73
      frontend/wechat-web/src/modules/homework/HomeWorkDetail.jsx
  12. 18 10
      frontend/wechat-web/src/modules/phonesBook/PhonesList.jsx
  13. 16 10
      frontend/wechat-web/src/modules/phonesBook/PhonesSearch.jsx
  14. 8 4
      frontend/wechat-web/src/modules/phonesBook/PhonesSelect.jsx
  15. 2 5
      frontend/wechat-web/src/modules/user/UserInfo.js
  16. 1 0
      frontend/wechat-web/src/redux/reducers/redUserInfo.js

+ 2 - 2
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/controller/WxClazzController.java

@@ -114,9 +114,9 @@ public class WxClazzController {
 	 * @return
 	 */
 	@PostMapping("/getAllTeacherBySchool")
-	public ResultBean getAllTeacherBySchool(@Param("teacherId") Long teacherId, @Param("selectKey") String selectKey){
+	public ResultBean getAllTeacherBySchool(@Param("teacherId") Long teacherId, @Param("selectKey") String selectKey,@Param("pageSize") Integer pageSize,@Param("pageIndex") Integer pageIndex){
 		try {
-			List<TeacherDO> teacher = clazzService.getAllTeacherBySchool(teacherId, selectKey);
+			List<TeacherDO> teacher = clazzService.getAllTeacherBySchool(teacherId, selectKey,pageSize,pageIndex);
 			return new ResultBean(teacher);
 		}catch (Exception e){
 			return new ResultBean(e);

+ 11 - 2
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/controller/WxUserController.java

@@ -20,6 +20,8 @@ import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -143,8 +145,15 @@ public class WxUserController {
 		//System.err.println("res======"+res);
 		//System.err.println("body======"+body);
 		String headimgurl = JSON.parseObject(body).getString("headimgurl");
-		System.err.println("headimgurl======"+headimgurl);
-		return  new ModelAndView("redirect:https://school-wechat.ubtob.com/bindMenu/open/"+openid+"/headimgurl/"+headimgurl);
+		String encode =null;
+		try {
+			encode = URLEncoder.encode(headimgurl.toString(), "ISO-8859-1");
+			System.err.println("headimgurl======"+headimgurl);
+			System.err.println("encode======"+encode);
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		}
+		return  new ModelAndView("redirect:https://school-wechat.ubtob.com/bindMenu/open/"+openid+"/"+encode);
 	}
 
 	/**

+ 1 - 1
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/WxClazzService.java

@@ -60,5 +60,5 @@ public interface WxClazzService {
 	 * @param selectKey
 	 * @return
 	 */
-	public List<TeacherDO> getAllTeacherBySchool(@Param("teacherId") Long teacherId, @Param("selectKey") String selectKey);
+	public List<TeacherDO> getAllTeacherBySchool(@Param("teacherId") Long teacherId, @Param("selectKey") String selectKey,@Param("pageSize") Integer pageSize,@Param("pageIndex") Integer pageIndex);
 }

+ 3 - 2
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxClazzServiceImpl.java

@@ -169,9 +169,10 @@ public class WxClazzServiceImpl implements WxClazzService {
 	 * @param selectKey
 	 * @return
 	 */
-	public List<TeacherDO> getAllTeacherBySchool(Long teacherId, String selectKey){
+	public List<TeacherDO> getAllTeacherBySchool(Long teacherId, String selectKey,Integer pageSize,Integer pageIndex){
 		TeacherDO teacherDO = teacherMapper.get(teacherId);
-		List<TeacherDO> teacherDOS = teacherMapper.getAll(teacherDO.getSchoolId(),"%"+selectKey+"%");
+		Integer pageStart = (pageIndex - 1) * pageSize;
+		List<TeacherDO> teacherDOS = teacherMapper.getAll(teacherDO.getSchoolId(),"%"+selectKey+"%",pageStart,pageSize);
 		for (TeacherDO tc:teacherDOS) {
 			tc.setUserPhone(userMapper.get(tc.getUserId()).getUserPhone());
 		}

+ 1 - 1
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/mapper/WxTeacherMapper.java

@@ -37,5 +37,5 @@ public interface WxTeacherMapper {
 	List<TeacherDO> getByClazzId(@Param("clazzId") Long clazzId, @Param("teacherName") String teacherName);
 
 
-	List<TeacherDO> getAll(@Param("schoolId") Long schoolId, @Param("teacherName") String teacherName);
+	List<TeacherDO> getAll(@Param("schoolId") Long schoolId, @Param("teacherName") String teacherName,@Param("pageStart")Integer pageStart,@Param("pageSize")Integer pageSize);
 }

+ 2 - 0
applications/school/school-server/src/main/resources/mapper/WxTeacherMapper.xml

@@ -156,6 +156,8 @@
 			school_id = #{schoolId}
 			<if test="teacherName != null and teacherName != ''"> and teacher_name like #{teacherName} </if>
 		</where>
+		order by teacher_id desc
+		limit #{pageStart}, #{pageSize}
 	</select>
 
 

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

@@ -78,7 +78,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='/bindMenu/:type/:openid?/:wxAvatar?' component={BindMenu}/>{/*绑定菜单页面*/}
                     <Route path='/accountBind/:type?' component={AccountBind}/>{/*绑定页面*/}
 
                     <Route path='/newAlbum/:classId/:name?' component={NewAlbum}/>{/*新建相册*/}

+ 16 - 2
frontend/wechat-web/src/modules/accountBind/BindMenu.jsx

@@ -13,8 +13,9 @@ import {API} from "../../configs/api.config";
 import {switchUser} from 'action/userInfo'
 import {getIntValue, getStrValue, isObjEmpty} from "../../utils/common";
 import {clearUserInfo} from "../../redux/actions/userInfo";
+import {connect} from "react-redux";
 
-export default class BindMenu extends Component {
+class BindMenu extends Component {
 
     constructor() {
         super()
@@ -54,9 +55,14 @@ export default class BindMenu extends Component {
                 errorMsg: '获取绑定信息中...'
             })
             this.openid = this.paramId
+            this.wxAvatar = this.props.match.params.wxAvatar
 
             //清除用户信息
             clearUserInfo()()
+
+            switchUser({
+                userAvatar: decodeURIComponent(this.wxAvatar),
+            })()
             this.obtainBindStatus()
         }
     }
@@ -201,4 +207,12 @@ export default class BindMenu extends Component {
     teacherBind = () => {
         this.props.history.push('/accountBind/teacher')
     }
-}
+}
+
+let mapStateToProps = (state) => ({
+    userInfo: {...state.redUserInfo}
+})
+
+let mapDispatchToProps = (dispatch) => ({})
+
+export default connect(mapStateToProps, mapDispatchToProps)(BindMenu)

+ 40 - 37
frontend/wechat-web/src/modules/hiPages/accessnoticedetail/AccessNoticeDetail.js

@@ -1,54 +1,55 @@
 /**
-*   Created by FANGlh on 2019/1/17 8:57.
-*   Desc: 进出校通知详情
-*/
+ *   Created by FANGlh on 2019/1/17 8:57.
+ *   Desc: 进出校通知详情
+ */
 
-import React,{Component} from 'react';
+import React, {Component} from 'react';
 import {connect} from 'react-redux';
 import './AccessNoticeDetail.css';
-import {isObjEmpty,getIntValue, getStrValue} from  '../../../utils/common';
-import {getWeixinInfo} from '../../../utils/api.request'
-import {fetchPost, fetchGet, fetchGetNoSession} from '../../../utils/fetchRequest';
+import {isObjEmpty, getIntValue, getStrValue} from '../../../utils/common';
+import {fetchGet, fetchGetNoSession} from '../../../utils/fetchRequest';
 import {API, _baseURL} from '../../../configs/api.config';
 
 
-class AccessNoticeDetail extends Component{
-   constructor(props){
+class AccessNoticeDetail extends Component {
+    constructor(props) {
         super(props);
         this.state = {
-            studentName:'',
-            studentType:'出校时间',
-            studentPhoto:'http://pic.vjshi.com/2018-08-28/8b163ad1a98e567f26cea40f34d56a27/00001.jpg?x-oss-process=style/watermark',
-            studentHourMinues:'',
+            studentName: '',
+            studentType: '出校时间',
+            studentPhoto: 'http://pic.vjshi.com/2018-08-28/8b163ad1a98e567f26cea40f34d56a27/00001.jpg?x-oss-process=style/watermark',
+            studentHourMinues: '',
 
         }
     }
+
     componentWillMount() {
     }
+
     componentDidMount() {
         let stuId = this.props.match.params.stuId
         let role = this.props.match.params.role
         let anId = this.props.match.params.anId
-        console.log("stuId",stuId)
-        if (!isObjEmpty(stuId)){
-            this.getANDetail(stuId,anId)
+        console.log("stuId", stuId)
+        if (!isObjEmpty(stuId)) {
+            this.getANDetail(stuId, anId)
         }
 
 
         let curDay = new Date().getDay()
-        if(curDay == 1){
+        if (curDay == 1) {
             curDay = '星期一'
-        }else if(curDay == 2){
+        } else if (curDay == 2) {
             curDay = '星期二'
-        }else if(curDay == 3){
+        } else if (curDay == 3) {
             curDay = '星期三'
-        }else if(curDay == 4){
+        } else if (curDay == 4) {
             curDay = '星期四'
-        }else if(curDay ==  5){
+        } else if (curDay == 5) {
             curDay = '星期五'
-        }else if(curDay == 6){
+        } else if (curDay == 6) {
             curDay = '星期六'
-        }else if(curDay ==  7){
+        } else if (curDay == 7) {
             curDay = '星期日'
         }
 
@@ -56,31 +57,33 @@ class AccessNoticeDetail extends Component{
         let hout_min = new Date().getHours() + ':' + new Date().getMinutes()
 
         this.setState({
-            studentName:this.props.userInfo.user.student.stuName,
-            studentType:'出校时间',
-            studentPhoto:'http://pic.vjshi.com/2018-08-28/8b163ad1a98e567f26cea40f34d56a27/00001.jpg?x-oss-process=style/watermark',
-            studentTime:hout_min,
-            studentDate:date,
+            studentName: this.props.userInfo.user.student.stuName,
+            studentType: '出校时间',
+            studentPhoto: 'http://pic.vjshi.com/2018-08-28/8b163ad1a98e567f26cea40f34d56a27/00001.jpg?x-oss-process=style/watermark',
+            studentTime: hout_min,
+            studentDate: date,
         })
     }
-     render(){
-       const  { studentName,studentType,studentPhoto,studentTime,studentDate} = this.state
-        return(
-            <div style={{textAlign:'center',}}>
+
+    render() {
+        const {studentName, studentType, studentPhoto, studentTime, studentDate} = this.state
+        return (
+            <div style={{textAlign: 'center',}}>
                 <div className="an_student_name">{studentName}</div>
-                <img className="an_student_photo"  src = {studentPhoto} alt = ""/>
+                <img className="an_student_photo" src={studentPhoto} alt=""/>
                 <div className="an_student_type">{studentType}</div>
                 <div className='an_student_foot_time'>
-                    <span style={{color:'#222222',fontSize:24,paddingRight:10,}}>{studentTime}</span>
-                    <span style={{color:'#666666',fontsize:12,}}>{studentDate}</span>
+                    <span style={{color: '#222222', fontSize: 24, paddingRight: 10,}}>{studentTime}</span>
+                    <span style={{color: '#666666', fontsize: 12,}}>{studentDate}</span>
                 </div>
             </div>
         )
     }
-    getANDetail =(stuId,anId)=>{
+
+    getANDetail = (stuId, anId) => {
         fetchGet(API.leaveDetail, {
             stuId: stuId,
-            anId:anId
+            anId: anId
         }).then((response) => {
             if (response.success && !isObjEmpty(response.data)) {
 

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

@@ -20,7 +20,6 @@ import 'css/home-page.css'
 import {fetchGet, fetchPost} from "../../utils/fetchRequest";
 import {_baseURL, API} from "../../configs/api.config";
 import icon_home_change from "../../style/imgs/icon_home_change.png";
-import {getWeixinInfo} from '../../utils/api.request'
 
 const operation = Modal.operation;
 
@@ -35,7 +34,7 @@ class HomePage extends Component {
     }
 
     componentWillMount() {
-        // getWeixinInfo()
+
     }
 
     componentDidMount() {
@@ -290,17 +289,15 @@ class HomePage extends Component {
 
     userInfoLayout = () => {
         const {userInfo} = this.props
-        let schoolName = '', userAvatar = '', userName = '', albums = ''
+        let schoolName = '', userName = '', albums = ''
         if (userInfo.userRole === 1) {
             if (userInfo.parent) {
                 schoolName = userInfo.parent.schoolName
-                userAvatar = userInfo.parent.parentsPhoto
                 userName = userInfo.parent.parentsName
             }
         } else if (userInfo.userRole === 2) {
             if (userInfo.teacher) {
                 schoolName = userInfo.teacher.schoolName
-                userAvatar = userInfo.teacher.teacherPhoto
                 userName = userInfo.teacher.teacherName
             }
         }
@@ -308,10 +305,10 @@ class HomePage extends Component {
             <div>
                 <div className='home-top-school-text'>{schoolName}</div>
                 <div className='home-top-msg-root'>
-                    {isObjEmpty(userAvatar) ?
+                    {isObjEmpty(userInfo.userAvatar) ?
                         <Avatar size={50} icon='user'/> :
                         <img
-                            src={userAvatar}
+                            src={userInfo.userAvatar}
                             width={50} height={50} className="img-circle"
                             style={{border: '3px solid #ffffff'}}/>
                     }

+ 0 - 73
frontend/wechat-web/src/modules/homework/HomeWorkDetail.jsx

@@ -1,73 +0,0 @@
-/**
- * Created by RaoMeng on 2019/1/14
- * Desc: 作业详情
- */
-
-import React, {Component} from 'react'
-import {Toast} from 'antd-mobile'
-import {isObjEmpty} from "../../utils/common";
-import {fetchGet} from "../../utils/fetchRequest";
-import {API} from "../../configs/api.config";
-
-class HomeWorkDetail extends Component {
-
-    constructor() {
-        super()
-
-        this.state = {}
-    }
-
-    componentDidMount() {
-        document.title = '作业详情'
-
-        if (this.props.match.params) {
-            this.workId = this.props.match.params.id
-            this.role = this.props.match.params.role
-        }
-
-        this.obtainDetail()
-    }
-
-    componentWillUnmount() {
-        Toast.hide()
-    }
-
-    render() {
-        return (
-            <div className='common-flex-column'>
-                <div className='common-flex-row-12'>
-                    {isObjEmpty(userInfo.userAvatar) ?
-                        <Avatar size={60} icon='user'/> :
-                        <img
-                            src={this.props.userInfo.userAvatar}
-                            width={60} height={60} className="img-circle"
-                            style={{border: '3px solid #ffffff'}}/>
-                    }
-                    <div className='common-flex-column-y-center'>
-                        <span></span>
-                        <span></span>
-                    </div>
-                </div>
-            </div>
-        )
-    }
-
-    obtainDetail = () => {
-        fetchGet(API.homeWorkDetail, {
-            notifyId: this.workId,
-            userId: this.props.userInfo.userId
-        }).then(response => {
-
-        }).catch(error => {
-
-        })
-    }
-}
-
-let mapStateToProps = (state) => ({
-    userInfo: {...state.redUserInfo},
-})
-
-let mapDispatchToProps = (dispatch) => ({})
-
-export default connect(mapStateToProps, mapDispatchToProps)(HomeWorkDetail)

+ 18 - 10
frontend/wechat-web/src/modules/phonesBook/PhonesList.jsx

@@ -76,7 +76,8 @@ class PhonesList extends Component {
                 <div className='common-fixed-top'>
                     <SearchBar placeholder={searchHint} maxLength={20}
                                value={searchText} onSubmit={this.searchSubmit}
-                               onChange={this.searchChange} onClear={this.searchClear}/>
+                               onChange={this.searchChange} onClear={this.searchClear}
+                               onCancel={this.searchCancel}/>
                     <div className={isObjEmpty(classTitle) ? 'displayNone' : 'phones-list-header'}>{classTitle}</div>
                     <div className={isObjEmpty(classTitle) ? 'displayNone' : 'gray-line'} style={{height: '1px'}}></div>
                 </div>
@@ -106,15 +107,22 @@ class PhonesList extends Component {
     }
 
     searchClear = (e) => {
-        mPageIndex = 0
-        this.setState({
-            isLoading: true,
-            isRefreshing: false,
-            searchText: '',
-            searchKey: ''
-        }, () => {
-            this.loadPhones()
-        })
+        if (!isObjEmpty(this.state.searchKey)) {
+            mPageIndex = 0
+            this.setState({
+                isLoading: true,
+                isRefreshing: false,
+                searchText: '',
+                searchKey: ''
+            }, () => {
+                this.loadPhones()
+            })
+        }
+
+    }
+
+    searchCancel = (e) => {
+        console.log(e)
     }
 
     searchSubmit = (value) => {

+ 16 - 10
frontend/wechat-web/src/modules/phonesBook/PhonesSearch.jsx

@@ -60,7 +60,7 @@ class PhonesSearch extends Component {
                            ref={ref => this.searchInput = ref}
                            value={searchText} onSubmit={this.searchSubmit}
                            onChange={this.searchChange} onClear={this.searchClear}
-                           onCancel={this.searchClear}/>
+                           onCancel={this.searchCancel}/>
 
                 <RefreshLayout
                     refreshing={isRefreshing}
@@ -88,15 +88,21 @@ class PhonesSearch extends Component {
 
 
     searchClear = (e) => {
-        mPageIndex = 0
-        this.setState({
-            isLoading: true,
-            isRefreshing: false,
-            searchText: '',
-            searchKey: ''
-        }, () => {
-            this.loadPhones()
-        })
+        if (!isObjEmpty(this.state.searchKey)) {
+            mPageIndex = 0
+            this.setState({
+                isLoading: true,
+                isRefreshing: false,
+                searchText: '',
+                searchKey: ''
+            }, () => {
+                this.loadPhones()
+            })
+        }
+    }
+
+    searchCancel = (e) => {
+        console.log(e)
     }
 
     searchSubmit = (value) => {

+ 8 - 4
frontend/wechat-web/src/modules/phonesBook/PhonesSelect.jsx

@@ -41,7 +41,8 @@ class PhonesSelect extends Component {
 
     componentDidMount() {
         document.title = '通讯录'
-        const hei = this.state.height - ReactDOM.findDOMNode(this.contain).offsetTop;
+        const hei = this.state.height - ReactDOM.findDOMNode(this.contain1).offsetTop
+            - ReactDOM.findDOMNode(this.contain2).offsetTop;
         this.setState({
             height: hei
         })
@@ -115,7 +116,7 @@ class PhonesSelect extends Component {
                 </div>
                 <div className="swiper-container"
                      ref={el => {
-                         this.contain = el
+                         this.contain1 = el
                      }}>
                     <div className="swiper-wrapper">
                         <div className="swiper-slide">
@@ -125,7 +126,10 @@ class PhonesSelect extends Component {
                                     <span style={{paddingLeft: '10px'}}>搜索联系人</span>
                                 </div>
                             </div>
-                            <div className='swiper-content'>
+                            <div className='swiper-content'
+                                 ref={el => {
+                                     this.contain2 = el
+                                 }}>
                                 {teacherItems}
                             </div>
                         </div>
@@ -225,7 +229,7 @@ class PhonesSelect extends Component {
                 response.data.map((item, index) => {
                     let phoneBean = new PhonesBean()
                     phoneBean.icon = require('imgs/ic_head' + (index % 15 + 1) + '.png')
-                    phoneBean.icon = _baseURL + getStrValue(item,'teacherPhoto')
+                    phoneBean.icon = _baseURL + getStrValue(item, 'teacherPhoto')
                     phoneBean.name = getStrValue(item, 'teacherName')
                     phoneBean.phone = [getStrValue(item, 'userPhone')]
                     // phoneBean.claName = getStrValue(item, 'schName')

+ 2 - 5
frontend/wechat-web/src/modules/user/UserInfo.js

@@ -60,21 +60,18 @@ class UserInfo extends Component {
     //显示顶部个人信息
     showUserInfo() {
         const {userInfo} = this.props
-        let userAvatar = ''
         let userName = ''
 
         if (this.type == 1) {
-            userAvatar = userInfo.teacher.teacherPhoto
             userName = userInfo.teacher.teacherName
         } else if (this.type == 2) {
-            userAvatar = userInfo.parent.parentsPhoto
             userName = userInfo.parent.parentsName
         }
         return <div className='user-row'>
-            {isObjEmpty(userAvatar) ?
+            {isObjEmpty(userInfo.userAvatar) ?
                 <Avatar size={50} icon='user'/> :
                 <img className='user-info-avatar' onClick={this.onAvatarClick}
-                     src={userAvatar}/>}
+                     src={userInfo.userAvatar}/>}
             <div className="flex_row_center user-info-msg">
                 <span>{userName}</span>
             </div>

+ 1 - 0
frontend/wechat-web/src/redux/reducers/redUserInfo.js

@@ -56,6 +56,7 @@ const initListState = {
 
     userOpenid: '',
     userRole: 0,
+    userAvatar: '',
     teacher: '',
     parent: '',
     user: {