|
|
@@ -1,33 +1,18 @@
|
|
|
import {View, Image, Text} from '@tarojs/components';
|
|
|
-import classNames from 'classnames';
|
|
|
-import sendIcon from '@assets/sending.svg';
|
|
|
-import complateIcon from '@assets/complate.svg';
|
|
|
-import orderIcon from '@assets/order.svg';
|
|
|
import face from '@assets/face.svg';
|
|
|
+import classNames from 'classnames';
|
|
|
+import {useStore} from 'zustand';
|
|
|
import Login from './login';
|
|
|
import {useBoolean} from 'ahooks';
|
|
|
-import {DELIVER_GOODS_PATH, ORDER_PATH, RECEIVE_GOODS_PATH} from '@routes';
|
|
|
+import {ORDER_PATH} from '@routes';
|
|
|
import {useNavigate} from '@hooks';
|
|
|
-import {useStore} from 'zustand';
|
|
|
+import {useBtnList} from './hooks';
|
|
|
import {userStore} from '@stores';
|
|
|
|
|
|
-const btnList = [
|
|
|
- {
|
|
|
- title: '收发货',
|
|
|
- children: [
|
|
|
- {title: '发货', icon: sendIcon, url: DELIVER_GOODS_PATH},
|
|
|
- {title: '收货', icon: complateIcon, url: RECEIVE_GOODS_PATH},
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- title: '历史记录',
|
|
|
- children: [{title: '发货单', icon: orderIcon, url: ORDER_PATH}],
|
|
|
- },
|
|
|
-];
|
|
|
-
|
|
|
export default function App() {
|
|
|
const [visible, {toggle, setFalse}] = useBoolean();
|
|
|
const {navigateWithLogin, navigate} = useNavigate();
|
|
|
+ const {userName} = useStore(userStore);
|
|
|
|
|
|
function navigateTo(name, needLogin) {
|
|
|
return function () {
|
|
|
@@ -35,7 +20,7 @@ export default function App() {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- const userName = useStore(userStore, state => state.userName);
|
|
|
+ const btnList = useBtnList();
|
|
|
|
|
|
return (
|
|
|
<>
|
|
|
@@ -63,6 +48,8 @@ export default function App() {
|
|
|
</View>
|
|
|
|
|
|
{btnList.map(function (el, index) {
|
|
|
+ if (!el.children.length) return null;
|
|
|
+
|
|
|
return (
|
|
|
<View
|
|
|
key={el.title}
|