Commit cc3796041e4021ef81737af2a2b8a87ab6b530d3

Authored by xp.Huang
2 parents dd6e6b3a c3ce930d

Merge branch 'dev-fix-ww' into 'main_dev'

fix: DEFECT-1272 修复复制失效问题

See merge request yunteng/thingskit-front!587
... ... @@ -27,9 +27,9 @@
27 27 import { ShareModal } from '/@/views/common/ShareModal';
28 28 import { ViewTypeNameEnum } from '../../common/ShareModal/config';
29 29 import { useModal } from '/@/components/Modal';
30   - import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
31 30 import { ViewType } from '../../visual/board/config/panelDetail';
32 31 import { useRole } from '/@/hooks/business/useRole';
  32 + import { useClipboard } from '@vueuse/core';
33 33
34 34 const listColumn = ref(5);
35 35
... ... @@ -167,12 +167,12 @@
167 167 return `${origin}${configurationPrefix}/?${searchParams.toString()}`;
168 168 };
169 169
170   - const { clipboardRef, isSuccessRef } = useCopyToClipboard();
171   - const handleCreateShareUrl = (record: ConfigurationCenterItemsModal) => {
  170 + const { copied, copy } = useClipboard();
  171 + const handleCreateShareUrl = async (record: ConfigurationCenterItemsModal) => {
172 172 if (!unref(getShareFlag)) return;
173 173 const url = createShareUrl(record);
174   - clipboardRef.value = url;
175   - if (unref(isSuccessRef)) {
  174 + await copy(url);
  175 + if (unref(copied)) {
176 176 createMessage.success('复制成功~');
177 177 }
178 178 };
... ...
... ... @@ -28,11 +28,11 @@
28 28 import { useModal } from '/@/components/Modal';
29 29 import { ShareModal } from '/@/views/common/ShareModal';
30 30 import { ViewTypeNameEnum } from '../common/ShareModal/config';
31   - import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
32 31 import { ViewType } from '../visual/board/config/panelDetail';
33 32 import { useUserStore } from '/@/store/modules/user';
34 33 import { RoleEnum } from '/@/enums/roleEnum';
35 34 import { useRole } from '/@/hooks/business/useRole';
  35 + import { useClipboard } from '@vueuse/core';
36 36
37 37 const listColumn = ref(5);
38 38
... ... @@ -182,10 +182,10 @@
182 182 return userStore.getUserInfo.roles![0] !== RoleEnum.CUSTOMER_USER;
183 183 });
184 184
185   - const { clipboardRef, isSuccessRef } = useCopyToClipboard();
186   - const handleCreateShareUrl = (record: BigScreenCenterItemsModel) => {
187   - clipboardRef.value = createShareUrl(record);
188   - if (unref(isSuccessRef)) {
  185 + const { copied, copy } = useClipboard();
  186 + const handleCreateShareUrl = async (record: BigScreenCenterItemsModel) => {
  187 + await copy(createShareUrl(record));
  188 + if (unref(copied)) {
189 189 createMessage.success('复制成功~');
190 190 }
191 191 };
... ...
... ... @@ -3,7 +3,6 @@
3 3 import { onMounted, ref, unref } from 'vue';
4 4 import { PageWrapper } from '/@/components/Page';
5 5 import { MoreOutlined, ShareAltOutlined } from '@ant-design/icons-vue';
6   - import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
7 6 import { useMessage } from '/@/hooks/web/useMessage';
8 7 import Dropdown from '/@/components/Dropdown/src/Dropdown.vue';
9 8 import { DropMenu } from '/@/components/Dropdown';
... ... @@ -25,6 +24,7 @@
25 24 import { ModalParamsType } from '/#/utils';
26 25 import { DataActionModeEnum } from '/@/enums/toolEnum';
27 26 import { useRole } from '/@/hooks/business/useRole';
  27 + import { useClipboard } from '@vueuse/core';
28 28
29 29 const ListItem = List.Item;
30 30 const router = useRouter();
... ... @@ -87,10 +87,10 @@
87 87 return `${origin}${DATA_BOARD_SHARE_URL(id, publicId)}`;
88 88 };
89 89
90   - const { clipboardRef } = useCopyToClipboard();
91   - const handleCopyShareUrl = (record: DataBoardRecord) => {
92   - clipboardRef.value = createShareUrl(record);
93   - unref(clipboardRef) ? createMessage.success('复制成功') : createMessage.error('未找到分享链接');
  90 + const { copied, copy } = useClipboard();
  91 + const handleCopyShareUrl = async (record: DataBoardRecord) => {
  92 + await copy(createShareUrl(record));
  93 + unref(copied) ? createMessage.success('复制成功') : createMessage.error('未找到分享链接');
94 94 };
95 95
96 96 const { isCustomerUser } = useRole();
... ...