Commit c3069f20 authored by wangxuelai's avatar wangxuelai

''

parent 0e0b887a
......@@ -5,6 +5,7 @@ webpack.dll.config.js
webpack.config.js
package.json
lib/*
wangeditorjs/*
src/common/distpicker.data.js
src/common/dis.data.js
src/utils/download.js
......
......@@ -7,6 +7,8 @@ if (process.env.NODE_ENV == 'development') {
} else if (process.env.NODE_ENV == 'production') {
imagePath = "'https://cdn.img.shangjiadao.cn/qingxiao/biz/image/'";
}
console.log(process.env.NODE_ENV, 'NODE_ENV');
export default {
"env": {
"development": {
......
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>轻校</title><link rel="shortcut icon" href="https://cdn.img.shangjiadao.cn/qingxiao/biz/image/qxlogo4.png"><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0;" name="viewport"><meta http-equiv="X-UA-Compatible" content="IE=edge"><!-- Polyfills --><!--[if lt IE 10]>
<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><link href="https://cdn.img.shangjiadao.cn/qingxiao/biz/dist/index.css?1568024803493" rel="stylesheet"><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/lib/vendor.dll.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/console-polyfill.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es6-shim.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es5-shim.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es5-sham.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/json3.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/html5shiv.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/polyfill.js?3" charset="utf-8"></script></head><body><div id="root"></div><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/dist/index.js?1568024803493" charset="utf-8"></script></body></html>
\ No newline at end of file
<![endif]--><script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=XSZBZ-5LHCV-5I2P7-UQHPW-6456F-JBB3B"></script><link href="https://cdn.img.shangjiadao.cn/qingxiao/biz/dist/index.css?1568093964459" rel="stylesheet"><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/lib/vendor.dll.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/console-polyfill.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es6-shim.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es5-shim.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es5-sham.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/json3.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/html5shiv.min.js?3" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/polyfill.js?3" charset="utf-8"></script></head><body><div id="root"></div><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/dist/index.js?1568093964459" charset="utf-8"></script></body></html>
\ No newline at end of file
......@@ -39,6 +39,7 @@
"react": "^16.2.0",
"react-dom": "^16.2.0",
"video-react": "^0.14.1",
"wangeditor": "^3.1.1",
"xlsx": "^0.15.0"
},
"devDependencies": {
......@@ -55,7 +56,7 @@
"html-webpack-plugin": "^3.1.0",
"husky": "^0.12.0",
"redbox-react": "^1.4.3",
"roadhog": "^2.0.0",
"roadhog": "^2.5.0-beta.4",
"webpack": "^3.8.1"
}
}
......@@ -67,8 +67,8 @@ export default {
uploaderLoading();
const filename = `${signature.dir}${getRandomFilename(file.name)}`;
const params = {
key: filename,
policy: signature.policy,
key: filename,
OSSAccessKeyId: signature.accessid,
signature: signature.signature,
file,
......
import React from 'react';
import { connect } from 'dva';
import { Row, Col, Modal, Form, Input, Button, message, Icon } from 'antd';
import Editor from '../../../wangeditorjs/wangEditor';
import pageStyles from './index.less';
import * as uploader from '../../services/uploader';
import { pageIn, imagify, getRandomFilename } from '../../utils/index';
const { Search } = Input;
const FormItem = Form.Item;
class WangEditor extends React.Component {
constructor(props) {
super(props);
this.state = {
editorContent: '',
};
}
componentDidMount() {
const that = this;
pageIn('轻校-编辑器');
this.getUploadSingature();
}
componentWillUnmount() {
const { dispatch } = this.props;
}
getUploadSingature() {
const { userInfo, sid } = this.props;
uploader.uploadImageSignature({
type: 1,
token: userInfo.token,
schoolId: sid,
}).then((res) => {
const elem = this.hello;
this.editor = new Editor(elem);
this.editor.customConfig.onchange = (html) => {
this.setState({
editorContent: html,
});
};
this.editor.customConfig.showLinkImg = false;
this.editor.customConfig.menus = [
'head', // 标题
'bold', // 粗体
'fontSize', // 字号
// 'fontName', // 字体
'italic', // 斜体
'underline', // 下划线
// 'strikeThrough', // 删除线
'foreColor', // 文字颜色
'backColor', // 背景颜色
'list', // 列表
'justify', // 对齐方式
'emoticon', // 表情
'image', // 插入图片
'table', // 表格
// 'video', // 插入视频
// 'code', // 插入代码
'undo', // 撤销
'redo', // 重复
];
// 配置图片上传路径
this.editor.customConfig.uploadImgServer = res.data.host;
this.editor.customConfig.uploadImgParams = {
// 如果版本 <=v3.1.0 ,属性值会自动进行 encode ,此处无需 encode
// 如果版本 >=v3.1.1 ,属性值不会自动 encode ,如有需要自己手动 encode
key: res.data.dir,
policy: res.data.policy,
OSSAccessKeyId: res.data.accessid,
signature: res.data.signature,
// file,
// url: signature.host,
};
this.editor.customConfig.uploadFileName = 'file';
this.editor.customConfig.uploadImgHooks = {
// 如果服务器端返回的不是 {errno:0, data: [...]} 这种格式,可使用该配置
// (但是,服务器端返回的必须是一个 JSON 格式字符串!!!否则会报错)
customInsert(insertImg, result, editor) {
const { url } = result;
insertImg(imagify(res.data.dir + result));
},
};
// 配置图片上传路径
this.editor.create();
});
}
getContent = () => {
// console.log('dddddddddddd');
console.log(this.state.editorContent, 'this.editor');
// const content = this.editor.txt.html();
// console.log(content, 'content');
}
render() {
// const {} = this.props;
return (
<div>
<div ref={(c) => { this.hello = c; }} />
<div onClick={this.getContent}>获取内容</div>
</div>
);
}
}
WangEditor.propTypes = {
};
function mapStateToProps(state) {
const {
userInfo,
sid,
} = state.webapp;
return {
userInfo,
sid,
};
}
export default connect(mapStateToProps)(WangEditor);
......@@ -155,6 +155,11 @@ const Institutions = props => (
{ Institutions => (<Institutions {...props} />) }
</Bundle>
);
const WangEditor = props => (
<Bundle load={() => import(/* webpackChunkName:"WangEditor" */'./pages/wangeditor/index')}>
{ WangEditor => (<WangEditor {...props} />) }
</Bundle>
);
function RouterConfig({ history }) {
return (
......@@ -187,6 +192,7 @@ function RouterConfig({ history }) {
<Route path="/sjd/studentclass/:id" exact component={StudentClass} />
<Route path="/sjd/institutions" exact component={Institutions} />
<Route path="/sjd/schooledit" exact component={SchoolEdit} />
<Route path="/sjd/wangeditor" exact component={WangEditor} />
</SjdIndex>
)}
/>
......
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