refactor(登录流程): 优化登录退出逻辑和页面跳转
- 将 mine.vue 和 mineMini.vue 的退出登录逻辑简化为清除存储并触发事件 - 修改登录成功后的跳转方式为 redirectTo 避免页面堆叠 - 移除 Tabbar.vue 中多余的"全部"选项 - 在 minihome/index.vue 中处理退出登录后的 tab 切换 - 默认展开 RankListMini 并移除展开/收起功能
This commit is contained in:
parent
b899101cf9
commit
f306788d8c
|
|
@ -35,12 +35,12 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<view @click="isExp = !isExp" class="r_exp">
|
||||
<!-- <view @click="isExp = !isExp" class="r_exp">
|
||||
<text v-if="isExp">收起</text>
|
||||
<text v-else>展开全部</text>
|
||||
<img src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/zixun/up_icon.png" class="exp_up" v-if="isExp" />
|
||||
<img src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/zixun/down_icon.png" class="exp_up" v-else />
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- <LoginPopup :show="LoginShow" @handlePopupClose="handlePopupClose"
|
||||
@handlePopupSuccessCallback="handlePopupSuccessCallback" @handlePopupErrorCallback="handlePopupErrorCallback" /> -->
|
||||
|
|
@ -53,7 +53,7 @@ import dayjs from "dayjs/esm/index";
|
|||
import LoginPopup from "@/components/loginPopup/index.vue";
|
||||
import { Session } from "@/utils/storage";
|
||||
|
||||
const isExp = ref(false);
|
||||
const isExp = ref(true);
|
||||
const rankListLocal = ref([]);
|
||||
const loading = ref(true);
|
||||
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ const loginOut = () => {
|
|||
uni.reLaunch({
|
||||
url: "/pages/login/index",
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
const handleClick = (val: number) => {
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ import LoginPopup from "@/components/loginPopup/index.vue";
|
|||
import { useShareStore } from "@/stores/shareStore";
|
||||
import Navbar from '@/components/mini/Navbar.vue'
|
||||
|
||||
const emit = defineEmits(['logout'])
|
||||
|
||||
const stores = useShareStore();
|
||||
const curPages = getCurrentPages();
|
||||
|
||||
|
|
@ -150,18 +152,8 @@ const loginBtnStatus = () => {
|
|||
|
||||
// 退出登录,回到登录页面
|
||||
const loginOut = () => {
|
||||
uni.showToast({
|
||||
title: "退出登录",
|
||||
icon: "none",
|
||||
duration: 1500,
|
||||
});
|
||||
// 清除 cookie
|
||||
Session.clear();
|
||||
uni.removeStorageSync("subStatus");
|
||||
uni.removeStorageSync("tabValue");
|
||||
uni.reLaunch({
|
||||
url: "/pages/login/index",
|
||||
});
|
||||
uni.clearStorageSync()
|
||||
emit("logout")
|
||||
};
|
||||
|
||||
const handleClick = (val: number) => {
|
||||
|
|
|
|||
|
|
@ -17,13 +17,6 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<view class="tabbar_item" @click="tabChange(1)">
|
||||
<image v-if="tabIndex == 0" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_normal.png"
|
||||
class="tabbar_img" />
|
||||
<image v-if="tabIndex == 1" src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/mine_icon_pre.png"
|
||||
class="tabbar_img" />
|
||||
<text class="tabbar_title" :style="{ color: tabIndex == 1 ? '#D13E3C' : '#757A80' }">全部</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
|
|
|||
|
|
@ -97,10 +97,9 @@ async function doWxAuthFn(phoneObj, jsCode) {
|
|||
uni.setStorageSync("unionId", data.unionId);
|
||||
uni.setStorageSync("openId", data.openId);
|
||||
uni.setStorageSync("phone", data.phone);
|
||||
uni.navigateTo({
|
||||
uni.redirectTo({
|
||||
url: "/pages/minihome/index",
|
||||
|
||||
})
|
||||
});
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
<view style="margin-top: 30rpx;" v-if="tabIndex == 0">
|
||||
<RankListMini :newsList="newsList"></RankListMini>
|
||||
</view>
|
||||
<MineMini v-if="tabIndex == 1"></MineMini>
|
||||
<MineMini v-if="tabIndex == 1" @logout="tabIndex = 0"></MineMini>
|
||||
</view>
|
||||
|
||||
<Tabbar @tabChange="tabChange"></Tabbar>
|
||||
|
|
|
|||
Loading…
Reference in New Issue