zz-shopify-components 0.3.1-beta.12 → 0.3.1-beta.14
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
if (!customElements.get('zz-edu-info-dialog')) {
|
|
2
|
+
class ZZEduInfoDialog extends HTMLElement {
|
|
2
3
|
constructor() {
|
|
3
4
|
super();
|
|
4
5
|
this.init();
|
|
@@ -115,8 +116,8 @@ class ZZEduInfoDialog extends HTMLElement {
|
|
|
115
116
|
|
|
116
117
|
|
|
117
118
|
}
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
|
|
120
120
|
customElements.define('zz-edu-info-dialog', ZZEduInfoDialog);
|
|
121
|
+
}
|
|
121
122
|
|
|
122
123
|
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
<zz-radio-tabs-item value="manual">Upload student card</zz-radio-tabs-item>
|
|
98
98
|
</zz-radio-tabs>
|
|
99
99
|
<div class="zz-edu-form-container">
|
|
100
|
-
<form class="zz-edu-form-form" id="eduForm">
|
|
100
|
+
<form class="zz-edu-form-form" id="eduForm-{{ block.id }}">
|
|
101
101
|
<div class="zz-edu-form-group">
|
|
102
102
|
<label for="firstName" class="zz-edu-form-label">Full name</label>
|
|
103
103
|
<div class="zz-edu-form-row">
|
|
@@ -169,10 +169,10 @@
|
|
|
169
169
|
<div class="zz-edu-form-row upload-file-row zz-edu-form-hidden">
|
|
170
170
|
<div class="zz-edu-form-column">
|
|
171
171
|
<div class="zz-edu-form-group">
|
|
172
|
-
<label for="fileUpload" class="zz-edu-form-label">Upload Document</label>
|
|
172
|
+
<label for="fileUpload-{{ block.id }}" class="zz-edu-form-label">Upload Document</label>
|
|
173
173
|
<div class="zz-edu-form-file-upload-container">
|
|
174
|
-
<input type="file" id="fileUpload" name="fileUpload" class="zz-edu-form-file-input" accept=".pdf,.jpg,.jpeg,.png">
|
|
175
|
-
<label for="fileUpload" class="zz-edu-form-file-upload-label">
|
|
174
|
+
<input type="file" id="fileUpload-{{ block.id }}" name="fileUpload" class="zz-edu-form-file-input" accept=".pdf,.jpg,.jpeg,.png">
|
|
175
|
+
<label for="fileUpload-{{ block.id }}" class="zz-edu-form-file-upload-label">
|
|
176
176
|
<div class="zz-edu-form-file-upload-content">
|
|
177
177
|
<svg class="zz-edu-form-file-upload-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
178
178
|
<path d="M12 16L12 8M12 8L15 11M12 8L9 11" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
<span class="zz-edu-form-file-upload-hint">PDF, JPG, PNG (Max 10MB)</span>
|
|
183
183
|
</div>
|
|
184
184
|
</label>
|
|
185
|
-
<div class="zz-edu-form-file-preview" id="filePreview"></div>
|
|
185
|
+
<div class="zz-edu-form-file-preview" id="filePreview-{{ block.id }}"></div>
|
|
186
186
|
</div>
|
|
187
187
|
</div>
|
|
188
188
|
</div>
|
|
@@ -217,19 +217,14 @@
|
|
|
217
217
|
|
|
218
218
|
<script src="{{ 'aliyun-oss-sdk-6.20.0.min.js' | asset_url }}" defer></script>
|
|
219
219
|
|
|
220
|
-
|
|
221
|
-
{% assign base_url = 'https://h130-app-server-us.hoverx1.cn' %}
|
|
222
|
-
{% else %}
|
|
223
|
-
{% assign base_url = 'https://h130-app-server-test-us.hoverx1.cn' %}
|
|
224
|
-
{% endif %}
|
|
220
|
+
|
|
225
221
|
<script src="{{ 'zz-edu-info-dialog.js' | asset_url }}" defer></script>
|
|
226
222
|
|
|
227
223
|
<script>
|
|
228
|
-
|
|
229
|
-
const verifySuccessMessage = '{{ block.settings.verify_success_message }}';
|
|
230
|
-
const verifyFailTitle = '{{ block.settings.verify_fail_title }}';
|
|
224
|
+
|
|
231
225
|
|
|
232
|
-
|
|
226
|
+
|
|
227
|
+
var EduErrorCodeConf = {
|
|
233
228
|
201: {
|
|
234
229
|
zh: "该教育邮箱已完成注册,无需重复认证",
|
|
235
230
|
en: "This educational email has been registered, no need to re-authenticate"
|
|
@@ -276,10 +271,18 @@
|
|
|
276
271
|
}
|
|
277
272
|
}
|
|
278
273
|
document.addEventListener('DOMContentLoaded', function () {
|
|
274
|
+
{% if block.settings.request_type == 'prod' %}
|
|
275
|
+
{% assign base_url = 'https://h130-app-server-us.hoverx1.cn' %}
|
|
276
|
+
{% else %}
|
|
277
|
+
{% assign base_url = 'https://h130-app-server-test-us.hoverx1.cn' %}
|
|
278
|
+
{% endif %}
|
|
279
|
+
const verifySuccessTitle = '{{ block.settings.verify_success_title }}';
|
|
280
|
+
const verifySuccessMessage = '{{ block.settings.verify_success_message }}';
|
|
281
|
+
const verifyFailTitle = '{{ block.settings.verify_fail_title }}';
|
|
279
282
|
|
|
280
283
|
const baseUrl = '{{ base_url }}';
|
|
281
284
|
const block = document.getElementById('shopify-block-{{ block.id }}');
|
|
282
|
-
const form = block.querySelector('#eduForm');
|
|
285
|
+
const form = block.querySelector('#eduForm-{{ block.id }}');
|
|
283
286
|
let verifyType = 'email'
|
|
284
287
|
let identityDocumentUrl = ''
|
|
285
288
|
|
|
@@ -310,7 +313,7 @@
|
|
|
310
313
|
|
|
311
314
|
// 验证文件上传
|
|
312
315
|
if (verifyType === 'manual') {
|
|
313
|
-
const fileInput = form.querySelector('#fileUpload');
|
|
316
|
+
const fileInput = form.querySelector('#fileUpload-{{ block.id }}');
|
|
314
317
|
if (!fileInput.files || fileInput.files.length === 0) {
|
|
315
318
|
fileInput.classList.add('error');
|
|
316
319
|
isValid = false;
|
|
@@ -416,8 +419,8 @@
|
|
|
416
419
|
|
|
417
420
|
|
|
418
421
|
// 文件上传处理
|
|
419
|
-
const fileInput = form.querySelector('#fileUpload');
|
|
420
|
-
const filePreview = form.querySelector('#filePreview');
|
|
422
|
+
const fileInput = form.querySelector('#fileUpload-{{ block.id }}');
|
|
423
|
+
const filePreview = form.querySelector('#filePreview-{{ block.id }}');
|
|
421
424
|
const fileUploadLabel = form.querySelector('.zz-edu-form-file-upload-label');
|
|
422
425
|
|
|
423
426
|
fileInput.addEventListener('change', function(e) {
|
|
@@ -458,7 +461,6 @@
|
|
|
458
461
|
accessKeySecret: data.AccessKeySecret,
|
|
459
462
|
stsToken: data.SecurityToken,
|
|
460
463
|
});
|
|
461
|
-
|
|
462
464
|
const result = await client.put(file.name, file);
|
|
463
465
|
if(result.url) {
|
|
464
466
|
identityDocumentUrl = result.url
|
|
@@ -516,7 +518,7 @@
|
|
|
516
518
|
<span class="zz-edu-form-file-name">${fileName}</span>
|
|
517
519
|
<span class="zz-edu-form-file-size">${fileSize} MB</span>
|
|
518
520
|
</div>
|
|
519
|
-
<div class="zz-edu-form-file-remove-btn" onclick="removeEduVerifyFile()">
|
|
521
|
+
<div class="zz-edu-form-file-remove-btn" onclick="removeEduVerifyFile{{ block.id }}()">
|
|
520
522
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
521
523
|
<circle cx="12" cy="12" r="12" fill="#DD3B46"/>
|
|
522
524
|
<path d="M8.07812 15.9609L15.9977 8.04134" stroke="white" stroke-width="1.6" stroke-linecap="round"/>
|
|
@@ -530,7 +532,7 @@
|
|
|
530
532
|
}
|
|
531
533
|
|
|
532
534
|
// 移除文件
|
|
533
|
-
window
|
|
535
|
+
window['removeEduVerifyFile{{ block.id }}'] = function() {
|
|
534
536
|
fileInput.value = '';
|
|
535
537
|
filePreview.innerHTML = '';
|
|
536
538
|
fileUploadLabel.style.display = 'flex';
|
|
@@ -544,15 +546,6 @@
|
|
|
544
546
|
block.querySelector('.upload-file-row').classList.add('zz-edu-form-hidden');
|
|
545
547
|
}
|
|
546
548
|
});
|
|
547
|
-
{% comment %} block.querySelector('.zz-edu-form-submit-btn').addEventListener('click', (e) => {
|
|
548
|
-
const zzEduInfoDialog = block.querySelector('zz-edu-info-dialog');
|
|
549
|
-
zzEduInfoDialog.showModal({
|
|
550
|
-
title: 'Verify my email',
|
|
551
|
-
message: 'Please enter the verification code sent to your email',
|
|
552
|
-
showInput: true
|
|
553
|
-
});
|
|
554
|
-
|
|
555
|
-
}); {% endcomment %}
|
|
556
549
|
|
|
557
550
|
});
|
|
558
551
|
</script>
|