Files
lingji-work-fe/src/components/join-modal.vue
dkp c83eadcbed feat(layout): 添加企业邀请码加入功能
- 在 Basic.vue 中添加 JoinModal 组件,用于展示加入企业的模态框
- 添加 checkHasInviteCode 方法,在页面加载时检查邀请码
- 新增 getQueryParam 工具函数,用于获取 URL 参数
- 添加加入企业的相关 API 接口
- 实现 JoinModal 组件,包含加入企业的逻辑和界面
2025-06-20 18:16:40 +08:00

48 lines
1.2 KiB
Vue

<template>
<Modal title="加入企业" @ok="handleJoin">
<div v-if="enterprise" class="join-body flex item-center">
<img src="@/assets/warning.svg" alt="" />
{{ `确定加入 “${enterprise.name}”吗?` }}
</div>
</Modal>
</template>
<script setup lang="ts">
import Modal from '@components/modal.vue';
import { ref, onMounted } from 'vue';
import { getQueryParam } from '@/utils/helper';
import { getEnterpriseByInviteCode, joinEnterpriseByInviteCode } from '@/api/all';
const enterprise = ref();
const inviteCode = ref();
async function getEnterprise() {
inviteCode.value = getQueryParam('invite_code');
if (inviteCode.value) {
enterprise.value = await getEnterpriseByInviteCode(inviteCode.value);
}
}
async function handleJoin() {
await joinEnterpriseByInviteCode(inviteCode.value);
AMessage.success('加入成功');
}
onMounted(() => {
getEnterprise();
});
</script>
<style lang="less">
.join-body {
margin: 0;
font-family: Alibaba PuHuiTi, serif;
font-weight: 400;
font-size: 14px;
color: var(--Text-1, rgba(33, 31, 36, 1));
img {
width: 20px;
height: 20px;
margin-right: 12px;
margin-left: 0;
}
}
</style>