소스 검색

工作台初始化

wushaodong 4 년 전
부모
커밋
4a35b98fd4

+ 2 - 1
android/app/src/main/java/com/zzliaoyuan/decorate_touch/MainApplication.java

@@ -10,7 +10,7 @@ import com.github.wuxudong.rncharts.MPAndroidChartPackage;
 import com.facebook.react.ReactNativeHost;
 import com.facebook.react.ReactPackage;
 import com.facebook.soloader.SoLoader;
-
+import com.zzliaoyuan.decorate_touch.bugly.BuglyPackage;
 import java.lang.reflect.InvocationTargetException;
 import java.util.List;
 
@@ -32,6 +32,7 @@ public class MainApplication extends Application implements ReactApplication {
           // Packages that cannot be autolinked yet can be added manually here, for example:
           // packages.add(new MyReactNativePackage());
           packages.add(reactPackage);
+          packages.add(new BuglyPackage());
 
           return packages;
         }

+ 39 - 0
android/app/src/main/java/com/zzliaoyuan/decorate_touch/bugly/BuglyModule.java

@@ -0,0 +1,39 @@
+package com.zzliaoyuan.decorate_touch.bugly;
+
+import android.content.pm.PackageManager;
+
+import com.facebook.react.bridge.Callback;
+import com.facebook.react.bridge.ReactApplicationContext;
+import com.facebook.react.bridge.ReactContextBaseJavaModule;
+import com.facebook.react.bridge.ReactMethod;
+import com.tencent.bugly.beta.Beta;
+import com.tencent.bugly.beta.UpgradeInfo;
+import com.zzliaoyuan.decorate_touch.MainApplication;
+
+public class BuglyModule extends ReactContextBaseJavaModule {
+    public BuglyModule(ReactApplicationContext reactContext) {
+        super(reactContext);
+    }
+
+    @Override
+    public String getName() {
+        return "Bugly";
+    }
+
+    @ReactMethod
+    public void checkUpgrade() {
+        Beta.checkUpgrade();
+    }
+
+    @ReactMethod
+    public void getVersion(Callback callback) {
+        String verName = "";
+        try {
+            verName = this.getReactApplicationContext().getPackageManager().
+                    getPackageInfo(this.getReactApplicationContext().getPackageName(), 0).versionName;
+        } catch (PackageManager.NameNotFoundException e) {
+            e.printStackTrace();
+        }
+        callback.invoke(verName);
+    }
+}

+ 27 - 0
android/app/src/main/java/com/zzliaoyuan/decorate_touch/bugly/BuglyPackage.java

@@ -0,0 +1,27 @@
+package com.zzliaoyuan.decorate_touch.bugly;
+
+import com.facebook.react.ReactPackage;
+import com.facebook.react.bridge.NativeModule;
+import com.facebook.react.bridge.ReactApplicationContext;
+import com.facebook.react.uimanager.ViewManager;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class BuglyPackage implements ReactPackage {
+
+    @Override
+    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
+        return Collections.emptyList();
+    }
+
+    @Override
+    public List<NativeModule> createNativeModules(
+            ReactApplicationContext reactContext) {
+        List<NativeModule> modules = new ArrayList<>();
+        modules.add(new BuglyModule(reactContext));
+        return modules;
+    }
+
+}

+ 1 - 1
index.js

@@ -12,4 +12,4 @@ import {name as appName} from './app.json';
 
 AppRegistry.registerComponent(appName, () => App);
 
-SyncStorage.set('baseURL', '192.168.2.45:8887');
+SyncStorage.set('baseURL', 'http://192.168.2.45:8887');

+ 59 - 179
jscore/models/user.js

@@ -1,224 +1,104 @@
-import {createAction, NavigationActions, Storage} from '../utils'
+import {createAction, NavigationActions, Storage} from '../utils';
 import SyncStorage from 'sync-storage';
-import * as authService from '../services/user'
-import {REFRESH_STATE} from "react-native-refresh-flatlist";
-import {userfetch} from '../services/user'
-import TurnPage from "../components/TurnPage";
-import ResponseError from "../components/ResponseError";
+import * as authService from '../services/user';
+import ResponseError from '../components/ResponseError';
 
-let noticeData = [], receiveMessageData = [], sendMessageData = []
 export default {
     namespace: 'auth',
     state: {
-        login: false,
         loading: false,
-        fetching: false,
-        errorMessage: '',
-        infoData: {},
-        noticeData: [],
-        noticeRState: "",
-        sendMessageData: [],
-        sendMessageRState: '',
-        receiveMessageData: [],
-        receiveMessageRState: ""
+        tipsCount: {},
+        homeCount: {},
     },
     reducers: {
         updateState(state, {payload}) {
-            return {...state, ...payload}
+            return {...state, ...payload};
         },
         queryList(state, {payload}) {
-            return {...state, ...payload}
+            return {...state, ...payload};
         },
     },
     effects: {
         * authLogin({payload, callback, unLogin}, {call, put}) {
-            const result = yield call(authService.authLogin, payload)
-            if (result.success) {
-                SyncStorage.set('credential', result.data);
+            const result = yield call(authService.authLogin, payload);
+            if (!result.code) {
+                const data = {
+                    token: result.data.token,
+                    username: result.data.username,
+                    user_id: result.data.user_id,
+                    manager_stores: result.data.manager_stores,
+                };
+                SyncStorage.set('credential', data);
+                SyncStorage.set('premissions', result.data.permissions);
                 if (callback) {
-                    callback()
+                    callback();
                 }
             } else {
                 SyncStorage.remove('credential');
-                unLogin()
+                unLogin();
             }
         },
         * login({payload, callback, unLogin}, {call, put}) {
-            yield put(createAction('updateState')({fetching: true}))
-            const result = yield call(authService.login, payload)
-            if (result.success) {
+            yield put(createAction('updateState')({loading: true}));
+            const result = yield call(authService.login, payload);
+            if (!result.code) {
+                const data = {
+                    token: result.data.token,
+                    username: result.data.username,
+                    user_id: result.data.user_id,
+                    manager_stores: result.data.manager_stores,
+                };
+                SyncStorage.set('credential', data);
+                SyncStorage.set('premissions', result.data.permissions);
                 if (callback) {
-                    callback()
+                    callback();
                 }
-                SyncStorage.set('credential', result.data);
-                yield put(NavigationActions.navigate({
-                    routeName: "Main",
-                    actions: [NavigationActions.navigate({routeName: 'SalesHome'})],
-                }))
             } else {
-                if (result.errors) {
-                    unLogin(result.errors)
+                if (result.msg) {
+                    unLogin(result.msg);
                 }
             }
-            yield put(createAction('updateState')({fetching: false}))
+            yield put(createAction('updateState')({loading: false}));
         },
         * logout({payload}, {call, put}) {
-            yield call(authService.loginOut)
+            yield call(authService.loginOut);
             SyncStorage.remove('credential');
             yield put(NavigationActions.navigate({
-                routeName: "Login",
+                routeName: 'Login',
                 actions: [NavigationActions.navigate({routeName: 'Login'})],
             }));
         },
-        * fetchrnPermissions({payload}, {call, put}) {
-            const response = yield call(authService.queryPermissions);
-            if (response.success) {
-                SyncStorage.set('premissions', response.data);
-            }
-        },
-        * fetchRNInfo({payload}, {call, put}) {
-            yield put(createAction('updateState')({infoData: {}, loading: true}))
-            const response = yield call(authService.queryInfo);
-            if (response.success) {
-                yield put(createAction('updateState')({infoData: response.data, loading: false}))
-            }else {
-                ResponseError(response)
-                yield put(createAction('updateState')({infoData: {}, loading: false}))
-            }
-        },
-        //公告列表
-        * fetchNoticeList({payload}, {call, put}) {
-            if (payload.getParm.page > 1) {
-                yield put(createAction('queryList')({noticeRState: REFRESH_STATE.FooterRefreshing,}));
-            } else {
-                yield put(createAction('queryList')({noticeRState: REFRESH_STATE.HeaderRefreshing,}));
-            }
-            const response = yield call(authService.queryNoticeList, payload);
-            if (response.success) {
-                const result = TurnPage(response, payload.getParm, noticeData)
-                noticeData = result.data
-                yield put(createAction('queryList')({
-                    noticeData: noticeData, noticeRState: result.state,
-                    total: response.total, page: payload.getParm.page
-                }));
-            } else {
-                ResponseError(response)
-                yield put(createAction('queryList')({noticeRState: REFRESH_STATE.Ready,}));
-            }
-
-        },
-        //公告详情
-        * fetchrNoticeDetail({payload, callback}, {call, put}) {
-            const response = yield call(authService.queryNoticeDetail, payload);
-            if (response.success) {
-                if (callback) {
-                    callback(response)
-                }
-            } else {
-                ResponseError(response)
-            }
-        },
-        //回复公告
-        * fetchReplyNotice({payload, callback}, {call, put}) {
-            yield put(createAction('queryList')({loading: true,}));
-            const response = yield call(authService.replyNotice, payload);
-            if (response.success) {
-                if (callback) {
-                    callback()
-                }
-            } else {
-                ResponseError(response)
-            }
-            yield put(createAction('queryList')({loading: false,}));
-        },
-        //私信列表
-        * fetchReceiveMessageList({payload}, {call, put}) {
-            if (payload.getParm.page > 1) {
-                yield put(createAction('queryList')({receiveMessageRState: REFRESH_STATE.FooterRefreshing,}));
-            } else {
-                yield put(createAction('queryList')({receiveMessageRState: REFRESH_STATE.HeaderRefreshing,}));
-            }
-            const response = yield call(authService.queryReceiveMessageList, payload);
-            if (response.success) {
-                const result = TurnPage(response, payload.getParm, receiveMessageData)
-                receiveMessageData = result.data
-                yield put(createAction('queryList')({
-                    receiveMessageData: receiveMessageData, receiveMessageRState: result.state,
-                    receiveTotal: response.total, receivePage: payload.getParm.page
-                }));
-            } else {
-                ResponseError(response)
-                yield put(createAction('queryList')({receiveMessageRState: REFRESH_STATE.Ready,}));
-            }
-        },
-        //私信列表
-        * fetchSendMessageList({payload}, {call, put}) {
-            if (payload.getParm.page > 1) {
-                yield put(createAction('queryList')({sendMessageRState: REFRESH_STATE.FooterRefreshing,}));
-            } else {
-                yield put(createAction('queryList')({sendMessageRState: REFRESH_STATE.HeaderRefreshing,}));
-            }
-            const response = yield call(authService.querySendMessageList, payload);
-            if (response.success) {
-                const result = TurnPage(response, payload.getParm, sendMessageData)
-                sendMessageData = result.data
-                yield put(createAction('queryList')({
-                    sendMessageData: sendMessageData, sendMessageRState: result.state,
-                    sendTotal: response.total, sendPage: payload.getParm.page
-                }));
-            } else {
-                ResponseError(response)
-                yield put(createAction('queryList')({sendMessageRState: REFRESH_STATE.Ready,}));
-            }
-        },
-        //读私信
-        * fetchReadReceiveMessage({payload, callback}, {call, put}) {
-            const response = yield call(authService.readReceiveMessage, payload);
-            if (response.success) {
-                if (callback) {
-                    callback(response)
-                }
-            } else {
-                ResponseError(response)
-            }
-        },
-        //回复私信
-        * fetchReplyMessage({payload, callback}, {call, put}) {
-            yield put(createAction('queryList')({loading: true,}));
-            const response = yield call(authService.replyMessage, payload);
-            if (response.success) {
-                if (callback) {
-                    callback()
-                }
-            } else {
-                ResponseError(response)
-            }
-            yield put(createAction('queryList')({loading: false,}));
-        },
         //修改密码
         * changePassword({payload, callback}, {call, put}) {
-            yield put(createAction('queryList')({loading: true,}));
+            yield put(createAction('queryList')({loading: true}));
             const response = yield call(authService.changePassword, payload);
-            if (response.success) {
+            if (!response.code) {
                 if (callback) {
-                    callback()
+                    callback();
                 }
             } else {
-                ResponseError(response)
+                ResponseError(response);
             }
-            yield put(createAction('queryList')({loading: false,}));
+            yield put(createAction('queryList')({loading: false}));
         },
-        //验证登录地址
-        * checkBaseURL({payload, callback}, {call, put}) {
-            const response = yield call(authService.checkBaseURL, payload);
-            if (response.success) {
-                if (response.data === 'carwin') {
-                    callback(true)
-                } else {
-                    callback(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);
+            if (!response.code) {
+                yield put(createAction('updateState')({tipsCount: response.data, loading: false}));
             } else {
-                callback(false)
+                ResponseError(response);
+                yield put(createAction('updateState')({tipsCount: {}, loading: false}));
             }
         },
     },
@@ -227,4 +107,4 @@ export default {
             //dispatch({ type: 'loadStorage' })
         },
     },
-}
+};

+ 1 - 1
jscore/pages/Mine/Home.js

@@ -76,7 +76,7 @@ class MineHome extends Component {
                                 fontSize: 22,
                                 fontWeight: '900',
                                 textAlign: "center"
-                            }}>{credential.name}</Text>
+                            }}>{credential.username}</Text>
                             <Text
                                 style={{
                                     fontSize: 14,

+ 21 - 35
jscore/pages/Outside/login.js

@@ -1,10 +1,10 @@
-import React, {Component} from 'react'
-import {StyleSheet, View, Text, Alert, TouchableOpacity, Image, StatusBar} from 'react-native'
-import {connect} from 'react-redux'
-import SyncStorage from 'sync-storage';
+import React, {Component} from 'react';
+import {StyleSheet, View, Image, StatusBar} from 'react-native';
+import {connect} from 'react-redux';
 import {Button, InputItem, List, Toast, Provider} from '@ant-design/react-native';
 
-import {createAction, ScreenUtil} from '../../utils'
+import {createAction, ScreenUtil} from '../../utils';
+import {NavigationActions} from 'react-navigation';
 
 @connect(auth => ({...auth}))
 class Login extends Component {
@@ -13,7 +13,6 @@ class Login extends Component {
         this.state = {
             username: '',
             password: '',
-            tabIndex: 0,
         };
     }
 
@@ -26,38 +25,27 @@ class Login extends Component {
     }
 
     onLogin = () => {
-        console.log('===>', this.state.username, this.state.password)
+        console.log('===>', this.state.username, this.state.password);
         if (!this.state.username || !this.state.password) {
-            Toast.info('请输入用户名密码', 1)
-            return
+            Toast.info('请输入用户名密码', 1);
+            return;
         }
         this.props.dispatch({
             type: 'auth/login',
             payload: this.state,
             callback: () => {
-                //获取其他信息
-                this.props.dispatch({
-                    type: 'auth/fetchRNInfo',
-                });
-                //获取权限
-                this.props.dispatch({
-                    type: 'auth/fetchrnPermissions',
-                });
-                console.log(3333333333)
-                this.props.navigation.navigate("SalesHome",)
+                this.props.navigation.navigate('SalesHome');
             },
             unLogin: (msg) => {
                 if (msg) {
-                    Toast.info(msg)
+                    Toast.info(msg);
                 }
-            }
+            },
         });
-    }
+    };
 
     render() {
-        const {
-            fetching,
-        } = this.props.auth
+        const {loading} = this.props.auth;
         return (
             <View style={styles.container}>
                 <StatusBar backgroundColor={'#fff'} barStyle='dark-content'/>
@@ -88,14 +76,12 @@ class Login extends Component {
                             }}
                         >密码:</InputItem>
                     </List>
-                    <Button loading={fetching} onPress={this.onLogin}
+                    <Button loading={loading} disabled={loading} onPress={this.onLogin}
                             style={styles.button}
                             type="primary">登录</Button>
-                    <Text style={styles.tabText}
-                          onPress={() => this.props.navigation.navigate('settingURL')}>设置登录地址</Text>
                 </Provider>
             </View>
-        )
+        );
     }
 }
 
@@ -103,7 +89,7 @@ const styles = StyleSheet.create({
     tabText: {
         textAlign: 'center',
         paddingTop: 10,
-        color: '#03C762'
+        color: '#03C762',
     },
     button: {
         borderRadius: 10,
@@ -117,16 +103,16 @@ const styles = StyleSheet.create({
     },
     logoContainer: {
         alignItems: 'center',
-        marginVertical: 60
+        marginVertical: 60,
     },
     logo: {
         width: ScreenUtil.scaleSize(80),
         height: ScreenUtil.scaleSize(80),
     },
     list: {
-        marginTop: 10
-    }
-})
+        marginTop: 10,
+    },
+});
 
 
-export default Login
+export default Login;

+ 276 - 0
jscore/pages/Sales/Home.js

@@ -0,0 +1,276 @@
+import React, {Component} from 'react';
+import {
+    StyleSheet,
+    View,
+    Text,
+    StatusBar,
+    Dimensions,
+    Image,
+    TouchableOpacity,
+    ScrollView,
+    RefreshControl,
+    DeviceEventEmitter,
+    Platform,
+} from 'react-native';
+import {Provider} from '@ant-design/react-native';
+import {connect} from 'react-redux';
+import CheckPrem from '../../components/CheckPrem';
+import IconBadge from 'react-native-icon-badge';
+import {createAction} from '../../utils';
+import {ComponentsStyles} from '../../components/ComponentsStyles';
+import {Tooltip} from 'react-native-elements';
+import SyncStorage from 'sync-storage';
+
+const {width} = Dimensions.get('window');
+const qkgl = [
+    {
+        name: '客户报备',
+        img: require('../../../assets/images/sales/jdws2.png'),
+        navetion: 'ReceptionList',
+        param: {},
+        premission: 'customer.view_report_customer',
+    },
+    {
+        name: '报备审核',
+        img: require('../../../assets/images/sales/jddj2.png'),
+        navetion: 'VisitorList',
+        param: {},
+        badge: 'report_customer_count',
+        premission: 'customer.check_report_customer',
+    },
+    {
+        name: '客户跟踪',
+        img: require('../../../assets/images/sales/lddj2.png'),
+        navetion: 'CallList',
+        param: {},
+        premission: 'customer.view_new_customer',
+    },
+    {
+        name: '跟踪审核',
+        img: require('../../../assets/images/sales/wbxs2.png'),
+        navetion: 'NetworkList',
+        param: {},
+        premission: 'customer.check_review',
+        badge: 'review_count',
+    },
+    {
+        name: '进度跟踪',
+        img: require('../../../assets/images/sales/jrxg2.png'),
+        navetion: 'ReviewTodayList',
+        param: {track_status: 'today', title: '今日需跟', status: ''},
+        premission: 'order.view_order',
+    },
+    {
+        name: '进度审核',
+        img: require('../../../assets/images/sales/jryg2.png'),
+        navetion: 'ReviewTodayList',
+        param: {track_status: 'today_ok', title: '今日已跟', status: ''},
+        badge: 'order_count',
+        premission: 'order.order_process_dispatch',
+    },
+];
+
+@connect(auth => ({...auth}))
+class SalesHome extends Component {
+    constructor(props) {
+        super(props);
+        this.state = {
+            page: 1,
+            qkglOpen: true,
+        };
+    }
+
+    static navigationOptions = {
+        headerShown: false,  //隐藏顶部导航栏
+    };
+
+    componentDidMount() {
+        this._entry = DeviceEventEmitter.addListener('ShowWhiteStatusBar', (param) => {
+            this._setStatusBar();
+        });
+        this.props.dispatch(createAction('auth/fetchHomeCount')());
+        this.props.dispatch(createAction('auth/fetchTipsCount')());
+    }
+
+    componentWillUnmount() {
+        this._entry.remove();
+    }
+
+    _setStatusBar = () => {
+        StatusBar.setBarStyle('dark-content');
+        if (Platform.OS === 'android') {
+            StatusBar.setTranslucent(false);
+            StatusBar.setBackgroundColor('#f2f2f2');
+        }
+    };
+
+    onItemPrss = (navetion, param, premission) => {
+        const prem = CheckPrem(navetion, premission);
+        if (prem) {
+            this.props.navigation.navigate(navetion, param);
+        }
+    };
+
+    render() {
+        const {homeCount, 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: '管理范围内,总的报备且已审核的客户数量。'},
+        ];
+        return (
+            <View style={styles.container}>
+                <StatusBar backgroundColor={'#f2f2f2'} barStyle='dark-content'/>
+                <Provider>
+                    <ScrollView
+                        refreshControl={
+                            <RefreshControl
+                                refreshing={loading}
+                                onRefresh={() => {
+                                    // TODO 下拉刷新提示数字
+                                    // this.props.dispatch(createAction('auth/fetchRNInfo')());
+                                }}
+                            />}
+                    >
+
+                        <View style={styles.monthView}>
+                            <View style={{flexDirection: 'row'}}>
+                                {qinake.map((item, index) => (
+                                    <Tooltip
+                                        key={index}
+                                        withOverlay={false}
+                                        skipAndroidStatusBar={true}
+                                        height={50}
+                                        popover={<Text style={ComponentsStyles.toolTipText}>{item.tips}</Text>}>
+                                        <View style={{
+                                            padding: 10,
+                                            width: (width - 20) / 3,
+                                            alignItems: 'center'
+                                        }}>
+                                            <Text style={{color: '#fffe37'}}>{item.name}</Text>
+                                            <Text style={styles.countText}>{item.count}</Text>
+                                        </View>
+                                    </Tooltip>
+                                ))}
+                            </View>
+                        </View>
+                        <View style={styles.itemView}>
+                            <View style={[styles.titleView, {flexDirection: 'row'}]}>
+                                <Text style={styles.titleText}>客户服务管理</Text>
+                            </View>
+                            <View style={styles.fixBody}>
+                                {qkgl.map((item, index) => (
+                                    <TouchableOpacity
+                                        key={index}
+                                        style={styles.fixBodyItem}
+                                        onPress={() => this.onItemPrss(item.navetion, item.param, item.premission)}
+                                    >
+                                        <IconBadge
+                                            MainElement={
+                                                <Image
+                                                    source={item.img}
+                                                    style={styles.img}/>
+                                            }
+                                            BadgeElement={
+                                                <Text style={{
+                                                    color: '#FFFFFF',
+                                                    fontSize: 10,
+                                                }}>{tipsCount[item.badge]}</Text>
+                                            }
+                                            IconBadgeStyle={
+                                                {
+                                                    minWidth: 8 + 6 * (tipsCount[item.badge] ? tipsCount[item.badge] : '').toString().length,
+                                                    height: 15,
+                                                    left: 30,
+                                                    top: -2,
+                                                    borderRadius: 10,
+                                                    backgroundColor: '#ff3d27',
+                                                }
+                                            }
+                                            Hidden={!tipsCount[item.badge]}
+                                        />
+                                        <Text style={styles.nameText}>{item.name}</Text>
+                                    </TouchableOpacity>
+                                ))}
+                            </View>
+                        </View>
+                    </ScrollView>
+                </Provider>
+            </View>
+        );
+    }
+
+}
+
+const styles = StyleSheet.create({
+    monthText: {
+        color: '#fff',
+        fontSize: 18,
+        padding: 10,
+        paddingBottom: 0,
+    },
+    container: {
+        flex: 1,
+        paddingHorizontal: 10,
+        marginTop: ComponentsStyles.top_margin,
+    },
+    fixBody: {
+        flexDirection: 'row',
+        flexWrap: 'wrap',
+    },
+    fixBodyItem: {
+        alignItems: 'center',
+        margin: 2,
+        // borderWidth: 1,
+        padding: 3,
+        width: (width - 40) / 4,
+
+    },
+    img: {
+        height: 30,
+        width: 30,
+    },
+    nameText: {
+        paddingVertical: 3,
+    },
+    itemView: {
+        marginVertical: 5,
+        borderRadius: 5,
+        backgroundColor: '#fff',
+    },
+    titleView: {
+        paddingVertical: 5,
+        paddingLeft: 10,
+    },
+    titleText: {
+        color: '#333',
+        fontSize: 18,
+    },
+    monthView: {
+        marginVertical: 10,
+        backgroundColor: '#0f89f7',
+        borderRadius: 5,
+    },
+    countText: {
+        color: '#fff',
+        fontSize: 18,
+        paddingTop: 5,
+    },
+    searchBarIcon: {
+        fontFamily: 'iconfont',
+        fontSize: 14,
+        paddingHorizontal: 5,
+        color: '#ababab',
+    },
+    searchBarInput: {
+        justifyContent: 'center',
+        backgroundColor: '#fff',
+        borderRadius: 15,
+        flexDirection: 'row',
+        flex: 1,
+        margin: Platform.OS === 'ios' ? 0 : 5,
+        padding: Platform.OS === 'ios' ? 0 : 5,
+    },
+});
+
+export default SalesHome;

+ 28 - 0
jscore/pages/Sales/Index.js

@@ -0,0 +1,28 @@
+'use strict';
+
+import {createStackNavigator} from 'react-navigation-stack';
+import NavigationOptions from '../../components/NavbarOptions';
+import SalesHome from './Home';
+
+const HomeStack = createStackNavigator({
+        SalesHome: {
+            screen: SalesHome,
+            navigationOptions: {
+                title: '首页',
+            },
+        },
+    },
+);
+
+HomeStack.navigationOptions = ({navigation}) => {  // ~注意~ 如果想实现隐藏Tabbar的功能要调用这个方法
+    let tabBarVisible = true;
+    if (navigation.state.index > 0) {
+        tabBarVisible = false;
+    }
+    return {
+        tabBarVisible,
+    };
+};
+
+
+module.exports = HomeStack;

+ 2 - 11
jscore/pages/Welcome.js

@@ -17,19 +17,11 @@ class Welcome extends Component {
         SyncStorage.init().then((data) => {
             const credential = SyncStorage.get('credential');
             let resetAction;
-            if (credential && credential['access_token'] != undefined) {
+            if (credential && credential['token'] !== undefined) {
                 dispatch({
                     type: 'auth/authLogin',
                     payload: credential,
                     callback: () => {
-                        //获取权限
-                        dispatch({
-                            type: 'auth/fetchrnPermissions',
-                        });
-                        //获取其他信息
-                        dispatch({
-                            type: 'auth/fetchRNInfo',
-                        });
                         resetAction = NavigationActions.navigate({
                             routeName: "Main",
                             actions: [NavigationActions.navigate({routeName: 'SalesHome'})],
@@ -70,10 +62,9 @@ class Welcome extends Component {
             <View style={ComponentsStyles.container}>
                 <View style={styles.up}>
                     <Image source={require('../../assets/images/logo.png')} style={styles.logo}/>
-                    {/* <Text style={styles.title}>销管佳</Text> */}
                 </View>
                 <View style={styles.down}>
-                    <Text style={styles.rights}>©2020 销管佳 All rights reserved.</Text>
+                    <Text style={styles.rights}>©2021 装集客 All rights reserved.</Text>
                 </View>
             </View>
         )

+ 2 - 1
jscore/root.js

@@ -11,6 +11,7 @@ import {
 } from 'react-navigation';
 import {createMaterialBottomTabNavigator} from 'react-navigation-material-bottom-tabs';
 import Welcome from './pages/Welcome'
+import SalesHome from './pages/Sales/Index'
 import MineHome from './pages/Mine/Index'
 import Outside from './pages/Outside/Index';
 
@@ -29,7 +30,7 @@ const styles = StyleSheet.create({
 
 const TabStack = createMaterialBottomTabNavigator({
     SalesHome: {
-        screen: MineHome,
+        screen: SalesHome,
         navigationOptions: {
             tabBarLabel: '工作台',
             tabBarIcon: ({ focused, horizontal, tintColor }) => (

+ 2 - 2
jscore/router.js

@@ -65,10 +65,10 @@ class Router extends React.PureComponent {
 
     backHandle = () => {
         const currentScreen = getActiveRouteName(this.props.router);
-        if (currentScreen === 'Main') {
+        if (currentScreen === 'Login') {
             return true;
         }
-        const MainRouteNames = ['SalesHome', 'MaintenanceHome', 'MineHome', 'ReportHome', 'Login',];
+        const MainRouteNames = ['SalesHome', 'MineHome', 'Login',];
         if (MainRouteNames.indexOf(currentScreen) === -1) {
             this.props.dispatch(NavigationActions.back());
             return true;

+ 7 - 60
jscore/services/user.js

@@ -3,10 +3,9 @@ import request from './../utils/request';
 
 export async function authLogin(params) {
     let formdata = new FormData();
-    formdata.append("user_id", params.user_id);
-    formdata.append("access_token", params.access_token);
+    formdata.append("token", params.token);
 
-    return request('/touchd/rn/auth_login/', {
+    return request('/account/token_refresh/', {
         method: 'POST',
         body: formdata,
     });
@@ -17,7 +16,7 @@ export async function login(params) {
     formdata.append("username", params.username);
     formdata.append("password", params.password);
 
-    return request('/touchd/rn/login/', {
+    return request('/account/login/', {
         method: 'POST',
         body: formdata,
     });
@@ -27,59 +26,11 @@ export async function loginOut() {
     return request(`/touchd/rn/login_out/`);
 }
 
-export async function queryInfo() {
-    return request(`/touchd/rn/get_userInfo/`);
+export async function queryHomeCount() {
+    return request(`/account/statistics/`);
 }
-
-export async function queryPermissions() {
-    return request(`/touchd/rn/get_permissions/`);
-}
-
-//公告列表
-export async function queryNoticeList(params) {
-    return request(`/office/touch/notice/data/?${stringify(params.getParm)}`);
-}
-
-//公告详情
-export async function queryNoticeDetail(params) {
-    return request(`/office/notice/` + params.id + `/`);
-}
-
-//回复公告
-export async function replyNotice(params) {
-    let formdata = new FormData();
-    formdata.append('content', params.content)
-    return request(`/office/notice/` + params.id + `/reply/`, {
-        method: 'POST',
-        body: formdata,
-    });
-}
-
-//收信列表
-export async function queryReceiveMessageList(params) {
-    return request(`/office/message/data/?${stringify(params.getParm)}`);
-}
-
-//发信列表
-export async function querySendMessageList(params) {
-    return request(`/office/message/send/data/?${stringify(params.getParm)}`);
-}
-
-//读私信
-export async function readReceiveMessage(params) {
-    return request(`/office/message/` + params.id + `/read/`);
-}
-
-//回复私信
-export async function replyMessage(params) {
-    let formdata = new FormData();
-    formdata.append('content', params.content)
-    formdata.append('title', params.title)
-    formdata.append('to_user', params.to_user)
-    return request(`/office/message/send/`, {
-        method: 'POST',
-        body: formdata,
-    });
+export async function queryTipsCount() {
+    return request(`/customer/list_count/`);
 }
 
 //修改密码
@@ -95,7 +46,3 @@ export async function changePassword(params) {
     });
 }
 
-//验证登录地址
-export async function checkBaseURL(params) {
-    return request(`/touchd/rn/echo/`);
-}

+ 1 - 1
jscore/utils/request.js

@@ -88,7 +88,7 @@ export default function request(url, option,) {
     if (credential) {
         newOptions.headers = {
             ...newOptions.headers,
-            ...credential,
+            Authorization:`JWT ${credential.token}`,
         };
     }