ts-glitter 20.4.2 → 20.4.4
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.
- package/lowcode/Entry.js +26 -1
- package/lowcode/Entry.ts +26 -1
- package/lowcode/cms-plugin/POS-setting.js +17 -12
- package/lowcode/cms-plugin/POS-setting.ts +16 -12
- package/lowcode/glitter-base/route/user.js +23 -10
- package/lowcode/glitter-base/route/user.ts +23 -11
- package/lowcode/official_event/page/change-page.js +1 -0
- package/lowcode/official_event/page/change-page.ts +1 -0
- package/lowcode/public-components/blogs/blogs-01.ts +1 -0
- package/package.json +1 -1
- package/src/api-public/services/phone-verify.d.ts +3 -0
- package/src/api-public/services/phone-verify.js +20 -0
- package/src/api-public/services/phone-verify.js.map +1 -0
- package/src/api-public/services/phone-verify.ts +13 -0
- package/src/api-public/services/user.d.ts +4 -0
- package/src/api-public/services/user.js +15 -5
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +12 -3
- package/src/controllers/template.js +6 -1
- package/src/controllers/template.js.map +1 -1
- package/src/controllers/template.ts +6 -1
- package/src/index.js +2 -420
- package/src/index.js.map +1 -1
- package/src/index.ts +3 -444
- package/src/seo-config.d.ts +17 -0
- package/src/seo-config.js +431 -0
- package/src/seo-config.js.map +1 -1
- package/src/seo-config.ts +463 -0
package/lowcode/Entry.js
CHANGED
|
@@ -144,7 +144,7 @@ export class Entry {
|
|
|
144
144
|
}
|
|
145
145
|
window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
|
|
146
146
|
console.log(`Entry-time:`, window.renderClock.stop());
|
|
147
|
-
glitter.share.editerVersion = 'V_20.4.
|
|
147
|
+
glitter.share.editerVersion = 'V_20.4.4';
|
|
148
148
|
glitter.share.start = new Date();
|
|
149
149
|
const vm = { appConfig: [] };
|
|
150
150
|
window.saasConfig = {
|
|
@@ -329,6 +329,31 @@ export class Entry {
|
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
+
Entry.checkSeoInfo(glitter);
|
|
333
|
+
}
|
|
334
|
+
static checkSeoInfo(glitter) {
|
|
335
|
+
var _a, _b, _c;
|
|
336
|
+
glitter.share.last_seo_config = (_a = glitter.share.last_seo_config) !== null && _a !== void 0 ? _a : {
|
|
337
|
+
title: document.title,
|
|
338
|
+
description: (_b = document.querySelector('meta[name="description"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content'),
|
|
339
|
+
ogImage: (_c = document.querySelector('meta[property="og:image"]')) === null || _c === void 0 ? void 0 : _c.getAttribute('content')
|
|
340
|
+
};
|
|
341
|
+
window.glitterInitialHelper.getPageData(glitter.getUrlParameter('page'), (data) => {
|
|
342
|
+
var _a, _b;
|
|
343
|
+
if ((data.response.seo_config && (data.response.seo_config.title && data.response.seo_config.content)) && ([data.response.seo_config.title, data.response.seo_config.content].join('') !== [
|
|
344
|
+
glitter.share.last_seo_config.title,
|
|
345
|
+
glitter.share.last_seo_config.description,
|
|
346
|
+
].join(''))) {
|
|
347
|
+
glitter.share.last_seo_config.title = data.response.seo_config.title;
|
|
348
|
+
glitter.share.last_seo_config.description = data.response.seo_config.content;
|
|
349
|
+
(_a = document.querySelector('meta[name="description"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('content', data.response.seo_config.content);
|
|
350
|
+
(_b = document.querySelector('meta[name="og:description"]')) === null || _b === void 0 ? void 0 : _b.setAttribute('content', data.response.seo_config.content);
|
|
351
|
+
document.title = data.response.seo_config.title;
|
|
352
|
+
}
|
|
353
|
+
setTimeout(() => {
|
|
354
|
+
Entry.checkSeoInfo(glitter);
|
|
355
|
+
}, 500);
|
|
356
|
+
});
|
|
332
357
|
}
|
|
333
358
|
static checkIframe(glitter) {
|
|
334
359
|
if (glitter.getUrlParameter('isIframe') === 'true') {
|
package/lowcode/Entry.ts
CHANGED
|
@@ -25,6 +25,7 @@ export class Entry {
|
|
|
25
25
|
return originalReplaceState.apply(history, arguments);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
+
//進入時就要提供堆棧,避免頁面返回問題
|
|
28
29
|
window.history.pushState({}, glitter.document.title,location.href);
|
|
29
30
|
function next(){
|
|
30
31
|
//判斷結帳成功清空購物車紀錄
|
|
@@ -145,7 +146,7 @@ export class Entry {
|
|
|
145
146
|
}
|
|
146
147
|
(window as any).renderClock = (window as any).renderClock ?? createClock();
|
|
147
148
|
console.log(`Entry-time:`, (window as any).renderClock.stop());
|
|
148
|
-
glitter.share.editerVersion = 'V_20.4.
|
|
149
|
+
glitter.share.editerVersion = 'V_20.4.4';
|
|
149
150
|
glitter.share.start = new Date();
|
|
150
151
|
const vm = { appConfig: [] };
|
|
151
152
|
(window as any).saasConfig = {
|
|
@@ -334,7 +335,31 @@ export class Entry {
|
|
|
334
335
|
})
|
|
335
336
|
}
|
|
336
337
|
}
|
|
338
|
+
Entry.checkSeoInfo(glitter)
|
|
339
|
+
}
|
|
337
340
|
|
|
341
|
+
//定期確認SEO資訊並更新
|
|
342
|
+
public static checkSeoInfo(glitter:Glitter){
|
|
343
|
+
glitter.share.last_seo_config=glitter.share.last_seo_config ?? {
|
|
344
|
+
title:document.title,
|
|
345
|
+
description:document.querySelector('meta[name="description"]')?.getAttribute('content'),
|
|
346
|
+
ogImage:document.querySelector('meta[property="og:image"]')?.getAttribute('content')
|
|
347
|
+
};
|
|
348
|
+
(window as any).glitterInitialHelper.getPageData(glitter.getUrlParameter('page'), (data: any) => {
|
|
349
|
+
if((data.response.seo_config && (data.response.seo_config.title && data.response.seo_config.content)) && ([data.response.seo_config.title,data.response.seo_config.content].join('') !== [
|
|
350
|
+
glitter.share.last_seo_config.title,
|
|
351
|
+
glitter.share.last_seo_config.description,
|
|
352
|
+
].join(''))){
|
|
353
|
+
glitter.share.last_seo_config.title=data.response.seo_config.title;
|
|
354
|
+
glitter.share.last_seo_config.description=data.response.seo_config.content;
|
|
355
|
+
document.querySelector('meta[name="description"]')?.setAttribute('content',data.response.seo_config.content);
|
|
356
|
+
document.querySelector('meta[name="og:description"]')?.setAttribute('content',data.response.seo_config.content);
|
|
357
|
+
document.title=data.response.seo_config.title;
|
|
358
|
+
}
|
|
359
|
+
setTimeout(()=>{
|
|
360
|
+
Entry.checkSeoInfo(glitter)
|
|
361
|
+
},500)
|
|
362
|
+
})
|
|
338
363
|
}
|
|
339
364
|
|
|
340
365
|
// 判斷是否為 Iframe 來覆寫 Glitter 代碼
|
|
@@ -106,7 +106,7 @@ export class POSSetting {
|
|
|
106
106
|
onclick="${gvc.event(() => {
|
|
107
107
|
dialog.dataLoading({ visible: true });
|
|
108
108
|
ApiUser.login({
|
|
109
|
-
app_name:
|
|
109
|
+
app_name: window.glitterBase,
|
|
110
110
|
account: vm.account,
|
|
111
111
|
pwd: vm.pwd,
|
|
112
112
|
}).then((r) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -206,7 +206,12 @@ export class POSSetting {
|
|
|
206
206
|
POSSetting.initialStyle(gvc);
|
|
207
207
|
gvc.glitter.share.NormalPageEditor = NormalPageEditor;
|
|
208
208
|
gvc.glitter.addStyleLink('./css/editor.css');
|
|
209
|
-
window.
|
|
209
|
+
if (window.location.href.includes('smartshop')) {
|
|
210
|
+
window.glitterBase = 'hd_saas';
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
window.glitterBase = 'shopnex';
|
|
214
|
+
}
|
|
210
215
|
window.appName = gvc.glitter.getUrlParameter('app-id');
|
|
211
216
|
window.saasConfig.config.token = GlobalUser.saas_token;
|
|
212
217
|
localStorage.setItem('on-pos', 'true');
|
|
@@ -278,7 +283,7 @@ export class POSSetting {
|
|
|
278
283
|
dialog.dataLoading({ visible: true });
|
|
279
284
|
localStorage.removeItem('on-pos');
|
|
280
285
|
window.parent.history.replaceState({}, document.title, `${glitter.root_path}cms?appName=${glitter.getUrlParameter('app-id')}&type=editor&function=backend-manger&tab=home_page`);
|
|
281
|
-
glitter.share.reload('cms',
|
|
286
|
+
glitter.share.reload('cms', window.glitterBase);
|
|
282
287
|
},
|
|
283
288
|
});
|
|
284
289
|
return '';
|
|
@@ -303,7 +308,7 @@ export class POSSetting {
|
|
|
303
308
|
dialog.dataLoading({ visible: true });
|
|
304
309
|
localStorage.removeItem('on-pos');
|
|
305
310
|
window.parent.history.replaceState({}, document.title, `${glitter.root_path}cms?appName=${glitter.getUrlParameter('app-id')}&type=editor&function=backend-manger&tab=home_page`);
|
|
306
|
-
glitter.share.reload('cms',
|
|
311
|
+
glitter.share.reload('cms', window.glitterBase);
|
|
307
312
|
return '';
|
|
308
313
|
}
|
|
309
314
|
}),
|
|
@@ -977,8 +982,8 @@ export class POSSetting {
|
|
|
977
982
|
>
|
|
978
983
|
${document.body.offsetWidth < 800
|
|
979
984
|
? ''
|
|
980
|
-
: html
|
|
981
|
-
|
|
985
|
+
: html ` <div class="d-flex align-items-center h-100 border-end pe-4" style="gap:10px;">
|
|
986
|
+
<img src="${SaasOffer.saas_logo}" style="max-width:150px;" />
|
|
982
987
|
<div
|
|
983
988
|
style="text-align: center; color: #8D8D8D; font-size: 38px; font-family: Lilita One; font-weight: 400; word-wrap: break-word"
|
|
984
989
|
>
|
|
@@ -1195,7 +1200,7 @@ export class POSSetting {
|
|
|
1195
1200
|
class: `h-100`,
|
|
1196
1201
|
},
|
|
1197
1202
|
})}
|
|
1198
|
-
${document.body.clientWidth < 800 ? html
|
|
1203
|
+
${document.body.clientWidth < 800 ? html ` <div class="flex-fill"></div>` : ''}
|
|
1199
1204
|
<div class="h-100 d-flex align-items-center border-start ps-1">
|
|
1200
1205
|
<div
|
|
1201
1206
|
style="width:50px;height: 100%;cursor: pointer;"
|
|
@@ -1218,7 +1223,7 @@ export class POSSetting {
|
|
|
1218
1223
|
</div>
|
|
1219
1224
|
${document.body.clientWidth > 800 || vm.type !== 'menu'
|
|
1220
1225
|
? ''
|
|
1221
|
-
: html
|
|
1226
|
+
: html ` <div style="width:50px;" class="d-flex align-items-center justify-content-center">
|
|
1222
1227
|
${cartBtn}
|
|
1223
1228
|
</div>`}
|
|
1224
1229
|
${gvc.bindView({
|
|
@@ -1306,7 +1311,7 @@ export class POSSetting {
|
|
|
1306
1311
|
dialog.dataLoading({ visible: true });
|
|
1307
1312
|
localStorage.removeItem('on-pos');
|
|
1308
1313
|
window.parent.history.replaceState({}, document.title, `${glitter.root_path}cms?appName=${glitter.getUrlParameter('app-id')}&type=editor&function=backend-manger&tab=home_page`);
|
|
1309
|
-
glitter.share.reload('cms',
|
|
1314
|
+
glitter.share.reload('cms', window.glitterBase);
|
|
1310
1315
|
})}"
|
|
1311
1316
|
><i
|
|
1312
1317
|
class="fa-solid fa-angle-left d-flex align-items-center justify-content-center"
|
|
@@ -1346,12 +1351,12 @@ export class POSSetting {
|
|
|
1346
1351
|
});
|
|
1347
1352
|
}
|
|
1348
1353
|
else if (vm.type === 'order') {
|
|
1349
|
-
return html
|
|
1354
|
+
return html ` <div class="vw-100 px-lg-3" style="overflow-y: scroll;">
|
|
1350
1355
|
${ShoppingOrderManager.main(gvc, { isPOS: true })}
|
|
1351
1356
|
</div>`;
|
|
1352
1357
|
}
|
|
1353
1358
|
else if (vm.type === 'member') {
|
|
1354
|
-
return html
|
|
1359
|
+
return html ` <div class="vw-100 px-lg-3" style="overflow-y: scroll;">
|
|
1355
1360
|
${UserList.main(gvc)}
|
|
1356
1361
|
</div>`;
|
|
1357
1362
|
}
|
|
@@ -1371,7 +1376,7 @@ export class POSSetting {
|
|
|
1371
1376
|
}
|
|
1372
1377
|
})();
|
|
1373
1378
|
if (document.body.clientWidth < 768) {
|
|
1374
|
-
view += html
|
|
1379
|
+
view += html ` <div style="height: 100px;"></div>`;
|
|
1375
1380
|
}
|
|
1376
1381
|
return view;
|
|
1377
1382
|
}),
|
|
@@ -135,7 +135,7 @@ export class POSSetting {
|
|
|
135
135
|
onclick="${gvc.event(() => {
|
|
136
136
|
dialog.dataLoading({ visible: true });
|
|
137
137
|
ApiUser.login({
|
|
138
|
-
app_name:
|
|
138
|
+
app_name: (window as any).glitterBase,
|
|
139
139
|
account: vm.account,
|
|
140
140
|
pwd: vm.pwd,
|
|
141
141
|
}).then(async r => {
|
|
@@ -239,8 +239,12 @@ export class POSSetting {
|
|
|
239
239
|
|
|
240
240
|
gvc.glitter.share.NormalPageEditor = NormalPageEditor; // 提供給編輯器使用
|
|
241
241
|
gvc.glitter.addStyleLink('./css/editor.css');
|
|
242
|
+
if (window.location.href.includes('smartshop')) {
|
|
243
|
+
(window as any).glitterBase = 'hd_saas';
|
|
244
|
+
} else {
|
|
245
|
+
(window as any).glitterBase = 'shopnex';
|
|
246
|
+
}
|
|
242
247
|
|
|
243
|
-
(window as any).glitterBase = 'shopnex';
|
|
244
248
|
(window as any).appName = gvc.glitter.getUrlParameter('app-id');
|
|
245
249
|
(window as any).saasConfig.config.token = GlobalUser.saas_token;
|
|
246
250
|
|
|
@@ -322,7 +326,7 @@ export class POSSetting {
|
|
|
322
326
|
document.title,
|
|
323
327
|
`${glitter.root_path}cms?appName=${glitter.getUrlParameter('app-id')}&type=editor&function=backend-manger&tab=home_page`
|
|
324
328
|
);
|
|
325
|
-
glitter.share.reload('cms',
|
|
329
|
+
glitter.share.reload('cms', (window as any).glitterBase);
|
|
326
330
|
},
|
|
327
331
|
});
|
|
328
332
|
return '';
|
|
@@ -348,7 +352,7 @@ export class POSSetting {
|
|
|
348
352
|
document.title,
|
|
349
353
|
`${glitter.root_path}cms?appName=${glitter.getUrlParameter('app-id')}&type=editor&function=backend-manger&tab=home_page`
|
|
350
354
|
);
|
|
351
|
-
glitter.share.reload('cms',
|
|
355
|
+
glitter.share.reload('cms', (window as any).glitterBase);
|
|
352
356
|
return '';
|
|
353
357
|
}
|
|
354
358
|
},
|
|
@@ -1080,8 +1084,8 @@ export class POSSetting {
|
|
|
1080
1084
|
>
|
|
1081
1085
|
${document.body.offsetWidth < 800
|
|
1082
1086
|
? ''
|
|
1083
|
-
: html
|
|
1084
|
-
|
|
1087
|
+
: html` <div class="d-flex align-items-center h-100 border-end pe-4" style="gap:10px;">
|
|
1088
|
+
<img src="${SaasOffer.saas_logo}" style="max-width:150px;" />
|
|
1085
1089
|
<div
|
|
1086
1090
|
style="text-align: center; color: #8D8D8D; font-size: 38px; font-family: Lilita One; font-weight: 400; word-wrap: break-word"
|
|
1087
1091
|
>
|
|
@@ -1297,7 +1301,7 @@ export class POSSetting {
|
|
|
1297
1301
|
class: `h-100`,
|
|
1298
1302
|
},
|
|
1299
1303
|
})}
|
|
1300
|
-
${document.body.clientWidth < 800 ? html
|
|
1304
|
+
${document.body.clientWidth < 800 ? html` <div class="flex-fill"></div>` : ''}
|
|
1301
1305
|
<div class="h-100 d-flex align-items-center border-start ps-1">
|
|
1302
1306
|
<div
|
|
1303
1307
|
style="width:50px;height: 100%;cursor: pointer;"
|
|
@@ -1320,7 +1324,7 @@ export class POSSetting {
|
|
|
1320
1324
|
</div>
|
|
1321
1325
|
${document.body.clientWidth > 800 || vm.type !== 'menu'
|
|
1322
1326
|
? ''
|
|
1323
|
-
: html
|
|
1327
|
+
: html` <div style="width:50px;" class="d-flex align-items-center justify-content-center">
|
|
1324
1328
|
${cartBtn}
|
|
1325
1329
|
</div>`}
|
|
1326
1330
|
${gvc.bindView({
|
|
@@ -1414,7 +1418,7 @@ export class POSSetting {
|
|
|
1414
1418
|
document.title,
|
|
1415
1419
|
`${glitter.root_path}cms?appName=${glitter.getUrlParameter('app-id')}&type=editor&function=backend-manger&tab=home_page`
|
|
1416
1420
|
);
|
|
1417
|
-
glitter.share.reload('cms',
|
|
1421
|
+
glitter.share.reload('cms', (window as any).glitterBase);
|
|
1418
1422
|
})}"
|
|
1419
1423
|
><i
|
|
1420
1424
|
class="fa-solid fa-angle-left d-flex align-items-center justify-content-center"
|
|
@@ -1453,11 +1457,11 @@ export class POSSetting {
|
|
|
1453
1457
|
vm: vm,
|
|
1454
1458
|
});
|
|
1455
1459
|
} else if (vm.type === 'order') {
|
|
1456
|
-
return html
|
|
1460
|
+
return html` <div class="vw-100 px-lg-3" style="overflow-y: scroll;">
|
|
1457
1461
|
${ShoppingOrderManager.main(gvc, { isPOS: true })}
|
|
1458
1462
|
</div>`;
|
|
1459
1463
|
} else if (vm.type === 'member') {
|
|
1460
|
-
return html
|
|
1464
|
+
return html` <div class="vw-100 px-lg-3" style="overflow-y: scroll;">
|
|
1461
1465
|
${UserList.main(gvc)}
|
|
1462
1466
|
</div>`;
|
|
1463
1467
|
} else if (vm.type === 'setting') {
|
|
@@ -1474,7 +1478,7 @@ export class POSSetting {
|
|
|
1474
1478
|
}
|
|
1475
1479
|
})();
|
|
1476
1480
|
if (document.body.clientWidth < 768) {
|
|
1477
|
-
view += html
|
|
1481
|
+
view += html` <div style="height: 100px;"></div>`;
|
|
1478
1482
|
}
|
|
1479
1483
|
return view;
|
|
1480
1484
|
},
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { BaseApi } from '../../glitterBundle/api/base.js';
|
|
11
11
|
import { GlobalUser } from '../global/global-user.js';
|
|
12
12
|
import { ApiShop } from './shopping.js';
|
|
13
|
+
import { ShareDialog } from '../../dialog/ShareDialog.js';
|
|
13
14
|
export class ApiUser {
|
|
14
15
|
static register(json) {
|
|
15
16
|
return BaseApi.create({
|
|
@@ -208,16 +209,28 @@ export class ApiUser {
|
|
|
208
209
|
});
|
|
209
210
|
}
|
|
210
211
|
static phoneVerify(phone_number) {
|
|
211
|
-
return
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
212
|
+
return new Promise((resolve, reject) => {
|
|
213
|
+
BaseApi.create({
|
|
214
|
+
url: getBaseUrl() + `/api-public/v1/user/phone-verify`,
|
|
215
|
+
type: 'POST',
|
|
216
|
+
headers: {
|
|
217
|
+
'g-app': getConfig().config.appName,
|
|
218
|
+
'Content-Type': 'application/json',
|
|
219
|
+
},
|
|
220
|
+
data: JSON.stringify({
|
|
221
|
+
phone_number: phone_number,
|
|
222
|
+
}),
|
|
223
|
+
}).then((res) => {
|
|
224
|
+
if (res.response.out_limit) {
|
|
225
|
+
const dialog = new ShareDialog(window.glitter);
|
|
226
|
+
dialog.errorMessage({
|
|
227
|
+
text: '連續驗證失敗超過三次,請聯絡客服進行修改'
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
resolve(res);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
221
234
|
});
|
|
222
235
|
}
|
|
223
236
|
static registerFCM(userID, deviceToken, app_name) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BaseApi } from '../../glitterBundle/api/base.js';
|
|
2
2
|
import { GlobalUser } from '../global/global-user.js';
|
|
3
3
|
import { ApiShop } from './shopping.js';
|
|
4
|
+
import { ShareDialog } from '../../dialog/ShareDialog.js';
|
|
4
5
|
|
|
5
6
|
export class ApiUser {
|
|
6
7
|
public static register(json: { account: string; pwd: string; userData: any }) {
|
|
@@ -219,17 +220,28 @@ export class ApiUser {
|
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
public static phoneVerify(phone_number: string) {
|
|
222
|
-
return
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
223
|
+
return new Promise<{result:boolean,response:any}>((resolve, reject) => {
|
|
224
|
+
BaseApi.create({
|
|
225
|
+
url: getBaseUrl() + `/api-public/v1/user/phone-verify`,
|
|
226
|
+
type: 'POST',
|
|
227
|
+
headers: {
|
|
228
|
+
'g-app': getConfig().config.appName,
|
|
229
|
+
'Content-Type': 'application/json',
|
|
230
|
+
},
|
|
231
|
+
data: JSON.stringify({
|
|
232
|
+
phone_number: phone_number,
|
|
233
|
+
}),
|
|
234
|
+
}).then((res)=>{
|
|
235
|
+
if(res.response.out_limit){
|
|
236
|
+
const dialog=new ShareDialog((window as any).glitter);
|
|
237
|
+
dialog.errorMessage({
|
|
238
|
+
text:'連續驗證失敗超過三次,請聯絡客服進行修改'
|
|
239
|
+
})
|
|
240
|
+
}else{
|
|
241
|
+
resolve(res)
|
|
242
|
+
}
|
|
243
|
+
})
|
|
244
|
+
})
|
|
233
245
|
}
|
|
234
246
|
|
|
235
247
|
public static registerFCM(userID: string, deviceToken: string, app_name?: string) {
|
|
@@ -20,6 +20,7 @@ class ChangePage {
|
|
|
20
20
|
url.searchParams.set('page', link);
|
|
21
21
|
const saasConfig = window.saasConfig;
|
|
22
22
|
window.glitterInitialHelper.getPageData(link, (data) => {
|
|
23
|
+
console.log(`seo_config==>`, data.response.seo_config);
|
|
23
24
|
if (data.response.result.length === 0) {
|
|
24
25
|
const url = new URL("./", location.href);
|
|
25
26
|
url.searchParams.set('page', data.response.redirect);
|
|
@@ -17,6 +17,7 @@ class ChangePage {
|
|
|
17
17
|
appConfig: any
|
|
18
18
|
} = (window as any).saasConfig;
|
|
19
19
|
(window as any).glitterInitialHelper.getPageData(link, (data: any) => {
|
|
20
|
+
console.log(`seo_config==>`,data.response.seo_config)
|
|
20
21
|
if (data.response.result.length === 0) {
|
|
21
22
|
const url = new URL("./", location.href)
|
|
22
23
|
url.searchParams.set('page', data.response.redirect)
|
|
@@ -8,6 +8,7 @@ import { GlobalUser } from '../../glitter-base/global/global-user.js';
|
|
|
8
8
|
|
|
9
9
|
export class Blogs01 {
|
|
10
10
|
static main(gvc: GVC, subData: any) {
|
|
11
|
+
|
|
11
12
|
if (subData.content.generator !== 'page_editor') {
|
|
12
13
|
const dd = subData.content;
|
|
13
14
|
return `<div class="container mx-auto fr-view mb-5" style="max-width: 1100px;font-family: 'Source Sans Pro', 'Open Sans', 'Helvetica Neue', Helvetica, Arial, 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', 'STHeiti', 'WenQuanYi Micro Hei', SimSun, sans-serif;">
|
package/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PhoneVerify = void 0;
|
|
7
|
+
const redis_js_1 = __importDefault(require("../../modules/redis.js"));
|
|
8
|
+
class PhoneVerify {
|
|
9
|
+
static async verify(phone, code) {
|
|
10
|
+
if (await redis_js_1.default.getValue(`verify-phone-${phone}`) === code) {
|
|
11
|
+
await redis_js_1.default.deleteKey(`verify-phone-${phone}-last-count`);
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.PhoneVerify = PhoneVerify;
|
|
20
|
+
//# sourceMappingURL=phone-verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone-verify.js","sourceRoot":"","sources":["phone-verify.ts"],"names":[],"mappings":";;;;;;AAAA,sEAA2C;AAE3C,MAAa,WAAW;IACf,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAY,EAAC,IAAW;QACjD,IAAG,MAAM,kBAAK,CAAC,QAAQ,CAAC,gBAAgB,KAAK,EAAE,CAAC,KAAG,IAAI,EAAC,CAAC;YACvD,MAAM,kBAAK,CAAC,SAAS,CAAC,gBAAgB,KAAK,aAAa,CAAC,CAAC;YAC1D,OAAO,IAAI,CAAC;QACd,CAAC;aAAI,CAAC;YACJ,OAAO,KAAK,CAAC;QACf,CAAC;IAEH,CAAC;CACF;AAVD,kCAUC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import redis from '../../modules/redis.js';
|
|
2
|
+
|
|
3
|
+
export class PhoneVerify{
|
|
4
|
+
public static async verify(phone:string,code:string){
|
|
5
|
+
if(await redis.getValue(`verify-phone-${phone}`)===code){
|
|
6
|
+
await redis.deleteKey(`verify-phone-${phone}-last-count`);
|
|
7
|
+
return true;
|
|
8
|
+
}else{
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -60,7 +60,11 @@ export declare class User {
|
|
|
60
60
|
result: boolean;
|
|
61
61
|
}>;
|
|
62
62
|
phoneVerify(account: string): Promise<{
|
|
63
|
+
out_limit: boolean;
|
|
64
|
+
result?: undefined;
|
|
65
|
+
} | {
|
|
63
66
|
result: boolean;
|
|
67
|
+
out_limit?: undefined;
|
|
64
68
|
}>;
|
|
65
69
|
createUser(account: string, pwd: string, userData: any, req: any, pass_verify?: boolean): Promise<any>;
|
|
66
70
|
createUserHook(userID: string): Promise<void>;
|
|
@@ -58,6 +58,7 @@ const user_update_js_1 = require("./user-update.js");
|
|
|
58
58
|
const public_table_check_js_1 = require("./public-table-check.js");
|
|
59
59
|
const ut_timer_1 = require("../utils/ut-timer");
|
|
60
60
|
const auto_fcm_js_1 = require("../../public-config-initial/auto-fcm.js");
|
|
61
|
+
const phone_verify_js_1 = require("./phone-verify.js");
|
|
61
62
|
class User {
|
|
62
63
|
constructor(app, token) {
|
|
63
64
|
this.normalMember = {
|
|
@@ -119,6 +120,14 @@ class User {
|
|
|
119
120
|
}
|
|
120
121
|
async phoneVerify(account) {
|
|
121
122
|
const time = await redis_js_1.default.getValue(`verify-phone-${account}-last-time`);
|
|
123
|
+
let last_count = parseInt(`${(await redis_js_1.default.getValue(`verify-phone-${account}-last-count`)) || '0'}`, 10);
|
|
124
|
+
last_count++;
|
|
125
|
+
if (last_count > 3) {
|
|
126
|
+
return {
|
|
127
|
+
out_limit: true,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
await redis_js_1.default.setValue(`verify-phone-${account}-last-count`, last_count);
|
|
122
131
|
if (!time || new Date().getTime() - new Date(time).getTime() > 1000 * 30) {
|
|
123
132
|
await redis_js_1.default.setValue(`verify-phone-${account}-last-time`, new Date().toISOString());
|
|
124
133
|
const data = await auto_send_email_js_1.AutoSendEmail.getDefCompare(this.app, 'auto-phone-verify-update', 'zh-TW');
|
|
@@ -183,7 +192,7 @@ class User {
|
|
|
183
192
|
});
|
|
184
193
|
}
|
|
185
194
|
if (login_config.phone_verify &&
|
|
186
|
-
|
|
195
|
+
!(await phone_verify_js_1.PhoneVerify.verify(userData.phone, userData.verify_code_phone)) &&
|
|
187
196
|
register_form.list.find((dd) => {
|
|
188
197
|
return dd.key === 'phone' && `${dd.hidden}` !== 'true';
|
|
189
198
|
})) {
|
|
@@ -1701,10 +1710,11 @@ class User {
|
|
|
1701
1710
|
});
|
|
1702
1711
|
}
|
|
1703
1712
|
if (login_config.phone_verify &&
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1713
|
+
!(await phone_verify_js_1.PhoneVerify.verify(par.userData.phone, par.userData.verify_code_phone))
|
|
1714
|
+
&&
|
|
1715
|
+
register_form.list.find((dd) => {
|
|
1716
|
+
return dd.key === 'phone' && `${dd.hidden}` !== 'true';
|
|
1717
|
+
})) {
|
|
1708
1718
|
throw exception_1.default.BadRequestError('BAD_REQUEST', 'Verify code error.', {
|
|
1709
1719
|
msg: 'phone-verify-false',
|
|
1710
1720
|
});
|