From 267a31006317887642eeb9d5cd513f3ca7553689 Mon Sep 17 00:00:00 2001 From: hzj <1304805162@qq.com> Date: Tue, 14 Oct 2025 11:46:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=88=91=E7=9A=84=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E9=A1=B5):=20=E5=AF=B9=E6=8E=A5=E2=80=9C=E7=A6=BB=E5=BC=80?= =?UTF-8?q?=E6=88=91=E7=9A=84=E4=BB=A3=E7=90=86=E2=80=9D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/host.js | 12 ++++++ src/views/HostSettingView.vue | 78 +++++++++++++++++++++++++++++++---- 2 files changed, 83 insertions(+), 7 deletions(-) diff --git a/src/api/host.js b/src/api/host.js index 9b43599..03cc9cd 100644 --- a/src/api/host.js +++ b/src/api/host.js @@ -11,3 +11,15 @@ export const getMyAgency = async () => { throw error } } + +// 退出团队 +export const leaveAgency = async (data) => { + try { + const response = await post(`/team/user/apply`, data) + return response + } catch (error) { + console.error('Failed to fetch leave agency:', error) + console.error('error:' + error.response.errorMsg) + throw error + } +} diff --git a/src/views/HostSettingView.vue b/src/views/HostSettingView.vue index efa56b3..f8e258b 100644 --- a/src/views/HostSettingView.vue +++ b/src/views/HostSettingView.vue @@ -40,11 +40,39 @@
-
Leave
+
Leave
+ + +
+
+
+
+ Tips +
+
+ +
+
+ The host can only leave the current agent on the 1st and 16th of each month +
+
+ +
+ + +
+
+
+
@@ -53,9 +81,12 @@ import { onMounted, reactive, ref } from 'vue' import { useRouter } from 'vue-router' import MobileHeader from '../components/MobileHeader.vue' import { showError } from '@/utils/toast.js' -import { getMyAgency } from '@/api/host' +import { getMyAgency, leaveAgency } from '@/api/host' +import maskLayer from '@/components/MaskLayer.vue' +import { getTeamId } from '@/utils/userStore.js' const router = useRouter() +const maskLayerShow = ref(false) // 用户信息 const userInfo = ref({}) @@ -66,12 +97,13 @@ const defaultAvatarUrl = (e) => { e.target.src = new URL('/src/assets/images/WeeklyStar/defaultAvatar.png', import.meta.url).href } -// 方法 -const leaveAgent = () => { - if (confirm('Are you sure you want to leave this agency?')) { - showError('Leave agency request submitted') - // 这里可以添加实际的离开代理商逻辑 +// 确定离开 +const confirmLeave = async () => { + console.log('确定离开') + const resLeave = await leaveAgency({ reason: 'QUIT', teamId: getTeamId() }) + if (resLeave.status) { } + maskLayerShow.value = false } const getMyAgencyInfo = async () => { @@ -110,6 +142,38 @@ onMounted(() => { background-color: #00000010; } +.cancel-btn, +.confirm-btn { + flex: 1; + padding: 12px; + border: none; + border-radius: 8px; + font-size: 14px; + font-weight: 700; + cursor: pointer; + transition: all 0.2s; +} + +.cancel-btn { + border: 1px solid #e6e6e6; + background-color: #fff; + color: rgba(0, 0, 0, 0.4); +} + +.confirm-btn { + color: rgba(255, 255, 255, 0.8); + background: linear-gradient( + 152deg, + rgba(198, 112, 255, 0.6) 7.01%, + rgba(119, 38, 255, 0.6) 92.99% + ); +} + +.cancel-btn:active, +.confirm-btn:active { + transform: scale(0.98); +} + @media screen and (max-width: 360px) { * { font-size: 10px;