From 93c477323bfd5c69c3de021970a55fbbfda0465d Mon Sep 17 00:00:00 2001 From: Vinjor Date: Fri, 27 Sep 2024 21:17:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=82=E5=8A=A0=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.js | 4 ++-- pages/home/active.vue | 4 ++++ pages/my/my.vue | 5 +++-- utils/common.js | 18 +++++++++--------- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/config.js b/config.js index ec892d3..cef8f9b 100644 --- a/config.js +++ b/config.js @@ -1,8 +1,8 @@ // 应用全局配置 module.exports = { // baseUrl: 'https://www.nuoyunr.com', - // baseUrl: 'http://192.168.1.4:48080', - baseUrl: "http://localhost:48080", + baseUrl: 'http://192.168.1.4:48080', + // baseUrl: "http://localhost:48080", imagesUrl: 'http://shequ.0315e.com/static/images/pages/', baseImageUrl: 'https://www.nuoyunr.com/minio/', wsUrl: 'wss://www.nuoyunr.com', diff --git a/pages/home/active.vue b/pages/home/active.vue index 2ad2d2d..bd65dda 100644 --- a/pages/home/active.vue +++ b/pages/home/active.vue @@ -162,6 +162,10 @@ export default { data: dataObj }).then((res) => { this.getActive() + uni.showToast({ + title: '礼包领取成功!', + icon: 'none' + }) this.canClick = true console.log(res); }) diff --git a/pages/my/my.vue b/pages/my/my.vue index a27d3f8..351930b 100644 --- a/pages/my/my.vue +++ b/pages/my/my.vue @@ -67,6 +67,7 @@ import request from "@/utils/request"; import {getUserInfoRequest} from "@/utils/common.js"; import {getToken,setUserInfo} from '@/utils/auth.js' + import {getUserInfo} from "../../utils/auth"; export default { components: { tabBarVue, @@ -111,8 +112,8 @@ }, //获取当前登录用户信息 async getServer() { - console.log("获取用户信息") - this.customInfo = getUserInfoRequest() + await getUserInfoRequest() + this.customInfo = JSON.parse(getUserInfo()) } } } diff --git a/utils/common.js b/utils/common.js index bf1e83e..6e54fef 100644 --- a/utils/common.js +++ b/utils/common.js @@ -60,17 +60,17 @@ export function tansParams(params) { * @returns {Promise} */ export async function getUserInfoRequest(){ - const res = await request({ + request({ url: "/userClient/customer/getUserCustomer", method: 'get', params:{} + }).then(res=>{ + if(!res.data){ + uni.reLaunch({ + url: '/pages/my/register' + }) + }else{ + setUserInfo(JSON.stringify(res.data)) + } }) - if(!res.data){ - uni.reLaunch({ - url: '/pages/my/register' - }) - }else{ - setUserInfo(JSON.stringify(res.data)) - return res.data - } }