ts-glitter 13.8.663 → 13.8.665
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 +1 -1
- package/lowcode/Entry.ts +3 -3
- package/lowcode/cms-plugin/module/form-check.js +1 -0
- package/lowcode/cms-plugin/module/form-check.ts +1 -1
- package/lowcode/public-components/product/pd-card-01.js +14 -14
- package/lowcode/public-components/product/pd-card-01.ts +13 -13
- package/lowcode/public-components/product/pd-card-02.js +14 -14
- package/lowcode/public-components/product/pd-card-02.ts +13 -13
- package/lowcode/public-components/product/pd-card-03.js +14 -14
- package/lowcode/public-components/product/pd-card-03.ts +13 -13
- package/lowcode/public-components/user-manager/um-class.js +174 -0
- package/lowcode/public-components/user-manager/um-class.ts +174 -0
- package/lowcode/public-components/user-manager/um-info.js +575 -1
- package/lowcode/public-components/user-manager/um-info.ts +662 -2
- package/lowcode/view-model/saas-view-model.js +375 -202
- package/lowcode/view-model/saas-view-model.ts +836 -655
- package/package.json +1 -1
- package/src/api-public/controllers/ai-chat.js.map +1 -1
- package/src/api-public/services/ai-robot.d.ts +1 -0
- package/src/api-public/services/ai-robot.js.map +1 -1
- package/src/api-public/services/user.js +30 -19
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +31 -20
package/lowcode/Entry.js
CHANGED
|
@@ -64,7 +64,7 @@ export class Entry {
|
|
|
64
64
|
}
|
|
65
65
|
window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
|
|
66
66
|
console.log(`Entry-time:`, window.renderClock.stop());
|
|
67
|
-
glitter.share.editerVersion = 'V_13.8.
|
|
67
|
+
glitter.share.editerVersion = 'V_13.8.665';
|
|
68
68
|
glitter.share.start = new Date();
|
|
69
69
|
const vm = {
|
|
70
70
|
appConfig: [],
|
package/lowcode/Entry.ts
CHANGED
|
@@ -64,7 +64,7 @@ export class Entry {
|
|
|
64
64
|
}
|
|
65
65
|
(window as any).renderClock = (window as any).renderClock ?? clockF();
|
|
66
66
|
console.log(`Entry-time:`, (window as any).renderClock.stop());
|
|
67
|
-
glitter.share.editerVersion = 'V_13.8.
|
|
67
|
+
glitter.share.editerVersion = 'V_13.8.665';
|
|
68
68
|
glitter.share.start = new Date();
|
|
69
69
|
const vm: {
|
|
70
70
|
appConfig: any;
|
|
@@ -215,8 +215,8 @@ export class Entry {
|
|
|
215
215
|
|
|
216
216
|
// 跳轉至頁面編輯器
|
|
217
217
|
public static toBackendEditor(glitter: Glitter, callback: () => void) {
|
|
218
|
-
if(localStorage.getItem('on-pos')==='true'){
|
|
219
|
-
location.href=glitter.root_path+'pos?app-id=t_1725992531001'
|
|
218
|
+
if (localStorage.getItem('on-pos') === 'true') {
|
|
219
|
+
location.href = glitter.root_path + 'pos?app-id=t_1725992531001';
|
|
220
220
|
}
|
|
221
221
|
glitter.addStyle(`
|
|
222
222
|
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap');
|
|
@@ -134,7 +134,18 @@ export class ProductCard01 {
|
|
|
134
134
|
letter-spacing: -0.98px;
|
|
135
135
|
}
|
|
136
136
|
`);
|
|
137
|
-
return html `<div class="card mb-7 card-border"
|
|
137
|
+
return html `<div class="card mb-7 card-border" onclick="${gvc.event(() => {
|
|
138
|
+
let path = '';
|
|
139
|
+
if (!(prod.seo && prod.seo.domain)) {
|
|
140
|
+
glitter.setUrlParameter('product_id', subData.id);
|
|
141
|
+
path = 'products';
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
glitter.setUrlParameter('product_id', undefined);
|
|
145
|
+
path = `products/${prod.seo.domain}`;
|
|
146
|
+
}
|
|
147
|
+
changePage(path, 'page', {});
|
|
148
|
+
})}">
|
|
138
149
|
<div
|
|
139
150
|
class="card-img-top parent card-image"
|
|
140
151
|
style="background-image: url('${(() => {
|
|
@@ -149,18 +160,6 @@ export class ProductCard01 {
|
|
|
149
160
|
}
|
|
150
161
|
return rela_link;
|
|
151
162
|
})()}')"
|
|
152
|
-
onclick="${gvc.event(() => {
|
|
153
|
-
let path = '';
|
|
154
|
-
if (!(prod.seo && prod.seo.domain)) {
|
|
155
|
-
glitter.setUrlParameter('product_id', subData.id);
|
|
156
|
-
path = 'products';
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
glitter.setUrlParameter('product_id', undefined);
|
|
160
|
-
path = `products/${prod.seo.domain}`;
|
|
161
|
-
}
|
|
162
|
-
changePage(path, 'page', {});
|
|
163
|
-
})}"
|
|
164
163
|
>
|
|
165
164
|
<div class="child add-cart-child">
|
|
166
165
|
<div
|
|
@@ -206,7 +205,8 @@ export class ProductCard01 {
|
|
|
206
205
|
</div>
|
|
207
206
|
<div
|
|
208
207
|
class="wishBt wish-button"
|
|
209
|
-
onclick="${gvc.event(() => {
|
|
208
|
+
onclick="${gvc.event((e, event) => {
|
|
209
|
+
event.stopPropagation();
|
|
210
210
|
if (CheckInput.isEmpty(GlobalUser.token)) {
|
|
211
211
|
changePage('login', 'page', {});
|
|
212
212
|
return;
|
|
@@ -138,7 +138,17 @@ export class ProductCard01 {
|
|
|
138
138
|
}
|
|
139
139
|
`);
|
|
140
140
|
|
|
141
|
-
return html`<div class="card mb-7 card-border"
|
|
141
|
+
return html`<div class="card mb-7 card-border" onclick="${gvc.event(() => {
|
|
142
|
+
let path = '';
|
|
143
|
+
if (!(prod.seo && prod.seo.domain)) {
|
|
144
|
+
glitter.setUrlParameter('product_id', subData.id);
|
|
145
|
+
path = 'products';
|
|
146
|
+
} else {
|
|
147
|
+
glitter.setUrlParameter('product_id', undefined);
|
|
148
|
+
path = `products/${prod.seo.domain}`;
|
|
149
|
+
}
|
|
150
|
+
changePage(path, 'page', {});
|
|
151
|
+
})}">
|
|
142
152
|
<div
|
|
143
153
|
class="card-img-top parent card-image"
|
|
144
154
|
style="background-image: url('${(() => {
|
|
@@ -153,17 +163,6 @@ export class ProductCard01 {
|
|
|
153
163
|
}
|
|
154
164
|
return rela_link;
|
|
155
165
|
})()}')"
|
|
156
|
-
onclick="${gvc.event(() => {
|
|
157
|
-
let path = '';
|
|
158
|
-
if (!(prod.seo && prod.seo.domain)) {
|
|
159
|
-
glitter.setUrlParameter('product_id', subData.id);
|
|
160
|
-
path = 'products';
|
|
161
|
-
} else {
|
|
162
|
-
glitter.setUrlParameter('product_id', undefined);
|
|
163
|
-
path = `products/${prod.seo.domain}`;
|
|
164
|
-
}
|
|
165
|
-
changePage(path, 'page', {});
|
|
166
|
-
})}"
|
|
167
166
|
>
|
|
168
167
|
<div class="child add-cart-child">
|
|
169
168
|
<div
|
|
@@ -209,7 +208,8 @@ export class ProductCard01 {
|
|
|
209
208
|
</div>
|
|
210
209
|
<div
|
|
211
210
|
class="wishBt wish-button"
|
|
212
|
-
onclick="${gvc.event(() => {
|
|
211
|
+
onclick="${gvc.event((e,event) => {
|
|
212
|
+
event.stopPropagation()
|
|
213
213
|
if (CheckInput.isEmpty(GlobalUser.token)) {
|
|
214
214
|
changePage('login', 'page', {});
|
|
215
215
|
return;
|
|
@@ -131,7 +131,18 @@ export class ProductCard02 {
|
|
|
131
131
|
letter-spacing: -0.98px;
|
|
132
132
|
}
|
|
133
133
|
`);
|
|
134
|
-
return html `<div class="card mb-7 card-border"
|
|
134
|
+
return html `<div class="card mb-7 card-border" onclick="${gvc.event(() => {
|
|
135
|
+
let path = '';
|
|
136
|
+
if (!(prod.seo && prod.seo.domain)) {
|
|
137
|
+
glitter.setUrlParameter('product_id', subData.id);
|
|
138
|
+
path = 'products';
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
glitter.setUrlParameter('product_id', undefined);
|
|
142
|
+
path = `products/${prod.seo.domain}`;
|
|
143
|
+
}
|
|
144
|
+
changePage(path, 'page', {});
|
|
145
|
+
})}">
|
|
135
146
|
<div
|
|
136
147
|
class="card-img-top parent card-image"
|
|
137
148
|
style="background-image: url('${(() => {
|
|
@@ -146,22 +157,11 @@ export class ProductCard02 {
|
|
|
146
157
|
}
|
|
147
158
|
return rela_link;
|
|
148
159
|
})()}')"
|
|
149
|
-
onclick="${gvc.event(() => {
|
|
150
|
-
let path = '';
|
|
151
|
-
if (!(prod.seo && prod.seo.domain)) {
|
|
152
|
-
glitter.setUrlParameter('product_id', subData.id);
|
|
153
|
-
path = 'products';
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
glitter.setUrlParameter('product_id', undefined);
|
|
157
|
-
path = `products/${prod.seo.domain}`;
|
|
158
|
-
}
|
|
159
|
-
changePage(path, 'page', {});
|
|
160
|
-
})}"
|
|
161
160
|
></div>
|
|
162
161
|
<div
|
|
163
162
|
class="wishBt wish-button"
|
|
164
|
-
onclick="${gvc.event(() => {
|
|
163
|
+
onclick="${gvc.event((e, event) => {
|
|
164
|
+
event.stopPropagation();
|
|
165
165
|
if (CheckInput.isEmpty(GlobalUser.token)) {
|
|
166
166
|
changePage('login', 'page', {});
|
|
167
167
|
return;
|
|
@@ -135,7 +135,17 @@ export class ProductCard02 {
|
|
|
135
135
|
}
|
|
136
136
|
`);
|
|
137
137
|
|
|
138
|
-
return html`<div class="card mb-7 card-border"
|
|
138
|
+
return html`<div class="card mb-7 card-border" onclick="${gvc.event(() => {
|
|
139
|
+
let path = '';
|
|
140
|
+
if (!(prod.seo && prod.seo.domain)) {
|
|
141
|
+
glitter.setUrlParameter('product_id', subData.id);
|
|
142
|
+
path = 'products';
|
|
143
|
+
} else {
|
|
144
|
+
glitter.setUrlParameter('product_id', undefined);
|
|
145
|
+
path = `products/${prod.seo.domain}`;
|
|
146
|
+
}
|
|
147
|
+
changePage(path, 'page', {});
|
|
148
|
+
})}">
|
|
139
149
|
<div
|
|
140
150
|
class="card-img-top parent card-image"
|
|
141
151
|
style="background-image: url('${(() => {
|
|
@@ -150,21 +160,11 @@ export class ProductCard02 {
|
|
|
150
160
|
}
|
|
151
161
|
return rela_link;
|
|
152
162
|
})()}')"
|
|
153
|
-
onclick="${gvc.event(() => {
|
|
154
|
-
let path = '';
|
|
155
|
-
if (!(prod.seo && prod.seo.domain)) {
|
|
156
|
-
glitter.setUrlParameter('product_id', subData.id);
|
|
157
|
-
path = 'products';
|
|
158
|
-
} else {
|
|
159
|
-
glitter.setUrlParameter('product_id', undefined);
|
|
160
|
-
path = `products/${prod.seo.domain}`;
|
|
161
|
-
}
|
|
162
|
-
changePage(path, 'page', {});
|
|
163
|
-
})}"
|
|
164
163
|
></div>
|
|
165
164
|
<div
|
|
166
165
|
class="wishBt wish-button"
|
|
167
|
-
onclick="${gvc.event(() => {
|
|
166
|
+
onclick="${gvc.event((e,event) => {
|
|
167
|
+
event.stopPropagation()
|
|
168
168
|
if (CheckInput.isEmpty(GlobalUser.token)) {
|
|
169
169
|
changePage('login', 'page', {});
|
|
170
170
|
return;
|
|
@@ -138,7 +138,18 @@ export class ProductCard03 {
|
|
|
138
138
|
letter-spacing: -0.98px;
|
|
139
139
|
}
|
|
140
140
|
`);
|
|
141
|
-
return html `<div class="card mb-7 card-border"
|
|
141
|
+
return html `<div class="card mb-7 card-border" onclick="${gvc.event(() => {
|
|
142
|
+
let path = '';
|
|
143
|
+
if (!(prod.seo && prod.seo.domain)) {
|
|
144
|
+
glitter.setUrlParameter('product_id', subData.id);
|
|
145
|
+
path = 'products';
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
glitter.setUrlParameter('product_id', undefined);
|
|
149
|
+
path = `products/${prod.seo.domain}`;
|
|
150
|
+
}
|
|
151
|
+
changePage(path, 'page', {});
|
|
152
|
+
})}">
|
|
142
153
|
<div
|
|
143
154
|
class="card-img-top parent card-image"
|
|
144
155
|
style="background-image: url('${(() => {
|
|
@@ -153,22 +164,11 @@ export class ProductCard03 {
|
|
|
153
164
|
}
|
|
154
165
|
return rela_link;
|
|
155
166
|
})()}')"
|
|
156
|
-
onclick="${gvc.event(() => {
|
|
157
|
-
let path = '';
|
|
158
|
-
if (!(prod.seo && prod.seo.domain)) {
|
|
159
|
-
glitter.setUrlParameter('product_id', subData.id);
|
|
160
|
-
path = 'products';
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
glitter.setUrlParameter('product_id', undefined);
|
|
164
|
-
path = `products/${prod.seo.domain}`;
|
|
165
|
-
}
|
|
166
|
-
changePage(path, 'page', {});
|
|
167
|
-
})}"
|
|
168
167
|
></div>
|
|
169
168
|
<div
|
|
170
169
|
class="wishBt wish-button"
|
|
171
|
-
onclick="${gvc.event(() => {
|
|
170
|
+
onclick="${gvc.event((e, event) => {
|
|
171
|
+
event.stopPropagation();
|
|
172
172
|
if (CheckInput.isEmpty(GlobalUser.token)) {
|
|
173
173
|
changePage('login', 'page', {});
|
|
174
174
|
return;
|
|
@@ -142,7 +142,17 @@ export class ProductCard03 {
|
|
|
142
142
|
}
|
|
143
143
|
`);
|
|
144
144
|
|
|
145
|
-
return html`<div class="card mb-7 card-border"
|
|
145
|
+
return html`<div class="card mb-7 card-border" onclick="${gvc.event(() => {
|
|
146
|
+
let path = '';
|
|
147
|
+
if (!(prod.seo && prod.seo.domain)) {
|
|
148
|
+
glitter.setUrlParameter('product_id', subData.id);
|
|
149
|
+
path = 'products';
|
|
150
|
+
} else {
|
|
151
|
+
glitter.setUrlParameter('product_id', undefined);
|
|
152
|
+
path = `products/${prod.seo.domain}`;
|
|
153
|
+
}
|
|
154
|
+
changePage(path, 'page', {});
|
|
155
|
+
})}">
|
|
146
156
|
<div
|
|
147
157
|
class="card-img-top parent card-image"
|
|
148
158
|
style="background-image: url('${(() => {
|
|
@@ -157,21 +167,11 @@ export class ProductCard03 {
|
|
|
157
167
|
}
|
|
158
168
|
return rela_link;
|
|
159
169
|
})()}')"
|
|
160
|
-
onclick="${gvc.event(() => {
|
|
161
|
-
let path = '';
|
|
162
|
-
if (!(prod.seo && prod.seo.domain)) {
|
|
163
|
-
glitter.setUrlParameter('product_id', subData.id);
|
|
164
|
-
path = 'products';
|
|
165
|
-
} else {
|
|
166
|
-
glitter.setUrlParameter('product_id', undefined);
|
|
167
|
-
path = `products/${prod.seo.domain}`;
|
|
168
|
-
}
|
|
169
|
-
changePage(path, 'page', {});
|
|
170
|
-
})}"
|
|
171
170
|
></div>
|
|
172
171
|
<div
|
|
173
172
|
class="wishBt wish-button"
|
|
174
|
-
onclick="${gvc.event(() => {
|
|
173
|
+
onclick="${gvc.event((e,event) => {
|
|
174
|
+
event.stopPropagation()
|
|
175
175
|
if (CheckInput.isEmpty(GlobalUser.token)) {
|
|
176
176
|
changePage('login', 'page', {});
|
|
177
177
|
return;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { ApiUser } from '../../glitter-base/route/user.js';
|
|
11
|
+
const html = String.raw;
|
|
12
|
+
export class UmClass {
|
|
13
|
+
static nav(gvc) {
|
|
14
|
+
gvc.addStyle(`
|
|
15
|
+
.um-nav-container {
|
|
16
|
+
width: 1000px;
|
|
17
|
+
max-width: 100%;
|
|
18
|
+
}
|
|
19
|
+
.um-nav-title {
|
|
20
|
+
font-weight: 700;
|
|
21
|
+
font-size: 36px;
|
|
22
|
+
color: #292218;
|
|
23
|
+
}
|
|
24
|
+
.um-nav-btn {
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
text-align: center;
|
|
27
|
+
border: 2px solid #232323;
|
|
28
|
+
align-items: center;
|
|
29
|
+
border-radius: 22px;
|
|
30
|
+
height: 44px;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
width: 120px;
|
|
33
|
+
font-size: 16px;
|
|
34
|
+
}
|
|
35
|
+
.um-nav-btn.um-nav-btn-active {
|
|
36
|
+
background: #292218;
|
|
37
|
+
color: #ffffff;
|
|
38
|
+
font-weight: 600;
|
|
39
|
+
}
|
|
40
|
+
.um-nav-mobile-tags-container {
|
|
41
|
+
gap: 10px;
|
|
42
|
+
overflow-x: auto;
|
|
43
|
+
align-items: center;
|
|
44
|
+
}
|
|
45
|
+
@media (max-width: 768px) {
|
|
46
|
+
.um-nav-btn {
|
|
47
|
+
width: 110px;
|
|
48
|
+
font-size: 14px;
|
|
49
|
+
height: 40px;
|
|
50
|
+
}
|
|
51
|
+
.um-nav-title {
|
|
52
|
+
font-size: 30px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`);
|
|
56
|
+
const pageName = gvc.glitter.getUrlParameter('page');
|
|
57
|
+
const buttonHTML = [
|
|
58
|
+
{
|
|
59
|
+
key: 'account_userinfo',
|
|
60
|
+
title: '個人資料',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
key: 'rebate',
|
|
64
|
+
title: '商店購物金',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
key: 'orderlist',
|
|
68
|
+
title: '訂單記錄',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
key: 'wishlist',
|
|
72
|
+
title: '心願單',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
key: 'logout',
|
|
76
|
+
title: '登出',
|
|
77
|
+
},
|
|
78
|
+
]
|
|
79
|
+
.map((item) => {
|
|
80
|
+
return html `
|
|
81
|
+
<div
|
|
82
|
+
class="option px-4 d-flex justify-content-center um-nav-btn ${pageName === item.key ? 'um-nav-btn-active' : ''}"
|
|
83
|
+
onclick="${gvc.event(() => {
|
|
84
|
+
console.log(item.key);
|
|
85
|
+
})}"
|
|
86
|
+
>
|
|
87
|
+
${item.title}
|
|
88
|
+
</div>
|
|
89
|
+
`;
|
|
90
|
+
})
|
|
91
|
+
.join('');
|
|
92
|
+
return html ` <div class="account-section">
|
|
93
|
+
<div class="section-title mb-4 mt-0 pt-lg-3 um-nav-title">我的帳號</div>
|
|
94
|
+
${document.body.clientWidth > 768
|
|
95
|
+
? html `<div class="mx-auto mt-3 um-nav-container">
|
|
96
|
+
<div class="account-options d-flex gap-4">${buttonHTML}</div>
|
|
97
|
+
</div>`
|
|
98
|
+
: html `<div class="account-navigation w-100">
|
|
99
|
+
<nav class="nav-links mb-3 mb-md-0">
|
|
100
|
+
<div class="nav-options d-flex flex-wrap um-nav-mobile-tags-container">${buttonHTML}</div>
|
|
101
|
+
</nav>
|
|
102
|
+
</div>`}
|
|
103
|
+
</div>`;
|
|
104
|
+
}
|
|
105
|
+
static spinner() {
|
|
106
|
+
return html `<div class="d-flex align-items-center justify-content-center flex-column w-100 mx-auto">
|
|
107
|
+
<div class="spinner-border" role="status"></div>
|
|
108
|
+
<span class="mt-3">載入中</span>
|
|
109
|
+
</div>`;
|
|
110
|
+
}
|
|
111
|
+
static dialog(obj) {
|
|
112
|
+
return obj.gvc.glitter.innerDialog((gvc) => {
|
|
113
|
+
var _a;
|
|
114
|
+
return html ` <div
|
|
115
|
+
class="bg-white shadow rounded-3"
|
|
116
|
+
style="overflow-y: auto; ${document.body.clientWidth > 768 ? `min-width: 400px; width: 600px;` : 'min-width: 90vw; max-width: 92.5vw;'}"
|
|
117
|
+
>
|
|
118
|
+
<div class="bg-white shadow rounded-3" style="width: 100%; overflow-y: auto; position: relative;">
|
|
119
|
+
<div class="w-100 d-flex align-items-center p-3 border-bottom" style="position: sticky; top: 0; background: #fff;">
|
|
120
|
+
<div style="font-size: 16px; font-weight: 700; color: #292218;">${(_a = obj.title) !== null && _a !== void 0 ? _a : ''}</div>
|
|
121
|
+
<div class="flex-fill"></div>
|
|
122
|
+
<i
|
|
123
|
+
class="fa-regular fa-circle-xmark fs-5 text-dark"
|
|
124
|
+
style="cursor: pointer"
|
|
125
|
+
onclick="${gvc.event(() => {
|
|
126
|
+
gvc.closeDialog();
|
|
127
|
+
})}"
|
|
128
|
+
></i>
|
|
129
|
+
</div>
|
|
130
|
+
<div class="c_dialog">
|
|
131
|
+
<div class="c_dialog_body">
|
|
132
|
+
<div class="c_dialog_main" style="gap: 24px; height: auto; max-height: 500px; padding: 12px 20px;">${obj.innerHTML}</div>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>`;
|
|
137
|
+
}, obj.tag);
|
|
138
|
+
}
|
|
139
|
+
static getUserData(gvc) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
gvc.glitter.share.GlobalUser.userInfo = undefined;
|
|
143
|
+
gvc.glitter.ut.queue['api-get-user_data'] = undefined;
|
|
144
|
+
if (!gvc.glitter.share.GlobalUser.token) {
|
|
145
|
+
gvc.glitter.share.GlobalUser.token = '';
|
|
146
|
+
resolve(false);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
gvc.glitter.ut.setQueue('api-get-user_data', (callback) => __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
callback(yield ApiUser.getUserData(gvc.glitter.share.GlobalUser.token, 'me'));
|
|
151
|
+
}), (r) => {
|
|
152
|
+
try {
|
|
153
|
+
if (!r.result) {
|
|
154
|
+
gvc.glitter.share.GlobalUser.token = '';
|
|
155
|
+
resolve(false);
|
|
156
|
+
gvc.glitter.ut.queue['api-get-user_data'] = undefined;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
gvc.glitter.share.GlobalUser.userInfo = r.response;
|
|
160
|
+
gvc.glitter.share.GlobalUser.updateUserData = JSON.parse(JSON.stringify(r.response));
|
|
161
|
+
resolve(gvc.glitter.share.GlobalUser.userInfo);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
resolve(false);
|
|
166
|
+
gvc.glitter.ut.queue['api-get-user_data'] = undefined;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
})).then((data) => {
|
|
170
|
+
return data;
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { GVC } from '../../glitterBundle/GVController.js';
|
|
2
|
+
import { ApiUser } from '../../glitter-base/route/user.js';
|
|
3
|
+
|
|
4
|
+
const html = String.raw;
|
|
5
|
+
|
|
6
|
+
export class UmClass {
|
|
7
|
+
static nav(gvc: GVC) {
|
|
8
|
+
gvc.addStyle(`
|
|
9
|
+
.um-nav-container {
|
|
10
|
+
width: 1000px;
|
|
11
|
+
max-width: 100%;
|
|
12
|
+
}
|
|
13
|
+
.um-nav-title {
|
|
14
|
+
font-weight: 700;
|
|
15
|
+
font-size: 36px;
|
|
16
|
+
color: #292218;
|
|
17
|
+
}
|
|
18
|
+
.um-nav-btn {
|
|
19
|
+
white-space: nowrap;
|
|
20
|
+
text-align: center;
|
|
21
|
+
border: 2px solid #232323;
|
|
22
|
+
align-items: center;
|
|
23
|
+
border-radius: 22px;
|
|
24
|
+
height: 44px;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
width: 120px;
|
|
27
|
+
font-size: 16px;
|
|
28
|
+
}
|
|
29
|
+
.um-nav-btn.um-nav-btn-active {
|
|
30
|
+
background: #292218;
|
|
31
|
+
color: #ffffff;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
}
|
|
34
|
+
.um-nav-mobile-tags-container {
|
|
35
|
+
gap: 10px;
|
|
36
|
+
overflow-x: auto;
|
|
37
|
+
align-items: center;
|
|
38
|
+
}
|
|
39
|
+
@media (max-width: 768px) {
|
|
40
|
+
.um-nav-btn {
|
|
41
|
+
width: 110px;
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
height: 40px;
|
|
44
|
+
}
|
|
45
|
+
.um-nav-title {
|
|
46
|
+
font-size: 30px;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
`);
|
|
50
|
+
|
|
51
|
+
const pageName = gvc.glitter.getUrlParameter('page');
|
|
52
|
+
const buttonHTML = [
|
|
53
|
+
{
|
|
54
|
+
key: 'account_userinfo',
|
|
55
|
+
title: '個人資料',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
key: 'rebate',
|
|
59
|
+
title: '商店購物金',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
key: 'orderlist',
|
|
63
|
+
title: '訂單記錄',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: 'wishlist',
|
|
67
|
+
title: '心願單',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: 'logout',
|
|
71
|
+
title: '登出',
|
|
72
|
+
},
|
|
73
|
+
]
|
|
74
|
+
.map((item) => {
|
|
75
|
+
return html`
|
|
76
|
+
<div
|
|
77
|
+
class="option px-4 d-flex justify-content-center um-nav-btn ${pageName === item.key ? 'um-nav-btn-active' : ''}"
|
|
78
|
+
onclick="${gvc.event(() => {
|
|
79
|
+
console.log(item.key);
|
|
80
|
+
})}"
|
|
81
|
+
>
|
|
82
|
+
${item.title}
|
|
83
|
+
</div>
|
|
84
|
+
`;
|
|
85
|
+
})
|
|
86
|
+
.join('');
|
|
87
|
+
|
|
88
|
+
return html` <div class="account-section">
|
|
89
|
+
<div class="section-title mb-4 mt-0 pt-lg-3 um-nav-title">我的帳號</div>
|
|
90
|
+
${document.body.clientWidth > 768
|
|
91
|
+
? html`<div class="mx-auto mt-3 um-nav-container">
|
|
92
|
+
<div class="account-options d-flex gap-4">${buttonHTML}</div>
|
|
93
|
+
</div>`
|
|
94
|
+
: html`<div class="account-navigation w-100">
|
|
95
|
+
<nav class="nav-links mb-3 mb-md-0">
|
|
96
|
+
<div class="nav-options d-flex flex-wrap um-nav-mobile-tags-container">${buttonHTML}</div>
|
|
97
|
+
</nav>
|
|
98
|
+
</div>`}
|
|
99
|
+
</div>`;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static spinner() {
|
|
103
|
+
return html`<div class="d-flex align-items-center justify-content-center flex-column w-100 mx-auto">
|
|
104
|
+
<div class="spinner-border" role="status"></div>
|
|
105
|
+
<span class="mt-3">載入中</span>
|
|
106
|
+
</div>`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
static dialog(obj: { gvc: GVC; tag: string; title?: string; innerHTML: string }) {
|
|
110
|
+
return obj.gvc.glitter.innerDialog((gvc: GVC) => {
|
|
111
|
+
return html` <div
|
|
112
|
+
class="bg-white shadow rounded-3"
|
|
113
|
+
style="overflow-y: auto; ${document.body.clientWidth > 768 ? `min-width: 400px; width: 600px;` : 'min-width: 90vw; max-width: 92.5vw;'}"
|
|
114
|
+
>
|
|
115
|
+
<div class="bg-white shadow rounded-3" style="width: 100%; overflow-y: auto; position: relative;">
|
|
116
|
+
<div class="w-100 d-flex align-items-center p-3 border-bottom" style="position: sticky; top: 0; background: #fff;">
|
|
117
|
+
<div style="font-size: 16px; font-weight: 700; color: #292218;">${obj.title ?? ''}</div>
|
|
118
|
+
<div class="flex-fill"></div>
|
|
119
|
+
<i
|
|
120
|
+
class="fa-regular fa-circle-xmark fs-5 text-dark"
|
|
121
|
+
style="cursor: pointer"
|
|
122
|
+
onclick="${gvc.event(() => {
|
|
123
|
+
gvc.closeDialog();
|
|
124
|
+
})}"
|
|
125
|
+
></i>
|
|
126
|
+
</div>
|
|
127
|
+
<div class="c_dialog">
|
|
128
|
+
<div class="c_dialog_body">
|
|
129
|
+
<div class="c_dialog_main" style="gap: 24px; height: auto; max-height: 500px; padding: 12px 20px;">${obj.innerHTML}</div>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
</div>`;
|
|
134
|
+
}, obj.tag);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
static async getUserData(gvc: GVC) {
|
|
138
|
+
return new Promise(async (resolve, reject) => {
|
|
139
|
+
gvc.glitter.share.GlobalUser.userInfo = undefined;
|
|
140
|
+
(gvc.glitter.ut.queue as any)['api-get-user_data'] = undefined;
|
|
141
|
+
|
|
142
|
+
if (!gvc.glitter.share.GlobalUser.token) {
|
|
143
|
+
gvc.glitter.share.GlobalUser.token = '';
|
|
144
|
+
resolve(false);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
gvc.glitter.ut.setQueue(
|
|
149
|
+
'api-get-user_data',
|
|
150
|
+
async (callback: any) => {
|
|
151
|
+
callback(await ApiUser.getUserData(gvc.glitter.share.GlobalUser.token, 'me'));
|
|
152
|
+
},
|
|
153
|
+
(r: any) => {
|
|
154
|
+
try {
|
|
155
|
+
if (!r.result) {
|
|
156
|
+
gvc.glitter.share.GlobalUser.token = '';
|
|
157
|
+
resolve(false);
|
|
158
|
+
(gvc.glitter.ut.queue as any)['api-get-user_data'] = undefined;
|
|
159
|
+
} else {
|
|
160
|
+
gvc.glitter.share.GlobalUser.userInfo = r.response;
|
|
161
|
+
gvc.glitter.share.GlobalUser.updateUserData = JSON.parse(JSON.stringify(r.response));
|
|
162
|
+
resolve(gvc.glitter.share.GlobalUser.userInfo);
|
|
163
|
+
}
|
|
164
|
+
} catch (e) {
|
|
165
|
+
resolve(false);
|
|
166
|
+
(gvc.glitter.ut.queue as any)['api-get-user_data'] = undefined;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
}).then((data) => {
|
|
171
|
+
return data;
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|