退出登录页面
This commit is contained in:
parent
f31ef4b79d
commit
00bf837bd6
|
|
@ -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
61
components/MyProfile.vue
Normal 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>
|
||||
|
||||
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
<view class="form-section">
|
||||
<!-- 客户 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label required">*客户</text>
|
||||
<text class="form-label required">客户</text>
|
||||
<view class="form-input-wrapper readonly">
|
||||
<input
|
||||
v-model="formData.customerName"
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
<!-- 客户状态 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label required">*客户状态</text>
|
||||
<text class="form-label required">客户状态</text>
|
||||
<view class="form-input-wrapper" @click="openStatusPicker">
|
||||
<input
|
||||
:value="getStatusText(formData.customerStatus)"
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
|
||||
<!-- 意向强度 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label required">*意向强度</text>
|
||||
<text class="form-label required">意向强度</text>
|
||||
<view class="form-input-wrapper" @click="openIntentLevelPicker">
|
||||
<input
|
||||
:value="getIntentLevelText(formData.customerIntentLevel)"
|
||||
|
|
@ -85,7 +85,7 @@
|
|||
|
||||
<!-- 跟进方式 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label required">*跟进方式</text>
|
||||
<text class="form-label required">跟进方式</text>
|
||||
<view class="form-input-wrapper" @click="openFollowTypePicker">
|
||||
<input
|
||||
:value="getFollowTypeText(formData.type)"
|
||||
|
|
@ -100,7 +100,7 @@
|
|||
|
||||
<!-- 跟进内容 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label required">*跟进内容</text>
|
||||
<text class="form-label required">跟进内容</text>
|
||||
<view class="textarea-wrapper">
|
||||
<textarea
|
||||
v-model="formData.content"
|
||||
|
|
@ -146,7 +146,7 @@
|
|||
<view class="form-section">
|
||||
<!-- 跟进时间 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label required">*跟进时间</text>
|
||||
<text class="form-label required">跟进时间</text>
|
||||
<view class="form-input-wrapper" @click="openFollowTimePicker">
|
||||
<input
|
||||
:value="formatDateTime(formData.followTime)"
|
||||
|
|
@ -161,7 +161,7 @@
|
|||
|
||||
<!-- 下次跟进 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label required">*下次跟进</text>
|
||||
<text class="form-label required">下次跟进</text>
|
||||
<view class="form-input-wrapper" @click="openNextFollowTimePicker">
|
||||
<input
|
||||
:value="formatDateTime(formData.nextFollowTime)"
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
<view class="form-section">
|
||||
<!-- 客户 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label required">*客户</text>
|
||||
<text class="form-label required">客户</text>
|
||||
<view class="form-input-wrapper readonly">
|
||||
<input
|
||||
v-model="formData.customerName"
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
<!-- 客户状态 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label required">*客户状态</text>
|
||||
<text class="form-label required">客户状态</text>
|
||||
<view class="form-input-wrapper" @click="openStatusPicker">
|
||||
<input
|
||||
:value="getStatusText(formData.customerStatus)"
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
|
||||
<!-- 意向强度 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label required">*意向强度</text>
|
||||
<text class="form-label required">意向强度</text>
|
||||
<view class="form-input-wrapper" @click="openIntentLevelPicker">
|
||||
<input
|
||||
:value="getIntentLevelText(formData.customerIntentLevel)"
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
|
||||
<!-- 跟进方式 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label required">*跟进方式</text>
|
||||
<text class="form-label required">跟进方式</text>
|
||||
<view class="form-input-wrapper" @click="openFollowTypePicker">
|
||||
<input
|
||||
:value="getFollowTypeText(formData.type)"
|
||||
|
|
@ -104,7 +104,7 @@
|
|||
|
||||
<!-- 跟进内容 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label required">*跟进内容</text>
|
||||
<text class="form-label required">跟进内容</text>
|
||||
<view class="textarea-wrapper">
|
||||
<textarea
|
||||
v-model="formData.content"
|
||||
|
|
@ -150,7 +150,7 @@
|
|||
<view class="form-section">
|
||||
<!-- 跟进时间 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label required">*跟进时间</text>
|
||||
<text class="form-label required">跟进时间</text>
|
||||
<view class="form-input-wrapper" @click="openFollowTimePicker">
|
||||
<input
|
||||
:value="formatDateTime(formData.followTime)"
|
||||
|
|
@ -165,7 +165,7 @@
|
|||
|
||||
<!-- 下次跟进 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label required">*下次跟进</text>
|
||||
<text class="form-label required">下次跟进</text>
|
||||
<view class="form-input-wrapper" @click="openNextFollowTimePicker">
|
||||
<input
|
||||
:value="formatDateTime(formData.nextFollowTime)"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<!-- 顶部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>
|
||||
</view>
|
||||
|
||||
|
|
@ -8,6 +8,8 @@
|
|||
<view class="content-wrapper">
|
||||
<!-- 客户管理(底部导航栏选中时显示,使用 v-show 避免组件销毁重建) -->
|
||||
<CustomerManagement v-if="value === 3" ref="customerManagementRef" />
|
||||
<!-- 我的 -->
|
||||
<MyProfile v-else-if="value === 4" />
|
||||
|
||||
<!-- 其他内容(底部导航栏未选中客户管理时显示) -->
|
||||
<template v-else>
|
||||
|
|
@ -31,7 +33,7 @@
|
|||
</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" />
|
||||
|
|
@ -60,6 +62,7 @@ import ContentDashboard from '@/components/ContentDashboard.vue';
|
|||
import TodoList from '@/components/TodoList.vue';
|
||||
import MessageContent from '@/components/MessageContent.vue';
|
||||
import CustomerManagement from '@/components/CustomerManagement.vue';
|
||||
import MyProfile from '@/components/MyProfile.vue';
|
||||
|
||||
// 顶部tabs选项
|
||||
const topTabs = [
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user