ts-glitter 21.4.7 → 21.4.8

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 (37) hide show
  1. package/lowcode/Entry.js +2 -1
  2. package/lowcode/Entry.ts +2 -2
  3. package/lowcode/api/pageConfig.js +2 -0
  4. package/lowcode/api/pageConfig.ts +4 -2
  5. package/lowcode/cms-plugin/menus-setting.js +4 -9
  6. package/lowcode/cms-plugin/menus-setting.ts +4 -9
  7. package/lowcode/editor/normal-page-editor.js +2 -2
  8. package/lowcode/editor/normal-page-editor.ts +2 -2
  9. package/lowcode/glitter-base/route/api-cart.ts +1 -0
  10. package/lowcode/glitterBundle/html-component/global-widget.js +78 -2
  11. package/lowcode/glitterBundle/html-component/global-widget.ts +86 -16
  12. package/lowcode/jspage/main.js +10 -2
  13. package/lowcode/jspage/main.ts +14 -2
  14. package/lowcode/official_view_component/official/component.js +4 -0
  15. package/lowcode/official_view_component/official/component.ts +4 -1
  16. package/lowcode/public-components/headers/header-class.js +3 -1
  17. package/lowcode/public-components/headers/header-class.ts +4 -1
  18. package/lowcode/public-components/headers/sy-02.js +13 -3
  19. package/lowcode/public-components/headers/sy-02.ts +14 -3
  20. package/lowcode/public-components/headers/sy-03.js +13 -3
  21. package/lowcode/public-components/headers/sy-03.ts +13 -3
  22. package/lowcode/public-components/headers/sy-04.js +13 -3
  23. package/lowcode/public-components/headers/sy-04.ts +13 -3
  24. package/lowcode/public-components/headers/sy-05.js +10 -3
  25. package/lowcode/public-components/headers/sy-05.ts +10 -3
  26. package/lowcode/public-components/product/pd-card-01.js +11 -1
  27. package/lowcode/public-components/product/pd-card-01.ts +10 -1
  28. package/lowcode/public-components/product/pd-card-02.js +13 -1
  29. package/lowcode/public-components/product/pd-card-02.ts +12 -1
  30. package/lowcode/public-components/product/pd-card-03.js +13 -1
  31. package/lowcode/public-components/product/pd-card-03.ts +12 -1
  32. package/lowcode/public-components/product/pd-class.js +32 -24
  33. package/lowcode/public-components/product/pd-class.ts +15 -5
  34. package/package.json +1 -1
  35. package/src/services/template.js +9 -11
  36. package/src/services/template.js.map +1 -1
  37. package/src/services/template.ts +5 -3
@@ -9,6 +9,7 @@ import { LanguageView } from '../public/language-view.js';
9
9
  import { HeaderClass } from './header-class.js';
10
10
  import { HeadInitial } from './head-initial.js';
11
11
  import { HeaderMobile } from './header-mobile.js';
12
+ import { PdClass } from '../product/pd-class.js';
12
13
 
13
14
  const html = String.raw;
14
15
 
@@ -41,7 +42,7 @@ export class Sy02 {
41
42
  <div class="d-flex align-items-center justify-content-center h-100 w-100 gap-2">
42
43
  <!--手機版選單-->
43
44
  <div
44
- class="d-flex align-items-center justify-content-center"
45
+ class="${PdClass.isShoppingPage() ? `d-none`:`d-flex d-lg-none`} align-items-center justify-content-center"
45
46
  style="width:40px !important;height:40px !important;"
46
47
  onclick="${gvc.event(() => {
47
48
  gvc.glitter.setDrawer(
@@ -114,8 +115,9 @@ export class Sy02 {
114
115
  const vm = {
115
116
  data: [],
116
117
  };
118
+
117
119
  ApiUser.getPublicConfig(
118
- 'menu-setting',
120
+ widget.formData.menu_refer || 'menu-setting',
119
121
  'manager',
120
122
  (window as any).appName
121
123
  ).then(res => {
@@ -137,6 +139,9 @@ export class Sy02 {
137
139
  }
138
140
 
139
141
  function loopItems(data: any, show_border: boolean) {
142
+ if(PdClass.isShoppingPage()){
143
+ return ``
144
+ }
140
145
  return data
141
146
  .map((dd: any) => {
142
147
  return html`
@@ -260,7 +265,7 @@ background: ${colors.bgr ?? '#000'};overflow-x: hidden;`,
260
265
  const vm = {
261
266
  data: [],
262
267
  };
263
- ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then(res => {
268
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', (window as any).appName).then(res => {
264
269
  vm.data = res.response.value[Language.getLanguage()];
265
270
  gvc.notifyDataChange(id);
266
271
  });
@@ -268,6 +273,9 @@ background: ${colors.bgr ?? '#000'};overflow-x: hidden;`,
268
273
  bind: id,
269
274
  view: () => {
270
275
  function loopItems(data: any) {
276
+ if(PdClass.isShoppingPage()){
277
+ return ``
278
+ }
271
279
  return data
272
280
  .map((dd: any) => {
273
281
  return html` <li class="nav-item dropdown">
@@ -368,6 +376,9 @@ padding-bottom: 2px;
368
376
  return {
369
377
  bind: vm.id,
370
378
  view: () => {
379
+ if(PdClass.isShoppingPage()){
380
+ return ``
381
+ }
371
382
  if (!vm.toggle) {
372
383
  return html`<i
373
384
  class="fa-regular fa-magnifying-glass"
@@ -8,6 +8,7 @@ import { LanguageView } from '../public/language-view.js';
8
8
  import { HeaderClass } from './header-class.js';
9
9
  import { HeadInitial } from './head-initial.js';
10
10
  import { HeaderMobile } from './header-mobile.js';
11
+ import { PdClass } from '../product/pd-class.js';
11
12
  const html = String.raw;
12
13
  export class Sy03 {
13
14
  static main(gvc, widget, subData) {
@@ -37,7 +38,7 @@ export class Sy03 {
37
38
  >
38
39
  <!--手機版選單-->
39
40
  <div
40
- class="d-flex align-items-center justify-content-center d-md-none"
41
+ class=" align-items-center justify-content-center ${PdClass.isShoppingPage() ? `d-none` : `d-flex d-lg-none`} "
41
42
  style="width:45px !important;height:40px !important;"
42
43
  onclick="${gvc.event(() => {
43
44
  gvc.glitter.setDrawer(gvc.bindView(() => {
@@ -100,7 +101,7 @@ export class Sy03 {
100
101
  const vm = {
101
102
  data: [],
102
103
  };
103
- ApiUser.getPublicConfig('menu-setting', 'manager', window.appName).then(res => {
104
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', window.appName).then(res => {
104
105
  vm.data = res.response.value[Language.getLanguage()];
105
106
  gvc.notifyDataChange(id);
106
107
  });
@@ -118,6 +119,9 @@ export class Sy03 {
118
119
  loop(vm.data);
119
120
  }
120
121
  function loopItems(data, show_border) {
122
+ if (PdClass.isShoppingPage()) {
123
+ return ``;
124
+ }
121
125
  return data
122
126
  .map((dd) => {
123
127
  var _a, _b, _c, _d, _e;
@@ -234,7 +238,7 @@ background: ${(_a = colors.bgr) !== null && _a !== void 0 ? _a : '#000'};overflo
234
238
  const vm = {
235
239
  data: [],
236
240
  };
237
- ApiUser.getPublicConfig('menu-setting', 'manager', window.appName).then(res => {
241
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', window.appName).then(res => {
238
242
  vm.data = res.response.value[Language.getLanguage()];
239
243
  gvc.notifyDataChange(id);
240
244
  });
@@ -242,6 +246,9 @@ background: ${(_a = colors.bgr) !== null && _a !== void 0 ? _a : '#000'};overflo
242
246
  bind: id,
243
247
  view: () => {
244
248
  function loopItems(data) {
249
+ if (PdClass.isShoppingPage()) {
250
+ return ``;
251
+ }
245
252
  return data
246
253
  .map((dd) => {
247
254
  var _a, _b;
@@ -337,6 +344,9 @@ padding-bottom: 2px;
337
344
  bind: vm.id,
338
345
  view: () => {
339
346
  var _a, _b;
347
+ if (PdClass.isShoppingPage()) {
348
+ return ``;
349
+ }
340
350
  if (!vm.toggle) {
341
351
  return html `<i
342
352
  class="fa-regular fa-magnifying-glass"
@@ -9,6 +9,7 @@ import { LanguageView } from '../public/language-view.js';
9
9
  import { HeaderClass } from './header-class.js';
10
10
  import { HeadInitial } from './head-initial.js';
11
11
  import { HeaderMobile } from './header-mobile.js';
12
+ import { PdClass } from '../product/pd-class.js';
12
13
 
13
14
  const html = String.raw;
14
15
 
@@ -40,7 +41,7 @@ export class Sy03 {
40
41
  >
41
42
  <!--手機版選單-->
42
43
  <div
43
- class="d-flex align-items-center justify-content-center d-md-none"
44
+ class=" align-items-center justify-content-center ${PdClass.isShoppingPage() ? `d-none`:`d-flex d-lg-none`} "
44
45
  style="width:45px !important;height:40px !important;"
45
46
  onclick="${gvc.event(() => {
46
47
  gvc.glitter.setDrawer(
@@ -103,7 +104,7 @@ export class Sy03 {
103
104
  const vm = {
104
105
  data: [],
105
106
  };
106
- ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then(
107
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', (window as any).appName).then(
107
108
  res => {
108
109
  vm.data = res.response.value[Language.getLanguage()];
109
110
  gvc.notifyDataChange(id);
@@ -124,6 +125,9 @@ export class Sy03 {
124
125
  }
125
126
 
126
127
  function loopItems(data: any, show_border: boolean) {
128
+ if(PdClass.isShoppingPage()){
129
+ return ``
130
+ }
127
131
  return data
128
132
  .map((dd: any) => {
129
133
  return html`
@@ -240,7 +244,7 @@ background: ${colors.bgr ?? '#000'};overflow-x: hidden;`,
240
244
  const vm = {
241
245
  data: [],
242
246
  };
243
- ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then(res => {
247
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', (window as any).appName).then(res => {
244
248
  vm.data = res.response.value[Language.getLanguage()];
245
249
  gvc.notifyDataChange(id);
246
250
  });
@@ -248,6 +252,9 @@ background: ${colors.bgr ?? '#000'};overflow-x: hidden;`,
248
252
  bind: id,
249
253
  view: () => {
250
254
  function loopItems(data: any) {
255
+ if(PdClass.isShoppingPage()){
256
+ return ``
257
+ }
251
258
  return data
252
259
  .map((dd: any) => {
253
260
  return html` <li class="nav-item dropdown">
@@ -342,6 +349,9 @@ padding-bottom: 2px;
342
349
  return {
343
350
  bind: vm.id,
344
351
  view: () => {
352
+ if(PdClass.isShoppingPage()){
353
+ return ``
354
+ }
345
355
  if (!vm.toggle) {
346
356
  return html`<i
347
357
  class="fa-regular fa-magnifying-glass"
@@ -8,6 +8,7 @@ import { LanguageView } from '../public/language-view.js';
8
8
  import { HeaderClass } from './header-class.js';
9
9
  import { HeadInitial } from './head-initial.js';
10
10
  import { HeaderMobile } from './header-mobile.js';
11
+ import { PdClass } from '../product/pd-class.js';
11
12
  const html = String.raw;
12
13
  export class Sy04 {
13
14
  static main(gvc, widget, subData) {
@@ -30,7 +31,7 @@ export class Sy04 {
30
31
  <div class="d-flex align-items-center justify-content-center h-100 gap-2">
31
32
  <!--手機版選單-->
32
33
  <div
33
- class="d-flex d-lg-none align-items-center justify-content-center"
34
+ class="${PdClass.isShoppingPage() ? `d-none` : `d-flex d-lg-none`} align-items-center justify-content-center"
34
35
  style="width:40px !important;height:40px !important;"
35
36
  onclick="${gvc.event(() => {
36
37
  gvc.glitter.setDrawer(gvc.bindView(() => {
@@ -105,7 +106,7 @@ export class Sy04 {
105
106
  const vm = {
106
107
  data: [],
107
108
  };
108
- ApiUser.getPublicConfig('menu-setting', 'manager', window.appName).then(res => {
109
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', window.appName).then(res => {
109
110
  vm.data = res.response.value[Language.getLanguage()];
110
111
  gvc.notifyDataChange(id);
111
112
  });
@@ -123,6 +124,9 @@ export class Sy04 {
123
124
  loop(vm.data);
124
125
  }
125
126
  function loopItems(data, show_border) {
127
+ if (PdClass.isShoppingPage()) {
128
+ return ``;
129
+ }
126
130
  return data
127
131
  .map((dd) => {
128
132
  var _a, _b, _c, _d, _e;
@@ -251,7 +255,7 @@ background: ${(_a = colors.bgr) !== null && _a !== void 0 ? _a : '#000'};overflo
251
255
  const vm = {
252
256
  data: [],
253
257
  };
254
- ApiUser.getPublicConfig('menu-setting', 'manager', window.appName).then(res => {
258
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', window.appName).then(res => {
255
259
  vm.data = res.response.value[Language.getLanguage()];
256
260
  gvc.notifyDataChange(id);
257
261
  });
@@ -259,6 +263,9 @@ background: ${(_a = colors.bgr) !== null && _a !== void 0 ? _a : '#000'};overflo
259
263
  bind: id,
260
264
  view: () => {
261
265
  function loopItems(data) {
266
+ if (PdClass.isShoppingPage()) {
267
+ return ``;
268
+ }
262
269
  return data
263
270
  .map((dd) => {
264
271
  var _a, _b;
@@ -347,6 +354,9 @@ padding-bottom: 2px;
347
354
  bind: vm.id,
348
355
  view: () => {
349
356
  var _a, _b;
357
+ if (PdClass.isShoppingPage()) {
358
+ return ``;
359
+ }
350
360
  if (!vm.toggle) {
351
361
  return html `<i
352
362
  class="fa-regular fa-magnifying-glass"
@@ -9,6 +9,7 @@ import { LanguageView } from '../public/language-view.js';
9
9
  import { HeaderClass } from './header-class.js';
10
10
  import { HeadInitial } from './head-initial.js';
11
11
  import { HeaderMobile } from './header-mobile.js';
12
+ import { PdClass } from '../product/pd-class.js';
12
13
 
13
14
  const html = String.raw;
14
15
 
@@ -33,7 +34,7 @@ export class Sy04 {
33
34
  <div class="d-flex align-items-center justify-content-center h-100 gap-2">
34
35
  <!--手機版選單-->
35
36
  <div
36
- class="d-flex d-lg-none align-items-center justify-content-center"
37
+ class="${PdClass.isShoppingPage() ? `d-none`:`d-flex d-lg-none`} align-items-center justify-content-center"
37
38
  style="width:40px !important;height:40px !important;"
38
39
  onclick="${gvc.event(() => {
39
40
  gvc.glitter.setDrawer(
@@ -107,7 +108,7 @@ export class Sy04 {
107
108
  const vm = {
108
109
  data: [],
109
110
  };
110
- ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then(
111
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', (window as any).appName).then(
111
112
  res => {
112
113
  vm.data = res.response.value[Language.getLanguage()];
113
114
 
@@ -129,6 +130,9 @@ export class Sy04 {
129
130
  }
130
131
 
131
132
  function loopItems(data: any, show_border: boolean) {
133
+ if(PdClass.isShoppingPage()){
134
+ return ``
135
+ }
132
136
  return data
133
137
  .map((dd: any) => {
134
138
  return html`
@@ -258,7 +262,7 @@ background: ${colors.bgr ?? '#000'};overflow-x: hidden;`,
258
262
  const vm = {
259
263
  data: [],
260
264
  };
261
- ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then(res => {
265
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', (window as any).appName).then(res => {
262
266
  vm.data = res.response.value[Language.getLanguage()];
263
267
  gvc.notifyDataChange(id);
264
268
  });
@@ -266,6 +270,9 @@ background: ${colors.bgr ?? '#000'};overflow-x: hidden;`,
266
270
  bind: id,
267
271
  view: () => {
268
272
  function loopItems(data: any) {
273
+ if(PdClass.isShoppingPage()){
274
+ return ``
275
+ }
269
276
  return data
270
277
  .map((dd: any) => {
271
278
  return html` <li class="nav-item dropdown">
@@ -353,6 +360,9 @@ padding-bottom: 2px;
353
360
  return {
354
361
  bind: vm.id,
355
362
  view: () => {
363
+ if(PdClass.isShoppingPage()){
364
+ return ``
365
+ }
356
366
  if (!vm.toggle) {
357
367
  return html`<i
358
368
  class="fa-regular fa-magnifying-glass"
@@ -4,6 +4,7 @@ import { LanguageView } from "../public/language-view.js";
4
4
  import { Color } from "../public/color.js";
5
5
  import { HeadInitial } from './head-initial.js';
6
6
  import { HeaderMobile } from './header-mobile.js';
7
+ import { PdClass } from '../product/pd-class.js';
7
8
  const html = String.raw;
8
9
  export class Sy05 {
9
10
  static main(gvc, widget, subData) {
@@ -27,7 +28,7 @@ export class Sy05 {
27
28
  <div class="d-flex align-items-center justify-content-center h-100 w-100 gap-2">
28
29
  <!--手機版選單-->
29
30
  <div
30
- class="d-flex align-items-center justify-content-center"
31
+ class="${PdClass.isShoppingPage() ? `d-none` : `d-flex d-lg-none`} align-items-center justify-content-center"
31
32
  style="width:40px !important;height:40px !important;"
32
33
  onclick="${gvc.event(() => {
33
34
  gvc.glitter.setDrawer(gvc.bindView(() => {
@@ -78,7 +79,7 @@ export class Sy05 {
78
79
  const vm = {
79
80
  data: [],
80
81
  };
81
- ApiUser.getPublicConfig('menu-setting', 'manager', window.appName).then((res) => {
82
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', window.appName).then((res) => {
82
83
  vm.data = res.response.value[Language.getLanguage()];
83
84
  gvc.notifyDataChange(id);
84
85
  });
@@ -96,6 +97,9 @@ export class Sy05 {
96
97
  loop(vm.data);
97
98
  }
98
99
  function loopItems(data, show_border) {
100
+ if (PdClass.isShoppingPage()) {
101
+ return ``;
102
+ }
99
103
  return data
100
104
  .map((dd) => {
101
105
  var _a, _b, _c, _d, _e;
@@ -198,7 +202,7 @@ background: ${(_a = widget.formData.theme_color['background']) !== null && _a !=
198
202
  const vm = {
199
203
  data: [],
200
204
  };
201
- ApiUser.getPublicConfig('menu-setting', 'manager', window.appName).then((res) => {
205
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', window.appName).then((res) => {
202
206
  vm.data = res.response.value[Language.getLanguage()];
203
207
  gvc.notifyDataChange(id);
204
208
  });
@@ -206,6 +210,9 @@ background: ${(_a = widget.formData.theme_color['background']) !== null && _a !=
206
210
  bind: id,
207
211
  view: () => {
208
212
  function loopItems(data) {
213
+ if (PdClass.isShoppingPage()) {
214
+ return ``;
215
+ }
209
216
  return data
210
217
  .map((dd) => {
211
218
  var _a, _b;
@@ -9,6 +9,7 @@ import { HeaderClass } from './header-class.js';
9
9
  import { getCheckoutCount } from '../../official_event/e-commerce/get-count.js';
10
10
  import { GlobalUser } from '../../glitter-base/global/global-user.js';
11
11
  import { HeaderMobile } from './header-mobile.js';
12
+ import { PdClass } from '../product/pd-class.js';
12
13
 
13
14
  const html = String.raw;
14
15
 
@@ -34,7 +35,7 @@ export class Sy05 {
34
35
  <div class="d-flex align-items-center justify-content-center h-100 w-100 gap-2">
35
36
  <!--手機版選單-->
36
37
  <div
37
- class="d-flex align-items-center justify-content-center"
38
+ class="${PdClass.isShoppingPage() ? `d-none`:`d-flex d-lg-none`} align-items-center justify-content-center"
38
39
  style="width:40px !important;height:40px !important;"
39
40
  onclick="${gvc.event(() => {
40
41
  gvc.glitter.setDrawer(
@@ -85,7 +86,7 @@ export class Sy05 {
85
86
  const vm = {
86
87
  data: [],
87
88
  };
88
- ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then((res) => {
89
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', (window as any).appName).then((res) => {
89
90
  vm.data = res.response.value[Language.getLanguage()];
90
91
  gvc.notifyDataChange(id);
91
92
  });
@@ -104,6 +105,9 @@ export class Sy05 {
104
105
  }
105
106
 
106
107
  function loopItems(data: any, show_border: boolean) {
108
+ if(PdClass.isShoppingPage()){
109
+ return ``
110
+ }
107
111
  return data
108
112
  .map((dd: any) => {
109
113
  return html`
@@ -208,7 +212,7 @@ background: ${widget.formData.theme_color['background'] ?? '#000'};overflow-x: h
208
212
  const vm = {
209
213
  data: [],
210
214
  };
211
- ApiUser.getPublicConfig('menu-setting', 'manager', (window as any).appName).then((res) => {
215
+ ApiUser.getPublicConfig(widget.formData.menu_refer || 'menu-setting', 'manager', (window as any).appName).then((res) => {
212
216
  vm.data = res.response.value[Language.getLanguage()];
213
217
  gvc.notifyDataChange(id);
214
218
  });
@@ -216,6 +220,9 @@ background: ${widget.formData.theme_color['background'] ?? '#000'};overflow-x: h
216
220
  bind: id,
217
221
  view: () => {
218
222
  function loopItems(data: any) {
223
+ if(PdClass.isShoppingPage()){
224
+ return ``
225
+ }
219
226
  return data
220
227
  .map((dd: any) => {
221
228
  return html` <li class="nav-item dropdown">
@@ -154,7 +154,17 @@ export class ProductCard01 {
154
154
  return html ` <div
155
155
  class="card mb-7 card-border"
156
156
  onclick="${gvc.event(() => {
157
- PdClass.changePage(prod, gvc);
157
+ if (PdClass.isShoppingPage()) {
158
+ PdClass.addCartAction({
159
+ gvc: gvc,
160
+ titleFontColor: titleFontColor,
161
+ prod: prod,
162
+ vm: vm,
163
+ });
164
+ }
165
+ else {
166
+ PdClass.changePage(prod, gvc);
167
+ }
158
168
  })}"
159
169
  >
160
170
  <div
@@ -172,7 +172,16 @@ export class ProductCard01 {
172
172
  return html` <div
173
173
  class="card mb-7 card-border"
174
174
  onclick="${gvc.event(() => {
175
- PdClass.changePage(prod, gvc);
175
+ if(PdClass.isShoppingPage()){
176
+ PdClass.addCartAction({
177
+ gvc: gvc,
178
+ titleFontColor: titleFontColor,
179
+ prod: prod,
180
+ vm: vm,
181
+ })
182
+ }else{
183
+ PdClass.changePage(prod, gvc)
184
+ }
176
185
  })}"
177
186
  >
178
187
  <div
@@ -142,7 +142,19 @@ export class ProductCard02 {
142
142
  return html `<div
143
143
  class="card mb-7 card-border"
144
144
  style="cursor: pointer"
145
- onclick="${gvc.event(() => PdClass.changePage(prod, gvc))}"
145
+ onclick="${gvc.event(() => {
146
+ if (PdClass.isShoppingPage()) {
147
+ PdClass.addCartAction({
148
+ gvc: gvc,
149
+ titleFontColor: titleFontColor,
150
+ prod: prod,
151
+ vm: vm,
152
+ });
153
+ }
154
+ else {
155
+ PdClass.changePage(prod, gvc);
156
+ }
157
+ })}"
146
158
  >
147
159
  <div
148
160
  class="card-img-top parent card-image position-relative"
@@ -161,7 +161,18 @@ export class ProductCard02 {
161
161
  return html`<div
162
162
  class="card mb-7 card-border"
163
163
  style="cursor: pointer"
164
- onclick="${gvc.event(() => PdClass.changePage(prod, gvc))}"
164
+ onclick="${gvc.event(() => {
165
+ if(PdClass.isShoppingPage()){
166
+ PdClass.addCartAction({
167
+ gvc: gvc,
168
+ titleFontColor: titleFontColor,
169
+ prod: prod,
170
+ vm: vm,
171
+ })
172
+ }else{
173
+ PdClass.changePage(prod, gvc)
174
+ }
175
+ })}"
165
176
  >
166
177
  <div
167
178
  class="card-img-top parent card-image position-relative"
@@ -148,7 +148,19 @@ export class ProductCard03 {
148
148
  return html ` <div
149
149
  class="card mb-7 card-border"
150
150
  style="cursor: pointer"
151
- onclick="${gvc.event(() => PdClass.changePage(prod, gvc))}"
151
+ onclick="${gvc.event(() => {
152
+ if (PdClass.isShoppingPage()) {
153
+ PdClass.addCartAction({
154
+ gvc: gvc,
155
+ titleFontColor: titleFontColor,
156
+ prod: prod,
157
+ vm: vm,
158
+ });
159
+ }
160
+ else {
161
+ PdClass.changePage(prod, gvc);
162
+ }
163
+ })}"
152
164
  >
153
165
  <div
154
166
  class="card-img-top parent card-image position-relative"
@@ -166,7 +166,18 @@ export class ProductCard03 {
166
166
  return html` <div
167
167
  class="card mb-7 card-border"
168
168
  style="cursor: pointer"
169
- onclick="${gvc.event(() => PdClass.changePage(prod, gvc))}"
169
+ onclick="${gvc.event(() => {
170
+ if(PdClass.isShoppingPage()){
171
+ PdClass.addCartAction({
172
+ gvc: gvc,
173
+ titleFontColor: titleFontColor,
174
+ prod: prod,
175
+ vm: vm,
176
+ })
177
+ }else{
178
+ PdClass.changePage(prod, gvc)
179
+ }
180
+ })}"
170
181
  >
171
182
  <div
172
183
  class="card-img-top parent card-image position-relative"
@@ -410,6 +410,12 @@ export class PdClass {
410
410
  };
411
411
  });
412
412
  }
413
+ static isShoppingPage() {
414
+ const glitter = window.glitter;
415
+ return ['hidden/', 'shop/'].find((dd) => {
416
+ return (glitter.getUrlParameter('page') || '').startsWith(dd) || ((glitter.getUrlParameter('page_refer') || '').startsWith(dd));
417
+ }) || glitter.share.is_shop;
418
+ }
413
419
  static changePage(prod, gvc) {
414
420
  const glitter = gvc.glitter;
415
421
  let path = '';
@@ -961,8 +967,8 @@ export class PdClass {
961
967
  }));
962
968
  }
963
969
  viewMap.push(html `<button
964
- class="add-cart-btn fw-bold fs-sm"
965
- style=" flex: 1;height:44px;"
970
+ class="${PdClass.isShoppingPage() ? `add-cart-imd-btn` : `add-cart-btn`} fw-bold fs-sm"
971
+ style="flex: 1;height:44px;"
966
972
  onclick="${gvc.event(() => {
967
973
  if (document.body.clientWidth < 800) {
968
974
  this.addProductPopUp(obj, 'addCart', () => refreshAll());
@@ -998,35 +1004,37 @@ export class PdClass {
998
1004
  >
999
1005
  ${isOutOfStock ? Language.text('preorder_item') : Language.text('add_to_cart')}
1000
1006
  </button>`);
1001
- viewMap.push(html `<button
1007
+ if (!PdClass.isShoppingPage()) {
1008
+ viewMap.push(html `<button
1002
1009
  class="add-cart-imd-btn fw-bold fs-sm"
1003
1010
  style="cursor: pointer; flex: 1;height:44px;"
1004
1011
  onclick="${gvc.event(() => {
1005
- if (document.body.clientWidth < 800) {
1006
- this.addProductPopUp(obj, 'buyNow', () => {
1007
- refreshAll();
1012
+ if (document.body.clientWidth < 800) {
1013
+ this.addProductPopUp(obj, 'buyNow', () => {
1014
+ refreshAll();
1015
+ });
1016
+ return;
1017
+ }
1018
+ const buy_it = new ApiCart(ApiCart.buyItNow);
1019
+ buy_it.clearCart();
1020
+ buy_it.addToCart(`${prod.id}`, vm.specs, vm.quantity);
1021
+ ApiCart.toCheckOutPage(ApiCart.buyItNow);
1022
+ gvc.closeDialog();
1023
+ ApiTrack.track({
1024
+ event_name: 'AddToCart',
1025
+ custom_data: {
1026
+ currency: 'TWD',
1027
+ value: variant.sale_price,
1028
+ content_ids: [variant.sku || `${prod.id}-${vm.specs.join('-')}`],
1029
+ content_name: prod.title,
1030
+ content_type: 'product',
1031
+ },
1008
1032
  });
1009
- return;
1010
- }
1011
- const buy_it = new ApiCart(ApiCart.buyItNow);
1012
- buy_it.clearCart();
1013
- buy_it.addToCart(`${prod.id}`, vm.specs, vm.quantity);
1014
- ApiCart.toCheckOutPage(ApiCart.buyItNow);
1015
- gvc.closeDialog();
1016
- ApiTrack.track({
1017
- event_name: 'AddToCart',
1018
- custom_data: {
1019
- currency: 'TWD',
1020
- value: variant.sale_price,
1021
- content_ids: [variant.sku || `${prod.id}-${vm.specs.join('-')}`],
1022
- content_name: prod.title,
1023
- content_type: 'product',
1024
- },
1025
- });
1026
- })}"
1033
+ })}"
1027
1034
  >
1028
1035
  ${Language.text('buy_it_now')}
1029
1036
  </button>`);
1037
+ }
1030
1038
  return viewMap.join('');
1031
1039
  },
1032
1040
  divCreate: {