// 获取--群-----客户群-- && -- 内部群 --右侧
export async function groupsTest(id,params) {
const response = request(`${v1}/wechat/groups/${id}/contents?${stringify(params)}`);
return checkCode(response)
}
models/wechat.js
import { message } from 'antd';
import * as API from '../services/api';
export default {
namespace: 'wechat',
state: {},
effects: {
// 获取--群-----客户群-- && -- 内部群 --右侧
*groupsTest({ payload: { id, ...rest }, callback }, { call }) {
const response = yield call(API.groupsTest, id, { ...rest });
if (response.code === 0) {
if (callback) callback(response.data);
}
},
}
}
主页面—请求接口 —可以的话放在 componentDidMount里
import Right from './Right';
// 客户群---右侧 --内部群
groupsCusName = (item, page) => {
const { dispatch } = this.props;
dispatch({
type: "wechat/groupsTest",
payload: { id: item.id, page },
callback: res => {
// console.log(res, "群会话");
this.setState({
dataList: res.list,
page: res.pagination,
id: item.id,
})
},
})
}
// 客户群---右侧结束 --内部群
<Right
id={id}
groupsCusName={
btnVal === '1' ? this.staffName
:btnVal === '2' ? this.customersName
:btnVal === '3' ? this.groupsCusName
:btnVal === '4' ? this.groupsCusName: null
}
dataList={dataList}
page={page}
/>
子页面接收值
onChange = (pageNumber) => {
const { groupsCusName, id } = this.props;
groupsCusName({ id }, pageNumber)
{/* 右侧分页开始 */}
<Pagination
style={{ float: 'right', marginTop: 20 }}
// defaultCurrent={1}
// total={60}
showSizeChanger
showQuickJumper
defaultCurrent={page.current}
current={page.current}
total={page.total}
// pageSize={page.pageSize}
// defaultPageSize={page.pageSize}
onChange={this.onChange}
/>
{/* 右侧分页结束 */}
};
好啦,可能看不懂,不过我会后续好好描述滴!!!