From af428323e11b4ee745399507d1e851026ca3cc48 Mon Sep 17 00:00:00 2001 From: zhangds Date: Thu, 30 May 2024 18:30:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dof-api.js | 3 ++- index.html | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/dof-api.js b/dof-api.js index 892eaa5..5006e64 100644 --- a/dof-api.js +++ b/dof-api.js @@ -1,4 +1,5 @@ -const baseurl = "http://lottery.unipay.test.86698.cn/api"; // 测试 +const baseurl = "http://192.168.110.39:8080"; // 本地 +// const baseurl = "http://lottery.unipay.test.86698.cn/api"; // 测试 // const baseurl = ""; // 正式 //统一请求 axios.interceptors.request.use((config) => { diff --git a/index.html b/index.html index 5e8f80e..343d93a 100644 --- a/index.html +++ b/index.html @@ -96,7 +96,7 @@
-
+
{{ state.toastText }}
@@ -113,22 +113,57 @@ showPage: false, showPop: "", checkedGoods: "", - toast: false, + showToast: false, toastText: "" }) + const openToast = (msg) => { + if (state.showToast) return; + state.toastText = msg; + state.showToast = true; + setTimeout(() => { + state.showToast = false; + }, 1500); + }; + // 获取商品列表 const getGoodsList = () => { } + // 获取用户信息 + const getUserInfo = () => { + try { + req.axiosGet("/front/getAccountInfo", { + token: state.token + }).then(res => { + console.log("res =>", res); + if (res.code === 200) { + state.showPage = true; + } else { + openToast(res.message); + } + }) + } catch (err) { + console.log("err =>", err); + } + + } + onMounted(() => { const url = new URL(window.location.href); const searchParams = new URLSearchParams(url.search); const token = searchParams.get("token"); if (token) { state.token = token; + localStorage.setItem("yl_token", token); + + state.showPage = true; + return + getUserInfo(); + } else { + openToast("未登录"); } })