From 9744a968bb9472dad90a0b7ceea706dc0b0194e0 Mon Sep 17 00:00:00 2001 From: gyq <875626088@qq.com> Date: Mon, 26 Feb 2024 11:46:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AF=B7=E6=B1=82=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E5=AF=B9=E6=8E=A5=E7=99=BB=E5=BD=95=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 9 +- src/api/product.js | 14 ++ src/api/user.js | 9 + src/components/takeFoodCode.vue | 13 ++ src/router/index.js | 4 +- src/store/user.js | 28 ++- src/utils/index.js | 11 ++ src/utils/request.js | 68 +++++++- src/utils/useStorage.js | 15 ++ src/views/home/components/goods.vue | 221 ++++++++++++++++++++++++ src/views/{home.vue => home/index.vue} | 230 ++++--------------------- src/views/login.vue | 87 +++++----- vite.config.js | 9 + 13 files changed, 457 insertions(+), 261 deletions(-) create mode 100644 src/api/product.js create mode 100644 src/api/user.js create mode 100644 src/components/takeFoodCode.vue create mode 100644 src/utils/useStorage.js create mode 100644 src/views/home/components/goods.vue rename src/views/{home.vue => home/index.vue} (63%) diff --git a/src/App.vue b/src/App.vue index caf4470..0cbd7c3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,10 +1,10 @@ diff --git a/src/views/login.vue b/src/views/login.vue index 1e3c64c..f99849b 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -4,41 +4,24 @@
-
+
银收客 收银、库存、营销、支付等业务一体化解决方案
- - - - + + - + - +
@@ -48,12 +31,7 @@
- + 登录 @@ -76,10 +54,16 @@ import { reactive, ref } from "vue"; import { useRouter } from "vue-router"; import { ipcRenderer } from "electron"; +import { RandomNumBoth } from '@/utils' + +import { useUser } from "@/store/user.js"; +const store = useUser(); + const router = useRouter(); const formRef = ref(null); const loading = ref(false); + const form = reactive({ shopCode: "", phone: "", @@ -112,16 +96,26 @@ const rules = reactive({ // 提交 const submitHandle = () => { - formRef.value.validate((valid) => { + formRef.value.validate(async (valid) => { if (valid) { - loading.value = true; - ElMessage.success("登录成功"); - localStorage.setItem("token", "skk918sjakajhjjqhw19jsdkandkahk"); - setTimeout(() => { - router.replace({ - name: "home", - }); - }, 1500); + const params = { + serialNumber: RandomNumBoth(1000, 9999), + clientType: 'pc', + loginName: form.phone, + password: form.password + } + + store.userlogin(params).then((res) => { + loading.value = true; + ElMessage.success("登录成功"); + setTimeout(() => { + router.replace({ + name: "home", + }); + }, 1000); + }).catch(err => { + loading.value = false + }); } }); }; @@ -131,14 +125,17 @@ const logout = () => { .then(() => { ipcRenderer.send("quitHandler", "退出吧"); }) - .catch(() => {}); + .catch(() => { }); };