@cmstops/pro-compo 3.9.2-alpha.24 → 3.9.2-alpha.26

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.
@@ -10,6 +10,13 @@ function generateDocPreviewLink(BASE_API, params) {
10
10
  data: params
11
11
  });
12
12
  }
13
+ function generateDocPreviewLinkPC(BASE_API, params) {
14
+ return request(BASE_API, {
15
+ url: "/poplar/v3/preview/document/generate/pc",
16
+ method: "post",
17
+ data: params
18
+ });
19
+ }
13
20
  function getTimeToNow(second) {
14
21
  second = parseInt((second / 1e3).toFixed(0), 10);
15
22
  function need(value, label) {
@@ -41,22 +48,54 @@ const EXPIRE_TIME_OPTIONS = [
41
48
  function useDocPreview(BASE_API, hashid) {
42
49
  const isPublish = ref(false);
43
50
  const innerUrl = ref("");
51
+ const pcInnerUrl = ref("");
44
52
  const shareData = ref(null);
53
+ const pcShareData = ref(null);
45
54
  const expireTime = ref(60 * 60 * 24);
55
+ const numpc = ref(0);
46
56
  const loading = ref(false);
47
57
  const qrCode = ref("");
48
58
  const intervalTime = ref("");
59
+ const pcIntervalTime = ref("");
49
60
  let interval = null;
61
+ let pcInterval = null;
50
62
  function startInterval() {
51
63
  var _a;
52
64
  if (!((_a = shareData.value) == null ? void 0 : _a.expiredAt)) {
53
65
  clearInterval(interval);
54
66
  interval = null;
67
+ intervalTime.value = "";
55
68
  return;
56
69
  }
57
70
  const now = new Date().getTime();
58
71
  const expire = new Date(shareData.value.expiredAt).getTime();
59
- intervalTime.value = getTimeToNow(expire - now);
72
+ const remaining = expire - now;
73
+ if (remaining <= 0) {
74
+ intervalTime.value = "\u5DF2\u8FC7\u671F";
75
+ clearInterval(interval);
76
+ interval = null;
77
+ return;
78
+ }
79
+ intervalTime.value = getTimeToNow(remaining);
80
+ }
81
+ function startPCInterval() {
82
+ var _a;
83
+ if (!((_a = pcShareData.value) == null ? void 0 : _a.expired_at)) {
84
+ clearInterval(pcInterval);
85
+ pcInterval = null;
86
+ pcIntervalTime.value = "";
87
+ return;
88
+ }
89
+ const now = new Date().getTime();
90
+ const expire = new Date(pcShareData.value.expired_at).getTime();
91
+ const remaining = expire - now;
92
+ if (remaining <= 0) {
93
+ pcIntervalTime.value = "\u5DF2\u8FC7\u671F";
94
+ clearInterval(pcInterval);
95
+ pcInterval = null;
96
+ return;
97
+ }
98
+ pcIntervalTime.value = getTimeToNow(remaining);
60
99
  }
61
100
  function genQrCode(shareUrl, selector) {
62
101
  innerUrl.value = shareUrl;
@@ -97,7 +136,8 @@ function useDocPreview(BASE_API, hashid) {
97
136
  };
98
137
  qrCode.value = base64;
99
138
  innerUrl.value = `${inner_url}?reqTime=${+new Date()}`;
100
- setInterval(startInterval, 1e3);
139
+ interval = setInterval(startInterval, 1e3);
140
+ startInterval();
101
141
  }
102
142
  return true;
103
143
  } catch (e) {
@@ -107,6 +147,50 @@ function useDocPreview(BASE_API, hashid) {
107
147
  loading.value = false;
108
148
  }
109
149
  }
150
+ async function generatePC(cancel2 = false) {
151
+ loading.value = true;
152
+ const params = {
153
+ force: true,
154
+ hash_id: hashid.value,
155
+ expiration: expireTime.value
156
+ };
157
+ if (cancel2)
158
+ params.expiration = 0;
159
+ try {
160
+ const { code, message } = await generateDocPreviewLinkPC(
161
+ BASE_API,
162
+ params
163
+ );
164
+ if (code !== 0)
165
+ return false;
166
+ const { expired_at, share_url, inner_url } = message;
167
+ if (cancel2) {
168
+ pcShareData.value = null;
169
+ pcInnerUrl.value = "";
170
+ clearInterval(pcInterval);
171
+ pcInterval = null;
172
+ pcIntervalTime.value = "";
173
+ } else {
174
+ pcShareData.value = message;
175
+ pcInnerUrl.value = `${inner_url}?reqTime=${+new Date()}`;
176
+ pcInterval = setInterval(startPCInterval, 1e3);
177
+ startPCInterval();
178
+ }
179
+ return true;
180
+ } catch (e) {
181
+ console.log("\u751F\u6210PC\u9884\u89C8\u94FE\u63A5\u5931\u8D25", e);
182
+ return false;
183
+ } finally {
184
+ loading.value = false;
185
+ }
186
+ }
187
+ function previewSite() {
188
+ if (isPublish.value) {
189
+ window.open(pcInnerUrl.value, "_blank");
190
+ } else {
191
+ window.open(pcInnerUrl.value, "_blank");
192
+ }
193
+ }
110
194
  async function cancel(update) {
111
195
  const flag = await generate(true);
112
196
  if (!flag)
@@ -114,6 +198,12 @@ function useDocPreview(BASE_API, hashid) {
114
198
  const text = update ? "\u5DF2\u53D6\u6D88\u9884\u89C8\uFF0C\u8BF7\u66F4\u65B0\u6709\u6548\u671F\u91CD\u65B0\u751F\u6210\u9884\u89C8\u94FE\u63A5" : "\u5DF2\u53D6\u6D88\u9884\u89C8\u94FE\u63A5";
115
199
  Message.warning(text);
116
200
  }
201
+ async function cancelPc() {
202
+ const flag = await generatePC(true);
203
+ if (!flag)
204
+ return;
205
+ Message.warning("\u5DF2\u53D6\u6D88\u9884\u89C8\u94FE\u63A5");
206
+ }
117
207
  async function copy() {
118
208
  var _a;
119
209
  if (!((_a = shareData.value) == null ? void 0 : _a.shareUrl))
@@ -123,18 +213,39 @@ function useDocPreview(BASE_API, hashid) {
123
213
  Message.success("\u590D\u5236\u6210\u529F");
124
214
  }
125
215
  }
216
+ async function copyPC() {
217
+ var _a;
218
+ if (!((_a = pcShareData.value) == null ? void 0 : _a.shareUrl))
219
+ return;
220
+ const res = await copyContent(pcShareData.value.shareUrl);
221
+ if (res) {
222
+ Message.success("\u590D\u5236\u6210\u529F");
223
+ }
224
+ }
225
+ function btn_device(device) {
226
+ numpc.value = device === "pc" ? 1 : 0;
227
+ }
126
228
  return {
127
229
  genQrCode,
128
230
  generate,
129
231
  cancel,
130
232
  copy,
233
+ copyPC,
131
234
  qrCode,
132
235
  isPublish,
133
236
  loading,
134
237
  expireTime,
135
238
  innerUrl,
136
239
  shareData,
137
- intervalTime
240
+ pcShareData,
241
+ intervalTime,
242
+ pcIntervalTime,
243
+ numpc,
244
+ btn_device,
245
+ pcInnerUrl,
246
+ generatePC,
247
+ previewSite,
248
+ cancelPc
138
249
  };
139
250
  }
140
- export { EXPIRE_TIME_OPTIONS, generateDocPreviewLink, useDocPreview };
251
+ export { EXPIRE_TIME_OPTIONS, generateDocPreviewLink, generateDocPreviewLinkPC, useDocPreview };
@@ -30,6 +30,33 @@
30
30
  border: none;
31
31
  outline: none;
32
32
  }
33
+ .iframe-container-pc {
34
+ position: relative;
35
+ height: 95vh;
36
+ overflow: hidden;
37
+ aspect-ratio: 1920 / 1080;
38
+ }
39
+ .iframe-container-pc img {
40
+ position: absolute;
41
+ width: 100%;
42
+ height: 100%;
43
+ }
44
+ .iframe-container-pc .iframe-content-pc {
45
+ position: absolute;
46
+ top: 70px;
47
+ left: 56px;
48
+ width: calc(100% - 106px);
49
+ height: calc(100% - 140px);
50
+ overflow: hidden;
51
+ background-color: white;
52
+ border-radius: 15px;
53
+ }
54
+ .iframe-container-pc iframe {
55
+ width: 100%;
56
+ height: 100%;
57
+ border: none;
58
+ outline: none;
59
+ }
33
60
  .doc-preview-container {
34
61
  position: fixed;
35
62
  top: 0;
@@ -147,3 +174,24 @@
147
174
  font-size: 20px;
148
175
  cursor: pointer;
149
176
  }
177
+ .v-bottom {
178
+ position: absolute;
179
+ bottom: 24px;
180
+ left: 100%;
181
+ z-index: 999;
182
+ width: 100%;
183
+ color: #fff;
184
+ font-size: 12px;
185
+ transform: translateX(-60%);
186
+ }
187
+ .v-bottom span {
188
+ width: 120px;
189
+ height: 42px;
190
+ margin-right: 16px;
191
+ padding: 10px 16px;
192
+ font-size: 12px;
193
+ background: rgba(216, 216, 216, 0.05);
194
+ background-color: #00000068;
195
+ border-radius: 6px;
196
+ opacity: 1;
197
+ }
@@ -138,3 +138,26 @@
138
138
  cursor: pointer;
139
139
  }
140
140
  }
141
+
142
+ .v-bottom {
143
+ position: absolute;
144
+ bottom: 24px;
145
+ left: 100%;
146
+ z-index: 999;
147
+ width: 100%;
148
+ color: #fff;
149
+ font-size: 12px;
150
+ transform: translateX(-60%);
151
+
152
+ span {
153
+ width: 120px;
154
+ height: 42px;
155
+ margin-right: 16px;
156
+ padding: 10px 16px;
157
+ font-size: 12px;
158
+ background: rgba(216, 216, 216, 0.05);
159
+ background-color: #00000068;
160
+ border-radius: 6px;
161
+ opacity: 1;
162
+ }
163
+ }
@@ -34,3 +34,34 @@
34
34
  }
35
35
  }
36
36
  }
37
+
38
+ .iframe-container-pc {
39
+ position: relative;
40
+ height: 95vh;
41
+ overflow: hidden;
42
+ aspect-ratio: 1920 / 1080;
43
+
44
+ img {
45
+ position: absolute;
46
+ width: 100%;
47
+ height: 100%;
48
+ }
49
+
50
+ .iframe-content-pc {
51
+ position: absolute;
52
+ top: 70px;
53
+ left: 56px;
54
+ width: calc(100% - 106px);
55
+ height: calc(100% - 140px);
56
+ overflow: hidden;
57
+ background-color: white;
58
+ border-radius: 15px;
59
+ }
60
+
61
+ iframe {
62
+ width: 100%;
63
+ height: 100%;
64
+ border: none;
65
+ outline: none;
66
+ }
67
+ }
package/es/index.css CHANGED
@@ -4742,6 +4742,33 @@
4742
4742
  border: none;
4743
4743
  outline: none;
4744
4744
  }
4745
+ .iframe-container-pc {
4746
+ position: relative;
4747
+ height: 95vh;
4748
+ overflow: hidden;
4749
+ aspect-ratio: 1920 / 1080;
4750
+ }
4751
+ .iframe-container-pc img {
4752
+ position: absolute;
4753
+ width: 100%;
4754
+ height: 100%;
4755
+ }
4756
+ .iframe-container-pc .iframe-content-pc {
4757
+ position: absolute;
4758
+ top: 70px;
4759
+ left: 56px;
4760
+ width: calc(100% - 106px);
4761
+ height: calc(100% - 140px);
4762
+ overflow: hidden;
4763
+ background-color: white;
4764
+ border-radius: 15px;
4765
+ }
4766
+ .iframe-container-pc iframe {
4767
+ width: 100%;
4768
+ height: 100%;
4769
+ border: none;
4770
+ outline: none;
4771
+ }
4745
4772
  .doc-preview-container {
4746
4773
  position: fixed;
4747
4774
  top: 0;
@@ -4859,6 +4886,27 @@
4859
4886
  font-size: 20px;
4860
4887
  cursor: pointer;
4861
4888
  }
4889
+ .v-bottom {
4890
+ position: absolute;
4891
+ bottom: 24px;
4892
+ left: 100%;
4893
+ z-index: 999;
4894
+ width: 100%;
4895
+ color: #fff;
4896
+ font-size: 12px;
4897
+ transform: translateX(-60%);
4898
+ }
4899
+ .v-bottom span {
4900
+ width: 120px;
4901
+ height: 42px;
4902
+ margin-right: 16px;
4903
+ padding: 10px 16px;
4904
+ font-size: 12px;
4905
+ background: rgba(216, 216, 216, 0.05);
4906
+ background-color: #00000068;
4907
+ border-radius: 6px;
4908
+ opacity: 1;
4909
+ }
4862
4910
  .doc-diff-panel-wrap {
4863
4911
  box-sizing: border-box;
4864
4912
  width: 100% !important;
package/lib/config.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a, _b, _c, _d, _e, _f, _g, _h;
3
3
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
4
- const DEFAULT_BASE_API = ((_b = (_a = window.situoyun) == null ? void 0 : _a.env) == null ? void 0 : _b.BASE_HOST) || "https://site.r.cmstop.xyz";
4
+ const DEFAULT_BASE_API = ((_b = (_a = window.situoyun) == null ? void 0 : _a.env) == null ? void 0 : _b.BASE_HOST) || "https://site.cmstop.xyz";
5
5
  const DEFAULT_BASE_ACCOUNT_HOST = ((_d = (_c = window.situoyun) == null ? void 0 : _c.env) == null ? void 0 : _d.BASE_ACCOUNT_HOST) || "https://account.cmstop.xyz";
6
6
  const DEFAULT_UPLOAD_CHUNK_SIZE = ((_f = (_e = window.situoyun) == null ? void 0 : _e.env) == null ? void 0 : _f.UPLOAD_CHUNK_SIZE) || 5242880;
7
7
  const DEFAULT_UPLOAD_URL = ((_h = (_g = window.situoyun) == null ? void 0 : _g.env) == null ? void 0 : _h.BASE_STATIC_FILE_API) || "https://oss.cmstop.xyz/maple/v1";
@@ -60,7 +60,7 @@ const _sfc_main = vue.defineComponent({
60
60
  const handleScroll = (e) => {
61
61
  emit("scroll", e);
62
62
  const { target } = e;
63
- if (target.scrollHeight - target.scrollTop === target.clientHeight + 20) {
63
+ if (target.scrollHeight - target.scrollTop <= target.clientHeight + 20) {
64
64
  emit("scrollReachEnd");
65
65
  }
66
66
  };