123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- import React from "react";
- import $ from "jquery/src/ajax";
- import "react-quill/dist/quill.bubble.css";
- import moment from "moment";
- import "../authentication/techDemand.less";
- import {
- Form,
- Button,
- message,
- } from "antd";
- import {
- beforeUploadFile,
- } from "@/tools.js";
- import Editors from "@/richTextEditors";
- //主体
- const Setting = Form.create()(
- React.createClass({
- getInitialState() {
- return {
- content: "",
- };
- },
- // 初始化数据
- loadData() {
- //发送请求
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/getSysConfig",
- data: {
- id: 100
- },
- success: function (data) {
- if (data.error.length == 0) {
- this.setState({
- content: data.data.content
- });
- } else {
- message.warning(data.error[0].message)
- }
- }.bind(this),
- }).always(
- function () {
- this.setState({
- loading: false,
- });
- }.bind(this)
- );
- },
- // 编辑声明
- edit() {
- this.setState({
- loading: true,
- });
- $.ajax({
- method: "post",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/updateSysConfig",
- data: {
- id: 100,
- content: this.state.content,
- },
- success: function (data) {
- this.setState({
- loading: false,
- });
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- }else{
- message.success("修改成功!")
- }
- }.bind(this),
- }).always(
- function () {
- this.setState({
- loading: false,
- });
- }.bind(this)
- );
- },
- componentWillMount() {
- this.loadData();
- },
- render() {
- return (
- <div className="user-content">
- <div className="content-title">
- <span>本站声明设置</span>
- <div style={{ width: 800, marginTop: 20 }}>
- <Editors
- textContent={this.state.content}
- uploadUrl={"/api/admin/news/uploadFile"}
- globalConfig={globalConfig.uploadPath}
- placeholder=""
- handleRichText={(value) => {
- this.setState({ content: value });
- }}
- />
- <Button
- type="primary"
- onClick={this.edit}
- style={{ margin: "50px 0 20px 360px" }}
- >
- 保存更改
- </Button>
- <div style={{ color: "red" }}>提示:本站声明,显示在新闻底部,一旦修改,将整站全部修改!!!</div>
- </div>
- </div>
- </div>
- );
- },
- })
- );
- export default Setting;
|