退出登录页面

This commit is contained in:
WindowBird 2025-11-10 16:54:46 +08:00
parent f31ef4b79d
commit 00bf837bd6
5 changed files with 93 additions and 16 deletions

View File

@ -47,3 +47,16 @@ export const login = (payload) => {
}); });
}; };
/**
* 退出登录
* @returns {Promise<any>} 退出结果
*/
export const logout = () => {
return uni.$uv.http.post('/logout', {}, {
custom: {
auth: true,
catch: true
}
});
};

61
components/MyProfile.vue Normal file
View File

@ -0,0 +1,61 @@
<template>
<view class="mine-page">
<view class="card">
<uv-button type="error" :plain="true" @click="onLogout" :loading="loading">
退出登录
</uv-button>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { useUserStore } from '@/store/user'
import { logout } from '@/common/api/user'
const loading = ref(false)
const userStore = useUserStore()
const onLogout = async () => {
if (loading.value) return
loading.value = true
try {
await logout()
} catch (e) {
//
} finally {
userStore.logout()
uni.$uv.toast('已退出登录')
setTimeout(() => {
uni.reLaunch({ url: '/pages/login/index' })
}, 200)
loading.value = false
}
}
</script>
<style lang="scss" scoped>
.mine-page {
background-color: #f6f7fb;
box-sizing: border-box;
}
.card {
background: #ffffff;
border-radius: 16rpx;
padding: 32rpx;
box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
}
.title {
font-size: 30rpx;
font-weight: 600;
margin-bottom: 24rpx;
color: #111827;
}
</style>

View File

@ -41,7 +41,7 @@
<view class="form-section"> <view class="form-section">
<!-- 客户 --> <!-- 客户 -->
<view class="form-item"> <view class="form-item">
<text class="form-label required">*客户</text> <text class="form-label required">客户</text>
<view class="form-input-wrapper readonly"> <view class="form-input-wrapper readonly">
<input <input
v-model="formData.customerName" v-model="formData.customerName"
@ -55,7 +55,7 @@
<!-- 客户状态 --> <!-- 客户状态 -->
<view class="form-item"> <view class="form-item">
<text class="form-label required">*客户状态</text> <text class="form-label required">客户状态</text>
<view class="form-input-wrapper" @click="openStatusPicker"> <view class="form-input-wrapper" @click="openStatusPicker">
<input <input
:value="getStatusText(formData.customerStatus)" :value="getStatusText(formData.customerStatus)"
@ -70,7 +70,7 @@
<!-- 意向强度 --> <!-- 意向强度 -->
<view class="form-item"> <view class="form-item">
<text class="form-label required">*意向强度</text> <text class="form-label required">意向强度</text>
<view class="form-input-wrapper" @click="openIntentLevelPicker"> <view class="form-input-wrapper" @click="openIntentLevelPicker">
<input <input
:value="getIntentLevelText(formData.customerIntentLevel)" :value="getIntentLevelText(formData.customerIntentLevel)"
@ -85,7 +85,7 @@
<!-- 跟进方式 --> <!-- 跟进方式 -->
<view class="form-item"> <view class="form-item">
<text class="form-label required">*跟进方式</text> <text class="form-label required">跟进方式</text>
<view class="form-input-wrapper" @click="openFollowTypePicker"> <view class="form-input-wrapper" @click="openFollowTypePicker">
<input <input
:value="getFollowTypeText(formData.type)" :value="getFollowTypeText(formData.type)"
@ -100,7 +100,7 @@
<!-- 跟进内容 --> <!-- 跟进内容 -->
<view class="form-item"> <view class="form-item">
<text class="form-label required">*跟进内容</text> <text class="form-label required">跟进内容</text>
<view class="textarea-wrapper"> <view class="textarea-wrapper">
<textarea <textarea
v-model="formData.content" v-model="formData.content"
@ -146,7 +146,7 @@
<view class="form-section"> <view class="form-section">
<!-- 跟进时间 --> <!-- 跟进时间 -->
<view class="form-item"> <view class="form-item">
<text class="form-label required">*跟进时间</text> <text class="form-label required">跟进时间</text>
<view class="form-input-wrapper" @click="openFollowTimePicker"> <view class="form-input-wrapper" @click="openFollowTimePicker">
<input <input
:value="formatDateTime(formData.followTime)" :value="formatDateTime(formData.followTime)"
@ -161,7 +161,7 @@
<!-- 下次跟进 --> <!-- 下次跟进 -->
<view class="form-item"> <view class="form-item">
<text class="form-label required">*下次跟进</text> <text class="form-label required">下次跟进</text>
<view class="form-input-wrapper" @click="openNextFollowTimePicker"> <view class="form-input-wrapper" @click="openNextFollowTimePicker">
<input <input
:value="formatDateTime(formData.nextFollowTime)" :value="formatDateTime(formData.nextFollowTime)"

View File

@ -45,7 +45,7 @@
<view class="form-section"> <view class="form-section">
<!-- 客户 --> <!-- 客户 -->
<view class="form-item"> <view class="form-item">
<text class="form-label required">*客户</text> <text class="form-label required">客户</text>
<view class="form-input-wrapper readonly"> <view class="form-input-wrapper readonly">
<input <input
v-model="formData.customerName" v-model="formData.customerName"
@ -59,7 +59,7 @@
<!-- 客户状态 --> <!-- 客户状态 -->
<view class="form-item"> <view class="form-item">
<text class="form-label required">*客户状态</text> <text class="form-label required">客户状态</text>
<view class="form-input-wrapper" @click="openStatusPicker"> <view class="form-input-wrapper" @click="openStatusPicker">
<input <input
:value="getStatusText(formData.customerStatus)" :value="getStatusText(formData.customerStatus)"
@ -74,7 +74,7 @@
<!-- 意向强度 --> <!-- 意向强度 -->
<view class="form-item"> <view class="form-item">
<text class="form-label required">*意向强度</text> <text class="form-label required">意向强度</text>
<view class="form-input-wrapper" @click="openIntentLevelPicker"> <view class="form-input-wrapper" @click="openIntentLevelPicker">
<input <input
:value="getIntentLevelText(formData.customerIntentLevel)" :value="getIntentLevelText(formData.customerIntentLevel)"
@ -89,7 +89,7 @@
<!-- 跟进方式 --> <!-- 跟进方式 -->
<view class="form-item"> <view class="form-item">
<text class="form-label required">*跟进方式</text> <text class="form-label required">跟进方式</text>
<view class="form-input-wrapper" @click="openFollowTypePicker"> <view class="form-input-wrapper" @click="openFollowTypePicker">
<input <input
:value="getFollowTypeText(formData.type)" :value="getFollowTypeText(formData.type)"
@ -104,7 +104,7 @@
<!-- 跟进内容 --> <!-- 跟进内容 -->
<view class="form-item"> <view class="form-item">
<text class="form-label required">*跟进内容</text> <text class="form-label required">跟进内容</text>
<view class="textarea-wrapper"> <view class="textarea-wrapper">
<textarea <textarea
v-model="formData.content" v-model="formData.content"
@ -150,7 +150,7 @@
<view class="form-section"> <view class="form-section">
<!-- 跟进时间 --> <!-- 跟进时间 -->
<view class="form-item"> <view class="form-item">
<text class="form-label required">*跟进时间</text> <text class="form-label required">跟进时间</text>
<view class="form-input-wrapper" @click="openFollowTimePicker"> <view class="form-input-wrapper" @click="openFollowTimePicker">
<input <input
:value="formatDateTime(formData.followTime)" :value="formatDateTime(formData.followTime)"
@ -165,7 +165,7 @@
<!-- 下次跟进 --> <!-- 下次跟进 -->
<view class="form-item"> <view class="form-item">
<text class="form-label required">*下次跟进</text> <text class="form-label required">下次跟进</text>
<view class="form-input-wrapper" @click="openNextFollowTimePicker"> <view class="form-input-wrapper" @click="openNextFollowTimePicker">
<input <input
:value="formatDateTime(formData.nextFollowTime)" :value="formatDateTime(formData.nextFollowTime)"

View File

@ -1,6 +1,6 @@
<template> <template>
<!-- 顶部Tabs栏只在非客户管理页面显示 --> <!-- 顶部Tabs栏只在非客户管理页面显示 -->
<view class="fixed-tabs" v-if="value !== 3"> <view class="fixed-tabs" v-if="value !== 3 && value !== 4">
<uv-tabs :list="topTabs" :current="topTabValue" @click="clickTab"></uv-tabs> <uv-tabs :list="topTabs" :current="topTabValue" @click="clickTab"></uv-tabs>
</view> </view>
@ -8,6 +8,8 @@
<view class="content-wrapper"> <view class="content-wrapper">
<!-- 客户管理底部导航栏选中时显示使用 v-show 避免组件销毁重建 --> <!-- 客户管理底部导航栏选中时显示使用 v-show 避免组件销毁重建 -->
<CustomerManagement v-if="value === 3" ref="customerManagementRef" /> <CustomerManagement v-if="value === 3" ref="customerManagementRef" />
<!-- 我的 -->
<MyProfile v-else-if="value === 4" />
<!-- 其他内容底部导航栏未选中客户管理时显示 --> <!-- 其他内容底部导航栏未选中客户管理时显示 -->
<template v-else> <template v-else>
@ -31,7 +33,7 @@
</view> </view>
<!-- 悬浮新建按钮只在日程编辑页显示 --> <!-- 悬浮新建按钮只在日程编辑页显示 -->
<FabPlus v-if="topTabValue === 0 && value !== 3" @click="handleAddClick" /> <FabPlus v-if="topTabValue === 0 && value !== 3 && value !== 4" @click="handleAddClick" />
<!-- 新建日程弹窗保留以备后用 --> <!-- 新建日程弹窗保留以备后用 -->
<AddEventModal :show="showAdd" @ok="addEvent" @cancel="showAdd = false" /> <AddEventModal :show="showAdd" @ok="addEvent" @cancel="showAdd = false" />
@ -60,6 +62,7 @@ import ContentDashboard from '@/components/ContentDashboard.vue';
import TodoList from '@/components/TodoList.vue'; import TodoList from '@/components/TodoList.vue';
import MessageContent from '@/components/MessageContent.vue'; import MessageContent from '@/components/MessageContent.vue';
import CustomerManagement from '@/components/CustomerManagement.vue'; import CustomerManagement from '@/components/CustomerManagement.vue';
import MyProfile from '@/components/MyProfile.vue';
// tabs // tabs
const topTabs = [ const topTabs = [