zhengyiming
2025-02-20 703c46d17731d1b437509f326c050d1d36838f74
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<template>
  <PageLayout title="合同预览" has-border v-if="url && lgGigSignId">
    <ContentScrollView>
      <iframe :src="url" class="contract-preview-body"></iframe>
    </ContentScrollView>
    <PageFooter>
      <PageFooterBtn @click="handleConfirm">前往签约</PageFooterBtn>
    </PageFooter>
  </PageLayout>
</template>
 
<script setup lang="ts">
import * as lgGigWorkerServices from '@/services/api/LgGigWorker';
import { SignUserType, SignChannelEnum } from '@/constants';
import { useSignChannelBySignId } from '@/hooks';
import { Message } from '@bole-core/core';
 
defineOptions({
  name: 'ContractPreview',
});
 
const route = useRoute();
const url = (route.query.url as string) ?? '';
const lgGigSignId = (route.query.lgGigSignId as string) ?? '';
console.log('lgGigSignId: ', lgGigSignId);
 
const { signChannel, ensureSignChannelBySignId } = useSignChannelBySignId({ signId: lgGigSignId });
 
onMounted(async () => {
  try {
    await ensureSignChannelBySignId();
    if (signChannel.value === SignChannelEnum.Alipay) {
      handleConfirm();
    }
  } catch (error) {}
});
 
async function handleConfirm() {
  try {
    let params: API.LgGigUserToSignUrlInput = {
      lgGigSignId: lgGigSignId,
      userType: SignUserType.Person,
    };
    let res = await lgGigWorkerServices.lgGigUserToSignUrl(params);
    if (res) {
      if (res.success) {
        location.href = res.data;
      } else {
        Message.errorMessage(res.msg);
      }
    }
  } catch (error) {}
}
</script>
 
<style lang="scss" scoped>
@use '@/style/common.scss' as *;
 
.contract-preview-body {
  width: 100%;
  height: 100%;
}
</style>