wushaodong преди 4 години
родител
ревизия
990da6c661
променени са 3 файла, в които са добавени 6 реда и са изтрити 21 реда
  1. 2 12
      jscore/models/user.js
  2. 4 5
      jscore/pages/Sales/Home.js
  3. 0 4
      jscore/services/user.js

+ 2 - 12
jscore/models/user.js

@@ -8,7 +8,6 @@ export default {
     state: {
         loading: false,
         tipsCount: {},
-        homeCount: {},
     },
     reducers: {
         updateState(state, {payload}) {
@@ -21,7 +20,8 @@ export default {
     effects: {
         * authLogin({payload, callback, unLogin}, {call, put}) {
             const result = yield call(authService.authLogin, payload);
-            if (!result.code) {
+            // token错误,error=true
+            if (!result.code && !result.data.error) {
                 const data = {
                     token: result.data.token,
                     username: result.data.username,
@@ -81,16 +81,6 @@ export default {
             }
             yield put(createAction('queryList')({loading: false}));
         },
-        * fetchHomeCount({payload}, {call, put}) {
-            yield put(createAction('updateState')({homeCount: {}, loading: true}));
-            const response = yield call(authService.queryHomeCount);
-            if (!response.code) {
-                yield put(createAction('updateState')({homeCount: response.data, loading: false}));
-            } else {
-                ResponseError(response);
-                yield put(createAction('updateState')({homeCount: {}, loading: false}));
-            }
-        },
         * fetchTipsCount({payload}, {call, put}) {
             yield put(createAction('updateState')({loading: true}));
             const response = yield call(authService.queryTipsCount);

+ 4 - 5
jscore/pages/Sales/Home.js

@@ -91,7 +91,6 @@ class SalesHome extends Component {
     }
 
     _fetchData = () => {
-        this.props.dispatch(createAction('auth/fetchHomeCount')());
         this.props.dispatch(createAction('auth/fetchTipsCount')());
     };
 
@@ -115,11 +114,11 @@ class SalesHome extends Component {
     };
 
     render() {
-        const {homeCount, tipsCount, loading} = this.props.auth;
+        const {tipsCount, loading} = this.props.auth;
         const qinake = [
-            {name: '今日新增', count: homeCount.today_report, tips: '管理范围内,新增报备且已审核的客户数量。'},
-            {name: '本月新增', count: homeCount.mouth_report, tips: '管理范围内,新增报备且已审核的客户数量。'},
-            {name: '总报备', count: homeCount.general_report, tips: '管理范围内,总的报备且已审核的客户数量。'},
+            {name: '今日新增', count: tipsCount.today_report, tips: '管理范围内,新增报备且已审核的客户数量。'},
+            {name: '本月新增', count: tipsCount.mouth_report, tips: '管理范围内,新增报备且已审核的客户数量。'},
+            {name: '总报备', count: tipsCount.general_report, tips: '管理范围内,总的报备且已审核的客户数量。'},
         ];
         return (
             <View style={styles.container}>

+ 0 - 4
jscore/services/user.js

@@ -26,10 +26,6 @@ export async function loginOut() {
     return request(`/touchd/rn/login_out/`);
 }
 
-export async function queryHomeCount() {
-    return request(`/account/statistics/`);
-}
-
 export async function queryTipsCount() {
     return request(`/customer/list_count/`);
 }