瀏覽代碼

增加本站声明及新闻大图处理

dev01 2 年之前
父節點
當前提交
db8b2320e3

+ 4 - 0
js/admin/index/content.jsx

@@ -42,6 +42,8 @@ import AuthExamine from '@/administration/authentication/authExamine';
 import Banner from '@/administration/banner/banner';
 import Vouchers from '@/administration/ticket/vouchers';
 import Coupon from '@/administration/ticket/coupon';
+// 本站声明
+import Statement from '@/administration/statement/setting';
 
 import {hashHistory,Route,Router} from 'react-router';
 import {Layout} from 'antd';
@@ -89,6 +91,8 @@ export default class ContentRouter extends React.Component {
                     <Route path="/newList" component={NewList} />
                     <Route path="/firmList" component={FirmList} />
                     <Route path="/activity" component={Activity} />
+                    {/* 本站声明 */}
+                    <Route path="/statement" component={Statement} />
                     {/*小程序-用户管理*/}
                     <Route path="/user" component={User} />
                     <Route path="/pay" component={Pay} />

+ 77 - 72
js/admin/menu.jsx

@@ -1,74 +1,79 @@
 module.exports = {
-    adminMenu: [
-        {
-            name: "广告系统",
-            url: "advertisementList",
-            icon: "database"
-        },
-        {
-            name: "新闻管理",
-            url: "firmList",
-            icon: "database"
-        },
-        {
-            name: "活动管理",
-            url: "activity",
-            icon: "database"
-        },
-        {
-            name: "客户服务",
-            url: "buyList",
-            icon: "database"
-        },
-        {
-            name: "招聘管理",
-            url: "talentsList",
-            icon: "database"
-        },
-        {
-            name: "战略合作",
-            url: "proservlist",
-            icon: "database"
-        },
-        {
-            name: "访问客户",
-            url: "customers",
-            icon: "database"
-        },
-        {
-            name: "用户管理",
-            url: "user",
-            icon: "database"
-        },
-        {
-            name: "支付管理",
-            url: "pay",
-            icon: "database"
-        },
-        {
-            name: "产品管理",
-            url: "product",
-            icon: "database"
-        },
-        {
-            name: "微信分享",
-            url: "weappShare",
-            icon: "database"
-        },
-        {
-            name: "产品类型管理",
-            url: "productSort",
-            icon: "database"
-        },
-        {
-            name: "友情链接管理",
-            url: "links",
-            icon: "database"
-        },
-        {
-            name: "热门城市管理",
-            url: "cities",
-            icon: "database"
-        }
-    ]
+  adminMenu: [
+    {
+      name: "广告系统",
+      url: "advertisementList",
+      icon: "database"
+    },
+    {
+      name: "新闻管理",
+      url: "firmList",
+      icon: "database"
+    },
+    {
+      name: "活动管理",
+      url: "activity",
+      icon: "database"
+    },
+    {
+      name: "客户服务",
+      url: "buyList",
+      icon: "database"
+    },
+    {
+      name: "招聘管理",
+      url: "talentsList",
+      icon: "database"
+    },
+    {
+      name: "战略合作",
+      url: "proservlist",
+      icon: "database"
+    },
+    {
+      name: "访问客户",
+      url: "customers",
+      icon: "database"
+    },
+    {
+      name: "用户管理",
+      url: "user",
+      icon: "database"
+    },
+    {
+      name: "支付管理",
+      url: "pay",
+      icon: "database"
+    },
+    {
+      name: "产品管理",
+      url: "product",
+      icon: "database"
+    },
+    {
+      name: "微信分享",
+      url: "weappShare",
+      icon: "database"
+    },
+    {
+      name: "产品类型管理",
+      url: "productSort",
+      icon: "database"
+    },
+    {
+      name: "友情链接管理",
+      url: "links",
+      icon: "database"
+    },
+    {
+      name: "热门城市管理",
+      url: "cities",
+      icon: "database"
+    },
+    {
+      name: "本站声明设置",
+      url: "statement",
+      icon: "database"
+    },
+  ]
 };

+ 21 - 1
js/component/administration/business/firmList.jsx

@@ -915,7 +915,27 @@ const FirmList = Form.create()(
                         globalConfig={globalConfig.uploadPath}
                         placeholder="业务项目客户基本条件"
                         handleRichText={(value) => {
-                          this.setState({ editorcontext: value });
+                          let imgReg = /<img.*?(?:>|\/>)/gi //匹配图片中的img标签
+                          let srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i // 匹配图片中的src
+                          let arr = value.match(imgReg) || [] //筛选出所有的img
+                          let srcArr = []
+                          for (let i = 0; i < arr.length; i++) {
+                            let src = arr[i].match(srcReg)
+                            // 获取图片地址
+                            srcArr.push(src[1])
+                          }
+                          this.setState({
+                            editorcontext: value,
+                          });
+                          if (srcArr.length > 0) {
+                            let purl = srcArr[0].replace(globalConfig.avatarUploadHost, "")
+                            if (splitUrl(purl, ",", globalConfig.avatarUploadHost) == this.state.pictureUrl) {
+                              return
+                            }
+                            this.setState({
+                              pictureUrl: purl ? splitUrl(purl, ",", globalConfig.avatarUploadHost) : []
+                            })
+                          }
                         }}
                       />
                     </FormItem>

+ 122 - 0
js/component/administration/statement/setting.jsx

@@ -0,0 +1,122 @@
+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;

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "afanti",
-  "version": "1.0.9",
+  "version": "1.0.10",
   "description": "",
   "main": "index.js",
   "scripts": {