Bläddra i källkod

Merge branch 'master' of git.proginn.com:zaixianjiaoyu/sourcecode

Go 4 år sedan
förälder
incheckning
9dcb9b9ead

+ 7 - 5
front/src/containers/AdminLeft.js

@@ -43,7 +43,7 @@ export default class extends Component {
   render() {
     const { config } = this.props;
     return (
-      <div className="admin" style={{ height: window.document.documentElement.clientHeight }}>
+      <div className="admin-left" style={{ height: window.document.documentElement.clientHeight }}>
         {config.module ? this.renderLayoutView() : this.renderContentView(true)}
       </div>
     );
@@ -154,10 +154,12 @@ export default class extends Component {
                         );
                       })}
                     </SubMenu>
-                  ) : (<Menu.Item key={group.key} path={group.path}>
-                    <Icon type={group.icon} />
-                    <span>{group.name}</span>
-                  </Menu.Item>);
+                  ) : (
+                    <Menu.Item key={group.key} path={group.path}>
+                      <Icon type={group.icon} />
+                      <span>{group.name}</span>
+                    </Menu.Item>
+                  );
                   return view;
                 })}
               </Menu>

+ 23 - 5
front/src/services/Tools.js

@@ -84,14 +84,14 @@ export function loadScript(url, callback) {
   script.async = true;
   script.defer = true;
   if (script.readyState) {
-    script.onreadystatechange = function () {
+    script.onreadystatechange = function() {
       if (script.readyState === 'loaded' || script.readyState === 'complete') {
         script.onreadystatechange = null;
         if (callback) callback();
       }
     };
   } else {
-    script.onload = function () {
+    script.onload = function() {
       if (callback) callback();
     };
   }
@@ -333,7 +333,7 @@ export function bindSearch(targetList, field, Component, listFunc, render, def,
   });
   const key = `lastFetchId${field}${index}`;
   if (!Component[key]) Component[key] = 0;
-  const searchFunc = (data) => {
+  const searchFunc = data => {
     Component[key] += 1;
     const fetchId = Component[key];
     targetList[index].loading = true;
@@ -381,7 +381,7 @@ export function generateSearch(field, props, Component, listFunc, render, def, n
     notFoundContent: notFound,
   };
   item = Object.assign(props || {}, item);
-  const searchFunc = (data) => {
+  const searchFunc = data => {
     Component[key] += 1;
     const fetchId = Component[key];
     item.loading = true;
@@ -398,7 +398,7 @@ export function generateSearch(field, props, Component, listFunc, render, def, n
       Component.setState({ [field]: item, fetching: false });
     });
   };
-  item.onSearch = (keyword) => {
+  item.onSearch = keyword => {
     searchFunc({ page: 1, number: 5, keyword });
   };
   if (def) {
@@ -412,3 +412,21 @@ export function generateSearch(field, props, Component, listFunc, render, def, n
   }
   Component.setState({ [field]: item });
 }
+
+export function getHtmlText(text) {
+  text = text.replace(new RegExp(/\r\n/, 'g'), '\r').replace(new RegExp(/\n/, 'g'), '\r');
+  let html = '';
+  text.split('\r').forEach(item => {
+    item.split(' ').forEach(t => {
+      html += `<i uuid="${uuid(4)}">${t}</i>`;
+    });
+    html += '<br/>';
+  });
+  return html;
+}
+
+export function getSimpleText(html) {
+  let text = html.replace(new RegExp('<br/>', 'g'), '\n\r');
+  text = text.replace(new RegExp('<.+?>', 'g'), '');
+  return text;
+}

+ 0 - 20
front/src/style/admin.less

@@ -1,26 +1,6 @@
 @charset "utf-8";
 @import './core';
 
-body {
-  color: @base_color;
-  font-size: @base_size;
-  line-height: 1.7;
-  font-family: Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
-  -webkit-font-smoothing: subpixel-antialiased;
-  background: @base_bg_color;
-}
-
-* {
-  box-sizing: border-box;
-}
-
-html,
-body,
-#root {
-  margin: 0;
-  padding: 0;
-}
-
 #root {
 
   .admin {

+ 9 - 28
front/src/style/adminLeft.less

@@ -1,40 +1,21 @@
 @charset "utf-8";
 @import './core';
 
-body {
-  color: @base_color;
-  font-size: @base_size;
-  line-height: 1.7;
-  font-family: Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
-  -webkit-font-smoothing: subpixel-antialiased;
-  background: @base_bg_color;
-}
-
-* {
-  box-sizing: border-box;
-}
-
-html,
-body,
 #root {
-  margin: 0;
-  padding: 0;
-}
 
-#root {
-  background: @admin_bg_color;
+  .admin-left {
+    background: @admin_bg_color;
 
-  .block {
-    margin-bottom: 20px;
-  }
+    .block {
+      margin-bottom: 20px;
+    }
 
-  .table-button {
-    a {
-      margin: 0 2px;
+    .table-button {
+      a {
+        margin: 0 2px;
+      }
     }
-  }
 
-  .admin {
     .ant-layout-sider-collapsed {
       #logo {
         h1 {

+ 21 - 0
front/src/style/core.less

@@ -29,6 +29,7 @@
 @blue: #e6f7ff;
 @geekblue: #f0f5ff;
 @purple: #f9f0ff;
+
 .theme,
 .theme a,
 .theme a:hover {
@@ -201,4 +202,24 @@ textarea::-webkit-input-placeholder {
 .nowrap {
   white-space: nowrap;
   text-overflow: ellipsis;
+}
+
+body {
+  color: @base_color;
+  font-size: @base_size;
+  line-height: 1.7;
+  font-family: 'PingFang SC', 'Microsoft YaHei', '微软雅黑', 'Hiragino Sans GB', Helvetica, Arial, sans-serif;
+  -webkit-font-smoothing: subpixel-antialiased;
+  background: @base_bg_color;
+}
+
+* {
+  box-sizing: border-box;
+}
+
+html,
+body,
+#root {
+  margin: 0;
+  padding: 0;
 }

+ 1 - 21
front/src/style/web.less

@@ -1,24 +1,4 @@
 @charset "utf-8";
 @import './core';
-body {
-  color: @base_color;
-  font-size: @base_size;
-  line-height: 1.7;
-  font-family: 'PingFang SC', 'Microsoft YaHei', '微软雅黑', 'Hiragino Sans GB', Helvetica, Arial, sans-serif;
-  -webkit-font-smoothing: subpixel-antialiased;
-  background: @base_bg_color;
-}
 
-* {
-  box-sizing: border-box;
-}
-
-html,
-body,
-#root {
-  margin: 0;
-  padding: 0;
-}
-
-#root {
-}
+#root {}