ts-glitter 20.4.1 → 20.4.3
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/filter-options.js +1 -0
- package/lowcode/cms-plugin/filter-options.ts +1 -0
- package/lowcode/cms-plugin/stock-history.js +4 -1
- package/lowcode/cms-plugin/stock-history.ts +3 -1
- 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/shopping.js +3 -0
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +3 -0
- package/src/api-public/services/user.d.ts +4 -0
- package/src/api-public/services/user.js +15 -7
- 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.3';
|
|
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.3';
|
|
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 代碼
|
|
@@ -238,7 +238,10 @@ export class StockHistory {
|
|
|
238
238
|
},
|
|
239
239
|
{
|
|
240
240
|
key: '總金額',
|
|
241
|
-
value: `<span class="fs-7">$ ${
|
|
241
|
+
value: `<span class="fs-7">$ ${dd.content.product_list.reduce((sum, item) => {
|
|
242
|
+
var _a;
|
|
243
|
+
return sum + item.cost * ((_a = item.recent_count) !== null && _a !== void 0 ? _a : 0);
|
|
244
|
+
}, 0).toLocaleString()}</span>`,
|
|
242
245
|
},
|
|
243
246
|
{
|
|
244
247
|
key: '供應商',
|
|
@@ -269,7 +269,9 @@ export class StockHistory {
|
|
|
269
269
|
},
|
|
270
270
|
{
|
|
271
271
|
key: '總金額',
|
|
272
|
-
value: `<span class="fs-7">$ ${
|
|
272
|
+
value: `<span class="fs-7">$ ${ dd.content.product_list.reduce((sum, item) => {
|
|
273
|
+
return sum + item.cost * (item.recent_count ?? 0);
|
|
274
|
+
}, 0).toLocaleString()}</span>`,
|
|
273
275
|
},
|
|
274
276
|
{
|
|
275
277
|
key: '供應商',
|
|
@@ -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
|
+
}
|
|
@@ -4585,6 +4585,9 @@ class Shopping {
|
|
|
4585
4585
|
case 'sku':
|
|
4586
4586
|
querySql.push(`(UPPER(JSON_EXTRACT(v.content, '$.sku')) LIKE UPPER('%${query.search}%'))`);
|
|
4587
4587
|
break;
|
|
4588
|
+
case 'barcode':
|
|
4589
|
+
querySql.push(`(UPPER(JSON_EXTRACT(v.content, '$.barcode')) LIKE UPPER('%${query.search}%'))`);
|
|
4590
|
+
break;
|
|
4588
4591
|
}
|
|
4589
4592
|
}
|
|
4590
4593
|
query.id && querySql.push(`(v.id = ${query.id})`);
|