晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/stando/www/wp-content/plugins/wpmudev-updates/assets/src/js/widget/views/ |
Upload File : |
import React from 'react';
import HeaderRow from './rows/header'
import eventBus from './../helpers/event-bus';
import ajaxRequest from './../helpers/request';
import PeriodSelector from './../components/period-selector';
import MetricSelector from './../components/metric-selector';
import TablePagination from './../components/table-pagination';
export default class ListContent extends React.Component {
constructor(props) {
super(props);
this.state = {
currentMetric: '',
currentPage: 1,
list: [],
perPage: 10,
loading: false,
}
// Bind events.
this.handleRowClick = this.handleRowClick.bind(this);
this.handlePaginate = this.handlePaginate.bind(this);
this.handleMetricChange = this.handleMetricChange.bind(this);
}
/**
* Setup required properties.
*
* @since 4.11.4
*/
componentDidMount() {
let metrics = this.props.metrics;
// Set current metric to first one.
if (metrics.length > 0) {
this.setState({
currentMetric: metrics[0].key,
})
}
// Paginate.
this.paginate(0, this.state.perPage)
}
/**
* Paginate if required after update.
*
* @param {object} prevProps Previous props.
* @since 4.11.6
*/
componentDidUpdate(prevProps) {
// Paginate if list changed.
if (this.props.list !== prevProps.list) {
this.setState({
currentPage: 1
})
this.paginate(0, this.state.perPage)
}
}
/**
* Handle metric item change event.
*
* @param {string} metric Metric key.
* @since 4.11.4
*/
handleMetricChange(metric) {
this.setState({
currentMetric: metric
})
}
/**
* Set paginated list of items.
*
* @param {int} start Start position.
* @param {int} end End position.
* @since 4.11.6
*/
paginate(start, end) {
// Set pagination.
if (this.props.list.length > 0) {
this.setState({
list: this.props.list.slice(start, end),
})
}
}
/**
* Handle pagination event.
*
* Set current page when page navigation happens.
*
* @param {object} data Page data.
* @since 4.11.4
*/
handlePaginate(data) {
this.setState({
currentPage: data.page
})
// Paginate.
this.paginate(data.start, data.end)
}
/**
* Handle table row click event.
*
* Send an wp-ajax request and get the filtered content
* for the applied filters.
*
* @param {object} data Row data.
* @since 4.11.4
*/
async handleRowClick(data) {
// Set loader.
this.setState({
loading: data.name
})
await ajaxRequest(
'wdp-analytics',
{
type: 'filtered',
filter_type: data.type,
filter_value: data.filter,
range: this.props.period.current,
}
).then(response => {
if (response.success) {
// Dispatch filter apply event.
eventBus.dispatch('AnalyticsApplyFilter', {
stats: response.data,
label: data.label,
type: 'list',
filter: {
type: data.type,
filter: data.filter,
}
});
}
});
// Remove loader.
this.setState({
loading: ''
})
}
/**
* Nothing to render as this is base component.
*
* @return {*}
* @since 4.11.4
*/
render() {
const metrics = this.props.metrics;
const ListRow = this.props.row;
return (
<div
data-pane={this.props.type}
className={`${this.props.active ? 'wpmudui-tab-current ' : ''}wpmudui-tab-content`}
>
<div className="wpmudui-search-form">
<PeriodSelector
type={this.props.type}
period={this.props.period}
/>
<MetricSelector
type="posts"
metrics={metrics}
onChange={this.handleMetricChange}
/>
</div>
<div className="wpmudui-table-flushed">
<table className="wpmudui-table">
<thead>
<HeaderRow
title={this.props.title}
metrics={metrics}
currentMetric={this.state.currentMetric}
/>
</thead>
<tbody className="wpmudui-table-sortable">
{this.state.list.map((item) =>
<ListRow
key={item.name}
item={item}
metrics={metrics}
current={this.state.currentMetric}
onClick={this.handleRowClick}
loading={this.state.loading === item.name}
/>
)}
</tbody>
</table>
{this.props.list.length > this.state.perPage &&
<TablePagination
type={this.props.type}
total={this.props.list.length}
page={this.state.currentPage}
perPage={this.state.perPage}
paginate={this.handlePaginate}
/>
}
</div>
</div>
);
}
}