Explorar el Código

Merge branch 'dev' of ssh://10.10.100.21/source/smartschool-platform into dev

guq hace 7 años
padre
commit
cfb4dc6267

+ 4 - 0
frontend/pc-web/app/view/basic/class/ClassInfo.js

@@ -5,6 +5,10 @@ Ext.define('school.view.basic.class.ClassInfo', {
     extend: 'Ext.panel.Panel',
     xtype: 'basic-class-classinfo',
 
+    requires: [
+        'Ext.tree.Panel'
+    ],
+
     controller: 'basic-class-classinfo',
     viewModel: 'basic-class-classinfo',
 

+ 98 - 0
frontend/pc-web/app/view/interact/timetable/Detail.js

@@ -0,0 +1,98 @@
+Ext.define('school.view.interact.timetable.Detail', {
+    extend: 'school.view.core.form.FormPanel',
+    xtype: 'interact-timetable-detail',
+
+    _title: '学生信息',
+    _idField: 'student_id',
+    _codeField: 'student_number',
+    _statusField: null,
+    _statusCodeField: null,
+    _auditmanField: null,
+    _auditdateField: null,
+    // _readUrl: 'http://10.1.80.35:8560/api/sale/saledown/read',
+    _readUrl: '/api/sale/xxxx/read',
+    // _saveUrl: 'http://10.1.80.35:8560/api/sale/saledown/update',
+    _saveUrl: '/api/sale/sss/update',
+    // _toSaleUrl: 'http://10.1.80.35:8560/api/sale/saledown/toSale',
+    _toSaleUrl: '/api/sale/sss/toSale',
+    initId: 0,
+
+    codeInHeader: true,
+
+    initComponent: function () {
+        Ext.apply(this, {
+            defaultItems: [{
+                xtype: 'textfield',
+                name: 'number',
+                fieldLabel: '录入人'
+            }, {
+                xtype: 'textfield',
+                name: 'name',
+                fieldLabel: '录入时间'
+            }, {
+                xtype: 'textfield',
+                name: 'grade',
+                fieldLabel: '状态'
+            }, {
+                xtype: 'textfield',
+                name: 'class',
+                fieldLabel: '课表编号'
+            }, {
+                xtype: "textfield",
+                name: "jg",
+                fieldLabel: "学期名称"
+            }, {
+                xtype: 'textfield',
+                name: 'mz',
+                fieldLabel: '课表名称'
+            }, {
+                xtype: 'textfield',
+                name: 'birth',
+                fieldLabel: '课表班级'
+            }, {
+                xtype: "textfield",
+                name: "address",
+                fieldLabel: "学期开始时间"
+            }, {
+                xtype: 'textfield',
+                name: 'teacher_zz',
+                fieldLabel: '学期结束时间'
+            }, {
+                xtype: 'textfield',
+                name: 'zs',
+                fieldLabel: '周数'
+            }, {
+                name: "timetable",
+                xtype: "detailGridField",
+                detnoColumn: 'no',
+                storeModel: 'school.model.basic.Student',
+                deleteDetailUrl: '/api/sale/sale/deleteDetail',
+                allowEmpty: true,
+                showCount: false,
+                columns: [{
+                    text: '星期一',
+                    dataIndex: 'monday'
+                }, {
+                    text: '星期二',
+                    dataIndex: 'tuesday'
+                }, {
+                    text: '星期三',
+                    dataIndex: 'wednesday',
+                }, {
+                    text: '星期四',
+                    dataIndex: 'thursday'
+                }, {
+                    text: '星期五',
+                    dataIndex: 'friday'
+                }, {
+                    text: '星期六',
+                    dataIndex: 'saturday'
+                }, {
+                    text: '星期日',
+                    dataIndex: 'sunday'
+                }]
+            }],
+        });
+        this.callParent();
+    },
+});

+ 167 - 0
frontend/pc-web/app/view/interact/timetable/List.js

@@ -0,0 +1,167 @@
+/**
+ * 课程表
+ */
+Ext.define('school.view.interact.timetable.List', {
+    extend: 'school.view.core.base.BasePanel',
+    xtype: 'interact-timetable-list',
+
+    dataUrl: '/api/interact/timetable/list',
+    initComponent: function() {
+        var me = this;
+        Ext.apply(this, {
+            searchField: [{
+                xtype: 'textfield',
+                name: 'term',
+                fieldLabel: '学期'
+            }, {
+                xtype: 'textfield',
+                name: 'grade',
+                fieldLabel: '年级'
+            }, {
+                xtype: 'textfield',
+                name: 'class',
+                fieldLabel: '班级'
+            }],
+        
+            caller: null,
+            _formXtype: null,
+            _title: null,
+            _deleteUrl: null,
+            _batchOpenUrl: null,
+            _batchCloseUrl: null,
+            _batchDeleteUrl: null,
+        
+            gridConfig: {
+                idField: null,
+                codeField: null,
+                statusCodeField: null,
+                dataUrl: me.dataUrl,
+                caller: null,
+                rootProperty: 'data.list',
+                totalProperty: 'data.total',
+                actionColumn: [],
+                selModel: {
+                    checkOnly:true,
+                    type:'checkboxmodel',
+                    mode : "MULTI" ,
+                    ignoreRightMouseSelection : false
+                },
+                hiddenTools: false,
+                toolBtns: [{
+                    xtype: 'button',
+                    text: '下载模板'
+                }, {
+                    xtype: 'button',
+                    text: '上传课表'
+                }, {
+                    xtype: 'button',
+                    text: '添加'
+                }, {
+                    xtype: 'button',
+                    text: '删除'
+                }],
+                columns : [{
+                    text: '编号',
+                    dataIndex: 'code',
+                    width: 150
+                }, {
+                    text: '学期',
+                    dataIndex: 'name',
+                    width: 120
+                }, {
+                    text: '性别',
+                    dataIndex: 'gender',
+                    width: 120
+                }, {
+                    text: '年级',
+                    dataIndex: 'grade'
+                }, {
+                    text: '班级',
+                    dataIndex: 'class'
+                }, {
+                    text: '出生日期',
+                    dataIndex: 'birth',
+                    width: 120
+                }, {
+                    text: '年龄',
+                    dataIndex: 'open'
+                }, {
+                    text: '状态',
+                    dataIndex: 'status'
+                }],
+                listeners: {
+                    itemclick: function(view, record, item, index, e, eOpts) {
+                        school.util.BaseUtil.openTab('interact-timetable-detail', '课程表', 'interact-timetable-detail'+record.get('id'), {
+                            initId: record.get('id')
+                        }); 
+                    }
+                }
+            },
+        });
+        this.callParent(arguments);
+    },
+
+    /**
+     * 处理部分字段值
+     */
+    getConditionValue: function (field, value) {
+        var me = this,
+            xtypes = field.getXTypes().split('/'),
+            conditionValue;
+        if (me.isContainsAny(xtypes, ['datefield'])) {
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
+        } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
+            var from = value.from,
+                to = value.to;
+
+            conditionValue = from + ',' + to;
+        } else if (me.isContainsAny(xtypes, ['condatefield'])) {
+            var from = value.from,
+                to = value.to;
+
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
+        } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
+            conditionValue = value;
+        } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
+            conditionValue = value;
+        } else if (me.isContainsAny(xtypes, ['multicombo'])) {
+            conditionValue = value.map ? value.map(function (v) {
+                return v.value;
+            }).join(',') : '';
+        } else {
+            conditionValue = value;
+        }
+
+        return conditionValue;
+    },
+
+    getExtraParams: function(store, op, condition) {
+        var temp = {};
+
+        for(let x = 0; x < condition.length; x++) {
+            let c = condition[x];
+            if(c.field == 'keyword') {
+                temp.keyword = c.value;
+            }else if(c.field == 'date') {
+                temp.fromDate = new Date(c.value.split(',')[0]).getTime();
+                temp.endDate = new Date(c.value.split(',')[1]).getTime();
+            }else if(c.field == 'quoted') {
+                temp.quoted = c.value == 'all' ? null : c.value;
+            }else if(c.field == 'closed') {
+                // temp.endDate = c.value == 'all' ? null : (
+                //     c.value == '0' ? 
+                // );
+            }
+        }
+        let obj = {
+            pageNumber: store.exportNumber?store.exportNumber:op._page,
+            pageSize: store.exportPageSize?store.exportPageSize:store.pageSize
+        };
+        for(let k in temp) {
+            if(!!temp[k]) {
+                obj[k] = temp[k];
+            }
+        }
+        return obj;
+     },
+});

+ 2 - 2
frontend/pc-web/resources/json/navigation.json

@@ -46,9 +46,9 @@
         "text": "作业发布",
         "view": "homework"
     }, {
-        "id": "timetable",
+        "id": "interact-timetable-list",
         "text": "课程表",
-        "view": "timetable"
+        "view": "interact-timetable-list"
     }, {
         "id": "grade",
         "text": "成绩发布",

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

@@ -122,7 +122,8 @@ export const API = {
     getClazzByTeacherId:_baseURL + '/wxSchool/user/getClazzByTeacherId',
     //学生端  学生所在班级的课表  按星期的每天分map
     curriculumListByTeacherId:_baseURL + '/wxSchool/clazzCurriculum/curriculumListByTeacherId',
-
+    //创建校长信箱
+    PRINCIPAL_MAILBOX:_baseURL + '/wxSchool/principalMailbox/mailboxString',
 
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //获取用户是否绑定

+ 32 - 3
frontend/wechat-web/src/modules/hiPages/approvel/Approvel.js

@@ -63,8 +63,34 @@ class Approvel extends Component {
                 }
             }
         })
-        this.getMyApplyData();
-        this.getMyApproveData();
+        if (this.props.listState && !isObjEmpty(this.props.listState.listData)) {
+            this.setState({
+                applyList: this.props.listState.listData,
+                isMyapplydload: false,
+            }, () => {
+                ReactDOM.findDOMNode(this.container).scrollTop = this.props.listState.scrollTop
+            })
+            myApplypageIndex = this.props.listState.pageIndex
+        } else {
+            myApplypageIndex = 0;
+            this.getMyApplyData();
+            Toast.hide();
+        }
+
+        if (this.props.listState && !isObjEmpty(this.props.listState.listData2)) {
+            this.setState({
+                approvelList: this.props.listState.listData2,
+                isMyapprovedload: false,
+            }, () => {
+                ReactDOM.findDOMNode(this.container).scrollTop = this.props.listState.scrollTop2
+            })
+            myApprovepageIndex = this.props.listState.pageIndex2
+        } else {
+            myApprovepageIndex = 0;
+            this.getMyApproveData();
+            Toast.hide();
+        }
+
     }
 
 
@@ -149,12 +175,14 @@ class Approvel extends Component {
                     this.setState({
                         applyList: response.data.proposes,
                     })
-                } else if(response.data.proposes.length > 0){
+                } else if(response.data.proposes.length > 0 && response.data.proposes != []){
                     this.setState({
                         applyList: this.state.applyList.push(response.data.proposes),
                     })
+                    console.log("proposes.length",response.data.proposes.length)
                 }
                 console.log("applyList",this.state.applyList)
+                console.log("myApplypageIndex",myApplypageIndex)
             }
             this.setState({
                 isMyApplyRefreshing: false,
@@ -258,6 +286,7 @@ class Approvel extends Component {
 }
 
 let mapStateToProps = (state) => ({
+    listState: {...state.redListState},
     userInfo: {...state.redUserInfo}
 })
 

+ 1 - 1
frontend/wechat-web/src/modules/hiPages/approvel/ApprovelItem.js

@@ -28,7 +28,7 @@ export default class ApprovelItem extends Component{
             isMyApply:this.props.isMyApply,
             approveId:this.props.itemdata.approveId
         },function () {
-            console.log('itemdata',this.state.itemdata)
+            // console.log('itemdata',this.state.itemdata)
         })
 
     }

+ 11 - 3
frontend/wechat-web/src/modules/hiPages/res_apply/ResApply.js

@@ -223,10 +223,18 @@ class ResApply extends Component{
             Toast.show('请输入物品用途',1)
             return
         }
-        if(isObjEmpty(this.state.selectContentArray)){
-            Toast.show('物品明细存在未输入项')
-            return
+
+        for(let i=0;i<this.state.selectContentArray.length;i++){
+            if (this.state.selectContentArray[i].artName == null || this.state.selectContentArray[i].artName.trim().length == 0
+                || this.state.selectContentArray[i].artCount ==null || this.state.selectContentArray[i].artCount.trim().length == 0){
+                Toast.show('物品明细存在未输入项')
+                return
+            }
         }
+        // if(isObjEmpty(this.state.selectContentArray)){
+        //     Toast.show('物品明细存在未输入项')
+        //     return
+        // }
         if(this.state.receivingSays == null || this.state.receivingSays.trim().length == 0){
             Toast.show('请输入领取说明',1)
             return

+ 286 - 195
frontend/wechat-web/src/modules/hiPages/send-vote/SendVote.js

@@ -1,82 +1,100 @@
 /**
- *   Created by FANGlh on 2018/11/6 15:47.
+ *   Created by FANGlh on 2018/11/8 14:57.
+ *   *   创建投票
  */
 
 import React, {Component} from 'react';
-import nextArrowimg from '../../../style/imgs/next_arrow.png';
 import './SendVote.css';
+import {Select, Switch, Upload, Icon, Modal, TreeSelect, Button, Input} from 'antd';
+import nextArrowimg from '../../../style/imgs/next_arrow.png';
+import moment from 'moment'
 import 'antd/dist/antd.css';
-import {Select, TreeSelect, Icon, Button} from 'antd';
-import moment from 'moment';
-import add_newimg from '../../../style/imgs/add_new.png';
-import {fetchPost, fetchGet, fetchGetNoSession} from '../../../utils/fetchRequest';
-import {API} from '../../../configs/api.config';
+import SelectItem from './SelectItem';
 import {Toast, Picker, List, DatePicker} from 'antd-mobile';
-import {getIntValue, getStrValue, isObjEmpty} from "../../../utils/common";
 import TargetSelect from '../../../components/TargetSelect';
+import {fetchPost, fetchGet, fetchGetNoSession} from '../../../utils/fetchRequest';
+import {_baseURL, API} from '../../../configs/api.config';
+import {getIntValue, getStrValue, isObjEmpty} from "../../../utils/common";
+import UploadEnclosure from '../../../components/UploadEnclosure';
 import {connect} from 'react-redux';
 import {clearListState} from "../../../redux/actions/listState";
 
 const Option = Select.Option;
+const {TextArea} = Input;
 
-class SendMeet extends Component {
+class SendVote extends Component {
     componentWillMount() {
-        document.title = '发起会议'
+        document.title = '发起投票'
     }
 
     componentDidMount() {
         this.getOrganization()
     }
 
-    componentWillUnmount() {
-        Toast.hide()
-        clearTimeout(this.backTask)
-    }
-
     getOrganization = () => {
         Toast.loading('', 0)
 
-        fetchGet(API.getAllTeacher, {
-            // schoolId: this.props.userInfo.schoolId,
-            schoolId:1
+        fetchGet(API.getClazzByTeacherId, {
+            teacherId: this.props.userInfo.userId,
         }).then(response => {
             Toast.hide()
             const {targetData} = this.state
             targetData.length = 0
             if (response && response.data) {
-                // const schoolArray = response.data.schools
-                const teacherArray = response.data
-
-                if (!isObjEmpty(teacherArray)) {
-                    const teacherData = []
-                    teacherArray.forEach((teacherObj, index) => {
-                        if (teacherObj) {
-                            teacherData.push({
-                                title: getStrValue(teacherObj, 'teacherName'),
-                                userId: getIntValue(teacherObj, 'teacherId'),
-                                userPhone: getStrValue(teacherObj, 'userPhone'),
-                                value: getStrValue(teacherObj, 'teacherName') + `-1-${index}`,
-                                key: `1-${index}`,
-                            })
-                        }
-                    })
-
-                    targetData.push({
-                        title: `全体老师`,
-                        value: `1`,
-                        key: `1`,
-                        children: teacherData,
-                    })
-                }
-            }
+                response.data.forEach((dataObj,data_index) =>{
+                    const parentsDOSArray = dataObj.parentsDOS
+                    const teacherDOSArray = dataObj.teacherDOS
+                    if (!isObjEmpty(parentsDOSArray)) {
+                        const classData = []
+                        parentsDOSArray.forEach((parentObj, index) => {
+                            if (parentObj) {
+                                classData.push({
+                                    title: getStrValue(parentObj, 'parentsName'),
+                                    userId: getIntValue(parentObj, 'parentId'),
+                                    userPhone: getStrValue(parentObj, 'userPhone'),
+                                    value: getStrValue(parentObj, 'parentsName') + `-${data_index}-0-${index}`,
+                                    key: `${data_index}-0-${index}`,
+                                })
+                            }
+                        })
 
+                        targetData.push({
+                            title: dataObj.gradeName+dataObj.clazzName + '全部家长',
+                            value: `${data_index}-0`,
+                            key: `${data_index}-0`,
+                            children: classData,
+                        })
+                    }
+
+                    if (!isObjEmpty(teacherDOSArray)) {
+                        const teacherData = []
+                        teacherDOSArray.forEach((teacherObj, index) => {
+                            if (teacherObj) {
+                                teacherData.push({
+                                    title: getStrValue(teacherObj, 'teacherName'),
+                                    userId: getIntValue(teacherObj, 'teacherId'),
+                                    userPhone: getStrValue(teacherObj, 'userPhone'),
+                                    value: getStrValue(teacherObj, 'teacherName') + `${data_index}-1-${index}`,
+                                    key: `${data_index}-1-${index}`,
+                                })
+                            }
+                        })
+
+                        targetData.push({
+                            title: dataObj.gradeName+dataObj.clazzName + '全部老师',
+                            value: `${data_index}-1`,
+                            key: `${data_index}-1`,
+                            children: teacherData,
+                        })
+                    }
+                })
+            }
             console.log('targetData', targetData)
             this.setState({
                 targetData,
             })
         }).catch(error => {
             Toast.hide()
-
             if (typeof error === 'string') {
                 Toast.fail(error, 2)
             } else {
@@ -85,45 +103,45 @@ class SendMeet extends Component {
         })
     }
 
-    constructor() {
-        super();
+    constructor(props) {
+        super(props);
         this.state = {
+            voteTitle: null,
+            endValue: null,
+            voteType: null,
+            nonameVote: false,
+            voteOptionss: [null, null],
             targetList: [],
             targetCount: 0,
             targetData: [],
-            startValue: null,
-            endValue: null,
-            endOpen: false,
-            titleValue: null,
-            contentValue: null,
-            earlyTime: null,
-            meetPerson: [],
-            meetAddress: null,
-            noticeType: [{
-                label: '创建即提醒',
-                value: '0'
-            }, {
-                label: '会前5分钟',
-                value: 5
-            }, {
-                label: '会前15分钟',
-                value: 15
+            previewVisible: false,
+            previewImage: '',
+            fileList: [],
+            votePerson: [],
+            voteMembers: 18,
+            typeVote: [{
+                label: '单选',
+                value: '1'
             }, {
-                label: '会前25分钟',
-                value: 25
-            }, {
-                label: '会前35分钟',
-                value: 35
+                label: '多选',
+                value: '2'
             }]
-        };
-
+        }
     }
 
     render() {
+
+        //添加附件按钮
+        const uploadButton = (
+            <div>
+                <Icon type="plus"/>
+                <div className="ant-upload-text">Upload</div>
+            </div>
+        );
         const targetProps = {
             targetData: this.state.targetData,
             targetValues: this.state.targetList,
-            title: '与会人',
+            title: '发布对象',
             targetCount: this.state.targetCount,
             onTargetChange: this.onTargetChange.bind(this),
             onTargetFocus: this.onTargetFocus.bind(this)
@@ -132,29 +150,44 @@ class SendMeet extends Component {
         const defaultTargetProps = {
             targetData: [],
             targetValues: this.state.targetList,
-            title: '与会人',
+            title: '发布对象',
             targetCount: this.state.targetCount,
             onTargetChange: this.onTargetChange.bind(this),
             onTargetFocus: this.onTargetFocus.bind(this)
         }
         return (
-            <div onChange={this.handelValueCom} style={{fontFamily: "PingFangSC-Regular", letterSpacing: 2.5}} className='common-column-layout'>
-                {/*<p>{new Date().getTime()}</p>*/}
-                <textarea autoFocus="autoFocus" ref='meetTitle' className="form-control textarea_sty" rows="2"
-                          placeholder="请填写会议主题…"></textarea>
-                <textarea ref='meetAddress' className="form-control textarea_sty" rows="3"
-                          placeholder="请填写会议地址…"></textarea>
+
+            <div onChange={this.handelValueCom} className='common-column-layout'>
+                {this.state.targetData.length > 0 ? <TargetSelect {...targetProps}/>
+                    : <TargetSelect {...defaultTargetProps}/>}
                 <div className="comhline_sty"></div>
-                <div className="common-column-layout" style={{fontSize: 15}}>
-                    <DatePicker
-                        value={this.state.startValue}
-                        locale={{
-                            okText: '确定',
-                            dismissText: '取消'
-                        }}
-                        onChange={date => this.setState({startValue: date})}>
-                        <List.Item arrow="horizontal">会议开始时间</List.Item>
-                    </DatePicker>
+                <textarea autoFocus="autoFocus" ref='voteTitle' className="form-control textarea_sty"
+                          rows="2" placeholder="请填写投票主题…" style={{resize: 'none'}}></textarea>
+                <div className="comhline_sty"></div>
+
+                <div>
+                    {this.state.voteOptionss.map((itemata, index) => <SelectItem index={index} itemata={itemata}
+                                                                                 handelSItem={this.handelSItem}
+                                                                                 removeSItem={this.removeSItem}></SelectItem>)}
+                    <div onClick={this.addSelectItem} className="text-center"
+                         style={{color: "#0CE11D", fontSize: 12, margin: 10,}}>+ <span
+                        style={{borderBottom: "1px #0CE11D solid"}}>添加选项</span></div>
+                </div>
+
+                <div className="comhline_sty"></div>
+                <div className="common-column-layout">
+                    <Picker
+                        data={this.state.typeVote} title='投票类型' extra='请选择'
+                        value={this.state.voteType}
+                        onChange={this.handleSelectChange}
+                        onOk={this.handleSelectChange} cols={1}>
+                        <List.Item arrow="horizontal">投票类型</List.Item>
+                    </Picker>
+                    {/*<Select defaultValue="请选择" style={{ width:100 }} onChange={this.handleSelectChange}>*/}
+                    {/*<Option value="1">单选</Option>*/}
+                    {/*<Option value="2">多选</Option>*/}
+                    {/*</Select>*/}
+                    {/*<img src={nextArrowimg} className="nextarr_sty"/>*/}
                     <div className="comhline_sty1"></div>
                     <DatePicker
                         value={this.state.endValue}
@@ -163,175 +196,233 @@ class SendMeet extends Component {
                             dismissText: '取消'
                         }}
                         onChange={date => this.setState({endValue: date})}>
-                        <List.Item arrow="horizontal">会议结束时间</List.Item>
+                        <List.Item arrow="horizontal">结束时间</List.Item>
                     </DatePicker>
-                    <div className="comhline_sty1"></div>
-                    <Picker
-                        data={this.state.noticeType} title='提醒时间' extra='请选择'
-                        value={this.state.earlyTime}
-                        onChange={this.handleSelectChange}
-                        onOk={this.handleSelectChange} cols={1}>
-                        <List.Item arrow="horizontal">提醒时间</List.Item>
-                    </Picker>
                 </div>
 
                 <div className="comhline_sty1"></div>
-                {this.state.targetData.length > 0 ? <TargetSelect {...targetProps}/>
-                    : <TargetSelect {...defaultTargetProps}/>}
-                {/*<center><Button type="button" className="btn btn-primary comBtn_sty"*/}
-                {/*onClick={this.doSaveClick}>创建</Button></center>*/}
 
+                <div className="item_sty">
+                    <div style={{width: 150, fontSize: 15, color: "#333333"}}>匿名投票:</div>
+                    <div className="text-right" style={{width: "100%",}}>
+                        <Switch checkedChildren="开" unCheckedChildren="关" defaultunchecked="false"
+                                onChange={this.switchStatues}/>
+                    </div>
+                </div>
+                <div className="comhline_sty1"></div>
+
+                <UploadEnclosure
+                    action={API.UPLOAD_FILE}
+                    fileList={this.state.fileList}
+                    count={9}
+                    multiple={true}
+                    beforeUpload={this.beforeUpload.bind(this)}
+                    handleChange={this.handleChange.bind(this)}
+                />
                 <Button className='commonButton' type='primary' style={{margin: '35px'}}
-                        onClick={this.doSaveClick}>创建</Button>
+                        onClick={this.doSendVote}>提交</Button>
+                {/*<center><Button type="button" className="btn btn-primary comBtn_sty"*/}
+                {/*onClick={this.doSendVote}>提交</Button></center>*/}
             </div>
         )
     }
 
-    doSaveClick = (event) => {
-        console.log('state', this.state)
-        if (this.state.titleValue == null || this.state.titleValue.trim().length == 0) {
-            Toast.fail('请填写会议主题...')
-            return
+    onTargetFocus = (e) => {
+        if (isObjEmpty(this.state.targetData)) {
+            this.getOrganization()
         }
-        if (this.state.meetAddress == null || this.state.meetAddress.trim().length == 0) {
-            Toast.fail('请填写会议地址...')
-            return
+    }
+
+    onTargetChange = (value, label, checkNodes, count) => {
+        this.checkNodes = checkNodes
+        this.setState({
+            targetList: value,
+            targetCount: count
+        });
+    }
+    //发布提交
+    doSendVote = (event) => {
+        if (!isObjEmpty(this.checkNodes)) {
+            this.checkNodes.forEach((node, index) => {
+                this.state.votePerson.push(node.userId)
+            })
         }
-        if (this.state.startValue == null ) {
-            Toast.fail('请选择开始时间...')
+        // this.setState({
+        //     votePerson:[1,2,3,10001,10002,10003]
+        // })
+        console.log('state', this.state)
+
+        if (this.state.votePerson.length == 0) {
+            Toast.fail('请选择投票对象...')
             return
         }
-        if (this.state.endValue == null ) {
-            Toast.fail('请选择结束时间...')
+        if (this.state.voteTitle == null || this.state.voteTitle.trim().length == 0) {
+            Toast.fail('请填写投票主题...', 1)
             return
         }
-        if (this.state.earlyTime == null ){
-            Toast.fail('请选择提醒时间...')
-            return
+        for(let i=0;i<this.state.voteOptionss.length;i++){
+            if(this.state.voteOptionss[i] == null ||  this.state.voteOptionss[i].trim().length == 0 ){
+                Toast.fail('存在选项内容为空...')
+                return
+            }
         }
-        if (this.state.targetList.length == 0) {
-            Toast.fail('请选择与会人...')
+
+        if (this.state.voteType == null) {
+            Toast.fail('请选择投票类型...')
             return
         }
-        const userList = []
-        if (!isObjEmpty(this.checkNodes)) {
-            this.checkNodes.forEach((node, index) => {
-                userList.push(node.userId)
-            })
+        if (this.state.endValue == null ) {
+            Toast.fail('请选择正确结束时间...')
+            return
         }
+
         var nowT = new Date().getTime()
-        var startT = new Date(this.state.startValue).getTime()
         var endT = new Date(this.state.endValue).getTime()
-
-        console.log('startT', startT)
-        if (nowT > startT) {
-            Toast.show('开始时间不可小于当前时间', 1)
+        if (nowT > endT) {
+            Toast.fail('当前时间不可大于结束时间', 1)
             return
         }
-        if (startT > endT) {
-            Toast.show('结束时间不可小于开始时间', 1)
-            return
+
+        var options = []
+        for (let i = 0; i < this.state.voteOptionss.length; i++) {
+            const item = {
+                optionName: this.state.voteOptionss[i],
+                optionStatus: 1
+            }
+            options[i] = item
         }
-        if (!isObjEmpty(this.checkNodes)) {
-            this.checkNodes.forEach((node, index) => {
-                this.state.meetPerson.push(node.userId)
+
+
+        const approveFiles = []
+        if (this.state.fileList) {
+            this.state.fileList.forEach((value, index) => {
+                approveFiles.push(value.picUrl)
             })
         }
-        var noticeT = startT - this.state.earlyTime * 1000 * 60
-        console.log('noticeT', noticeT)
-        console.log('noticeT', new Date(noticeT))
-
-        let params = {
-            // meetingCreator: this.props.userInfo.userId,
-            meetingCreator:this.props.userInfo.userId,
-            meetingStatus: 1,
-            meetingName: this.state.titleValue,
-            meetingAddress: this.state.meetAddress,
-            startDate: moment(this.state.startValue).format('YYYY-MM-DD HH:mm:ss'),
-            endDate: moment(this.state.endValue).format('YYYY-MM-DD HH:mm:ss'),
-            reminderDate: moment(new Date(noticeT)).format('YYYY-MM-DD HH:mm:ss'),
-            meetingNotifier: JSON.stringify(userList),
-            meetingRemarks: "会议备注",
-            meetingFiles:"[]",
-            meetingDetails: "一定要参加",
-        }
 
-        console.log('params', params)
+        var params = {
+            topicName: this.state.voteTitle,
+            topicType:this.state.voteType[0],
+            topicFiles: approveFiles,
+            creator: this.props.userInfo.userId,
 
-        Toast.loading("会议创建中...", 0)
-        fetchPost(API.createMeeting, {
-            jsonMeeting:JSON.stringify(params)
+            topicStatus: 1,
+            voteRemarks: "这是一个调查",
+            voteName: this.state.voteTitle,
+            voter: JSON.stringify(this.state.votePerson),
+            voteEndDate: moment(this.state.endValue).format('YYYY-MM-DD HH:mm:ss'),
+            voteType:1,
+            optionName: [
+                {
+                    optionStatus: 1,
+                    options: options,
+                    topicType: this.state.voteType[0],
+                }
+            ]
+        }
+        console.log('params', {
+            voteString: params
+        })
+        fetchPost(API.voteCreate, {
+            voteTopicDOS: JSON.stringify(params)
         }, {})
             .then((response) => {
-                Toast.hide()
-                console.log('response', response)
                 if (response.success) {
+                    Toast.success('发布成功', 1)
                     clearListState()()
-                    Toast.show('创建成功', 1)
-
                     this.backTask = setTimeout(() => {
-                        this.props.history.goBack()
+                        // this.props.history.goBack()
                     }, 1000)
                 }
             })
             .catch((error) => {
-                Toast.hide()
-                console.log('error', error)
                 console.log('error', error)
                 if (typeof error === 'string') {
                     Toast.fail(error, 2)
                 } else {
-                    if (typeof error === 'string') {
-                        Toast.fail(error, 2)
-                    } else {
-                        Toast.fail('请求异常', 2)
-                    }
+                    Toast.fail('请求异常', 2)
                 }
             })
     }
-    onTargetFocus = (e) => {
-        if (isObjEmpty(this.state.targetData)) {
-            this.getOrganization()
-        }
+
+    componentWillUnmount() {
+        Toast.hide()
+        clearTimeout(this.backTask)
     }
 
-    onTargetChange = (value, label, checkNodes, count) => {
-        this.checkNodes = checkNodes
+    removeSItem = (index) => {
+        if (this.state.voteOptionss.length == 2) {
+            return
+        }
+        let voteOptionss = this.state.voteOptionss
+        voteOptionss.splice(index, 1)
         this.setState({
-            targetList: value,
-            targetCount: count
-        });
+            voteOptionss
+        })
     }
-    selectPersononChange = (value) => {
-        console.log('selectPersononChange ', value);
-        this.setState({meetPerson: value});
+    handelSItem = (itemdata, index) => {
+        console.log('index', index)
+        console.log('itemdata', itemdata)
+        let voteOptionss = this.state.voteOptionss
+        voteOptionss[index] = itemdata
+        this.setState({
+            voteOptionss
+        })
     }
-    disabledStartDate = (startValue) => {
-        const endValue = this.state.endValue;
-        if (!startValue || !endValue) {
-            return false;
-        }
-        return startValue.valueOf() > endValue.valueOf();
+
+    addSelectItem = (event) => {
+        let voteOptionss = [...this.state.voteOptionss, null];
+        this.setState({
+            voteOptionss
+        })
+    }
+    addAnnex = (event) => {
+        console.log('addAnnex')
     }
 
     handleSelectChange = (value) => {
-        console.log(`selected ${value}`);
+        console.log('voteType', value)
         this.setState({
-            earlyTime: value
+            voteType: value
         })
     }
-
     handelValueCom = (event) => {
         //获取用户名的值
-        let meetTitle = this.refs.meetTitle.value;
+        let voteTitle = this.refs.voteTitle.value;
         //获得内容的值
-        let meetAddress = this.refs.meetAddress.value;
+        this.setState({
+            voteTitle: voteTitle,
+        })
+    }
 
+    switchStatues = (value) => {
+        console.log('isOpend?', value)
         this.setState({
-            titleValue: meetTitle,
-            meetAddress: meetAddress
+            nonameVote: value
         })
     }
+    handleCancel = () => this.setState({previewVisible: false})
+
+    handlePreview = (file) => {
+        this.setState({
+            previewImage: file.url || file.thumbUrl,
+            previewVisible: true,
+        });
+    }
+    beforeUpload = (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({fileList})
+        }
+    }
+
 }
 
 let mapStateToProps = (state) => ({
@@ -340,4 +431,4 @@ let mapStateToProps = (state) => ({
 
 let mapDispatchToProps = (dispatch) => ({})
 
-export default connect(mapStateToProps, mapDispatchToProps)(SendMeet)
+export default connect(mapStateToProps, mapDispatchToProps)(SendVote)

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

@@ -6,7 +6,7 @@
 import React, {Component} from 'react'
 import 'bootstrap/dist/css/bootstrap.css'
 import 'bootstrap/dist/css/bootstrap.min.css'
-import {switchUser} from "../../redux/actions/userInfo";
+import {switchCurrentUser, switchUser} from "../../redux/actions/userInfo";
 import Swiper from 'swiper/dist/js/swiper'
 import 'swiper/dist/css/swiper.min.css'
 import {Avatar} from 'antd'
@@ -31,8 +31,6 @@ class HomePage extends Component {
 
         this.state = {
             studentIndex: 0,
-            albums: [],
-            videos: []
         }
     }
 
@@ -71,9 +69,9 @@ class HomePage extends Component {
             }
         })
 
-        if (!isObjEmpty(this.props.userInfo.students)) {
-            this.props.userInfo.students.forEach((item, index) => {
-                if (this.props.userInfo.stuId == item.stuId) {
+        if (!isObjEmpty(this.props.userInfo.parent, this.props.userInfo.parent.student, this.props.userInfo.parent.students)) {
+            this.props.userInfo.parent.students.forEach((item, index) => {
+                if (this.props.userInfo.parent.student.stuId == item.stuId) {
                     this.setState({
                         studentIndex: index
                     })
@@ -90,23 +88,13 @@ class HomePage extends Component {
 
     render() {
         const {userInfo} = this.props
-        let {studentIndex, albums} = this.state
+        let {studentIndex} = this.state
 
         const teacherMenu = this.getTeacherMenu()
         const parentMenu = this.getParentMenu()
         const videoLayout = this.getVideoLayout()
         const topMenus = this.getTopMenus()
 
-        const albumItems = []
-        if (!isObjEmpty(albums)) {
-            albums.forEach((item, index) => {
-                albumItems.push(<div className="swiper-slide"
-                                     style={{backgroundImage: 'url(' + _baseURL + item.picUrl + ')'}}>
-                    {/*<img className='home-albums-img' src={_baseURL + item.picUrl}/>*/}
-                </div>)
-            })
-        }
-
         const studentList = []
 
         if (!isObjEmpty(userInfo.parent) && !isObjEmpty(userInfo.parent.students) && userInfo.userRole === 1) {
@@ -115,21 +103,36 @@ class HomePage extends Component {
                                           stuIndex={index} onStuSwitch={this.onStuSwitch}/>)
             })
         }
+        const albumItems = []
 
-        let schoolName = '', userAvatar = '', userName = ''
+        let schoolName = '', userAvatar = '', userName = '', albums = ''
         if (userInfo.userRole === 1) {
             if (userInfo.parent) {
                 schoolName = userInfo.parent.schoolName
                 userAvatar = userInfo.parent.parentsPhoto
                 userName = userInfo.parent.parentsName
+
+                if (!isObjEmpty(userInfo.parent.student)) {
+                    albums = userInfo.parent.student.picAlbum
+                }
             }
         } else if (userInfo.userRole === 2) {
             if (userInfo.teacher) {
                 schoolName = userInfo.teacher.schoolName
                 userAvatar = userInfo.teacher.teacherPhoto
                 userName = userInfo.teacher.teacherName
+
+                albums = userInfo.teacher.albums
             }
         }
+        if (!isObjEmpty(albums)) {
+            albums.forEach((item, index) => {
+                albumItems.push(<div className="swiper-slide"
+                                     style={{backgroundImage: 'url(' + _baseURL + item.picUrl + ')'}}>
+                    {/*<img className='home-albums-img' src={_baseURL + item.picUrl}/>*/}
+                </div>)
+            })
+        }
 
         return (
             <div className='home-page-root'>
@@ -160,13 +163,16 @@ class HomePage extends Component {
                 {/*功能菜单*/}
                 {userInfo.userRole == 1 ? parentMenu : teacherMenu}
                 {/*班级相册*/}
-                <div className='gray-line'></div>
-                <MenuGroup groupIcon={require('imgs/ic_group_album.png')} groupText='班级相册'/>
-                <div className="home-swiper-container">
-                    <div className="swiper-wrapper">
-                        {albumItems}
+                {<div className={isObjEmpty(albumItems) ? 'displayNone' : ''}>
+                    <div className='gray-line'></div>
+                    <MenuGroup groupIcon={require('imgs/ic_group_album.png')} groupText='班级相册'/>
+                    <div className="home-swiper-container">
+                        <div className="swiper-wrapper">
+                            {albumItems}
+                        </div>
                     </div>
-                </div>
+                </div>}
+
                 {/*精彩瞬间*/}
                 {/*{videoLayout}*/}
 
@@ -219,6 +225,8 @@ class HomePage extends Component {
                             teacherEntry: getStrValue(teacherDOS, 'teacherEntry'),
                             teacherBirthday: getStrValue(teacherDOS, 'teacherBirthday'),
                             teacherSex: getStrValue(teacherDOS, 'teacherSex'),//1:男,2:女
+                            albums: getStrValue(teacherDOS, 'picAlbum'),
+                            videos: getStrValue(teacherDOS, 'videoAlbum')
                         }
                     })()
                 } else {
@@ -262,16 +270,12 @@ class HomePage extends Component {
                     userRole = 1
                 }
 
-                this.setState({
-                    albums: [],
-                    videos: []
-                })
-
-                switchUser({
+                /*switchUser({
                     userRole: userRole,
-                })()
+                })()*/
+                switchCurrentUser(userRole)()
 
-                if (!isObjEmpty(userInfo.parent) && !isObjEmpty(userInfo.parent.students)) {
+                if (!isObjEmpty(userInfo.parent, userInfo.parent.students)) {
                     userInfo.parent.students.forEach((item, index) => {
                         if (userInfo.parent.student.stuId == item.stuId) {
                             studentIndex = index
@@ -301,7 +305,8 @@ class HomePage extends Component {
                         Toast.loading('身份切换中...', 0)
                         setTimeout(() => {
                             Toast.success('切换成功!', 1)
-                            switchUser({userRole: 1})()
+                            switchCurrentUser(1)()
+                            // switchUser({userRole: 1})()
                         }, 500)
                     }
                 }
@@ -312,7 +317,8 @@ class HomePage extends Component {
                         Toast.loading('身份切换中...', 0)
                         setTimeout(() => {
                             Toast.success('切换成功!', 1)
-                            switchUser({userRole: 2})();
+                            switchCurrentUser(2)()
+                            // switchUser({userRole: 2})();
                         }, 500)
                     }
                 }
@@ -331,7 +337,18 @@ class HomePage extends Component {
     }
 
     getAlbumLayout = () => {
-        const {albums} = this.state
+        const {userInfo} = this.props
+        let albums = ''
+        if (userInfo.userRole === 1) {
+            if (!isObjEmpty(userInfo.parent, userInfo.parent.student)) {
+                albums = userInfo.parent.student.picAlbum
+            }
+        } else if (userInfo.userRole === 2) {
+            if (userInfo.teacher) {
+                albums = userInfo.teacher.albums
+            }
+        }
+
         if (isObjEmpty(albums)) {
             return <div></div>
         } else {
@@ -352,7 +369,6 @@ class HomePage extends Component {
                         </div>
                     </div>
                 </div>
-
             </div>
         }
     }

+ 13 - 9
frontend/wechat-web/src/modules/principalMailbox/PrincipalMailbox.jsx

@@ -73,7 +73,7 @@ class PrincipalMailbox extends Component {
     releaseEvent = () => {
         const {fileList, suggest, isAnonymous} = this.state;
 
-        if (isObjEmpty(suggest)) {
+        if (suggest.trim().length == 0) {
             Toast.fail('请填写您的意见或建议')
             return
         }
@@ -87,16 +87,20 @@ class PrincipalMailbox extends Component {
             })
         }
 
-        fetchPost(API.PRINCIPAL_MAILBOX, {
-            details: suggest,
-            notifyFiles: JSON.stringify(fileUrls),
-            userId: this.props.userInfo.userId,
-            schId: 1,
-            isAnonymity: isAnonymous ? 2 : 1
-        }).then(response => {
+        let params = {
+            mailboxString:{
+                mailboxTitle: "校长信箱",
+                mailboxContext: suggest,
+                mailboxFiles: JSON.stringify(fileUrls),
+                mailboxCreator: this.props.userInfo.userId,
+                isAnonymity: isAnonymous ? 2 : 1,
+                mailboxStatus:1
+            }
+        }
+        console.log("params",params)
+        fetchPost(API.PRINCIPAL_MAILBOX, params).then(response => {
             Toast.hide()
             Toast.success('提交成功,谢谢您的建议!')
-
             this.setState({
                 suggest: '',
                 fileList: []

+ 43 - 22
frontend/wechat-web/src/modules/user/UserInfo.js

@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import 'css/user-info.css'
 import 'css/phones.css'
-import {Icon, Modal, Upload} from "antd";
+import {Icon, Modal, Upload,Avatar} from "antd";
 import icon_userInfo_upload from "../../style/imgs/icon_userInfo_upload.png"
 import {API, _baseURL} from "../../configs/api.config";
 import {Toast} from 'antd-mobile'
@@ -59,11 +59,24 @@ 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'>
-            <img className='user-info-avatar' onClick={this.onAvatarClick}
-                 src={this.props.userInfo.userAvatar}/>
+            {isObjEmpty(userAvatar) ?
+                <Avatar size={50} icon='user'/> :
+                <img className='user-info-avatar' onClick={this.onAvatarClick}
+                     src={userAvatar}/>}
             <div className="flex_row_center user-info-msg">
-                <span>{this.props.userInfo.userName}</span>
+                <span>{userName}</span>
             </div>
 
         </div>
@@ -72,25 +85,25 @@ class UserInfo extends Component {
     //显示个人位置信息
     showLocation() {
         const {userInfo} = this.props
-        const idTag = (this.type == 1 ? '工号ID' : '绑定学号ID')
-        const id = (this.type == 1 ? userInfo.userId : userInfo.student.stuId)
-        const sex = (this.type == 1 ? userInfo.userSex : userInfo.student.stuSex)
+        const sex = (this.type == 1 ? userInfo.teacher.teacherSex : userInfo.parent.student.stuSex)
 
+        let schoolName = ''
+        if (this.type == 1) {
+            schoolName = userInfo.teacher.schoolName
+        } else {
+            schoolName = userInfo.parent.schoolName
+        }
         return <div className={'user-column'}>
-            {/*<div className='user-info-item-top'>
-                <text className='user-info-item-name'>{idTag}</text>
-                <text className='user-info-item-phone'>{id}</text>
-            </div>*/}
             {this.type == 1 ? '' : <div>
                 <div className='user-info-item-top'>
                     <text className='user-info-item-name'>学生姓名</text>
-                    <text className='user-info-item-phone'>{userInfo.student.stuName}</text>
+                    <text className='user-info-item-phone'>{userInfo.parent.student.stuName}</text>
                 </div>
                 <div className='gray-line' style={{height: '1px'}}></div>
             </div>}
             <div className='user-info-item-top'>
                 <text className='user-info-item-name'>所在学校</text>
-                <text className='user-info-item-phone'>{userInfo.school}</text>
+                <text className='user-info-item-phone'>{schoolName}</text>
             </div>
             <div className='gray-line' style={{height: '1px'}}></div>
             {this.type == 1 ? '' : (<div>
@@ -113,15 +126,21 @@ class UserInfo extends Component {
         const {userInfo} = this.props
 
         let pictureUrls = []
-        if (!isObjEmpty(userInfo.student.stuPhoto)) {
-            pictureUrls.push(_baseURL + userInfo.student.stuPhoto)
+        if (!isObjEmpty(userInfo.parent, userInfo.parent.student, userInfo.parent.student.stuPhoto)) {
+            pictureUrls.push(_baseURL + userInfo.parent.student.stuPhoto)
         }
 
+        let userPhone = ''
+        if (this.type == 1) {
+            userPhone = userInfo.teacher.userPhone
+        }else if (this.type == 2) {
+            userPhone = userInfo.parent.userPhone
+        }
         return <div className={'user-column'}>
             <div className='user-info-item-top'>
                 <div>
                     <text className='user-info-item-name'>手机号码</text>
-                    <div className='user-info-item-phone' style={{marginTop: '8px'}}>{userInfo.userPhone}</div>
+                    <div className='user-info-item-phone' style={{marginTop: '8px'}}>{userPhone}</div>
                 </div>
                 <div className="item_flex_1 flex_row_right">
                     <div className='gray-line'
@@ -152,8 +171,8 @@ class UserInfo extends Component {
                 </div>
                 <div className='flex' style={{marginTop: '8px'}}>
                     <img style={{marginLeft: "16px"}}
-                         src={userInfo.student.stuPhoto === "" ? icon_userInfo_upload :
-                             _baseURL + userInfo.student.stuPhoto}
+                         src={pictureUrls.length === 0 ? icon_userInfo_upload :
+                             pictureUrls[0]}
                          width={86}
                          height={100}
                          onClick={this.handlePreview}/>
@@ -216,7 +235,7 @@ class UserInfo extends Component {
 
     updateUserInfo = (userPhoto) => {
         fetchPost(API.UPDATE_STU_PHOTO, {
-            stuId: this.props.userInfo.student.stuId,
+            stuId: this.props.userInfo.parent.student.stuId,
             stuPhoto: userPhoto
         }).then((response) => {
             Toast.success('人脸照上传成功!')
@@ -225,9 +244,11 @@ class UserInfo extends Component {
             });
 
             switchUser({
-                student: {
-                    ...this.props.userInfo.student,
-                    stuPhoto: userPhoto
+                parent: {
+                    student: {
+                        ...this.props.userInfo.parent.student,
+                        stuPhoto: userPhoto
+                    }
                 }
             })()
         }).catch((error) => {

+ 1 - 0
frontend/wechat-web/src/modules/vote/VoteListTeacher.jsx

@@ -354,6 +354,7 @@ class VoteListTeacher extends Component {
     }
 
     onAddVote = () => {
+        console.log("onAddVote")
         this.saveListStatus(true, -1)
         this.props.history.push('/send-vote')
     }

+ 9 - 1
frontend/wechat-web/src/redux/actions/userInfo.js

@@ -3,7 +3,7 @@
  * Desc: 用户信息缓存
  */
 
-import {CLEAR_USER_INFO, USER_INFO} from "../constants/actionTypes";
+import {CLEAR_USER_INFO, USER_INFO, SWITCH_USER_INFO} from "../constants/actionTypes";
 import store from '../store/store'
 
 export const switchUser = (data) => {
@@ -16,6 +16,14 @@ export const switchUser = (data) => {
     }
 }
 
+export const switchCurrentUser = (userRole) => {
+    return () => {
+        store.dispatch({
+            type: SWITCH_USER_INFO,
+            userRole: userRole
+        })
+    }
+}
 
 export const clearUserInfo = () => {
     return () => {

+ 1 - 0
frontend/wechat-web/src/redux/constants/actionTypes.js

@@ -1,5 +1,6 @@
 export const USER_INFO = 'USER_INFO'
 export const CLEAR_USER_INFO = 'CLEAR_USER_INFO'
+export const SWITCH_USER_INFO = 'SWITCH_USER_INFO'
 export const LIST_STATE = 'LIST_STATE'
 export const CLEAR_LIST_STATE = 'CLEAR_LIST_STATE'
 export const CLASS_DATA = 'CLASS_DATA'

+ 51 - 4
frontend/wechat-web/src/redux/reducers/redUserInfo.js

@@ -1,5 +1,5 @@
-import {USER_INFO, CLEAR_USER_INFO} from "../constants/actionTypes";
-import {getVisibleObj} from "../../utils/common";
+import {USER_INFO, CLEAR_USER_INFO, SWITCH_USER_INFO} from "../constants/actionTypes";
+import {getVisibleObj, isObjEmpty} from "../../utils/common";
 
 /*teacher: {
     teacherId: 0,
@@ -15,6 +15,8 @@ import {getVisibleObj} from "../../utils/common";
         teacherEntry: '',
         teacherBirthday: '',
         teacherSex: 0,//1:男,2:女
+        albums: [],
+        videos: []
 },
 parent: {
     parentId: 0,
@@ -29,7 +31,10 @@ parent: {
         parentsPhoto: '',
         parentsAddress: '',
         students:'',
-        student:''
+        student:{
+            albums: [],
+            videos: []
+        }
 }*/
 
 const initListState = {
@@ -52,13 +57,13 @@ const initListState = {
     userRole: 0,
     teacher: '',
     parent: '',
+    user: '',
 }
 
 const redUserInfo = (state = initListState, action) => {
     if (action === undefined) {
         return state
     }
-
     switch (action.type) {
         case USER_INFO:
             return {
@@ -67,6 +72,48 @@ const redUserInfo = (state = initListState, action) => {
             }
         case CLEAR_USER_INFO:
             return initListState
+        case SWITCH_USER_INFO:
+            const userRole = action.userRole
+
+            let currentUser = {}
+            if (userRole === 1) {
+                currentUser = {
+                    userFunId: state.parent.parentId,
+                    userId: state.parent.userId,
+                    schoolId: state.parent.schoolId,
+                    schoolName: state.parent.schoolName,
+                    userName: state.parent.parentsName,
+                    userOpenid: state.parent.openid,
+                    userPhone: state.parent.userPhone,
+                    userAvatar: state.parent.parentsPhoto,
+                    userSex: state.parent.parentsSex,
+                    students: state.parent.students,
+                    student: state.parent.student,
+                    albums: isObjEmpty(state.parent.student) ? [] : state.parent.student.picAlbum,
+                    videos: isObjEmpty(state.parent.student) ? [] : state.parent.student.videoAlbum
+                }
+            } else if (userRole === 2) {
+                currentUser = {
+                    userFunId: state.teacher.teacherId,
+                    userId: state.teacher.userId,
+                    schoolId: state.teacher.schoolId,
+                    schoolName: state.teacher.schoolName,
+                    userName: state.teacher.teacherName,
+                    userOpenid: state.teacher.openid,
+                    userPhone: state.teacher.userPhone,
+                    userAvatar: state.teacher.teacherPhoto,
+                    userSex: state.teacher.teacherSex,
+                    students: [],
+                    student: '',
+                    albums: state.teacher.albums,
+                    videos: state.teacher.videos
+                }
+            }
+            return {
+                ...state,
+                userRole: userRole,
+                user: currentUser
+            }
         default:
             return state
     }