代发平台-{{SystemStore.isRoot?'管理员':'商家'}}
diff --git a/src/components/LayoutSider/index.vue b/src/components/LayoutSider/index.vue
index d980b3f..8e58f1d 100644
--- a/src/components/LayoutSider/index.vue
+++ b/src/components/LayoutSider/index.vue
@@ -1,32 +1,31 @@
-
-
-
-
-
- {{ item.title }}
- {{k.title}}
-
-
+
+
+
+
+
+
+ {{ item.title }}
+ {{ k.title }}
+
+
+
diff --git a/src/hooks/useTableQuery.js b/src/hooks/useTableQuery.js
new file mode 100644
index 0000000..ff54fb0
--- /dev/null
+++ b/src/hooks/useTableQuery.js
@@ -0,0 +1,72 @@
+import {ref, reactive, watch} from 'vue';
+
+/**
+ *
+ * @param parameter
+ * @param api
+ * @param callback
+ * @param immediate
+ * @param watchParameter
+ */
+function useTableQuery({
+ parameter,
+ api,
+ callback,
+ immediate = true,
+ watchParameter = false,
+ }) {
+ const loading = ref(false);
+
+ const pagination = reactive({
+ current: 1,
+ pageSize: 20,
+ total: 0
+ });
+
+ const fetchData = async () => {
+ try {
+ loading.value = true;
+
+ const params = {
+ ...parameter,
+ current: pagination.current,
+ pageSize: pagination.pageSize
+ }
+
+ const {data} = await api(params);
+
+ pagination.pageSize = data.page;
+ pagination.total = data.total;
+
+ callback && callback(data);
+ } finally {
+ loading.value = false;
+ }
+ }
+
+ const initFetchData = async () => {
+ pagination.current = 1;
+ pagination.total = 0;
+ }
+
+ watch(
+ () => [pagination.current, pagination.pageSize],
+ () => fetchData(),
+ {deep: true, immediate: immediate}
+ )
+
+ if (watchParameter) watch(
+ () => parameter,
+ () => fetchData(),
+ {deep: true}
+ );
+
+ return {
+ loading,
+ pagination,
+ fetchData,
+ initFetchData,
+ }
+}
+
+export default useTableQuery;
diff --git a/src/pages/layout/index.vue b/src/pages/layout/index.vue
index c5e9960..7f217fd 100644
--- a/src/pages/layout/index.vue
+++ b/src/pages/layout/index.vue
@@ -8,7 +8,7 @@ import LayoutSider from '../../components/LayoutSider/index.vue';
-
+
diff --git a/src/pages/login/Login.vue b/src/pages/login/Login.vue
index 8248b46..7b3875d 100644
--- a/src/pages/login/Login.vue
+++ b/src/pages/login/Login.vue
@@ -2,6 +2,9 @@
import {ref, reactive} from 'vue';
import {toPath} from "../../utils/index.js";
import VerificationCode from '../../components/VerificationCode/index.vue';
+import {useUserStore} from "../../pinia/UserStore/index.js";
+
+const {login} = useUserStore();
const MODE = {
PHONE: 'PHONE',
@@ -39,7 +42,7 @@ const mode = ref(MODE.PHONE);