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("未登录"); } })