Skip to content

Commit

Permalink
FEATURE DONE: filter
Browse files Browse the repository at this point in the history
  • Loading branch information
boyangwang committed Sep 18, 2020
1 parent 67093fc commit 8dc93c4
Show file tree
Hide file tree
Showing 33 changed files with 577 additions and 781 deletions.
6 changes: 2 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
/lambda/
/scripts
/config
.history
.history
/src/components/vendor
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ yarn-error.log
.history
CNAME
/build
/public
/public
/src/components/vendor
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@

其中有一位花名承志的设计师,创立了“蘑菇街”,他的真名叫陈琪。陈琪的故事是另一个故事的翻版。“大炮”方永新告诉我,在做 B2B 业务的时候,他手下的一个主管后来也去创业了。“他做了一个叫滴滴的项目,做得还不错。”“他叫程维吗?”我问。“是的。”

无招是花名,他的真名叫陈航. “至少当时在阿里巴巴内部,他已经快成为‘臭名昭著’的人:一个从日本回来的职业经理人,做一淘没什么起色,做来往看起来也快要完蛋。阿里似乎给了他不少机会,遗憾的是,他没有抓住其中任何一个。” `然后钉钉`
无招是花名,他的真名叫陈航. “至少当时在阿里巴巴内部,他已经快成为‘臭名昭著’的人:一个从日本回来的职业经理人,做一淘没什么起色,做来往看起来也快要完蛋。阿里似乎给了他不少机会,遗憾的是,他没有抓住其中任何一个。”

`然后钉钉`
16 changes: 8 additions & 8 deletions config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ export default defineConfig({
dva: {
hmr: true,
},
locale: {
// default zh-CN
default: 'zh-CN',
antd: true,
// default true, when it is true, will use `navigator.language` overwrite default
baseNavigator: true,
},
// locale: {
// // default zh-CN
// default: 'zh-CN',
// antd: true,
// // default true, when it is true, will use `navigator.language` overwrite default
// baseNavigator: true,
// },
dynamicImport: {
loading: '@/components/PageLoading/index',
},
Expand Down Expand Up @@ -49,7 +49,7 @@ export default defineConfig({
redirect: '/lanting',
},
{
name: 'lanting',
name: '兰亭已矣',
path: '/lanting',
icon: 'BookOutlined',
component: './Lanting',
Expand Down
2 changes: 1 addition & 1 deletion config/defaultSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const proSettings: ProSettings = {
fixSiderbar: false,
colorWeak: false,
menu: {
locale: true,
locale: false,
},
title: '兰亭',
iconfontUrl: '',
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"deploy": "echo TODO",
"dev": "npm run start:dev",
"fetch:blocks": "pro fetch-blocks && npm run prettier",
"i18n-remove": "pro i18n-remove --locale=zh-CN --write",
"postinstall": "umi g tmp",
"lint": "umi g tmp && npm run lint:js && npm run lint:prettier",
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
Expand Down Expand Up @@ -46,7 +45,6 @@
"antd": "^4.6.3",
"classnames": "^2.2.6",
"lodash": "^4.17.11",
"moment": "^2.25.3",
"omit.js": "^2.0.2",
"qs": "^6.9.0",
"react": "^16.8.6",
Expand Down
33 changes: 32 additions & 1 deletion src/assets/archives.json
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
{"archives":[{"id":"10000","title":"马云的湖畔花园 16 幢 1 单元 202 室","author":["迟宇宙"],"publisher":"商业人物","date":"2017-09","chapter":"世家","tag":["阿里","公司史"],"remarks":"\n`汗臭, 脚臭, 烟臭. 我是不行` 马云希望阿里巴巴变成技术驱动型公司。他好几次语重心长地对朱鸿说:“我们要有顶尖的技术。”2006 年夏天,吴妈萌生了一个想法。既然阿里巴巴的口号是“让天下没有难做的生意”,那么就应该有一个广告平台,“让天下没有难做的广告”。当时他在北京整合雅虎中国的 P2P(点对点)广告系统,萌生这个想法水到渠成。\n\n2007 年,盛大 CFO 张勇加盟了淘宝,花名逍遥子,很快他便参与了一件大事,“将阿里妈妈装回淘宝的子宫”。\n\n朱鸿读研的时候在, 后来读博去了. 朱鸿再次回到阿里巴巴的时候,阿里妈妈已经与淘宝合到了一起。他成为了淘宝的一员,在阿里的工号是 24083。他记得还在华星的时候,有一次他问:“我怎么没工号?”人力那边说:“给你个 100 号,要不要?”他当时还在读书,就没有要阿里的工号。他去查过 100 号,好像没有人在使用。从他回到阿里的那天起,他开始被叫作“一粟”,沧海一粟的“一粟”。终点又回到了起点,他开始走进另外一个陌生。\n\n湖畔花园, 淘宝, 阿里妈妈, 天猫, 菜鸟, 钉钉. 有个阿里软件的项目曾经在马云的“小黑屋”里关过,但它并没有获得想象中的成功。\n\n其中有一位花名承志的设计师,创立了“蘑菇街”,他的真名叫陈琪。陈琪的故事是另一个故事的翻版。“大炮”方永新告诉我,在做 B2B 业务的时候,他手下的一个主管后来也去创业了。“他做了一个叫滴滴的项目,做得还不错。”“他叫程维吗?”我问。“是的。”\n\n无招是花名,他的真名叫陈航. “至少当时在阿里巴巴内部,他已经快成为‘臭名昭著’的人:一个从日本回来的职业经理人,做一淘没什么起色,做来往看起来也快要完蛋。阿里似乎给了他不少机会,遗憾的是,他没有抓住其中任何一个。” `然后钉钉`\n","hasOrig":true},{"id":"10001","title":"复活“来往”,阿里的社交心结","author":["叶二"],"publisher":"蓝媒汇","date":"2017-09","chapter":"世家","tag":["阿里","社交","来往","钉钉"],"remarks":"\nReal如我 校园社交 点点虫 (原来往) 阅后即焚\n","hasOrig":false}],"fieldFreqMap":{"author":{"迟宇宙":1,"叶二":1},"publisher":{"商业人物":1,"蓝媒汇":1},"date":{"2017-09":2},"tag":{"阿里":2,"公司史":1,"社交":1,"来往":1,"钉钉":1}}}
{
"archives": [
{
"id": "10000",
"title": "马云的湖畔花园 16 幢 1 单元 202 室",
"author": ["迟宇宙"],
"publisher": "商业人物",
"date": "2017-09",
"chapter": "世家",
"tag": ["阿里", "公司史"],
"remarks": "\n`汗臭, 脚臭, 烟臭. 我是不行` 马云希望阿里巴巴变成技术驱动型公司。他好几次语重心长地对朱鸿说:“我们要有顶尖的技术。”2006 年夏天,吴妈萌生了一个想法。既然阿里巴巴的口号是“让天下没有难做的生意”,那么就应该有一个广告平台,“让天下没有难做的广告”。当时他在北京整合雅虎中国的 P2P(点对点)广告系统,萌生这个想法水到渠成。\n\n2007 年,盛大 CFO 张勇加盟了淘宝,花名逍遥子,很快他便参与了一件大事,“将阿里妈妈装回淘宝的子宫”。\n\n朱鸿读研的时候在, 后来读博去了. 朱鸿再次回到阿里巴巴的时候,阿里妈妈已经与淘宝合到了一起。他成为了淘宝的一员,在阿里的工号是 24083。他记得还在华星的时候,有一次他问:“我怎么没工号?”人力那边说:“给你个 100 号,要不要?”他当时还在读书,就没有要阿里的工号。他去查过 100 号,好像没有人在使用。从他回到阿里的那天起,他开始被叫作“一粟”,沧海一粟的“一粟”。终点又回到了起点,他开始走进另外一个陌生。\n\n湖畔花园, 淘宝, 阿里妈妈, 天猫, 菜鸟, 钉钉. 有个阿里软件的项目曾经在马云的“小黑屋”里关过,但它并没有获得想象中的成功。\n\n其中有一位花名承志的设计师,创立了“蘑菇街”,他的真名叫陈琪。陈琪的故事是另一个故事的翻版。“大炮”方永新告诉我,在做 B2B 业务的时候,他手下的一个主管后来也去创业了。“他做了一个叫滴滴的项目,做得还不错。”“他叫程维吗?”我问。“是的。”\n\n无招是花名,他的真名叫陈航. “至少当时在阿里巴巴内部,他已经快成为‘臭名昭著’的人:一个从日本回来的职业经理人,做一淘没什么起色,做来往看起来也快要完蛋。阿里似乎给了他不少机会,遗憾的是,他没有抓住其中任何一个。” `然后钉钉`\n",
"hasOrig": true
},
{
"id": "10001",
"title": "复活“来往”,阿里的社交心结",
"author": ["叶二"],
"publisher": "蓝媒汇",
"date": "2017-09",
"chapter": "世家",
"tag": ["阿里", "社交", "来往", "钉钉"],
"remarks": "\nReal如我 校园社交 点点虫 (原来往) 阅后即焚\n",
"hasOrig": false
}
],
"fieldFreqMap": {
"author": { "迟宇宙": 1, "叶二": 1 },
"publisher": { "商业人物": 1, "蓝媒汇": 1 },
"date": { "2017-09": 2 },
"tag": { "阿里": 2, "公司史": 1, "社交": 1, "来往": 1, "钉钉": 1 }
}
}
269 changes: 269 additions & 0 deletions src/components/vendor/ExpandCollapse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@


Object.defineProperty(exports, "__esModule", {
value: true
});

const _createClass = function () { function defineProperties(target, props) { for (let i = 0; i < props.length; i++) { const descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

const _react = require("react");

const _react2 = _interopRequireDefault(_react);

const _propTypes = require("prop-types");

const _propTypes2 = _interopRequireDefault(_propTypes);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError(`Super expression must either be null or a function, not ${ typeof superClass}`); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

const propTypes = {
// the height of data preview
previewHeight: _propTypes2.default.string.isRequired,
// any children you pass in
children: _propTypes2.default.node.isRequired,
// a custom class name
className: _propTypes2.default.string,
// a flag to set default state of data
expanded: _propTypes2.default.bool,
// the text to show for expand
expandText: _propTypes2.default.node,
// the text to show for collapse
collapseText: _propTypes2.default.node,
// option to set if expanded data can be collapsed
collapse: _propTypes2.default.bool,
// a flag to set ellipsis
ellipsis: _propTypes2.default.bool,
// custom text to show before expand text
ellipsisText: _propTypes2.default.string,
// called whenever the user clicks expand button
onExpandClick: _propTypes2.default.func,
// called whenever the user clicks collapse button
onCollapseClick: _propTypes2.default.func,
// called whenever the user clicks expand and collapse button
onClick: _propTypes2.default.func
};

const defaultProps = {
className: "",
expanded: false,
expandText: "Expand",
collapseText: "Collapse",
collapse: true,
ellipsis: true,
ellipsisText: "...",
onExpandClick: null,
onCollapseClick: null,
onClick: null
};

const ExpandCollapse = function (_React$Component) {
_inherits(ExpandCollapse, _React$Component);

function ExpandCollapse(props) {
_classCallCheck(this, ExpandCollapse);

const _this = _possibleConstructorReturn(this, (ExpandCollapse.__proto__ || Object.getPrototypeOf(ExpandCollapse)).call(this, props));

_this.state = {
expanded: _this.props.expanded,
shouldExpand: true
};

_this.handleClick = _this.handleClick.bind(_this);
_this.shouldDataExpand = _this.shouldDataExpand.bind(_this);
_this.getContentHeight = _this.getContentHeight.bind(_this);
_this.getButton = _this.getButton.bind(_this);
_this.getButtonText = _this.getButtonText.bind(_this);
_this.getClassName = _this.getClassName.bind(_this);
_this.setScrollPosition = _this.setScrollPosition.bind(_this);
_this.setRef = _this.setRef.bind(_this);
return _this;
}

_createClass(ExpandCollapse, [{
key: "componentDidMount",
value: function componentDidMount() {
this.shouldDataExpand();
}
}, {
key: "handleClick",
value: function handleClick(event) {
this.setState({
expanded: !this.state.expanded
}, function () {
const {expanded} = this.state;
const _props = this.props;
const {onExpandClick} = _props;
const {onCollapseClick} = _props;
const {onClick} = _props;


if (onExpandClick) {
if (expanded) {
onExpandClick(event);
}
}

if (onCollapseClick) {
if (!expanded) {
onCollapseClick(event);
}
}

if (onClick) {
onClick(event);
}

this.setScrollPosition();
});
}
}, {
key: "setScrollPosition",
value: function setScrollPosition() {
const {expanded} = this.state;


if (!expanded) {
const contentRect = this.toggleContent.getBoundingClientRect();
if (contentRect.top < 0) {
const offsetTop = Math.abs(contentRect.top + (window.pageYOffset || document.documentElement.scrollTop));

window.scrollTo(0, offsetTop);
}
}
}
}, {
key: "shouldDataExpand",
value: function shouldDataExpand() {
const {expanded} = this.state;


const contentRect = this.toggleContent.getBoundingClientRect();
const contentBodyRect = this.toggleContent.querySelector(".react-expand-collapse__body").getBoundingClientRect();

if (contentRect.height > contentBodyRect.height && !expanded) {
this.setState({
shouldExpand: false
});
}
}
}, {
key: "getContentHeight",
value: function getContentHeight() {
const _state = this.state;
const {expanded} = _state;
const {shouldExpand} = _state;
const {previewHeight} = this.props;


if (expanded || !shouldExpand) {
return "auto";
}

return previewHeight;
}
}, {
key: "getButton",
value: function getButton() {
const _state2 = this.state;
const {expanded} = _state2;
const {shouldExpand} = _state2;
const {collapse} = this.props;


if (shouldExpand) {
if (!collapse && expanded) {
return "";
}

const buttonText = this.getButtonText();

return _react2.default.createElement(
"span",
{
className: "react-expand-collapse__button",
onClick: this.handleClick,
"aria-label": buttonText,
"aria-expanded": expanded,
role: "button"
},
buttonText
);
}

return "";
}
}, {
key: "getButtonText",
value: function getButtonText() {
const {expanded} = this.state;
const _props2 = this.props;
const {expandText} = _props2;
const {collapseText} = _props2;
const {ellipsis} = _props2;
const {ellipsisText} = _props2;


let text = expanded ? collapseText : expandText;

if (ellipsis) {
text = !expanded ? `${ ellipsisText } ${ text}` : text;
}

return text;
}
}, {
key: "getClassName",
value: function getClassName() {
const {expanded} = this.state;
const {className} = this.props;


const expandedClass = expanded ? "react-expand-collapse--expanded" : "";

const classes = ["react-expand-collapse__content", expandedClass].concat(className.split(" ")).join(" ");

return classes;
}
}, {
key: "setRef",
value: function setRef(ref) {
this.toggleContent = ref;
}
}, {
key: "render",
value: function render() {
const className = this.getClassName();
const contentHeight = this.getContentHeight();
const button = this.getButton();

return _react2.default.createElement(
"div",
{
className,
ref: this.setRef,
style: { height: contentHeight }
},
_react2.default.createElement(
"div",
{ className: "react-expand-collapse__body" },
this.props.children
),
button
);
}
}]);

return ExpandCollapse;
}(_react2.default.Component);

ExpandCollapse.propTypes = propTypes;
ExpandCollapse.defaultProps = defaultProps;

exports.default = ExpandCollapse;
Loading

0 comments on commit 8dc93c4

Please sign in to comment.