forked from nsjcy/frontEnd/nsjcy

1
liuwh
2020-02-26 b321fc6111c6483e3b2e501620d2e7ffc6a22f15
1
6 files added
8 files modified
456 ■■■■■ changed files
SunshineIns/src/data/menu.js 9 ●●●● patch | view | raw | blame | history
SunshineIns/src/fetch/_fetch.js 2 ●●●●● patch | view | raw | blame | history
SunshineIns/src/fetch/addResult.js 6 ●●●●● patch | view | raw | blame | history
SunshineIns/src/fetch/index.js 12 ●●●●● patch | view | raw | blame | history
SunshineIns/src/fetch/socialCompany.js 9 ●●●●● patch | view | raw | blame | history
SunshineIns/src/fetch/socialCompanyDetail.js 9 ●●●●● patch | view | raw | blame | history
SunshineIns/src/fetch/socialCompanySave.js 8 ●●●●● patch | view | raw | blame | history
SunshineIns/src/fetch/socialCompanydelete.js 9 ●●●●● patch | view | raw | blame | history
SunshineIns/src/index.jsx 3 ●●●●● patch | view | raw | blame | history
SunshineIns/src/page/ActiveManage.jsx 132 ●●●●● patch | view | raw | blame | history
SunshineIns/src/page/UnderAgeList.jsx 224 ●●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js 8 ●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml 16 ●●●●● patch | view | raw | blame | history
SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxss 9 ●●●●● patch | view | raw | blame | history
SunshineIns/src/data/menu.js
@@ -85,7 +85,7 @@
  path: '/sweeping'
}, {
  id: 'activeManage',
  name: '活动管理',
  name: '法制活动',
  icon: active,
  iconCheck: activeCheck,
  path: '/activeManage'
@@ -98,6 +98,13 @@
  path: '/careList'
},
{
  id: 'underAgeList',
  name: '涉未成年负责部门组织',
  icon: active,
  iconCheck: activeCheck,
  path: '/underAgeList'
},
{
  id: 'questionnaire',
  name: '问卷管理部分',
  icon: msgManage,
SunshineIns/src/fetch/_fetch.js
@@ -2,6 +2,8 @@
// export const base = 'http://xnwj.gznsjc.gov.cn';
export const base = 'http://nsjc.vaiwan.com';
// export const base = 'http://nsjcy.hugeinfo.com.cn';
// export const base = 'http://192.168.0.147:8081';
export const domain = base + '/nsjc-charge/';
SunshineIns/src/fetch/addResult.js
New file
@@ -0,0 +1,6 @@
import fetch from './_fetch';
import { message } from 'antd';
export default ({ id, result}) => fetch(`api/activity/addResult?id=${id||''}&result=${result || ''}`)
    .catch(
        error => message.error('列表加载失败,请联系管理员', 2)
    );
SunshineIns/src/fetch/index.js
@@ -81,6 +81,11 @@
import attachmentDownload from './attachmentDownload';
import entryAudit from './entryAudit';
import signinfo from './signinfo';
import addResult from './addResult';
import socialCompany from './socialCompany';
import socialCompanySave from './socialCompanySave';
import socialCompanyDetail from './socialCompanyDetail';
import socialCompanydelete from './socialCompanydelete';
export default {
  domain,
@@ -165,5 +170,10 @@
  entryQuery,
  attachmentDownload,
  entryAudit,
  signinfo
  signinfo,
  addResult,
  socialCompany,
  socialCompanySave,
  socialCompanyDetail,
  socialCompanydelete
};
SunshineIns/src/fetch/socialCompany.js
New file
@@ -0,0 +1,9 @@
import fetch from './_fetch';
import { message } from 'antd';
export default ({ companyName, companyLegal,companyTel,companyAccount, createTime }) => fetch(`api/socialCompany/finds?companyName=${companyName || ''}&companyLegal=${companyLegal || ''}&companyTel=${companyTel || ''}&companyAccount=${companyAccount || ''}&createTime=${createTime || ''}`)
    .then(
        json => json.rows
    )
    .catch(
        error => message.error('列表加载失败,请联系管理员', 2)
    );
SunshineIns/src/fetch/socialCompanyDetail.js
New file
@@ -0,0 +1,9 @@
import fetch from './_fetch';
import { message } from 'antd';
export default (id) => fetch(`api/socialCompany/find?id=${id||'new'}`)
    .then(
        json => json
    )
    .catch(
        error => message.error('详情加载失败,请联系管理员', 2)
    );
SunshineIns/src/fetch/socialCompanySave.js
New file
@@ -0,0 +1,8 @@
import fetch from './_fetch';
export default (savedate) => {
    return fetch(`api/socialCompany/save`,
        savedate
    );
}
SunshineIns/src/fetch/socialCompanydelete.js
New file
@@ -0,0 +1,9 @@
import fetch from './_fetch';
import { message } from 'antd';
export default (id) => fetch(`api/socialCompany/delete?id=${id}`)
    .then(
        json => json
    )
    .catch(
        error => message.error('删除失败,请联系管理员', 2)
    );
SunshineIns/src/index.jsx
@@ -14,6 +14,8 @@
import BusDetail from './page/BusDetail';
import SupPerson from './page/SupPerson';
import Company from './page/Company';
// 涉未成年负责部门组织
import UnderAgeList from './page/UnderAgeList';
import ActiveManage from './page/ActiveManage';
import ActiveManageEdit from './page/ActiveManageEdit';
import KnowledgeBase from './page/KnowledgeBase';
@@ -72,6 +74,7 @@
          <Route path='/active' component={Active} />
          <Route path='/supPerson' component={SupPerson} />
          <Route path='/company' component={Company} />
          <Route path='/underAgeList' component={UnderAgeList} />
          <Route path='/knowledgeBase' component={KnowledgeBase} />
          <Route path='/articlePublish' component={ArticlePublish} />
          <Route path='/articleEidt/:id' component={ArticleEidt} />
SunshineIns/src/page/ActiveManage.jsx
@@ -4,12 +4,13 @@
import HeadView from '../view/HeadView';
import TableBtnView from '../view/TableBtnView';
import CommonSearchForm from '../view/CommonSearchForm';
import { Divider, Modal, message, Button, Progress } from 'antd'
import { Divider, Modal, message, Button, Row, Col, Progress, Input, Upload, Icon } from 'antd'
import moment from 'moment'
import Fetch from '../fetch';
import { domain } from '../fetch/_fetch';
import TableView from '../view/TableView';
const confirm = Modal.confirm;
const { TextArea } = Input;
function typeOfName(type) {
    switch (type) {
        case 0:
@@ -70,13 +71,20 @@
            data: [],
            resetKey: Date.now(),
            loading:false,
            confirmLoading: false,
            modal: false,
            closeKey: Date.now(),
            formData: {
                __key: Date.now(),
                activityType: '',
                activityStatus: '',
                startTime: '',
                endTime: '',
            }
            },
            savedate: {},
            fileList: [],
            previewVisible: false,
            previewImage: '',
        };
    }
@@ -92,12 +100,60 @@
        });
    }
    handlePreview = (file) => {
        this.setState({
            previewImage: file.url || file.thumbUrl,
            previewVisible: true,
        });
    }
    handleOk = () => {
        console.log('success')
        this.setState({ confirmLoading: true });
        const { savedate } = this.state;
        console.log(savedate)
        if (!savedate.result) {
            return message.warning("培训结果不能为空");
        }
        Fetch.addResult({ ...savedate })
            .then(res => {
                console.log(res)
                if (res.code === 0) {
                    this.setState({
                        confirmLoading: false,
                        modal: false,
                        closeKey: Date.now()
                    }, this.getData);
                    message.success("提交成功!")
                } else {
                    message.error('保存失败,请联系管理员', 2)
                }
            });
    }
    handleCancel = () => {
        this.setState({
            closeKey: Date.now(),
            modal: false
        });
    }
    searchonClick = data => {
        console.log('form', data);
        this.setState({
            formData: data,
        });
        this.getData();
    }
    saveInputChange = ({ target: { value, name } }) => {
        this.setState(({ savedate }) => ({
            savedate: {
                ...savedate,
                [name]: value
            }
        }))
    }
    getData = () => {
@@ -122,6 +178,16 @@
    signIn = (id) => {
        window.open('index.html#/signIn/' + id);
    }
    addResult = (id) => {
        this.setState(({ savedate }) => ({
            savedate: {
                ...savedate,
                id: id
            },
            modal: true
        }))
    }
    pulish = (id) => {
@@ -219,12 +285,44 @@
                                <label className='theme-color' onClick={() => this.signIn(record.id)} style={{ cursor: 'pointer' }}>签到上墙</label>
                            </span>
                            :
                            record.status == 3 ?
                                <span>
                                    <label className='theme-color' onClick={() => this.showModal(record.id)} style={{ cursor: 'pointer' }}>查看</label>
                                    {!record.result &&
                                        <React.Fragment>
                                            <Divider type="vertical" />
                                            <label className='theme-color' onClick={() => this.addResult(record.id)} style={{ cursor: 'pointer' }}>添加结果</label>
                                        </React.Fragment>
                                    }
                                </span>
                                :
                            <span><label className='theme-color' onClick={() => this.showModal(record.id)} style={{ cursor: 'pointer' }}>查看</label></span>
                )
            ),
        }];
        const { data, resetKey, formData, loading } = this.state;
        const { data, previewImage, formData, loading, modal, fileList, previewVisible, confirmLoading, closeKey, savedate } = this.state;
        const props = {
            action: domain + 'api/v1/attachment/materials?associateTypeId=1020&entityId=' + savedate.id,
            onChange: ({ file, fileList }) => {
                this.setState({ fileList });
            },
            fileList: fileList,
            onRemove: (file) => {
                Fetch.deleteAttachment(file.uid)
                    .then(res => {
                        message.success("移除成功!");
                    });
                this.setState(({ fileList }) => {
                    const index = fileList.indexOf(file);
                    const newFileList = fileList.slice();
                    newFileList.splice(index, 1);
                    return {
                        fileList: newFileList,
                    };
                });
            }
        };
        return (
            <div className="app-page" >
                <HeadView history={this.props.history} />
@@ -263,6 +361,34 @@
                        ]} />
                    <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} />
                </div>
                <Modal
                    key={closeKey}
                    confirmLoading={confirmLoading}
                    visible={modal}
                    width={'50%'}
                    title="添加结果"
                    onOk={this.handleOk}
                    onCancel={this.handleCancel}
                >
                    <Row type="flex" align='middle' style={{ margin: '12px 0' }} justify="space-around">
                        <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>培训结果</span></Col>
                        <Col span={18} push={0} ><TextArea rows={4} placeholder="请输入培训结果" value={savedate.result || ""} onChange={this.saveInputChange} name='result' /></Col>
                    </Row>
                    <Row type="flex" align='middle' justify="space-around">
                        <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>培训材料</span></Col>
                        <Col span={18} push={0} >
                            <Upload listType="picture-card" onPreview={this.handlePreview} {...props}>
                                <div>
                                    <Icon type="plus" />
                                    <div className="ant-upload-text">上传图片</div>
                                </div>
                            </Upload>
                            <Modal visible={previewVisible} footer={null} onCancel={this.handleCancel}>
                                <img alt="example" style={{ width: '100%' }} src={previewImage} />
                            </Modal>
                        </Col>
                    </Row>
                </Modal>
            </div>
        );
    }
SunshineIns/src/page/UnderAgeList.jsx
New file
@@ -0,0 +1,224 @@
import React from 'react';
import HeadView from '../view/HeadView';
import TableBtnView from '../view/TableBtnView';
import { Input, Button, DatePicker, Divider, Modal, message } from 'antd'
import moment from 'moment'
import Fetch from '../fetch';
import TableView from '../view/TableView';
const confirm = Modal.confirm;
export default class Company extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      data: [],
      loading: false,
      visible: false,
      savedate: {},
      formdata: {},
      resetKey: Date.now(),
      closeKey: Date.now()
    };
  }
  componentDidMount() {
    document.title = '涉未成年负责部门组织';
    this.getData();
  }
  getData = () => {
    const { formdata } = this.state;
    Fetch.socialCompany(formdata)
      .then(res => {
        for (var i = 0; i < res.length; i++) {
          res[i]['index'] = i + 1;
        }
        this.setState({
          data: res
        });
      });
  }
  onInputChange = ({ target: { value, name } }) => {
    this.setState(({ formdata }) => ({
      formdata: {
        ...formdata,
        [name]: value
      }
    }))
  }
  saveInputChange = ({ target: { value, name } }) => {
    this.setState(({ savedate }) => ({
      savedate: {
        ...savedate,
        [name]: value
      }
    }))
  }
  Seaech = () => {
    const { formdata } = this.state;
    Fetch.socialCompany(formdata)
      .then(res => {
        for (var i = 0; i < res.length; i++) {
          res[i]['index'] = i + 1;
        }
        this.setState({
          data: res
        });
      });
  }
  Reset = () => {
    this.setState({
      resetKey: Date.now(),
      formdata: {}
    }, this.getData);
  }
  showModal = (id) => {
    this.setState({
      visible: true,
    });
    Fetch.socialCompanyDetail(id)
      .then(res => {
        this.setState({ savedate: res })
      })
  }
  handleOk = () => {
    this.setState({ loading: true });
    const { savedate } = this.state;
    if (savedate.companyTel) {
      if (!validator.mobile(savedate.companyTel)) {
        this.setState({
          loading: false
        });
        return message.warning("电话号码格式不正确");
      }
    }
    if (!savedate.companyAccount) {
      return message.warning("账号不能为空");
    }
    if (!savedate.companyPassword) {
      return message.warning("密码不能为控");
    }
    Fetch.socialCompanySave(savedate)
      .then(res => {
        if (res.statuscode === 1) {
          this.setState({
            loading: false,
            visible: false,
            closeKey: Date.now()
          }, this.getData);
          message.success("提交成功!")
        } else {
          message.error('保存失败,请联系管理员', 2)
        }
      });
  }
  handleCancel = () => {
    this.setState({
      closeKey: Date.now(),
      visible: false
    });
  }
  deleteItems = (id) => {
    confirm({
      title: '确认要删除这条数据吗?',
      onOk: () => {
        Fetch.socialCompanydelete(id)
          .then(data => {
            if (data.statuscode == 1) {
              message.success("删除成功!")
              this.setState({
                resetKey: Date.now(),
                formdata: {}
              }, this.getData);
            } else {
              message.error('删除失败,请联系管理员', 2)
            }
          })
      }
    });
  }
  render() {
    const columns = [{
      title: '序号',
      dataIndex: 'index',
      key: 'index'
    }, {
      title: '公司名称',
      dataIndex: 'companyName',
      key: 'companyName'
    }, {
      title: '法人姓名',
      dataIndex: 'companyLegal',
      key: 'companyLegal',
    }, {
      title: '联系电话',
      dataIndex: 'companyTel',
      key: 'companyTel',
    }, {
      title: '公司地址',
      dataIndex: 'companyAddress',
      key: 'companyAddress',
    }, {
      title: '管理员账号',
      dataIndex: 'companyAccount',
      key: 'companyAccount',
    }, {
      title: '管理员密码',
      dataIndex: 'companyPassword',
      key: 'companyPassword',
      render: text => <span>***********</span>
    }, {
      title: '创建时间',
      dataIndex: 'createTime',
      key: 'createTime',
      render: text => <span>{moment(text).format("YYYY-MM-DD HH:mm")}</span>
    }, {
      title: '操作',
      key: 'action',
      render: (text, record) => (
        <span>
          <label onClick={() => this.showModal(record.id)} className='theme-color' style={{ cursor: 'pointer' }}>编辑</label>
          <Divider type="vertical" />
          <label onClick={() => this.deleteItems(record.id)} className='theme-color' style={{ cursor: 'pointer' }}>删除</label>
        </span>
      ),
    }];
    const { data, resetKey, visible, loading, savedate, closeKey } = this.state;
    return (
      <div className="app-page">
        <HeadView history={this.props.history} />
        <TableBtnView key={-resetKey} type="infoManage" name='涉未成年负责部门组织' btnName='新建公司' onClick={() => this.showModal('new')}>
          <Input placeholder="根据公司名称模糊查询" style={{ width: "200px" }} name='companyName' onChange={this.onInputChange} />
          <Input placeholder="根据法人姓名模糊查询" style={{ width: "200px" }} name='companyLegal' onChange={this.onInputChange} />
          <Input placeholder="根据联系电话模糊查询" style={{ width: "200px" }} name='companyTel' onChange={this.onInputChange} />
          <Input placeholder="根据管理员账号模糊查询" style={{ width: "200px" }} name='companyAccount' onChange={this.onInputChange} />
          <DatePicker onChange={(_, value) => this.onInputChange({ target: { name: 'createTime', value } })} placeholder="根据创建时间查询" />
          <Button type="primary" onClick={this.Seaech}>查询</Button>
          <Button onClick={this.Reset}>重置</Button>
        </TableBtnView>
        <TableView columns={columns} data={data} pageSize='10' size='default' />
        <Modal
          key={closeKey}
          confirmLoading={loading}
          visible={visible}
          title="公司信息"
          onOk={this.handleOk}
          onCancel={this.handleCancel}
          bodyStyle={{ lineHeight: 4 }}
        >
          <Input addonBefore="公司名称" name='companyName' onChange={this.saveInputChange} value={savedate.companyName || ''} />
          <Input addonBefore="法人姓名" name='companyLegal' onChange={this.saveInputChange} value={savedate.companyLegal || ''} />
          <Input addonBefore="联系电话" name='companyTel' onChange={this.saveInputChange} value={savedate.companyTel || ''} />
          <Input addonBefore="公司地址" name='companyAddress' onChange={this.saveInputChange} value={savedate.companyAddress || ''} />
          <Input addonBefore="管理员账号" name='companyAccount' onChange={this.saveInputChange} value={savedate.companyAccount || ''} />
          <Input addonBefore="管理员密码" name='companyPassword' onChange={this.saveInputChange} value={savedate.companyPassword || ''} />
        </Modal>
      </div>
    );
  }
}
SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js
@@ -12,7 +12,9 @@
    loading: false,
    peopleInfo: {},
    signStatus: '',
    id: ""
    id: "",
    topattList:[],
    bottomattList:[]
  },
  /**
@@ -40,7 +42,9 @@
        if (res.data.code == 0) {
          res.data.data.startTime = app.formatDate(res.data.data.startTime)
          that.setData({
            activity: res.data.data
            activity: res.data.data,
            bottomattList:res.data.data.attList.filter((item)=>(item.associateType==1020)),
            topattList:res.data.data.attList.filter((item)=>(item.associateType==1000))
          })
          console.log('传过来', options.flag)
          console.log('传过来', options.signStatus)
SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxml
@@ -2,7 +2,7 @@
<view class="fzpxInfo-bg" wx:if="{{!loading}}">
    <view class="flex1">
        <swiper class="screen-swiper square-dot" indicator-dots="true" circular="true" autoplay="true" interval="5000" duration="500">
            <swiper-item wx:for="{{activity.attList}}" wx:key>
            <swiper-item wx:for="{{topattList}}" wx:key>
                <image src="{{item.imgPath}}" mode="aspectFill"></image>
                <!-- <video src="{{item.url}}" autoplay loop muted show-play-btn="{{false}}" controls="{{false}}" objectFit="cover" wx:if="{{item.type=='video'}}"></video> -->
            </swiper-item>
@@ -39,6 +39,20 @@
                    <view class="fzpxInfo-main-group-around">{{activity.activityDesc}}</view>
                </view>
            </view>
            <view wx:if="{{activity.result}}" class="fzpxInfo-main-group">
                <view class="fzpxInfo-main-group-title">培训结果</view>
                <view class="fzpxInfo-main-group-around">{{activity.result}}</view>
            </view>
            <view wx:if="{{activity.result}}" class="fzpxInfo-main-group">
                <view class="fzpxInfo-main-group-title">培训材料</view>
                <view class="fzpxInfo-main-group-around" style="display:flex;flex-wrap: wrap">
                    <view class="educt_hasupload_pic" wx:for="{{bottomattList}}" wx:key="index">
                        <image src="{{item.imgPath}}" class="upload"></image>
                    </view>
                </view>
            </view>
        </view>
        <block wx:if="{{activity.activityStatus == 1 && flag == 'true'}}">
SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.wxss
@@ -76,6 +76,15 @@
  font-weight: 600;
}
.upload {
  width: 48px;
  height: 48px;
}
.educt_hasupload_pic {
  margin: 4px;
}
.fzpxInfo-foot-txt {
  margin: 6px 6px 24px;
  line-height: 22PX;