Commit 037ccb09 authored by wangxuelai's avatar wangxuelai

'合并白旺旺分支'

parents ab9e1e29 371d834a
......@@ -11,7 +11,7 @@
<script src="js/console-polyfill.js"></script>
<![endif]-->
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=XSZBZ-5LHCV-5I2P7-UQHPW-6456F-JBB3B"></script>
<script src="/js/ueeditor/ueditor.config.js?20200107" charset="utf-8"></script><script src="/js/ueeditor/ueditor.all.js?20200107" charset="utf-8"></script>
<script src="js/console-polyfill.js?20200107" charset="utf-8"></script><script src="js/es6-shim.min.js?20200107" charset="utf-8"></script><script src="js/es5-shim.js?20200107" charset="utf-8"></script><script src="js/es5-sham.min.js?20200107" charset="utf-8"></script><script src="js/json3.min.js?20200107" charset="utf-8"></script><script src="js/html5shiv.min.js?20200107" charset="utf-8"></script><script src="js/polyfill.js?20200107" charset="utf-8"></script><script src="lib/vendor.dll.js?20200107" charset="utf-8"></script>
</head>
......@@ -19,4 +19,4 @@
<body>
<div id="root"></div>
<script type="text/javascript" src="/dist/main.1b5c4c.js"></script></body>
</html>
\ No newline at end of file
</html>
......@@ -3862,6 +3862,51 @@
}
}
},
"braft-convert": {
"version": "2.3.0",
"resolved": "https://registry.npm.taobao.org/braft-convert/download/braft-convert-2.3.0.tgz",
"integrity": "sha1-J9WQUTbDNJA9CDt6I1KnIEVieIg=",
"requires": {
"draft-convert": "^2.0.0",
"draft-js": "^0.10.3"
}
},
"braft-editor": {
"version": "2.3.9",
"resolved": "https://registry.npm.taobao.org/braft-editor/download/braft-editor-2.3.9.tgz?cache=0&sync_timestamp=1582864845919&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbraft-editor%2Fdownload%2Fbraft-editor-2.3.9.tgz",
"integrity": "sha1-/SuOI+pxGRAWV5oe2CMdFq2PW0o=",
"requires": {
"@babel/runtime": "^7.0.0",
"braft-convert": "^2.3.0",
"braft-finder": "^0.0.19",
"braft-utils": "^3.0.8",
"draft-convert": "^2.0.0",
"draft-js": "^0.10.3",
"draft-js-multidecorators": "^1.0.0",
"draftjs-utils": "^0.9.4",
"immutable": "~3.7.4"
}
},
"braft-extensions": {
"version": "0.1.0",
"resolved": "https://registry.npm.taobao.org/braft-extensions/download/braft-extensions-0.1.0.tgz",
"integrity": "sha1-Xd3iLqkzmTZJBiBkl7d9j7oke1c=",
"requires": {
"@babel/runtime": "^7.0.0",
"braft-convert": "^2.1.10",
"braft-utils": "^3.0.12"
}
},
"braft-finder": {
"version": "0.0.19",
"resolved": "https://registry.npm.taobao.org/braft-finder/download/braft-finder-0.0.19.tgz",
"integrity": "sha1-wyTYJSbtNHapPehsybQH9OGIvI0="
},
"braft-utils": {
"version": "3.0.12",
"resolved": "https://registry.npm.taobao.org/braft-utils/download/braft-utils-3.0.12.tgz",
"integrity": "sha1-K3Vc4dg5fZa2J7Z2f3TQfyVynYU="
},
"brorand": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/brorand/download/brorand-1.1.0.tgz",
......@@ -5600,6 +5645,16 @@
"domelementtype": "1"
}
},
"draft-convert": {
"version": "2.1.8",
"resolved": "https://registry.npm.taobao.org/draft-convert/download/draft-convert-2.1.8.tgz",
"integrity": "sha1-BQjvr+6nnhHleTuncZSBKLoVEpE=",
"requires": {
"@babel/runtime": "^7.5.5",
"immutable": "~3.7.4",
"invariant": "^2.2.1"
}
},
"draft-js": {
"version": "0.10.5",
"resolved": "https://registry.npm.taobao.org/draft-js/download/draft-js-0.10.5.tgz",
......@@ -5610,6 +5665,19 @@
"object-assign": "^4.1.0"
}
},
"draft-js-multidecorators": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/draft-js-multidecorators/download/draft-js-multidecorators-1.0.0.tgz",
"integrity": "sha1-bEvo17eN0rlm7lHubMF5ubU15hI=",
"requires": {
"immutable": "*"
}
},
"draftjs-utils": {
"version": "0.9.4",
"resolved": "https://registry.npm.taobao.org/draftjs-utils/download/draftjs-utils-0.9.4.tgz?cache=0&sync_timestamp=1575816792357&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdraftjs-utils%2Fdownload%2Fdraftjs-utils-0.9.4.tgz",
"integrity": "sha1-l2xhqhM9u7/t1lrh3WYn17mMbwg="
},
"duplexer": {
"version": "0.1.1",
"resolved": "https://registry.npm.taobao.org/duplexer/download/duplexer-0.1.1.tgz",
......
......@@ -26,6 +26,8 @@
"bizcharts": "^3.5.5",
"bizcharts-plugin-slider": "^2.1.1-beta.1",
"blueimp-md5": "^2.10.0",
"braft-editor": "^2.3.9",
"braft-extensions": "^0.1.0",
"bundle-loader": "^0.5.6",
"clipboard": "^2.0.4",
"co": "^4.6.0",
......
......@@ -124,10 +124,21 @@ export default {
setBanner: `${dakaapi}member/website/school/set_banner`,
courseInfoAdd: `${dakaapi}member/website/course`,
courseInfoUpdate: `${dakaapi}member/website/course`,
schoolIntro: `${dakaapi}member/website/intro`,
schoolIntro: `${dakaapi}member/website/intros`,
schoolIntroSave: `${dakaapi}member/website/intro/save`,
schoolIntroDel: `${dakaapi}member/website/intro/destroy`,
moduleSort: `${dakaapi}member/website/school/module_sort`,
clockList: `${dakaapi}common/clock`,
ads: `${dakaapi}member/website/ads`,
adsSave: `${dakaapi}member/website/ad/save`,
moments: `${dakaapi}member/website/moments`,
momentSave: `${dakaapi}member/website/moment/save`,
onlineClass: `${dakaapi}member/website/online_courses`,
onlineClassSave: `${dakaapi}member/website/online_course/save`,
subjectMixture: `${dakaapi}member/website/subject_mixtures`,
subjectMixtureSave: `${dakaapi}member/website/subject_mixture/save`,
teacher: `${dakaapi}member/website/teachers`,
teacherSave: `${dakaapi}member/website/teacher/save`,
},
schedule: `${dakaapi}member/erp/schedules`,
scheduleMgt: {
......
import { connect } from 'dva';
import React from 'react';
import { Icon, Divider, Tabs, Select, Form, Upload, Row, Col, Input, Radio, Modal, message } from 'antd';
import pageStyle from './CommonEditor.less';
import api from '../common/api';
import { pageIn, hasBtnPower, LocalStorage, imagify, ossVideofy, audioorigin } from '../utils/index';
const upImg = `${__IMGCDN__}subjectUp.png`;
const { TabPane } = Tabs;
const { TextArea } = Input;
class CommonEditor extends React.Component {
constructor(props) {
super(props);
this.state = {
};
}
clearHtml = () => {
if (this.uEditor) {
this.uEditor.execCommand('cleardoc');
}
}
componentWillUnmount() {
if (this.uEditor) {
this.uEditor.destroy();
}
clearTimeout(this.timeout2);
clearTimeout(this.setTimeout3);
}
componentDidMount() { // 挂载
this.renderEditor();
}
renderEditor = () => {
const { sid, commentParams } = this.props;
const that = this;
if (UE && document.getElementById('editor_id')) {
that.uEditor = UE.getEditor('editor_id', {
autoHeightEnabled: false,
zIndex: 10,
allowDivTransToP: false,
// UEDITOR_HOME_URL: '../../js/ueeditor/',
materiaImgUrl: api.courseMateria.index,
materiaImgParams: {
school_id: LocalStorage.getItem('sid') || 0,
type: 1,
// page: 1
// perPage: 12
trans_status: 2,
},
elementPathEnabled: false,
requestUser: LocalStorage.getItem('user') || {},
serverUrl: api.editorUpload,
imageFieldName: 'file',
initialFrameHeight: 150,
removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',
toolbars: [
[
'undo', // 撤销
'redo', // 重做
'fontsize', // 字号
'forecolor', // 字体颜色
'bold', // 加粗
'italic', // 斜体
'underline', // 下划线
'simpleupload', // 单图上传
'insertimage', // 多图上传
'emotion', // 表情
'spechars', // 特殊字符
'justifyleft', // 居左对齐
'justifyright', // 居右对齐
'justifycenter', // 居中对齐
'justifyjustify', // 两端对齐
// 'fullscreen', // 全屏
'imagecenter', // 居中
'edittip ', // 编辑提示
],
],
});
that.timeout2 = setTimeout(() => {
if (document.getElementById('editor_id')) {
const { sid, commentParams } = that.props;
if (commentParams.content && commentParams.content.length == 1) {
if (commentParams.content[0].type == 'editor' && commentParams.content[0].value != '') {
that.uEditor.ready(() => {
that.uEditor.setContent(commentParams.content[0].value);
});
}
}
}
that.uEditor.ready(() => {
that.uEditor.setHeight(150);
that.uEditor.addListener('contentChange', () => {
that.props.uEditorChange(this.uEditor.getContent());
});
});
}, 800);
} else {
that.setTimeout3 = setTimeout(() => {
that.renderEditor();
}, 200);
}
}
render() {
const {
commentParams,
editorAdd,
} = this.props;
console.log(commentParams, 'commentParams');
return (
<div className={pageStyle.container}>
<div className={pageStyle.editor}>
{/* eslint-disable-next-line array-callback-return,consistent-return */}
{commentParams.content.map((item, index) => {
// eslint-disable-next-line default-case
switch (item.type) {
case 'editor':
return (
<div key={index} className={pageStyle.editorwrap}>
<textarea id="editor_id" name="content" style={{ width: '630px', height: '150px' }}>
</textarea>
</div>
);
}
},
)}
</div>
<div className={pageStyle.adding} onClick={editorAdd}>
添加图文
</div>
</div>
);
}
}
CommonEditor.propTypes = {
};
export default connect()(CommonEditor);
.textWrap {
height: auto;
position: relative;
margin-bottom:10px;
:global {
.ant-input {
padding: 6px 15px 20px;
}
}
.sizeNumber {
position: absolute;
bottom: 8px;
right: 10px;
}
}
.templatesbox {
line-height: initial;
width: 282px;
border:1px solid rgba(0,0,0,0.15);
.templatesheader {
background-color: #D9D9D9;
line-height: 37px;
color: #616161;
font-size: 16px;
text-align: center;
}
.templatesbody {
padding: 9px;
max-height: 550px;
overflow-y: scroll;
.templatesitem {
margin-bottom: 12px;
.imgbox {
width: 100%;
height: 135px;
border-radius: 6px;
overflow: hidden;
position: relative;
img {
height: 135px;
display: block;
width: 100%;
}
&:hover .templateoperate {
display: flex;
}
.templateoperate {
display: none;
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
left: 0;
top: 0;
z-index: 1;
// display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
.operateitem {
letter-spacing: 1px;
line-height: 40px;
color: #FFFFFF;
font-size: 14px;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
.operateicon {
margin-right: 4px;
}
&.preview {
.operateicon {
width: 16px;
height: 12px;
}
}
&.use {
.operateicon {
width: 16px;
height: 16px;
}
}
cursor: pointer;
&:hover {
background-color: rgba(0,0,0,0.5);
}
}
}
}
.templatename {
color: #616161;
font-size: 12px;
text-align: center;
margin-top: 4px;
}
}
}
}
.editorwrap {
position: relative;
height: 100px;
}
.uploadflex {
display: flex;
align-items: center;
.uploadimg {
cursor: pointer;
width: 106px;
height: 32px;
line-height: 32px;
text-align: center;
border: 1px solid #D9D9D9;
border-radius: 4px;
color: rgba(0,0,0,0.65);
position: relative;
margin-right: 30px;
.fileuploadinput {
cursor: pointer;
position: absolute;
width: 100%;
height: 100%;
z-index: 1;
opacity: 0;
left: 0;
top: 0;
}
}
}
.toolList {
position: absolute;
right: -30px;
top: 0;
width: 30px;
height: 90px;
display: flex;
flex-direction: column;
background-color: #D3D3D3;
opacity: 0;
border-radius: 2px;
z-index: -1;
div {
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-size: 14px;
cursor: pointer;
}
div>img {
width: 14px;
height: 14px;
}
.up:hover {
background-color: #1890FF;
}
.down,.nodown {
transform: rotate(180deg);
}
.nodown,.noup {
cursor: not-allowed;
}
.down:hover {
background-color: #1890FF;
}
.delete:hover {
background-color: #FF6060;
}
}
.textWrap:hover,.imgwrap:hover,.videowrap:hover {
.toolList {
opacity: 1;
z-index: 1;
}
}
.editor {
width: 738px;
min-height: 319px;
padding: 0 40px 126px;
background-color: #fafafa;
-webkit-border-radius: 4px;
border-radius: 4px;
border: 1px solid #eee;
}
......@@ -16,6 +16,11 @@ export default {
previewQrcode: '',
previewQrcodeShow: false,
downloadTitle: '',
editorParams: {
content: [
{ type: 'editor', value: '' },
],
},
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
......@@ -68,6 +73,33 @@ export default {
message.error('小程序码生成失败', 1);
}
},
* uEditorChange({ payload }, { call, put, select }) {
const { value } = payload;
const { editorParams } = yield select(state => state.common);
editorParams.content = [{
type: 'editor',
value,
}];
yield put({
type: 'updateState',
payload: {
editorParams: { ...editorParams },
},
});
},
* editorAdd({ payload }, { call, put, select }) {
const { editorParams } = yield select(state => state.common);
editorParams.content.push({
type: 'editor',
value: '',
});
yield put({
type: 'updateState',
payload: {
editorParams: { ...editorParams },
},
});
},
* pageInit({ payload }, { call, put, select }) {
yield put({
type: 'updateState',
......@@ -75,6 +107,11 @@ export default {
previewQrcode: '',
previewQrcodeShow: false,
downloadTitle: '',
editorParams: {
content: [
{ type: 'editor', value: '' },
],
},
},
});
},
......
......@@ -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) {
......
This diff is collapsed.
......@@ -64,6 +64,7 @@ export default {
signature, avatorUploader, files, uploaderLoading, uploadtype, orgIndex, imgIndex, orgType, action,
} = payload;
const file = files.files ? files.files[0] : null;
console.log(file, 'file');
uploaderLoading();
const filename = `${signature.dir}${getRandomFilename(file.name)}`;
const params = {
......@@ -171,6 +172,10 @@ export default {
});
const {
bannerImg, course, orgdescs,
adCarousel,
classMoment,
schoolIntro,
teachers,
} = yield select(state => state.officialweb);
const {
cropperUrl, filename, uploadtype, orgType, orgIndex, imgIndex, action,
......@@ -243,6 +248,43 @@ export default {
goodImage: `${filename}?x-oss-process=${cropperUrl}`,
},
});
} else if (uploadtype == 'uploadAdBanner') {
adCarousel[imgIndex].cover = `${filename}?x-oss-process=${cropperUrl}`;
yield put({
type: 'officialweb/updateState',
payload: {
adCarousel: [...adCarousel],
},
});
} else if (uploadtype == 'uploadClassMomentImg') {
classMoment[imgIndex].content.push({
type: 'img',
value: `${filename}?x-oss-process=${cropperUrl}`,
});
yield put({
type: 'officialweb/updateState',
payload: {
classMoment: [...classMoment],
},
});
} else if (uploadtype == 'uploadSchoolIntro') {
if (orgType == 1) {
schoolIntro[imgIndex].content = `${filename}?x-oss-process=${cropperUrl}`;
yield put({
type: 'officialweb/updateState',
payload: {
schoolIntro: [...schoolIntro],
},
});
}
} else if (uploadtype == 'uploadTeacherAvatar') {
teachers[imgIndex].avatar = `${filename}?x-oss-process=${cropperUrl}`;
yield put({
type: 'officialweb/updateState',
payload: {
teachers: [...teachers],
},
});
}
},
* unloadstates({ payload }, { call, put }) { // 释放该页面存储的所有状态
......
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 { pageIn, hasBtnPower, btnPermission, translateType, imagify } from '../../utils/index';
import BtnPermission from '../../components/BtnPermission';
import CommonEditor from '../../components/CommonEditor';
import Editor from '../liveclass/components/Editor';
const { Option } = Select;
const { TextArea } = Input;
const { Search } = Input;
const { RangePicker } = DatePicker;
class LiveClass extends React.Component {
constructor(props) {
super(props);
this.state = {
};
this.editorref = React.createRef();
}
componentDidMount() { // 挂载
pageIn('直播课堂');
}
disabledDate = (current) => {
return current && current > moment();
}
componentWillUnmount() { // 卸载
}
uEditorChange = (value) => {
const { dispatch } = this.props;
dispatch({
type: 'common/uEditorChange',
payload: {
value,
},
});
}
editorAdd = () => {
const { dispatch } = this.props;
dispatch({
type: 'common/editorAdd',
payload: {
},
});
}
render() {
const {
editorParams,
} = this.props;
return (
<div>
<div style={{ marginTop: 100 }}>
<CommonEditor
ref={this.editorref.current}
uEditorCallback={this.uEditorCallback}
uEditorChange={this.uEditorChange}
commentParams={editorParams}
editorAdd={this.editorAdd}
/>
</div>
</div>
);
}
}
LiveClass.propTypes = {
};
const LiveClassForm = Form.create()(LiveClass);
function mapStateToProps(state) {
const {
editorParams,
} = state.common;
return {
editorParams,
};
}
export default connect(mapStateToProps)(LiveClassForm);
......@@ -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;
}
import React from 'react';
import { Modal, Icon, message } from 'antd';
import BraftEditor from 'braft-editor';
import pageStyle from './RichText.less';
import api from '../../common/api';
import { getRandomFilename, LocalStorage } from '../../utils';
class RichText extends React.Component {
constructor(props) {
super(props);
this.state = {
};
}
componentDidMount() { // 挂载
}
componentWillUnmount() { // 卸载
}
myUploadFn = async (param) => {
const formData = new FormData();
const { sid } = this.props;
const user = LocalStorage.getItem('user');
if (param.file && param.file.size > 1000 * 1024 * 1024) {
param.error({
msg: '视频或者图片大小不能超过1GB,请重新上传',
});
return;
}
const res = await fetch(`${api.imgupload}?school_id=${sid}`, {
method: 'GET',
headers: {
Authorization: `Bearer ${user.token}}`,
},
}).then(response => response.json());
console.log(res.data, 'access');
const {
accessid,
policy,
signature,
host,
callback,
dir,
} = res.data;
const filename = `${dir}${param.file.name}`;
const formData2 = new FormData();
formData2.append('key', filename);
formData2.append('policy', policy);
formData2.append('OSSAccessKeyId', accessid);
formData2.append('signature', signature);
if (callback) {
formData2.append('callback', callback);
}
formData2.append('success_action_status', 200);
formData2.append('file', param.file);
const res2 = await fetch(host, {
method: 'POST',
body: formData2,
}).then(response => response.json());
if (res2.status == 'ok') {
console.log(res2, 'res21111111');
param.success({
url: `${host}/${filename}`,
meta: {
loop: true, // 指定音视频是否循环播放
autoPlay: true, // 指定音视频是否自动播放
controls: false, // 指定音视频是否显示控制栏
},
});
} else {
param.error({
msg: '上传错误',
});
}
}
handleChangeEditor = (editorState) => {
const { handleChangeEditor, index } = this.props;
console.log(editorState, 'editorState');
handleChangeEditor(editorState, index);
}
render() {
const {
editorValue,
} = this.props;
const controls = [
'undo', 'redo', 'separator', 'headings',
'font-size', 'line-height',
'text-color', 'bold', 'italic', 'underline', 'strike-through', 'separator',
'remove-styles', 'separator', 'text-align', 'separator', 'hr',
'media', 'separator', 'clear',
];
const accepts = {
audio: false,
};
const imageControls = [
'float-left',
'float-right',
'size',
'remove',
];
console.log(editorValue, 'editorValue');
const newValue = BraftEditor.createEditorState(editorValue);
return (
<div className={pageStyle.container}>
<BraftEditor
contentStyle={{ height: 210, boxShadow: 'inset 0 1px 3px rgba(0,0,0,.1)' }}
media={{ uploadFn: this.myUploadFn, accepts }}
controls={controls}
onChange={this.handleChangeEditor}
value={newValue}
imageControls={imageControls}
/>
</div>
);
}
}
RichText.propTypes = {
};
export default RichText;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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