Skip to content

Commit

Permalink
be
Browse files Browse the repository at this point in the history
  • Loading branch information
getrebuild committed Mar 23, 2024
1 parent 31d73e1 commit 6bf4475
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion @rbv
Submodule @rbv updated from 639b9c to bd6f59
24 changes: 14 additions & 10 deletions src/main/resources/web/assets/js/files/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ const PAGE_SIZE = 40

// ~ 文件列表
class FilesList extends React.Component {
state = { ...this.props }
__lastEntry = 1
__pageNo = 1
constructor(props) {
super(props)
this.state = { ...props }

this._lastEntry = 1
this._pageNo = 1
}

render() {
const currentActive = this.state.currentActive || []
Expand Down Expand Up @@ -53,15 +57,15 @@ class FilesList extends React.Component {
<a
href="#"
onClick={(e) => {
this.loadData(null, this.__pageNo + 1)
this.loadData(null, this._pageNo + 1)
e.preventDefault()
}}>
{$L('显示更多')}
</a>
</div>
)}
{this.__pageNo > 1 && this.state.currentLen > 0 && this.state.currentLen < PAGE_SIZE && <div className="text-center mt-3 pb-3 text-muted">{$L('已显示全部')}</div>}
{this.__pageNo === 1 && this.state.files && this.state.files.length === 0 && (
{this._pageNo > 1 && this.state.currentLen > 0 && this.state.currentLen < PAGE_SIZE && <div className="text-center mt-3 pb-3 text-muted">- {$L('已显示全部')} -</div>}
{this._pageNo === 1 && this.state.files && this.state.files.length === 0 && (
<div className="list-nodata">
<i className="zmdi zmdi-folder-outline" />
<p>{$L('暂无数据')}</p>
Expand Down Expand Up @@ -89,12 +93,12 @@ class FilesList extends React.Component {
componentDidMount = () => this.loadData()

loadData(entry, pageNo) {
this.__lastEntry = entry || this.__lastEntry
this.__pageNo = pageNo || 1
const url = `/files/list-file?entry=${this.__lastEntry}&sort=${currentSort || ''}&q=${$encode(currentSearch || '')}&pageNo=${this.__pageNo}&pageSize=${PAGE_SIZE}`
this._lastEntry = entry || this._lastEntry
this._pageNo = pageNo || 1
const url = `/files/list-file?entry=${this._lastEntry}&sort=${currentSort || ''}&q=${$encode(currentSearch || '')}&pageNo=${this._pageNo}&pageSize=${PAGE_SIZE}`
$.get(url, (res) => {
const current = res.data || []
let files = this.__pageNo === 1 ? [] : this.state.files
let files = this._pageNo === 1 ? [] : this.state.files
files = [].concat(files, current)
this.setState({ files: files, currentLen: current.length, currentActive: [] })
})
Expand Down

0 comments on commit 6bf4475

Please sign in to comment.