Authored by 于良

ListView使用Immutable Datasource review by 盖剑秋

... ... @@ -21,6 +21,7 @@ const actions = [
homeActions,
];
import Immutable, {Record, List} from 'immutable';
function mapStateToProps(state) {
return {
... ... @@ -52,6 +53,7 @@ class DrawerContainer extends Component {
_onPressItem(index) {
//选择店铺
this.drawer.close();
console.log(index);
// let item = this.props.user.shops.get(index);
// this.props.actions.switchShop(item.id);
... ... @@ -98,12 +100,17 @@ class DrawerContainer extends Component {
},
];
let i = List(items);
console.log(i);
console.log(i.get(0).name);
console.log(Immutable.fromJS(items).get(0));
const children = this.props.navigationState.children;
let disabled = children[0].index === 0 ? false : true; //只在第一个tab页启用抽屉菜单
return (
<Drawer
ref="navigation"
ref={(ref) => this.drawer = ref}
type="displace"
content={<SideMenu items={items} onPressItem={this._onPressItem}/>}
tapToClose={true}
... ...
... ... @@ -97,7 +97,6 @@ class HomeContainer extends Component {
}
componentDidMount() {
console.log('shopId'+ this.props.home.shopId);
this.props.actions.overview(this.props.home.shopId);
}
... ...
... ... @@ -54,7 +54,6 @@ export function overview(shopId) {
dispatch(overviewRequest(shopId));
return new HomeService().overview(shopId)
.then(json => {
console.log(json);
dispatch(overviewSuccess({
rank: 76,
rise: true,
... ...
... ... @@ -10,7 +10,7 @@ export default class UserService {
}
async overview(shopId) {
console.log(11111);
return await this.api.get({
url: '/operations/api/v6/category/getCategory',
body: {
... ... @@ -18,11 +18,9 @@ export default class UserService {
}
})
.then((json) => {
console.log(json);
return json;
})
.catch((error) => {
console.error(error);
throw(error);
});
}
... ...
... ... @@ -124,7 +124,6 @@ export default class Request {
}
let queryStrigPair = this._signParam(opts.body);
console.log(opts);
if (opts.method === 'GET' || opts.method === 'HEAD' || opts.method === 'DELETE') {
opts.url = opts.url + '?' + queryStrigPair;
... ...