Browse Source

视频分页和key设定

pzc 4 years ago
parent
commit
bbb5810586
1 changed files with 26 additions and 9 deletions
  1. 26 9
      UI/src/pages/vedioManage/vedioList.js

+ 26 - 9
UI/src/pages/vedioManage/vedioList.js

@@ -139,6 +139,8 @@ class VedioList extends React.Component{
                 },
                 },
             ],
             ],
             data: [],
             data: [],
+            total:0,
+            currentPage:1,
             tagModal: false,          //标签modal
             tagModal: false,          //标签modal
             tagColumns: [
             tagColumns: [
                 { title: '标签id', dataIndex:'tagTypeId', tagTypeId: 'tagTypeId'  },
                 { title: '标签id', dataIndex:'tagTypeId', tagTypeId: 'tagTypeId'  },
@@ -205,24 +207,32 @@ class VedioList extends React.Component{
         this.loadDepartmentList()   //科室列表
         this.loadDepartmentList()   //科室列表
     }
     }
     //搜索视频列表
     //搜索视频列表
-    searchDataList() {
+    searchDataList(page) {
+        var pageNum = page?page:1;
         request({
         request({
             url: ymallAPI + '/ymall/video/queryVideos',
             url: ymallAPI + '/ymall/video/queryVideos',
             method: 'post',
             method: 'post',
             data: {
             data: {
                 pageSize: 10,
                 pageSize: 10,
-                pageIndex: this.state.searchVideoPage,
+                pageIndex: pageNum,
                 filters: this.state.filters 
                 filters: this.state.filters 
             }
             }
         }).then(res => {
         }).then(res => {
             console.log('视频列表', res)
             console.log('视频列表', res)
+            
+            let itemdata = [];
+            for(var item of  res.items){
+                 item['key'] = item.id;
+                 itemdata.push(item);
+            }
             this.setState({
             this.setState({
-                data: this.state.data.concat(res.items),
-                searchVideoPage: this.state.searchVideoPage +1
+                data: itemdata,
+                currentPage: page,
+                total:res.totalCount
             }, () => {
             }, () => {
-                if(this.state.data.length < res.totalCount ) {
-                    this.searchDataList()
-                }
+                // if(this.state.data.length < res.totalCount ) {
+                //     this.searchDataList()
+                // }
             })
             })
         })
         })
     }
     }
@@ -707,6 +717,13 @@ class VedioList extends React.Component{
             onChange: this.onSelectChange,
             onChange: this.onSelectChange,
         };
         };
         let SsoToken = util.auth.getToken()
         let SsoToken = util.auth.getToken()
+
+        const { currentPage } = this.state;
+        const paginationProps = {
+            page: currentPage,
+            onChange : (page) => this.searchDataList(page),
+            total: this.state.total,
+        }
         return(
         return(
             <div style={{ padding: '50px',width: '100%', backgroundColor:'#fff'}}>
             <div style={{ padding: '50px',width: '100%', backgroundColor:'#fff'}}>
 
 
@@ -817,8 +834,8 @@ class VedioList extends React.Component{
                     bordered
                     bordered
                     rowKey={ record => record.id }
                     rowKey={ record => record.id }
                     rowSelection={rowSelection}
                     rowSelection={rowSelection}
-                    pagination={{current: this.state.currentVideoPage}}
-                    onChange={(e) => { this.setState({ currentVideoPage: e.current }) }}
+                    pagination={paginationProps}
+                    // onChange={(e) => { this.setState({ currentVideoPage: e.current }) }}
                 >
                 >
                 </Table>
                 </Table>