diff --git a/src/App.vue b/src/App.vue index 978d505..302d1f1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -29,7 +29,12 @@ watch( } ); +function emitUpdateUser(value) { + updateUser(value); +} + onShow(() => { + uni.$on("update-user", emitUpdateUser); const token = uni.getStorageSync( `${uni.getAccountInfoSync().miniProgram.envVersion}_token` ); @@ -42,6 +47,7 @@ onShow(() => { }); onHide(() => { + uni.$off("update-user", emitUpdateUser); websocket.closeWebSocket(); }); diff --git a/src/apis.js b/src/apis.js index 2f32381..76297c2 100644 --- a/src/apis.js +++ b/src/apis.js @@ -45,6 +45,7 @@ function request(method, url, data = {}) { uni.removeStorageSync( `${uni.getAccountInfoSync().miniProgram.envVersion}_token` ); + uni.$emit("update-user"); } if (message === "ROOM_FULL") { resolve({ full: true }); diff --git a/src/components/Signin.vue b/src/components/Signin.vue index b9d7e39..e3e4385 100644 --- a/src/components/Signin.vue +++ b/src/components/Signin.vue @@ -264,7 +264,7 @@ onShow(() => { height: 14px; border-radius: 50%; margin-right: 10px; - border: 1rpx solid #fff; + border: 1px solid #fff; } .protocol > view:last-child { display: flex; diff --git a/src/pages/index.vue b/src/pages/index.vue index 29281f8..4167de1 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -88,7 +88,7 @@ onShow(async () => { console.log("首页数据:", homeData); if (homeData.user) { updateUser(homeData.user); - if (homeData.user.id === 823) { + if ("823,209".indexOf(homeData.user.id) !== -1) { const show = uni.getStorageSync("show-the-user"); if (!show) { showTheUser.value = true;