Commit c88e707e authored by baixian's avatar baixian

公众号配置管理完成

parent 76b5e46a
......@@ -9,12 +9,24 @@ import {
import errorcode from '../common/errorcode';
import * as usersAjax from '../services/users';
import * as schoolajax from '../services/schooladd';
import * as themeListAjax from '../services/newthemelist';
import * as classMgtAjax from '../services/classmgt';
export default {
namespace: 'institutions',
state: {
categorys: [],
schoolDetail: {},
manageTab: 1,
punchList: [], // 打卡列表
punchListTotal: 0,
punchListParams: {
title: '',
page: 1,
perPage: 10,
subject_type: '',
class_id: '',
},
classList: [],
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
......@@ -28,6 +40,16 @@ export default {
categorys: [],
schoolDetail: {},
manageTab: 1,
punchList: [], // 打卡列表
punchListTotal: 0,
punchListParams: {
title: '',
page: 1,
perPage: 10,
subject_type: '',
class_id: '',
},
classList: [],
},
});
},
......@@ -36,11 +58,35 @@ export default {
yield put({
type: 'getcategorys',
});
const loading = message.loading('数据加载中...', 0);
yield put({
type: 'queryClassList',
});
yield put({
type: 'queryList',
payload: {
params: {},
},
});
yield put({
type: 'rolemanage/queryRoleList',
payload: {
params: {},
},
});
yield put({
type: 'personmanage/queryPeopleList',
payload: {
params: {},
},
});
yield put({
type: 'holidays/queryList',
payload: {
},
});
const schoolDetailData = yield call(usersAjax.schoolDetail, {
id: sid,
});
setTimeout(loading);
if (schoolDetailData.code == 200) {
try {
schoolDetailData.data.tel_phone = JSON.parse(schoolDetailData.data.tel_phone);
......@@ -61,33 +107,108 @@ export default {
},
});
}
},
* getcategorys({ payload }, { call, put }) {
const categorys = yield call(schoolajax.getCategorys);
yield put({
type: 'rolemanage/queryRoleList',
type: 'updateState',
payload: {
params: {},
categorys: categorys.data.list,
},
});
yield put({
type: 'personmanage/queryPeopleList',
payload: {
params: {},
},
},
// 查询作业打卡列表
* queryList({ payload }, { call, put, select }) {
const { params } = payload;
const { sid } = yield select(state => state.webapp);
const { punchListParams, punchListTotal } = yield select(state => state.institutions);
const loading = message.loading('数据加载中...', 0.5);
const newParams = Object.assign(punchListParams, params, {
school_id: sid,
});
yield put({
type: 'holidays/queryList',
payload: {
},
let newTotal = punchListTotal;
const data = yield call(themeListAjax.clockList, {
...newParams,
});
setTimeout(loading);
if (data.code == 200) {
if (data.data.total != undefined) {
newTotal = data.data.total;
}
let url = '';
const newList = data.data.list;
newList.forEach((item, index) => {
switch (item.subject_type) {
case 1:
url = `src/pages/themeindex/landpage?tid=${item.id}&sid=${sid}`;
break;
case 2:
url = `src/pages/calendarthemeindex/landpage?tid=${item.id}&sid=${sid}`;
break;
case 3:
url = `src/pages/sharemoretheme/index?tid=${item.id}&sid=${sid}`;
break;
default:
url = '';
break;
}
// eslint-disable-next-line no-param-reassign
item.jump_path = url;
});
yield put({
type: 'updateState',
payload: {
punchList: newList,
punchListTotal: newTotal,
punchListParams: { ...newParams },
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* getcategorys({ payload }, { call, put }) {
const categorys = yield call(schoolajax.getCategorys);
* reset({ payload }, { call, put, select }) {
yield put({
type: 'updateState',
type: 'queryList',
payload: {
categorys: categorys.data.list,
params: {
title: '',
page: 1,
perPage: 10,
subject_type: '',
class_id: '',
},
},
});
},
* queryClassList({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const classListData = yield call(classMgtAjax.getClassList, {
school_id: sid,
page: 1,
perPage: 1000,
});
if (classListData.code == 200) {
yield put({
type: 'updateState',
payload: {
classList: (classListData.data && classListData.data.list) || [],
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data: classListData,
},
});
}
},
},
reducers: {
save(state, action) {
......
......@@ -100,7 +100,7 @@ class EditClassModal extends React.Component {
}
const { getFieldDecorator } = this.props.form;
const selectBefore = (
<div>{title.length || 0}/20</div>
<div>{title.length || 0}/30</div>
);
return (
<Modal
......@@ -152,9 +152,9 @@ class EditClassModal extends React.Component {
initialValue: editClassInfo.title,
rules: [
{ required: true, message: '班级名称不能为空' },
{ max: 20, message: '班级名称最多20字符' },
{ max: 30, message: '班级名称最多30字符' },
],
})(<Input type="text" maxLength={20} onChange={e => this.titleChange(e)} addonAfter={selectBefore} placeholder="请输入班级名称" />)}
})(<Input type="text" maxLength={30} onChange={e => this.titleChange(e)} addonAfter={selectBefore} placeholder="请输入班级名称" />)}
</Form.Item>
<Form.Item
label="班级容量:"
......
......@@ -9,6 +9,7 @@ import SchoolInfo from './schoolinfo/index';
import PersonManage from './personmanage/index';
import RoleManage from './rolemanage/index';
import HolidaysSetting from './holidays/index';
import PublicSet from './publicset/index';
const { TabPane } = Tabs;
class Institutions extends React.Component {
componentDidMount() { // 挂载
......@@ -31,6 +32,9 @@ class Institutions extends React.Component {
case 4:
pageIn('节假日设置');
break;
case 5:
pageIn('公众号跳转配置');
break;
default:
pageIn('机构管理');
break;
......@@ -64,6 +68,9 @@ class Institutions extends React.Component {
<TabPane tab="节假日设置" key="4">
<HolidaysSetting />
</TabPane>
<TabPane tab="公众号跳转配置" key="5">
<PublicSet />
</TabPane>
</Tabs>
</div>
</div>
......
import { connect } from 'dva';
import React from 'react';
import {
Icon,
Button,
Row,
Col,
Input,
Select,
Checkbox,
Table,
Modal,
Form,
Alert,
Badge,
message,
Pagination,
Tooltip, DatePicker,
Divider,
Avatar,
} from 'antd';
import moment from 'moment';
import { routerRedux } from 'dva/router';
import ClipboardJS from 'clipboard';
import pageStyle from './index.less';
import { pageIn, hasBtnPower, btnPermission, translateType, imagify } from '../../../utils/index';
const { Option } = Select;
const { TextArea } = Input;
const { Search } = Input;
class LiveClass extends React.Component {
constructor(props) {
super(props);
this.state = {
};
}
componentDidMount() { // 挂载
this.clipboard = new ClipboardJS('#btnCopyLink1'); // 点击按钮复制到粘贴板
this.clipboard.on('success', () => {
message.success('复制成功', 0.3);
});
}
componentWillUnmount() { // 卸载
}
changePagination = (page, perPage) => {
const { dispatch } = this.props;
dispatch({
type: 'institutions/queryList',
payload: {
params: {
page,
perPage,
},
},
});
}
sizeChange = (page, perPage) => {
const { dispatch } = this.props;
dispatch({
type: 'institutions/queryList',
payload: {
params: {
page: 1,
perPage,
},
},
});
}
searchParamsChange = (e, type, key) => {
const { dispatch } = this.props;
let getvalue = '';
if (type == 'Input') {
getvalue = e;
} else if (type == 'Select') {
getvalue = e;
}
dispatch({
type: 'institutions/queryList',
payload: {
params: {
page: 1,
[key]: getvalue || '',
},
},
});
}
reset = () => {
const { dispatch } = this.props;
// // eslint-disable-next-line react/no-string-refs
// this.refs.searchBar.input.state.value = '';
dispatch({
type: 'institutions/reset',
});
}
render() {
const {
punchList,
punchListTotal,
punchListParams,
classList,
sid,
} = this.props;
const columns = [
{
title: '页面',
dataIndex: 'title',
key: 'title',
width: 300,
},
// {
// title: '主题类型',
// dataIndex: 'subject_type',
// align: 'center',
// key: 'subject_type',
// render: (text, record, index) => (
// <div className={pageStyle.tablecell}>
// {record.subject_type == 1 && '作业打卡'}
// {record.subject_type == 2 && '日历打卡'}
// {record.subject_type == 3 && '闯关打卡'}
// </div>
// ),
// },
{
title: '跳转地址',
dataIndex: 'jump_path',
key: 'jump_path',
width: 800,
},
{
title: '操作',
dataIndex: '',
align: 'center',
key: 'x',
render: (text, record) => (
<div className={pageStyle.tablecell}>
<span id="btnCopyLink1" className="hreflink" data-clipboard-text={record.jump_path}>复制地址</span>
</div>
),
}];
const dataSource = [
{
key: '1',
url: `src/pages/websiteindex/index?sid=${sid}`,
name: '微官网页',
},
{
key: '2',
url: `src/pages/papersquare/index?sid=${sid}`,
name: '习作广场页',
},
];
const defaultColumns = [
{
title: '页面',
dataIndex: 'name',
key: 'name',
width: 300,
},
{
title: '跳转地址',
dataIndex: 'url',
key: 'url',
width: 800,
},
{
title: '操作',
dataIndex: 'address',
key: 'address',
align: 'center',
render: (text, record) => (
<div className={pageStyle.tablecell}>
<span id="btnCopyLink1" className="hreflink" data-clipboard-text={record.url}>复制地址</span>
</div>
),
},
];
return (
<div className={pageStyle.container}>
<div className={pageStyle.tablebox} style={{ marginTop: 15 }}>
<Table
dataSource={dataSource}
columns={defaultColumns}
footer={null}
pagination={false}
bordered
scroll={{ x: 'max-content' }}
/>
</div>
<div className={pageStyle.searchbox}>
<Row
gutter={{
sm: 24, xs: 24, md: 24, lg: 24,
}}
className={pageStyle.searchrow}
>
{/* <Col className={pageStyle.formitem} xs={{ span: 12 }} sm={{ span: 12 }} md={{ span: 4 }} lg={{ span: 4 }} xl={{ span: 4 }}> */}
{/* <div className={pageStyle.formitemlabel}>打卡名称:</div> */}
{/* /!* eslint-disable-next-line react/no-string-refs *!/ */}
{/* <Search allowClear style={{ width: '100%' }} ref="searchBar" placeholder="请输入打卡名称" onSearch={e => this.searchParamsChange(e, 'Input', 'title')} /> */}
{/* </Col> */}
<Col className={pageStyle.formitem} xs={{ span: 12 }} sm={{ span: 12 }} md={{ span: 4 }} lg={{ span: 4 }} xl={{ span: 4 }}>
<div className={pageStyle.formitemlabel}>所在班级:</div>
<Select allowClear style={{ width: '100%', overflow: 'hidden' }} className={pageStyle.selectitem} value={punchListParams.class_id ? punchListParams.class_id : undefined} onChange={e => this.searchParamsChange(e, 'Select', 'class_id')} placeholder="全部班级">
{classList.map(ele => <Option key={ele.id} value={ele.id}>{ele.title}</Option>)}
</Select>
</Col>
<Col className={pageStyle.formitem} xs={{ span: 12 }} sm={{ span: 12 }} md={{ span: 4 }} lg={{ span: 4 }} xl={{ span: 4 }}>
<div className={pageStyle.formitemlabel}>全部类型:</div>
<Select allowClear style={{ width: '100%', overflow: 'hidden' }} className={pageStyle.selectitem} value={punchListParams.subject_type ? punchListParams.subject_type : undefined} onChange={e => this.searchParamsChange(e, 'Select', 'subject_type')} placeholder="全部">
<Option value={1}>作业打卡</Option>
<Option value={2}>日历打卡</Option>
<Option value={3}>闯关打卡</Option>
</Select>
</Col>
<Col className={pageStyle.formitem} xs={{ span: 4 }} sm={{ span: 4 }} md={{ span: 2 }} lg={{ span: 2 }} xl={{ span: 2 }}>
<div className={pageStyle.rightList}>
<Tooltip title="清空筛选">
<img onClick={this.reset} className={pageStyle.resetIcon} src={`${__IMGCDN__}common/reset.png`} alt="" />
</Tooltip>
</div>
</Col>
</Row>
</div>
<div className={pageStyle.tablebox}>
<Table
rowKey="id"
dataSource={punchList}
columns={columns}
scroll={{ x: 'max-content' }}
pagination={false}
bordered
footer={null}
/>
<div className={pageStyle.tablefooterbox}>
<span className={pageStyle.tablefooterstatic}>{punchListTotal}条数据</span>
<Pagination
showSizeChanger
showQuickJumper
onShowSizeChange={this.sizeChange}
total={Number(punchListTotal)}
onChange={this.changePagination}
current={Number(punchListParams.page) || 1}
pageSize={punchListParams.perPage}
/>
</div>
</div>
<p className={pageStyle.tip}>
如您想将学校公众号菜单便捷的跳至轻校小程序相关页面,请打开微信公众号管理后台 “自定义菜单”,在如上表格中复制您需要配置的 “跳转地址” 至小程序路径 “保存发布” 即可。
</p>
</div>
);
}
}
LiveClass.propTypes = {
};
const LiveClassForm = Form.create()(LiveClass);
function mapStateToProps(state) {
const {
punchList,
punchListTotal,
punchListParams,
classList,
} = state.institutions;
const {
sid,
} = state.webapp;
return {
punchList,
punchListTotal,
punchListParams,
classList,
sid,
};
}
export default connect(mapStateToProps)(LiveClassForm);
@import '../../../less/variables.less';
.container {
background-color: #fff;
border-radius: 2px;
}
.headerbox{
background-color: #fff;
.headerbtn {
color: #2194FF;
font-size: 14px;
cursor: pointer;
}
padding-bottom: 18px;
}
.searchbox {
margin-top: 15px;
}
.searchrow {
margin-bottom: 20px;
.formitem {
display: flex;
align-items: center;
.formitemlabel {
color: #000000;
font-size: 14px;
line-height: 1;
min-width: 70px;
white-space: nowrap;
}
}
}
.selectitem {
display: block;
}
.searchbtnbox {
height: 54px;
display: flex;
align-items: flex-end;
}
.resetbtn {
margin-right: 16px;
}
.tablebox {
background: #fff;
:global {
.ant-table-fixed {
border-bottom: 1px solid #E8E8E8 !important;
}
.ant-table tbody tr:nth-child(2n) {
background-color: #FBFBFB;
}
.ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 11px 10px;
}
.ant-table-bordered .ant-table-tbody tr td {
border-bottom: none;
border-right: none!important;
}
.ant-table-bordered .ant-table-thead tr th {
border-bottom: none;
border-right: none!important;
}
.ant-table-bordered .ant-table-thead tr th:last-child {
border-right: 1px solid #e8e8e8!important;
}
.ant-table-bordered .ant-table-tbody tr td:last-child {
border-right: 1px solid #e8e8e8!important;
}
.ant-table-bordered .ant-table-tbody tr:last-child {
border-bottom: 1px solid #e8e8e8!important;
}
}
}
.divideline {
color: #E9E9E9;
padding: 0 8px;
}
.alink {
color: #1890FF;
}
.classNamebox {
max-width: 250px;
word-break: break-all;
color: #1890FF;
cursor: pointer;
}
.tableoperatebox {
min-width: 160px;
line-height: 30px;
}
.endsearchcol {
margin-bottom: 18px;
}
.endclassfooter {
display: flex;
align-items: center;
justify-content: space-between;
}
.classroomitem {
margin-bottom: 5px;
.classroom {
color:rgba(0,0,0,0.85);
}
.aLink {
color: #1890FF;
padding-left: 21px;
}
}
.rightList {
display: flex;
align-items: center;
height: 32px;
.resetIcon {
width: 14px;
height: 14px;
cursor: pointer;
margin-right: 15px;
}
.expend {
font-size:13px;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(102,102,102,1);
display: inline-block;
cursor: pointer;
}
}
.tablefooterbox {
color: rgba(0,0,0,0.6);
font-size: 16px;
line-height: 50px;
display: flex;
background-color: #fff;
align-items: center;
justify-content: space-between;
padding-left: 14px;
padding-right: 14px;
margin-top: 10px;
.tablefooterstatic {
color:rgba(0,0,0,0.65);
font-size: 14px;
}
}
.shiftbox {
display: flex;
align-items: center;
border-bottom: 1px solid #e8e8e8;
.tabitem {
color: #000000;
font-size: 16px;
line-height: 1;
padding: 10px 11px 10px;
border-bottom: 3px solid transparent;
margin: 0 20px;
cursor: pointer;
&:first-child {
margin-left: 0;
}
&.active {
border-color: #1890FF;
color: #1890FF;
font-weight: 700;
}
&:hover {
border-color: #1890FF;
color: #1890FF;
font-weight: 700;
}
}
}
.formList {
margin: 10px 0;
}
.tip {
text-align: right;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment