diff --git a/otherPages/binding/withdrawal/index.vue b/otherPages/binding/withdrawal/index.vue index af3bf09..026b8b9 100644 --- a/otherPages/binding/withdrawal/index.vue +++ b/otherPages/binding/withdrawal/index.vue @@ -27,7 +27,10 @@ lineHeight: '45rpx', }"> - + + diff --git a/pages/login/index.vue b/pages/login/index.vue index 430a999..31e9b02 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -5,7 +5,7 @@ - diff --git a/pages/myOrdersManage/index.vue b/pages/myOrdersManage/index.vue index 197296f..72730e1 100644 --- a/pages/myOrdersManage/index.vue +++ b/pages/myOrdersManage/index.vue @@ -2,14 +2,14 @@ - 总订单 - 日订单 + 总订单 + 日订单 - - - + + + + + 加载中... @@ -64,8 +75,6 @@ 暂无订单数据 - - @@ -86,8 +95,10 @@ import { getLoginStatus } from "@/utils/useMixin.js" - // import personOrder from "./components/personOrder.vue"; - // import lossOrder from "./components/lossOrder.vue"; + import { + getIsLogin, + getToken + } from "@/utils/auth"; import { myList } from "@/api/receivingHall/index.js" @@ -108,8 +119,10 @@ }) onShow(() => { - if (!getLoginStatus()) return; - getList(); + checkLoginStatus(); + if (isLogin.value) { + getList(); + } }) const current = ref(0) @@ -118,6 +131,7 @@ const dateOrderList = ref([]) const loading = ref(false) // 添加loading状态 const requestId = ref(0) // 添加请求序列号 + const isLogin = ref(false) // 添加登录状态 const store = useStore(); const userInfo = computed(() => { @@ -158,7 +172,34 @@ }, ]) + // 检查登录状态 + const checkLoginStatus = () => { + if (getIsLogin() && getToken()) { + isLogin.value = true + } else { + isLogin.value = false + } + } + + // 跳转登录页面 + const goToLogin = () => { + uni.navigateTo({ + url: "/pages/login/index" + }) + } + + // 检查登录状态,未登录则跳转登录 + const checkLoginAndRedirect = () => { + if (!isLogin.value) { + goToLogin() + return false + } + return true + } + function getList() { + if (!isLogin.value) return; + loading.value = true; // 开始加载 requestId.value++; // 递增请求序列号 const currentRequestId = requestId.value; // 保存当前请求的ID @@ -231,39 +272,22 @@ loading.value = false; // 结束加载 } }) - - // getOrderDateList({ - // status: index, - // userId: userInfo.value.userId - // }) - // .then(res => { - // if (res.code == 200) { - // dateOrderList.value = res.data - // // 更新标签数量显示 - // let totalOrders = 0; - // dateOrderList.value.forEach(item => { - // totalOrders += item.num || 0; - // }); - // tabList2[index].badge.value = totalOrders; - // } - // }) - // .finally(() => { - // if(activeIndex.value == 2){ - // loading.value = false; // 结束加载 - // } - // }) } } - function clickTab(index) { + function handleClickTab(index) { current.value = 0; activeIndex.value = index; - getList(); + if (checkLoginAndRedirect()) { + getList(); + } } - const classIfyClickTab = (item) => { + const handleClassifyClickTab = (item) => { current.value = item.index; - getList(); + if (checkLoginAndRedirect()) { + getList(); + } } @@ -302,4 +326,33 @@ font-size: 28rpx; } } + + .login-tip-container { + display: flex; + align-items: center; + justify-content: center; + padding: 80rpx 40rpx; + + .login-tip-content { + display: flex; + flex-direction: column; + align-items: center; + padding: 60rpx; + border-radius: 20rpx; + + .login-image { + margin-bottom: 30rpx; + } + + .login-tip { + font-size: 28rpx; + color: #666; + margin-bottom: 30rpx; + } + + .login-btn { + width: 240rpx; + } + } + } \ No newline at end of file diff --git a/pages/orderTakingManage/index.vue b/pages/orderTakingManage/index.vue index e9ffb1c..a936418 100644 --- a/pages/orderTakingManage/index.vue +++ b/pages/orderTakingManage/index.vue @@ -9,12 +9,24 @@ }" :inactiveStyle="{ color: '#FFFFFF', transform: 'scale(1)' - }" :itemStyle="{height:'88rpx',width : '33%'}" lineColor="#FFFFFF" @click="clickEvent"> + }" :itemStyle="{height:'88rpx',width : '33%'}" lineColor="#FFFFFF" @click="handleClickEvent"> - + + + + + @@ -30,6 +42,10 @@ onShow } from "@dcloudio/uni-app" import { getLoginStatus } from "@/utils/useMixin.js" + import { + getIsLogin, + getToken + } from "@/utils/auth"; import { orderList } from "@/api/receivingHall/index.js" @@ -41,6 +57,7 @@ import dayjs from "dayjs"; import { getOrderServiceText, getProductNameText } from '@/utils/serviceTime.js' const current = ref(0) + const isLogin = ref(false) // 添加登录状态 const list = reactive([{ name: '系统派单', badge: { @@ -67,12 +84,41 @@ import { getOrderServiceText, getProductNameText } from '@/utils/serviceTime.js' const orderlist = ref([]); onShow(() => { - if (!getLoginStatus()) return; - getOrderList(); + checkLoginStatus(); + if (isLogin.value) { + getOrderList(); + } }) + // 检查登录状态 + const checkLoginStatus = () => { + if (getIsLogin() && getToken()) { + isLogin.value = true + } else { + isLogin.value = false + } + } + + // 跳转登录页面 + const goToLogin = () => { + uni.navigateTo({ + url: "/pages/login/index" + }) + } + + // 检查登录状态,未登录则跳转登录 + const checkLoginAndRedirect = () => { + if (!isLogin.value) { + goToLogin() + return false + } + return true + } + // 获取接单大厅列表 const getOrderList = async () => { + if (!isLogin.value) return; + let response = await orderList({ type: current.value, userIdJson: userInfo.value.userId, @@ -91,19 +137,50 @@ import { getOrderServiceText, getProductNameText } from '@/utils/serviceTime.js' }) } } - - - const clickEvent = (item) => { + const handleClickEvent = (item) => { current.value = item.index; - getOrderList(); + if (checkLoginAndRedirect()) { + getOrderList(); + } } const updateList = () => { - getOrderList(); + if (checkLoginAndRedirect()) { + getOrderList(); + } } \ No newline at end of file diff --git a/pages/userManage/index.vue b/pages/userManage/index.vue index 03c5108..9a4d360 100644 --- a/pages/userManage/index.vue +++ b/pages/userManage/index.vue @@ -1,165 +1,158 @@