添加后台清缓存的处理

This commit is contained in:
kron
2025-12-03 16:46:07 +08:00
parent d9ac803902
commit a9156e57ca
4 changed files with 9 additions and 2 deletions

View File

@@ -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();
});
</script>

View File

@@ -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 });

View File

@@ -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;

View File

@@ -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;