feat(功能用例): 功能用例分享功能开发

--bug=1035749 --user=宋天阳 【用例管理】功能用例-用例详情-点击分享按钮无响应 https://www.tapd.cn/55049933/s/1472213
This commit is contained in:
song-tianyang 2024-03-09 16:56:08 +08:00 committed by Craftsman
parent 455a4cdcf5
commit 5409468da3
1 changed files with 24 additions and 3 deletions

View File

@ -225,7 +225,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { Message } from '@arco-design/web-vue'; import { Message } from '@arco-design/web-vue';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
@ -353,7 +353,7 @@
console.log(error); console.log(error);
} }
} }
const route = useRoute();
const detailInfo = ref<DetailCase>({ ...initDetail }); const detailInfo = ref<DetailCase>({ ...initDetail });
const customFields = ref<CustomAttributes[]>([]); const customFields = ref<CustomAttributes[]>([]);
const caseLevels = ref<CaseLevel>('P0'); const caseLevels = ref<CaseLevel>('P0');
@ -412,7 +412,28 @@
const shareLoading = ref<boolean>(false); const shareLoading = ref<boolean>(false);
function shareHandler() {} function shareHandler() {
const { origin } = window.location;
const url = `${origin}/#${route.path}?id=${detailInfo.value.id}&projectId=${appStore.currentProjectId}&organizationId=${appStore.currentOrgId}`;
if (navigator.clipboard) {
navigator.clipboard.writeText(url).then(
() => {
Message.info(t('bugManagement.detail.shareTip'));
},
(e) => {
Message.error(e);
}
);
} else {
const input = document.createElement('input');
input.value = url;
document.body.appendChild(input);
input.select();
document.execCommand('copy');
document.body.removeChild(input);
Message.info(t('bugManagement.detail.shareTip'));
}
}
const followLoading = ref<boolean>(false); const followLoading = ref<boolean>(false);
// //