From e887ae724b88e757dc18316432299e5a885f6cab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=BC=9F=E5=BA=9A?= Date: Tue, 20 Jun 2023 16:17:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E8=B7=B3=E8=BD=AC=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=EF=BC=9B=E5=AF=86=E7=A0=81=E6=A1=86=E6=98=8E=E6=96=87?= =?UTF-8?q?=E5=AF=86=E6=96=87=E5=88=87=E6=8D=A2=EF=BC=9B=E6=9B=B4=E6=8D=A2?= =?UTF-8?q?=E8=8F=9C=E5=8D=95id=EF=BC=9B=E6=B3=A8=E9=87=8A=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E4=B8=AD=E5=BF=83sdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 4 +++- src/components/login-by-account.vue | 29 +++++++++++++------------ src/components/login-by-code.vue | 33 +++++++++++++---------------- 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/src/App.vue b/src/App.vue index d2d9dbf..e910d63 100644 --- a/src/App.vue +++ b/src/App.vue @@ -98,7 +98,7 @@ export default { }, userInfo: { handler() { - this.initMsg(); + // this.initMsg(); }, deep: true, }, @@ -126,6 +126,8 @@ export default { this.readFlag = !this.readFlag; }, initMsg() { + console.log(this.userInfo); + console.log(this.$trace); if (this.userInfo && this.userInfo.system_id) { this.$trace.setOptionValue("userId", this.userInfo.system_id); // this.$trace.setOptionValue('userType',this.userInfo.userType) diff --git a/src/components/login-by-account.vue b/src/components/login-by-account.vue index 3847f64..a2667dc 100644 --- a/src/components/login-by-account.vue +++ b/src/components/login-by-account.vue @@ -2,20 +2,22 @@
- + - + @keyup.enter="loginAction()"> + @@ -23,7 +25,7 @@
@@ -57,6 +59,9 @@ import { ElMessage } from "element-plus"; import axios from "@/request/http.js"; import { Encrypt } from "@/services/secret.js"; import { useStore } from "vuex"; +import { useRouter } from "vue-router"; + +const router = useRouter(); const state = reactive({ loginForm: { @@ -125,7 +130,7 @@ const getMenu = (search) => { return axios.get(`/apaas/system/v5/menu/user/tree?search=${search}`); }; const getUser = () => { - Promise.all([getUserInfo(), getMenu("dadb2d3f-e263-48d1-9389-42acb9ea49f8")]).then((res) => { + Promise.all([getUserInfo(), getMenu("79a8f214-db78-4db7-9c28-db66276b4be2")]).then((res) => { if (res[0].data.code == 200 && res[1].data.code == 200) { let data = (res[1].data.data && res[1].data.data[0].children) || []; store.commit("setUserInfo", res[0].data.data); @@ -143,9 +148,7 @@ const getUser = () => { store.commit("setMenuObj", menuObj); // } generateRoutes(); - // this.$router.push("/"); - //跳转到工作台页面 - window.location.href = "/apaas/portal/ui/#/"; + router.push("/"); } }); }; diff --git a/src/components/login-by-code.vue b/src/components/login-by-code.vue index 0507b1a..16f6aa7 100644 --- a/src/components/login-by-code.vue +++ b/src/components/login-by-code.vue @@ -6,14 +6,14 @@ v-model="loginForm.mobile" autofocus="autofocus" placeholder="请输入手机号码" - @keyup.enter.native="loginAction()" /> + @keyup.enter="loginAction()" />
@@ -34,9 +34,7 @@
- - 登 录 - + 登 录 @@ -58,6 +56,9 @@ import { generateRoutes } from "../router/index"; import { ElMessage } from "element-plus"; import axios from "@/request/http.js"; import { useStore } from "vuex"; +import { useRouter } from "vue-router"; + +const router = useRouter(); const validatePhone = (rule, value, callback) => { const reg = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/; @@ -93,15 +94,13 @@ const loginFormRef = ref(null); const getMsgCode = () => { loginFormRef.value.validateField("mobile", (valid) => { if (valid) { - axios - .post("/apaas/system/v5/sms/verifyCode", { phone: state.loginForm.mobile }) - .then(({ data }) => { - if (data.code == 200) { - countDownAction(); - } else { - ElMessage.error(data.data); - } - }); + axios.post("/apaas/system/v5/sms/verifyCode", { phone: state.loginForm.mobile }).then(({ data }) => { + if (data.code == 200) { + countDownAction(); + } else { + ElMessage.error(data.data); + } + }); } }); }; // 获取验证码 @@ -149,7 +148,7 @@ const getMenu = (search) => { return axios.get(`/apaas/system/v5/menu/user/tree?search=${search}`); }; const getUser = () => { - Promise.all([getUserInfo(), getMenu("dadb2d3f-e263-48d1-9389-42acb9ea49f8")]).then((res) => { + Promise.all([getUserInfo(), getMenu("79a8f214-db78-4db7-9c28-db66276b4be2")]).then((res) => { if (res[0].data.code == 200 && res[1].data.code == 200) { let data = (res[1].data.data && res[1].data.data[0].children) || []; store.commit("setUserInfo", res[0].data.data); @@ -167,9 +166,7 @@ const getUser = () => { store.commit("setMenuObj", menuObj); // } generateRoutes(); - // this.$router.push("/"); - //跳转到工作台页面 - window.location.href = "/apaas/portal/ui/#/"; + router.push("/"); } }); }; -- 2.26.0