@king-one/antdv 1.1.11 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/es/components/index.mjs +6 -1
  3. package/dist/es/components/pro-contract-view/apis/pro-contract-view.api.mjs +1 -1
  4. package/dist/es/components/pro-loading/src/pro-loading.mjs +2 -1
  5. package/dist/es/components/pro-selector/index.mjs +8 -0
  6. package/dist/es/components/pro-selector/src/components/org-tree.mjs +304 -0
  7. package/dist/es/components/pro-selector/src/components/user.mjs +92 -0
  8. package/dist/es/components/pro-selector/src/hooks/index.mjs +4 -0
  9. package/dist/es/components/pro-selector/src/hooks/useUserSelector.mjs +9 -0
  10. package/dist/es/components/pro-selector/src/pro-user.mjs +210 -0
  11. package/dist/es/components/pro-selector/src/types.mjs +1 -0
  12. package/dist/es/components/pro-selector/src/utils/orgTree.mjs +93 -0
  13. package/dist/es/components/pro-selector/style/index.mjs +2 -0
  14. package/dist/es/components/pro-sign/apis/pro-sign-api.mjs +19 -0
  15. package/dist/es/components/pro-sign/index.mjs +17 -0
  16. package/dist/es/components/pro-sign/src/components/add-signature.vue.mjs +4 -0
  17. package/dist/es/components/pro-sign/src/components/add-signature.vue2.mjs +129 -0
  18. package/dist/es/components/pro-sign/src/components/batch.vue.mjs +4 -0
  19. package/dist/es/components/pro-sign/src/components/batch.vue2.mjs +342 -0
  20. package/dist/es/components/pro-sign/src/components/date.vue.mjs +49 -0
  21. package/dist/es/components/pro-sign/src/components/date.vue2.mjs +4 -0
  22. package/dist/es/components/pro-sign/src/components/files.vue.mjs +74 -0
  23. package/dist/es/components/pro-sign/src/components/files.vue2.mjs +4 -0
  24. package/dist/es/components/pro-sign/src/components/index.mjs +10 -0
  25. package/dist/es/components/pro-sign/src/components/info.vue.mjs +61 -0
  26. package/dist/es/components/pro-sign/src/components/info.vue2.mjs +4 -0
  27. package/dist/es/components/pro-sign/src/components/loader.vue.mjs +4 -0
  28. package/dist/es/components/pro-sign/src/components/loader.vue2.mjs +405 -0
  29. package/dist/es/components/pro-sign/src/components/middle.vue.mjs +411 -0
  30. package/dist/es/components/pro-sign/src/components/middle.vue2.mjs +4 -0
  31. package/dist/es/components/pro-sign/src/components/pro-sign.vue.mjs +4 -0
  32. package/dist/es/components/pro-sign/src/components/pro-sign.vue2.mjs +286 -0
  33. package/dist/es/components/pro-sign/src/components/seals.vue.mjs +76 -0
  34. package/dist/es/components/pro-sign/src/components/seals.vue2.mjs +4 -0
  35. package/dist/es/components/pro-sign/src/components/signature.vue.mjs +106 -0
  36. package/dist/es/components/pro-sign/src/components/signature.vue2.mjs +4 -0
  37. package/dist/es/components/pro-sign/src/components/verify.vue.mjs +4 -0
  38. package/dist/es/components/pro-sign/src/components/verify.vue2.mjs +205 -0
  39. package/dist/es/components/pro-sign/src/context/contants.mjs +10 -0
  40. package/dist/es/components/pro-sign/src/context/effective.mjs +36 -0
  41. package/dist/es/components/pro-sign/src/context/sign-context.mjs +12 -0
  42. package/dist/es/components/pro-sign/src/core/Heart.mjs +31 -0
  43. package/dist/es/components/pro-sign/src/core/LifeCycle.mjs +30 -0
  44. package/dist/es/components/pro-sign/src/core/create-sign.mjs +226 -0
  45. package/dist/es/components/pro-sign/src/core/index.mjs +7 -0
  46. package/dist/es/components/pro-sign/src/core/move.mjs +287 -0
  47. package/dist/es/components/pro-sign/src/core/utils.mjs +30 -0
  48. package/dist/es/components/pro-sign/src/effects/effect.enum.mjs +9 -0
  49. package/dist/es/components/pro-sign/src/effects/index.mjs +8 -0
  50. package/dist/es/components/pro-sign/src/effects/onEffects.mjs +15 -0
  51. package/dist/es/components/pro-sign/src/hook/useProSign.mjs +60 -0
  52. package/dist/es/components/pro-sign/src/hook/useScrollDetection.mjs +30 -0
  53. package/dist/es/components/pro-sign/src/hook/useSms.mjs +39 -0
  54. package/dist/es/components/pro-sign/src/plugins/index.mjs +38 -0
  55. package/dist/es/components/pro-sign/src/plugins/modules/befor-sign.mjs +26 -0
  56. package/dist/es/components/pro-sign/src/plugins/modules/drop-crevice-seal.mjs +31 -0
  57. package/dist/es/components/pro-sign/src/plugins/modules/drop-date.mjs +34 -0
  58. package/dist/es/components/pro-sign/src/plugins/modules/drop-seal.mjs +26 -0
  59. package/dist/es/components/pro-sign/src/plugins/modules/index.mjs +10 -0
  60. package/dist/es/components/pro-sign/src/types.mjs +32 -0
  61. package/dist/es/components/pro-sign/style/index.mjs +2 -0
  62. package/dist/es/components/pro-upload/src/file-list.mjs +7 -6
  63. package/dist/es/components/pro-upload/src/gd-upload.mjs +91 -80
  64. package/dist/es/components/pro-upload/src/hooks/useHttp.mjs +5 -5
  65. package/dist/es/components/pro-upload/src/hooks/useUpload.mjs +2 -2
  66. package/dist/es/components/pro-upload/src/props.mjs +4 -0
  67. package/dist/es/components/pro-user-avatar/index.mjs +10 -0
  68. package/dist/es/components/pro-user-avatar/src/index.vue.mjs +4 -0
  69. package/dist/es/components/pro-user-avatar/src/index.vue2.mjs +69 -0
  70. package/dist/es/components/pro-user-avatar/src/style/index.mjs +2 -0
  71. package/dist/es/components/pro-user-avatar/src/types.mjs +1 -0
  72. package/dist/es/components/pro-user-avatar/src/util.mjs +28 -0
  73. package/dist/es/index.mjs +17 -1
  74. package/dist/lib/components/index.js +5 -0
  75. package/dist/lib/components/pro-contract-view/apis/pro-contract-view.api.js +1 -1
  76. package/dist/lib/components/pro-loading/src/pro-loading.js +2 -1
  77. package/dist/lib/components/pro-selector/index.js +8 -0
  78. package/dist/lib/components/pro-selector/src/components/org-tree.js +304 -0
  79. package/dist/lib/components/pro-selector/src/components/user.js +92 -0
  80. package/dist/lib/components/pro-selector/src/hooks/index.js +4 -0
  81. package/dist/lib/components/pro-selector/src/hooks/useUserSelector.js +9 -0
  82. package/dist/lib/components/pro-selector/src/pro-user.js +210 -0
  83. package/dist/lib/components/pro-selector/src/types.js +1 -0
  84. package/dist/lib/components/pro-selector/src/utils/orgTree.js +93 -0
  85. package/dist/lib/components/pro-selector/style/index.js +3 -0
  86. package/dist/lib/components/pro-sign/apis/pro-sign-api.js +19 -0
  87. package/dist/lib/components/pro-sign/index.js +17 -0
  88. package/dist/lib/components/pro-sign/src/components/add-signature.vue.js +4 -0
  89. package/dist/lib/components/pro-sign/src/components/add-signature.vue2.js +129 -0
  90. package/dist/lib/components/pro-sign/src/components/batch.vue.js +4 -0
  91. package/dist/lib/components/pro-sign/src/components/batch.vue2.js +342 -0
  92. package/dist/lib/components/pro-sign/src/components/date.vue.js +49 -0
  93. package/dist/lib/components/pro-sign/src/components/date.vue2.js +4 -0
  94. package/dist/lib/components/pro-sign/src/components/files.vue.js +74 -0
  95. package/dist/lib/components/pro-sign/src/components/files.vue2.js +4 -0
  96. package/dist/lib/components/pro-sign/src/components/index.js +11 -0
  97. package/dist/lib/components/pro-sign/src/components/info.vue.js +61 -0
  98. package/dist/lib/components/pro-sign/src/components/info.vue2.js +4 -0
  99. package/dist/lib/components/pro-sign/src/components/loader.vue.js +4 -0
  100. package/dist/lib/components/pro-sign/src/components/loader.vue2.js +405 -0
  101. package/dist/lib/components/pro-sign/src/components/middle.vue.js +411 -0
  102. package/dist/lib/components/pro-sign/src/components/middle.vue2.js +4 -0
  103. package/dist/lib/components/pro-sign/src/components/pro-sign.vue.js +4 -0
  104. package/dist/lib/components/pro-sign/src/components/pro-sign.vue2.js +286 -0
  105. package/dist/lib/components/pro-sign/src/components/seals.vue.js +76 -0
  106. package/dist/lib/components/pro-sign/src/components/seals.vue2.js +4 -0
  107. package/dist/lib/components/pro-sign/src/components/signature.vue.js +106 -0
  108. package/dist/lib/components/pro-sign/src/components/signature.vue2.js +4 -0
  109. package/dist/lib/components/pro-sign/src/components/verify.vue.js +4 -0
  110. package/dist/lib/components/pro-sign/src/components/verify.vue2.js +205 -0
  111. package/dist/lib/components/pro-sign/src/context/contants.js +10 -0
  112. package/dist/lib/components/pro-sign/src/context/effective.js +36 -0
  113. package/dist/lib/components/pro-sign/src/context/sign-context.js +12 -0
  114. package/dist/lib/components/pro-sign/src/core/Heart.js +31 -0
  115. package/dist/lib/components/pro-sign/src/core/LifeCycle.js +30 -0
  116. package/dist/lib/components/pro-sign/src/core/create-sign.js +226 -0
  117. package/dist/lib/components/pro-sign/src/core/index.js +7 -0
  118. package/dist/lib/components/pro-sign/src/core/move.js +287 -0
  119. package/dist/lib/components/pro-sign/src/core/utils.js +30 -0
  120. package/dist/lib/components/pro-sign/src/effects/effect.enum.js +9 -0
  121. package/dist/lib/components/pro-sign/src/effects/index.js +8 -0
  122. package/dist/lib/components/pro-sign/src/effects/onEffects.js +15 -0
  123. package/dist/lib/components/pro-sign/src/hook/useProSign.js +60 -0
  124. package/dist/lib/components/pro-sign/src/hook/useScrollDetection.js +30 -0
  125. package/dist/lib/components/pro-sign/src/hook/useSms.js +39 -0
  126. package/dist/lib/components/pro-sign/src/plugins/index.js +38 -0
  127. package/dist/lib/components/pro-sign/src/plugins/modules/befor-sign.js +26 -0
  128. package/dist/lib/components/pro-sign/src/plugins/modules/drop-crevice-seal.js +31 -0
  129. package/dist/lib/components/pro-sign/src/plugins/modules/drop-date.js +34 -0
  130. package/dist/lib/components/pro-sign/src/plugins/modules/drop-seal.js +26 -0
  131. package/dist/lib/components/pro-sign/src/plugins/modules/index.js +10 -0
  132. package/dist/lib/components/pro-sign/src/types.js +32 -0
  133. package/dist/lib/components/pro-sign/style/index.js +3 -0
  134. package/dist/lib/components/pro-upload/src/file-list.js +6 -5
  135. package/dist/lib/components/pro-upload/src/gd-upload.js +87 -76
  136. package/dist/lib/components/pro-upload/src/hooks/useHttp.js +5 -5
  137. package/dist/lib/components/pro-upload/src/hooks/useUpload.js +2 -2
  138. package/dist/lib/components/pro-upload/src/props.js +4 -0
  139. package/dist/lib/components/pro-user-avatar/index.js +10 -0
  140. package/dist/lib/components/pro-user-avatar/src/index.vue.js +4 -0
  141. package/dist/lib/components/pro-user-avatar/src/index.vue2.js +69 -0
  142. package/dist/lib/components/pro-user-avatar/src/style/index.js +3 -0
  143. package/dist/lib/components/pro-user-avatar/src/types.js +1 -0
  144. package/dist/lib/components/pro-user-avatar/src/util.js +28 -0
  145. package/dist/lib/index.js +16 -0
  146. package/dist/theme-chalk/base.css +1 -1
  147. package/dist/theme-chalk/fonts/iconfont.ttf +0 -0
  148. package/dist/theme-chalk/fonts/iconfont.woff +0 -0
  149. package/dist/theme-chalk/fonts/iconfont.woff2 +0 -0
  150. package/dist/theme-chalk/icon.css +1 -1
  151. package/dist/theme-chalk/index.css +1 -1
  152. package/dist/theme-chalk/pro-selector.css +1 -0
  153. package/dist/theme-chalk/pro-sign.css +1 -0
  154. package/dist/theme-chalk/pro-user-avatar.css +1 -0
  155. package/dist/theme-chalk/var.css +1 -1
  156. package/dist/types/components/index.d.ts +3 -0
  157. package/dist/types/components/pro-selector/index.d.ts +4 -0
  158. package/dist/types/components/pro-selector/src/components/org-tree.d.ts +61 -0
  159. package/dist/types/components/pro-selector/src/components/user.d.ts +40 -0
  160. package/dist/types/components/pro-selector/src/hooks/index.d.ts +1 -0
  161. package/dist/types/components/pro-selector/src/hooks/useUserSelector.d.ts +3 -0
  162. package/dist/types/components/pro-selector/src/pro-user.d.ts +75 -0
  163. package/dist/types/components/pro-selector/src/types.d.ts +40 -0
  164. package/dist/types/components/pro-selector/src/util.d.ts +26 -0
  165. package/dist/types/components/pro-selector/src/utils/orgTree.d.ts +20 -0
  166. package/dist/types/components/pro-sign/apis/pro-sign-api.d.ts +14 -0
  167. package/dist/types/components/pro-sign/index.d.ts +20 -0
  168. package/dist/types/components/pro-sign/src/components/add-signature.vue.d.ts +15 -0
  169. package/dist/types/components/pro-sign/src/components/batch.vue.d.ts +34 -0
  170. package/dist/types/components/pro-sign/src/components/date.vue.d.ts +3 -0
  171. package/dist/types/components/pro-sign/src/components/files.vue.d.ts +3 -0
  172. package/dist/types/components/pro-sign/src/components/index.d.ts +10 -0
  173. package/dist/types/components/pro-sign/src/components/info.vue.d.ts +3 -0
  174. package/dist/types/components/pro-sign/src/components/loader.vue.d.ts +144 -0
  175. package/dist/types/components/pro-sign/src/components/middle.vue.d.ts +3 -0
  176. package/dist/types/components/pro-sign/src/components/pro-sign.vue.d.ts +14 -0
  177. package/dist/types/components/pro-sign/src/components/seals.vue.d.ts +3 -0
  178. package/dist/types/components/pro-sign/src/components/signature.vue.d.ts +3 -0
  179. package/dist/types/components/pro-sign/src/components/verify.vue.d.ts +10 -0
  180. package/dist/types/components/pro-sign/src/context/contants.d.ts +7 -0
  181. package/dist/types/components/pro-sign/src/context/effective.d.ts +3 -0
  182. package/dist/types/components/pro-sign/src/context/sign-context.d.ts +3 -0
  183. package/dist/types/components/pro-sign/src/core/Heart.d.ts +9 -0
  184. package/dist/types/components/pro-sign/src/core/LifeCycle.d.ts +9 -0
  185. package/dist/types/components/pro-sign/src/core/create-sign.d.ts +54 -0
  186. package/dist/types/components/pro-sign/src/core/index.d.ts +3 -0
  187. package/dist/types/components/pro-sign/src/core/move.d.ts +30 -0
  188. package/dist/types/components/pro-sign/src/core/utils.d.ts +16 -0
  189. package/dist/types/components/pro-sign/src/effects/effect.enum.d.ts +5 -0
  190. package/dist/types/components/pro-sign/src/effects/index.d.ts +2 -0
  191. package/dist/types/components/pro-sign/src/effects/onEffects.d.ts +8 -0
  192. package/dist/types/components/pro-sign/src/hook/useProSign.d.ts +12 -0
  193. package/dist/types/components/pro-sign/src/hook/useScrollDetection.d.ts +5 -0
  194. package/dist/types/components/pro-sign/src/hook/useSms.d.ts +8 -0
  195. package/dist/types/components/pro-sign/src/plugins/index.d.ts +26 -0
  196. package/dist/types/components/pro-sign/src/plugins/modules/befor-sign.d.ts +6 -0
  197. package/dist/types/components/pro-sign/src/plugins/modules/drop-crevice-seal.d.ts +6 -0
  198. package/dist/types/components/pro-sign/src/plugins/modules/drop-date.d.ts +6 -0
  199. package/dist/types/components/pro-sign/src/plugins/modules/drop-seal.d.ts +6 -0
  200. package/dist/types/components/pro-sign/src/plugins/modules/index.d.ts +4 -0
  201. package/dist/types/components/pro-sign/src/types.d.ts +135 -0
  202. package/dist/types/components/pro-upload/index.d.ts +11 -0
  203. package/dist/types/components/pro-upload/src/file-list.d.ts +4 -2
  204. package/dist/types/components/pro-upload/src/gd-upload.d.ts +11 -0
  205. package/dist/types/components/pro-upload/src/hooks/useHttp.d.ts +1 -1
  206. package/dist/types/components/pro-upload/src/hooks/useUpload.d.ts +1 -1
  207. package/dist/types/components/pro-upload/src/props.d.ts +4 -0
  208. package/dist/types/components/pro-upload/src/types.d.ts +4 -4
  209. package/dist/types/components/pro-user-avatar/index.d.ts +39 -0
  210. package/dist/types/components/pro-user-avatar/src/index.vue.d.ts +34 -0
  211. package/dist/types/components/pro-user-avatar/src/types.d.ts +9 -0
  212. package/dist/types/components/pro-user-avatar/src/util.d.ts +1 -0
  213. package/global.d.ts +3 -0
  214. package/package.json +2 -1
  215. package/dist/theme-chalk/fonts//345/275/222/346/241/243.zip +0 -0
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const vue = require("vue");
4
+ require("../../../index.js");
5
+ const antDesignVue = require("ant-design-vue");
6
+ const index = require("../../../../hooks/use-namespace/index.js");
7
+ const useSms = require("../hook/useSms.js");
8
+ const signContext = require("../context/sign-context.js");
9
+ const proSignApi = require("../../apis/pro-sign-api.js");
10
+ const useProModal = require("../../../pro-modal/hooks/useProModal.js");
11
+ const index$1 = require("../../../pro-modal/index.js");
12
+ const _hoisted_1 = { class: "constract-verify-phone" };
13
+ const _hoisted_2 = { class: "constract-verify-password-switch" };
14
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
15
+ __name: "verify",
16
+ emits: ["confirm", "init"],
17
+ setup(__props, { emit: __emit }) {
18
+ const emit = __emit;
19
+ const { b } = index.useNamespace("pro-sign-verify");
20
+ const { codetext, sendCode, loading: smsLoading } = useSms.useSmsCode(30);
21
+ const { modalVisible, closeModal } = useProModal.useProModal();
22
+ const signContext$1 = signContext.useInjectSignContext();
23
+ const type = vue.ref();
24
+ const phone = vue.computed(() => {
25
+ var _a;
26
+ return ((_a = signContext$1.sharedStatus.userInfo) == null ? void 0 : _a.phone) || "";
27
+ });
28
+ const formState = vue.reactive({
29
+ password: "",
30
+ sms: ""
31
+ });
32
+ vue.watch(modalVisible, (newVal) => {
33
+ if (newVal) {
34
+ const { verifyType } = signContext$1.sharedStatus;
35
+ if (verifyType.PASSWORD) {
36
+ type.value = "PASSWORD";
37
+ } else if (verifyType.SMS) {
38
+ type.value = "SMS";
39
+ }
40
+ } else {
41
+ type.value = void 0;
42
+ Object.assign(formState, {
43
+ password: "",
44
+ sms: ""
45
+ });
46
+ }
47
+ });
48
+ function encryptPhoneNumber(phone2) {
49
+ const phoneStr = phone2.toString();
50
+ if (phoneStr.length !== 11) {
51
+ throw new Error("Invalid phone number length");
52
+ }
53
+ return phoneStr.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
54
+ }
55
+ function handleOk() {
56
+ if (type.value === "SMS") {
57
+ if (!formState.sms) {
58
+ antDesignVue.message.error("请输入短信验证码");
59
+ return;
60
+ }
61
+ } else if (type.value === "PASSWORD") {
62
+ if (!formState.password) {
63
+ antDesignVue.message.error("请输入密码");
64
+ return;
65
+ }
66
+ }
67
+ closeModal();
68
+ const code = type.value === "SMS" ? formState.sms : formState.password;
69
+ emit("confirm", code, type.value);
70
+ }
71
+ function handleSendSms() {
72
+ if (smsLoading.value)
73
+ return;
74
+ if (type.value === "SMS") {
75
+ const { config } = signContext$1;
76
+ const { signPreFix, userIdentity, appToken } = config;
77
+ sendCode(async () => {
78
+ return proSignApi.proSignApis.sendingSms(signPreFix, {
79
+ headers: {
80
+ "APP-TOKEN": appToken,
81
+ "User-Identity": userIdentity
82
+ },
83
+ params: {
84
+ phone: phone.value
85
+ }
86
+ }).then(() => {
87
+ }).catch(() => Promise.reject()).finally(() => {
88
+ });
89
+ });
90
+ }
91
+ }
92
+ return (_ctx, _cache) => {
93
+ return vue.openBlock(), vue.createBlock(vue.unref(index$1.KProModal), {
94
+ modelValue: vue.unref(modalVisible),
95
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.isRef(modalVisible) ? modalVisible.value = $event : null),
96
+ "modal-props": {
97
+ okText: "确定",
98
+ cancelText: "取消"
99
+ },
100
+ title: "确认签署",
101
+ onOnConfirm: handleOk
102
+ }, {
103
+ default: vue.withCtx(() => [
104
+ vue.createElementVNode(
105
+ "div",
106
+ {
107
+ class: vue.normalizeClass(vue.unref(b)())
108
+ },
109
+ [
110
+ type.value === "SMS" ? (vue.openBlock(), vue.createElementBlock(
111
+ vue.Fragment,
112
+ { key: 0 },
113
+ [
114
+ vue.createElementVNode(
115
+ "div",
116
+ _hoisted_1,
117
+ " 短信验证码会发送至 " + vue.toDisplayString(encryptPhoneNumber(phone.value)) + " 手机号,请注意查收 ",
118
+ 1
119
+ /* TEXT */
120
+ ),
121
+ vue.createVNode(vue.unref(antDesignVue.FormItem), { label: "验证码" }, {
122
+ default: vue.withCtx(() => [
123
+ vue.createVNode(vue.unref(antDesignVue.Input), {
124
+ value: formState.sms,
125
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => formState.sms = $event)
126
+ }, {
127
+ suffix: vue.withCtx(() => [
128
+ vue.createVNode(vue.unref(antDesignVue.Button), {
129
+ type: "link",
130
+ size: "small",
131
+ style: { "padding": "0 !important" },
132
+ disabled: vue.unref(smsLoading),
133
+ onClick: handleSendSms
134
+ }, {
135
+ default: vue.withCtx(() => [
136
+ vue.createTextVNode(
137
+ vue.toDisplayString(vue.unref(codetext)),
138
+ 1
139
+ /* TEXT */
140
+ )
141
+ ]),
142
+ _: 1
143
+ /* STABLE */
144
+ }, 8, ["disabled"])
145
+ ]),
146
+ _: 1
147
+ /* STABLE */
148
+ }, 8, ["value"])
149
+ ]),
150
+ _: 1
151
+ /* STABLE */
152
+ })
153
+ ],
154
+ 64
155
+ /* STABLE_FRAGMENT */
156
+ )) : type.value === "PASSWORD" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.FormItem), {
157
+ key: 1,
158
+ label: "密码"
159
+ }, {
160
+ default: vue.withCtx(() => [
161
+ vue.createVNode(vue.unref(antDesignVue.InputPassword), {
162
+ value: formState.password,
163
+ "onUpdate:value": _cache[1] || (_cache[1] = ($event) => formState.password = $event),
164
+ type: "text"
165
+ }, null, 8, ["value"])
166
+ ]),
167
+ _: 1
168
+ /* STABLE */
169
+ })) : vue.createCommentVNode("v-if", true),
170
+ vue.createElementVNode("div", _hoisted_2, [
171
+ type.value === "SMS" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Button), {
172
+ key: 0,
173
+ type: "link",
174
+ onClick: _cache[2] || (_cache[2] = ($event) => type.value = "PASSWORD")
175
+ }, {
176
+ default: vue.withCtx(() => [
177
+ vue.createTextVNode(" 切换为密码签署 ")
178
+ ]),
179
+ _: 1
180
+ /* STABLE */
181
+ })) : vue.createCommentVNode("v-if", true),
182
+ type.value === "PASSWORD" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Button), {
183
+ key: 1,
184
+ type: "link",
185
+ onClick: _cache[3] || (_cache[3] = ($event) => type.value = "SMS")
186
+ }, {
187
+ default: vue.withCtx(() => [
188
+ vue.createTextVNode(" 切换为短信签署 ")
189
+ ]),
190
+ _: 1
191
+ /* STABLE */
192
+ })) : vue.createCommentVNode("v-if", true)
193
+ ])
194
+ ],
195
+ 2
196
+ /* CLASS */
197
+ )
198
+ ]),
199
+ _: 1
200
+ /* STABLE */
201
+ }, 8, ["modelValue"]);
202
+ };
203
+ }
204
+ });
205
+ exports.default = _sfc_main;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const GlobalState = {
4
+ lifecycles: [],
5
+ context: [],
6
+ effectStart: false,
7
+ effectEnd: false,
8
+ initializing: false
9
+ };
10
+ exports.GlobalState = GlobalState;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const utils = require("@king-one/utils");
4
+ const LifeCycle = require("../core/LifeCycle.js");
5
+ const contants = require("./contants.js");
6
+ function createEffectHook(type, callback) {
7
+ return (...args) => {
8
+ if (contants.GlobalState.effectStart) {
9
+ contants.GlobalState.lifecycles.push(
10
+ new LifeCycle.LifeCycle(type, (payload, ...cargs) => {
11
+ if (utils.isFn(callback)) {
12
+ callback(...cargs, payload)(...args);
13
+ }
14
+ })
15
+ );
16
+ } else {
17
+ throw new Error("Effect hooks cannot be used in asynchronous function body");
18
+ }
19
+ };
20
+ }
21
+ function runEffects(context, ...args) {
22
+ contants.GlobalState.lifecycles = [];
23
+ contants.GlobalState.context = [];
24
+ contants.GlobalState.effectStart = true;
25
+ contants.GlobalState.effectEnd = false;
26
+ args.forEach((effect) => {
27
+ if (utils.isFn(effect))
28
+ effect(context);
29
+ });
30
+ contants.GlobalState.context = [];
31
+ contants.GlobalState.effectStart = false;
32
+ contants.GlobalState.effectEnd = true;
33
+ return contants.GlobalState.lifecycles;
34
+ }
35
+ exports.createEffectHook = createEffectHook;
36
+ exports.runEffects = runEffects;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const vue = require("vue");
4
+ const signContextSymbol = Symbol("signContext");
5
+ function useProvideSignContext(params) {
6
+ return vue.provide(signContextSymbol, params);
7
+ }
8
+ function useInjectSignContext() {
9
+ return vue.inject(signContextSymbol);
10
+ }
11
+ exports.useInjectSignContext = useInjectSignContext;
12
+ exports.useProvideSignContext = useProvideSignContext;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
+ const utils = require("@king-one/utils");
7
+ const LifeCycle = require("./LifeCycle.js");
8
+ class Heart {
9
+ constructor({ lifecycles, context }) {
10
+ __publicField(this, "context");
11
+ __publicField(this, "lifecycles");
12
+ this.lifecycles = this.buildLifeCycles(lifecycles || []);
13
+ this.context = context;
14
+ }
15
+ buildLifeCycles(lifecycles) {
16
+ return lifecycles.reduce((buf, item) => {
17
+ if (item instanceof LifeCycle.LifeCycle) {
18
+ return buf.concat(item);
19
+ }
20
+ return buf;
21
+ }, []);
22
+ }
23
+ publish(type, ...args) {
24
+ if (utils.isStr(type)) {
25
+ this.lifecycles.forEach((lifecyle) => {
26
+ lifecyle.notify(type, this.context, ...args);
27
+ });
28
+ }
29
+ }
30
+ }
31
+ exports.Heart = Heart;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
+ const utils = require("@king-one/utils");
7
+ class LifeCycle {
8
+ constructor(...params) {
9
+ __publicField(this, "listener");
10
+ __publicField(this, "notify", (type, payload, ...args) => {
11
+ if (utils.isStr(type)) {
12
+ this.listener.call(payload, { type, payload }, ...args);
13
+ }
14
+ });
15
+ this.listener = this.buildListener(params);
16
+ }
17
+ buildListener(params) {
18
+ return (payload, ...args) => {
19
+ for (let index = 0; index < params.length; index++) {
20
+ const item = params[index];
21
+ if (utils.isStr(item) && utils.isFn(params[index + 1])) {
22
+ if (item === payload.type) {
23
+ params[index + 1].call(this, payload.payload, ...args);
24
+ }
25
+ }
26
+ }
27
+ };
28
+ }
29
+ }
30
+ exports.LifeCycle = LifeCycle;
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
+ const vue = require("vue");
7
+ const utils$1 = require("@king-one/utils");
8
+ const lodashEs = require("lodash-es");
9
+ const effective = require("../context/effective.js");
10
+ const index = require("../plugins/index.js");
11
+ const proSignApi = require("../../apis/pro-sign-api.js");
12
+ require("../effects/index.js");
13
+ const Heart = require("./Heart.js");
14
+ const move = require("./move.js");
15
+ const utils = require("./utils.js");
16
+ const effect_enum = require("../effects/effect.enum.js");
17
+ function getInitStatus() {
18
+ return {
19
+ loading: true,
20
+ fileList: [],
21
+ currentFile: {},
22
+ companySeals: [],
23
+ baseSize: {
24
+ minH: 0,
25
+ minW: 0,
26
+ contractWidth: 0,
27
+ scale: 1
28
+ },
29
+ renderPages: [],
30
+ sealList: [],
31
+ currentSeal: null,
32
+ contractInfo: {
33
+ contractName: "",
34
+ createTime: ""
35
+ },
36
+ verifyType: {
37
+ SMS: true,
38
+ PASSWORD: true,
39
+ FACE: false,
40
+ NONE: false
41
+ },
42
+ userInfo: null
43
+ };
44
+ }
45
+ class CreateSign {
46
+ constructor(params) {
47
+ __publicField(this, "config");
48
+ __publicField(this, "tabsActiveKey", vue.reactive({
49
+ left: "1",
50
+ right: "1"
51
+ }));
52
+ __publicField(this, "sharedStatus", vue.reactive(getInitStatus()));
53
+ __publicField(this, "heart");
54
+ __publicField(this, "plugin");
55
+ if (!params.signPreFix) {
56
+ throw new Error("缺少必要参数:signPreFix(签署接口前缀),详情参照:https://www.baidu.com/");
57
+ }
58
+ if (!params.contractPreFix) {
59
+ throw new Error("缺少必要参数:contractPreFix(合同接口前缀),详情参照:https://www.baidu.com/");
60
+ }
61
+ this.config = params;
62
+ if (params.verifyType) {
63
+ this.setVerifyType(params.verifyType);
64
+ }
65
+ this.plugin = new index.Plugin();
66
+ this.heart = new Heart.Heart({
67
+ lifecycles: this.lifecycles,
68
+ context: this
69
+ });
70
+ }
71
+ async render(params) {
72
+ this.config = {
73
+ ...this.config,
74
+ ...params
75
+ };
76
+ if (!this.config.contractId) {
77
+ throw new Error("缺少必要参数:contractId(合同ID)");
78
+ }
79
+ if (!this.config.appToken) {
80
+ throw new Error("缺少必要参数:appToken(签署中心应用令牌)");
81
+ }
82
+ if (!this.config.userIdentity) {
83
+ throw new Error("缺少必要参数:userIdentity(签署中心用户令牌)");
84
+ }
85
+ this.handleRquest();
86
+ }
87
+ async handleRquest() {
88
+ await this.hooks.beforeInit.promise(true);
89
+ const { signPreFix, appToken, userIdentity, contractId } = this.config;
90
+ const f = await proSignApi.proSignApis.getFileList(signPreFix, {
91
+ headers: {
92
+ "SEAL-APP-TOKEN ": appToken,
93
+ "userIdentity": userIdentity
94
+ },
95
+ params: { contractId }
96
+ });
97
+ const l = await Promise.all(f.data.map((item) => this.getFileHomeImage(item.fileId)));
98
+ const fileList = f.data.map((item, index2) => {
99
+ var _a, _b;
100
+ return {
101
+ ...item,
102
+ homeImg: (_b = (_a = l[index2]) == null ? void 0 : _a.pages[0]) == null ? void 0 : _b.url
103
+ };
104
+ });
105
+ this.sharedStatus.fileList = fileList;
106
+ Object.assign(this.sharedStatus.currentFile, fileList[0]);
107
+ const s = await proSignApi.proSignApis.getCompanySeals(signPreFix, {
108
+ headers: {
109
+ "SEAL-APP-TOKEN ": appToken,
110
+ "userIdentity": userIdentity
111
+ }
112
+ });
113
+ const sealfiles = s.data.map((item) => ({ ...item, fileId: item.sealWatermarkFileId }));
114
+ const seals = await utils.batchDownload(signPreFix, sealfiles);
115
+ this.sharedStatus.companySeals = seals.map((item) => {
116
+ const { imgUrl, ...rest } = item;
117
+ return {
118
+ ...rest,
119
+ sealUrl: imgUrl
120
+ };
121
+ });
122
+ const c = await proSignApi.proSignApis.getContractInfo(signPreFix, {
123
+ headers: {
124
+ "SEAL-APP-TOKEN ": appToken,
125
+ "userIdentity": userIdentity
126
+ },
127
+ params: { contractId }
128
+ });
129
+ Object.assign(this.sharedStatus.contractInfo, c.data);
130
+ const u = await proSignApi.proSignApis.userIdentify(signPreFix, {
131
+ headers: {
132
+ "SEAL-APP-TOKEN ": appToken,
133
+ "userIdentity": userIdentity
134
+ }
135
+ });
136
+ this.sharedStatus.userInfo = u.data;
137
+ this.sharedStatus.loading = false;
138
+ this.notify(effect_enum.LifeCycleTypes.ON_SIGN_INIT);
139
+ }
140
+ async getFileHomeImage(fileId) {
141
+ const { signPreFix, appToken, userIdentity } = this.config;
142
+ const { data } = await proSignApi.proSignApis.getFileImg(signPreFix, {
143
+ headers: {
144
+ "SEAL-APP-TOKEN": appToken,
145
+ "userIdentity": userIdentity
146
+ },
147
+ params: {
148
+ fileId,
149
+ pageNum: 1,
150
+ pageSize: 1,
151
+ absoluteEnable: true
152
+ }
153
+ });
154
+ return data;
155
+ }
156
+ async setVerifyType(verifyType) {
157
+ Object.assign(this.sharedStatus.verifyType, verifyType);
158
+ }
159
+ /**
160
+ * 获取印章最大拖拽范围
161
+ * @param pageList 页码列表
162
+ * @param size 印章大小
163
+ * @returns 最大拖拽范围
164
+ */
165
+ getDragMaxSize(pageList, size) {
166
+ var _a;
167
+ const offset = 2;
168
+ const { fileList, baseSize } = this.sharedStatus;
169
+ const { scale } = baseSize;
170
+ const batchPages = [];
171
+ for (const key in pageList) {
172
+ const pages = pageList[key];
173
+ const pageInfoVoList = (_a = fileList.find((item) => item.fileId === key)) == null ? void 0 : _a.pageInfoVoList;
174
+ const List = vue.toRaw(pageInfoVoList);
175
+ pages.forEach((item) => {
176
+ const page = List.find((page2) => page2.pageNum === item);
177
+ batchPages.push(page);
178
+ });
179
+ }
180
+ const { minHeight, minWidth } = utils.getMinSizeByList(batchPages);
181
+ if (size) {
182
+ const [h, w] = size.split("*");
183
+ const sealH = Number.parseFloat(utils$1.mmtopx(+h).toFixed(2));
184
+ const sealW = Number.parseFloat(utils$1.mmtopx(+w).toFixed(2));
185
+ const maxLeft = Number.parseFloat(((minWidth - sealW) * scale).toFixed(2));
186
+ const maxTop = Number.parseFloat(((minHeight - sealH) * scale).toFixed(2));
187
+ return {
188
+ maxLeft: maxLeft - offset,
189
+ maxTop: maxTop - offset
190
+ };
191
+ } else {
192
+ const maxLeft = Number.parseFloat((minWidth * scale).toFixed(2));
193
+ const maxTop = Number.parseFloat((minHeight * scale).toFixed(2));
194
+ return {
195
+ maxLeft: maxLeft - offset,
196
+ maxTop: maxTop - offset
197
+ };
198
+ }
199
+ }
200
+ getSignData() {
201
+ const { baseSize, sealList } = this.sharedStatus;
202
+ const { scale } = baseSize;
203
+ const arr = lodashEs.cloneDeep(sealList);
204
+ return arr.map((item) => ({
205
+ ...item,
206
+ offsetY: item.signType !== "perforationSeal" ? Number.parseFloat((item.offsetY / scale).toFixed(2)) : item.offsetY,
207
+ offsetX: Number.parseFloat((item.offsetX / scale).toFixed(2))
208
+ }));
209
+ }
210
+ use(plugin) {
211
+ this.plugin.use(plugin);
212
+ }
213
+ notify(type, ...args) {
214
+ this.heart.publish(type, ...args, this);
215
+ }
216
+ get move() {
217
+ return new move.Move(this);
218
+ }
219
+ get hooks() {
220
+ return this.plugin.hooks;
221
+ }
222
+ get lifecycles() {
223
+ return effective.runEffects(this, this.config.effects);
224
+ }
225
+ }
226
+ exports.CreateSign = CreateSign;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const createSign = require("./create-sign.js");
4
+ function initProSign(config) {
5
+ return new createSign.CreateSign(config);
6
+ }
7
+ exports.initProSign = initProSign;