@pisell/private-materials 6.7.1 → 6.7.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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +7 -7
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +2 -2
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +2 -2
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/plus/webPosLogin/WebPosLogin.d.ts +11 -0
- package/es/plus/webPosLogin/WebPosLogin.js +551 -0
- package/es/plus/webPosLogin/WebPosLoginCpt.d.ts +9 -0
- package/es/plus/webPosLogin/WebPosLoginCpt.js +170 -0
- package/es/plus/webPosLogin/WebPosLoginCpt.less +170 -0
- package/es/plus/webPosLogin/components/BrandPanel/index.d.ts +9 -0
- package/es/plus/webPosLogin/components/BrandPanel/index.js +52 -0
- package/es/plus/webPosLogin/components/BrandPanel/index.less +58 -0
- package/es/plus/webPosLogin/components/LoginPanel/index.d.ts +21 -0
- package/es/plus/webPosLogin/components/LoginPanel/index.js +73 -0
- package/es/plus/webPosLogin/components/LoginPanel/index.less +43 -0
- package/es/plus/webPosLogin/components/SelectDevice/index.d.ts +28 -0
- package/es/plus/webPosLogin/components/SelectDevice/index.js +258 -0
- package/es/plus/webPosLogin/components/SelectDevice/index.less +167 -0
- package/es/plus/webPosLogin/components/SelectStore/index.d.ts +24 -0
- package/es/plus/webPosLogin/components/SelectStore/index.js +198 -0
- package/es/plus/webPosLogin/components/SelectStore/index.less +157 -0
- package/es/plus/webPosLogin/components/UserFooter/index.d.ts +28 -0
- package/es/plus/webPosLogin/components/UserFooter/index.js +110 -0
- package/es/plus/webPosLogin/components/UserFooter/index.less +70 -0
- package/es/plus/webPosLogin/index.d.ts +12 -0
- package/es/plus/webPosLogin/index.js +15 -0
- package/es/plus/webPosLogin/locales.d.ts +49 -0
- package/es/plus/webPosLogin/locales.js +57 -0
- package/es/plus/webPosLogin/service.d.ts +44 -0
- package/es/plus/webPosLogin/service.js +198 -0
- package/es/plus/webPosLogin/types.d.ts +286 -0
- package/es/plus/webPosLogin/types.js +1 -0
- package/es/pro/Login2.0/Login2.js +9 -3
- package/es/pro/Login2.0/index.less +0 -12
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/plus/webPosLogin/WebPosLogin.d.ts +11 -0
- package/lib/plus/webPosLogin/WebPosLogin.js +331 -0
- package/lib/plus/webPosLogin/WebPosLoginCpt.d.ts +9 -0
- package/lib/plus/webPosLogin/WebPosLoginCpt.js +170 -0
- package/lib/plus/webPosLogin/WebPosLoginCpt.less +170 -0
- package/lib/plus/webPosLogin/components/BrandPanel/index.d.ts +9 -0
- package/lib/plus/webPosLogin/components/BrandPanel/index.js +63 -0
- package/lib/plus/webPosLogin/components/BrandPanel/index.less +58 -0
- package/lib/plus/webPosLogin/components/LoginPanel/index.d.ts +21 -0
- package/lib/plus/webPosLogin/components/LoginPanel/index.js +98 -0
- package/lib/plus/webPosLogin/components/LoginPanel/index.less +43 -0
- package/lib/plus/webPosLogin/components/SelectDevice/index.d.ts +28 -0
- package/lib/plus/webPosLogin/components/SelectDevice/index.js +158 -0
- package/lib/plus/webPosLogin/components/SelectDevice/index.less +167 -0
- package/lib/plus/webPosLogin/components/SelectStore/index.d.ts +24 -0
- package/lib/plus/webPosLogin/components/SelectStore/index.js +123 -0
- package/lib/plus/webPosLogin/components/SelectStore/index.less +157 -0
- package/lib/plus/webPosLogin/components/UserFooter/index.d.ts +28 -0
- package/lib/plus/webPosLogin/components/UserFooter/index.js +91 -0
- package/lib/plus/webPosLogin/components/UserFooter/index.less +70 -0
- package/lib/plus/webPosLogin/index.d.ts +12 -0
- package/lib/plus/webPosLogin/index.js +56 -0
- package/lib/plus/webPosLogin/locales.d.ts +49 -0
- package/lib/plus/webPosLogin/locales.js +77 -0
- package/lib/plus/webPosLogin/service.d.ts +44 -0
- package/lib/plus/webPosLogin/service.js +94 -0
- package/lib/plus/webPosLogin/types.d.ts +286 -0
- package/lib/plus/webPosLogin/types.js +17 -0
- package/lib/pro/Login2.0/Login2.js +19 -9
- package/lib/pro/Login2.0/index.less +0 -12
- package/lowcode/web-pos-login/meta.ts +71 -0
- package/package.json +4 -4
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/plus/webPosLogin/WebPosLogin.tsx
|
|
30
|
+
var WebPosLogin_exports = {};
|
|
31
|
+
__export(WebPosLogin_exports, {
|
|
32
|
+
default: () => WebPosLogin_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(WebPosLogin_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_materials = require("@pisell/materials");
|
|
37
|
+
var import_utils = require("@pisell/utils");
|
|
38
|
+
var import_WebPosLoginCpt = __toESM(require("./WebPosLoginCpt"));
|
|
39
|
+
var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
|
|
40
|
+
var import_service = require("./service");
|
|
41
|
+
var import_utils2 = require("../../utils");
|
|
42
|
+
var useSearchParams = () => {
|
|
43
|
+
return new URLSearchParams(window.location.search);
|
|
44
|
+
};
|
|
45
|
+
var WebPosLogin = (props) => {
|
|
46
|
+
var _a, _b, _c;
|
|
47
|
+
const context = (0, import_useEngineContext.default)();
|
|
48
|
+
const { getApp = () => ({}), reloadAfterLogin } = (_a = context.appHelper) == null ? void 0 : _a.utils;
|
|
49
|
+
const { backgroundImage, step: propsStep = "login", config } = props;
|
|
50
|
+
const [storeList, setStoreList] = (0, import_react.useState)(() => {
|
|
51
|
+
var _a2;
|
|
52
|
+
const app = getApp();
|
|
53
|
+
const storeList2 = (_a2 = app == null ? void 0 : app.storage) == null ? void 0 : _a2.getStorage("storeList");
|
|
54
|
+
if (!storeList2) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
return JSON.parse(storeList2);
|
|
58
|
+
});
|
|
59
|
+
const urlStep = useSearchParams().get("step");
|
|
60
|
+
const [step, setStep] = (0, import_react.useState)(() => {
|
|
61
|
+
if (urlStep && urlStep !== "undefined") {
|
|
62
|
+
return urlStep;
|
|
63
|
+
}
|
|
64
|
+
return props.step || "login";
|
|
65
|
+
});
|
|
66
|
+
const [userInfo, setUserInfo] = (0, import_react.useState)(() => {
|
|
67
|
+
var _a2;
|
|
68
|
+
const app = getApp();
|
|
69
|
+
const userInfo2 = ((_a2 = app == null ? void 0 : app.storage) == null ? void 0 : _a2.getStorage("userInfo")) || "{}";
|
|
70
|
+
const userInfoObj = JSON.parse(userInfo2);
|
|
71
|
+
return {
|
|
72
|
+
name: (userInfoObj == null ? void 0 : userInfoObj.name) || "",
|
|
73
|
+
avatar: (userInfoObj == null ? void 0 : userInfoObj.avatar) || ""
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
const [selectedStore, setSelectedStore] = (0, import_react.useState)(() => {
|
|
77
|
+
var _a2;
|
|
78
|
+
const app = getApp();
|
|
79
|
+
const selectedStore2 = ((_a2 = app == null ? void 0 : app.storage) == null ? void 0 : _a2.getStorage("selectedStore")) || "{}";
|
|
80
|
+
return JSON.parse(selectedStore2);
|
|
81
|
+
});
|
|
82
|
+
const [deviceList, setDeviceList] = (0, import_react.useState)(() => {
|
|
83
|
+
var _a2;
|
|
84
|
+
const app = getApp();
|
|
85
|
+
const deviceList2 = ((_a2 = app == null ? void 0 : app.storage) == null ? void 0 : _a2.getStorage("deviceList")) || "[]";
|
|
86
|
+
return JSON.parse(deviceList2);
|
|
87
|
+
});
|
|
88
|
+
const [lastUsedStoreId, setLastUsedStoreId] = (0, import_react.useState)(() => {
|
|
89
|
+
var _a2, _b2;
|
|
90
|
+
const app = getApp();
|
|
91
|
+
const lastUsedStore = ((_a2 = app == null ? void 0 : app.storage) == null ? void 0 : _a2.getStorage("selectedStore")) || "{}";
|
|
92
|
+
const lastUsedStoreId2 = ((_b2 = JSON.parse(lastUsedStore)) == null ? void 0 : _b2.id) || 0;
|
|
93
|
+
return parseInt(lastUsedStoreId2);
|
|
94
|
+
});
|
|
95
|
+
const [lastUsedDeviceId, setLastUsedDeviceId] = (0, import_react.useState)(() => {
|
|
96
|
+
var _a2, _b2;
|
|
97
|
+
const app = getApp();
|
|
98
|
+
const lastUsedDevice = ((_a2 = app == null ? void 0 : app.storage) == null ? void 0 : _a2.getStorage("lastUsedDevice")) || "{}";
|
|
99
|
+
const lastUsedDeviceId2 = ((_b2 = JSON.parse(lastUsedDevice)) == null ? void 0 : _b2.id) || 0;
|
|
100
|
+
return parseInt(lastUsedDeviceId2);
|
|
101
|
+
});
|
|
102
|
+
const [isShowGoBack, setIsShowGoBack] = (0, import_react.useState)(true);
|
|
103
|
+
import_utils2.request.setRequest(context.appHelper.utils.request);
|
|
104
|
+
const onLoginSuccess = async (res) => {
|
|
105
|
+
var _a2, _b2, _c2, _d, _e;
|
|
106
|
+
const app = getApp();
|
|
107
|
+
if (!res) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
(_a2 = app == null ? void 0 : app.getPlugin("token")) == null ? void 0 : _a2.set(res == null ? void 0 : res.authorization);
|
|
111
|
+
(_b2 = app == null ? void 0 : app.storage) == null ? void 0 : _b2.setStorage(
|
|
112
|
+
"account",
|
|
113
|
+
JSON.stringify({ ...res == null ? void 0 : res.account, ...res })
|
|
114
|
+
);
|
|
115
|
+
setUserInfo({
|
|
116
|
+
name: ((_c2 = res == null ? void 0 : res.account) == null ? void 0 : _c2.name) || "",
|
|
117
|
+
avatar: ((_d = res == null ? void 0 : res.account) == null ? void 0 : _d.avatar) || ""
|
|
118
|
+
});
|
|
119
|
+
const tenant = await (0, import_service.getTenant)();
|
|
120
|
+
(_e = app == null ? void 0 : app.storage) == null ? void 0 : _e.setStorage("storeList", JSON.stringify(tenant || {}));
|
|
121
|
+
const lastUsedStore = tenant == null ? void 0 : tenant.find((item) => item.id == lastUsedStoreId);
|
|
122
|
+
if ((tenant == null ? void 0 : tenant.length) === 1) {
|
|
123
|
+
await handleStoreSelect(tenant[0], false);
|
|
124
|
+
} else if (lastUsedStore) {
|
|
125
|
+
await handleStoreSelect(lastUsedStore, false);
|
|
126
|
+
} else {
|
|
127
|
+
setStep("store");
|
|
128
|
+
}
|
|
129
|
+
setStoreList(tenant);
|
|
130
|
+
};
|
|
131
|
+
const onBack = () => {
|
|
132
|
+
if (step === "store") {
|
|
133
|
+
setStep("login");
|
|
134
|
+
} else if (step === "device") {
|
|
135
|
+
setStep("store");
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const handleStoreSelect = async (shopInfo, isShowGoBack2 = true) => {
|
|
139
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h;
|
|
140
|
+
const app = getApp();
|
|
141
|
+
app.storage.setStorage("tenant_domain", (_a2 = shopInfo == null ? void 0 : shopInfo.tenant) == null ? void 0 : _a2.default_domain);
|
|
142
|
+
app.storage.setStorage("selectedStore", JSON.stringify(shopInfo));
|
|
143
|
+
setLastUsedStoreId(shopInfo.id);
|
|
144
|
+
setSelectedStore(shopInfo);
|
|
145
|
+
(_b2 = app == null ? void 0 : app.logger) == null ? void 0 : _b2.addLog({
|
|
146
|
+
type: "info",
|
|
147
|
+
title: "选择店铺页-点击店铺",
|
|
148
|
+
metadata: shopInfo || {}
|
|
149
|
+
});
|
|
150
|
+
try {
|
|
151
|
+
const res = await (0, import_service.getTenantDetail)();
|
|
152
|
+
if (!res) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (!((_c2 = res == null ? void 0 : res.mypisell_data) == null ? void 0 : _c2.account_token)) {
|
|
156
|
+
(0, import_materials.PisellToast)({
|
|
157
|
+
content: import_utils.locales.getText("webpos-login-store-data-missing")
|
|
158
|
+
});
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
(_e = app == null ? void 0 : app.getPlugin("token")) == null ? void 0 : _e.set((_d = res == null ? void 0 : res.mypisell_data) == null ? void 0 : _d.account_token, "pisellV1Token");
|
|
162
|
+
if (res.nocobase_tenant_token) {
|
|
163
|
+
(_f = app == null ? void 0 : app.getPlugin("token")) == null ? void 0 : _f.set(res.nocobase_tenant_token, "nocobaseToken");
|
|
164
|
+
}
|
|
165
|
+
await getDeviceListFunction();
|
|
166
|
+
setIsShowGoBack(isShowGoBack2);
|
|
167
|
+
(_g = app == null ? void 0 : app.logger) == null ? void 0 : _g.addLog({
|
|
168
|
+
type: "info",
|
|
169
|
+
title: "选择店铺页-选择店铺成功",
|
|
170
|
+
metadata: res || {}
|
|
171
|
+
});
|
|
172
|
+
} catch (err) {
|
|
173
|
+
(_h = app == null ? void 0 : app.logger) == null ? void 0 : _h.addLog({
|
|
174
|
+
type: "error",
|
|
175
|
+
title: "登录页-选择店铺失败",
|
|
176
|
+
metadata: err || {}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const getDeviceListFunction = async () => {
|
|
181
|
+
var _a2, _b2;
|
|
182
|
+
const app = getApp();
|
|
183
|
+
const type = "terminal";
|
|
184
|
+
const res = await (0, import_service.getDeviceList)({
|
|
185
|
+
type,
|
|
186
|
+
with: ["client"]
|
|
187
|
+
});
|
|
188
|
+
if (!res) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if ((res == null ? void 0 : res.length) > 0) {
|
|
192
|
+
app == null ? void 0 : app.storage.setStorage("deviceList", JSON.stringify(res || []));
|
|
193
|
+
setDeviceList(res);
|
|
194
|
+
setStep("device");
|
|
195
|
+
(_a2 = app == null ? void 0 : app.logger) == null ? void 0 : _a2.addLog({
|
|
196
|
+
type: "info",
|
|
197
|
+
title: "选择店铺页-获取设备列表成功-有云端设备",
|
|
198
|
+
metadata: res || {}
|
|
199
|
+
});
|
|
200
|
+
} else {
|
|
201
|
+
app.storage.setStorage("isLogin", true);
|
|
202
|
+
reloadAfterLogin == null ? void 0 : reloadAfterLogin();
|
|
203
|
+
(_b2 = app == null ? void 0 : app.logger) == null ? void 0 : _b2.addLog({
|
|
204
|
+
type: "info",
|
|
205
|
+
title: "选择店铺页-获取设备列表成功-没有云端设备",
|
|
206
|
+
metadata: res || {}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
const handleDissociateDevice = async () => {
|
|
211
|
+
var _a2, _b2, _c2, _d, _e;
|
|
212
|
+
const app = getApp();
|
|
213
|
+
const boundCloudDevice = JSON.parse(
|
|
214
|
+
((_a2 = app == null ? void 0 : app.storage) == null ? void 0 : _a2.getStorage("boundCloudDevice")) || "{}"
|
|
215
|
+
);
|
|
216
|
+
if ((boundCloudDevice == null ? void 0 : boundCloudDevice.number) && ((_b2 = boundCloudDevice == null ? void 0 : boundCloudDevice.client) == null ? void 0 : _b2.number)) {
|
|
217
|
+
const res = await (0, import_service.dissociateDevice)({
|
|
218
|
+
number: (_c2 = boundCloudDevice == null ? void 0 : boundCloudDevice.client) == null ? void 0 : _c2.number,
|
|
219
|
+
dissociateDeviceNumber: boundCloudDevice == null ? void 0 : boundCloudDevice.number
|
|
220
|
+
});
|
|
221
|
+
if (!res) {
|
|
222
|
+
(_d = app == null ? void 0 : app.logger) == null ? void 0 : _d.addLog({
|
|
223
|
+
type: "error",
|
|
224
|
+
title: "选择设备页-解除设备绑定失败"
|
|
225
|
+
});
|
|
226
|
+
return false;
|
|
227
|
+
} else {
|
|
228
|
+
(_e = app == null ? void 0 : app.logger) == null ? void 0 : _e.addLog({
|
|
229
|
+
type: "info",
|
|
230
|
+
title: "选择设备页-解除设备绑定成功",
|
|
231
|
+
metadata: res || {}
|
|
232
|
+
});
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return true;
|
|
237
|
+
};
|
|
238
|
+
const handleDeviceSelect = async (device) => {
|
|
239
|
+
var _a2, _b2, _c2, _d, _e;
|
|
240
|
+
const app = getApp();
|
|
241
|
+
app.storage.setStorage("lastUsedDevice", JSON.stringify(device));
|
|
242
|
+
setLastUsedDeviceId(device.id);
|
|
243
|
+
const deviceNumber = device == null ? void 0 : device.number;
|
|
244
|
+
const language = ((_a2 = app == null ? void 0 : app.locales) == null ? void 0 : _a2.getLocale()) || "en";
|
|
245
|
+
let _device = null;
|
|
246
|
+
try {
|
|
247
|
+
const _deviceOrigin = await app.plugins.get("device").getDeviceInfo({ language });
|
|
248
|
+
_device = (_deviceOrigin == null ? void 0 : _deviceOrigin.data) || null;
|
|
249
|
+
app == null ? void 0 : app.storage.setStorage("localDevice", JSON.stringify(_device || {}));
|
|
250
|
+
} catch (error) {
|
|
251
|
+
(_b2 = app == null ? void 0 : app.logger) == null ? void 0 : _b2.addLog({
|
|
252
|
+
type: "error",
|
|
253
|
+
title: "选择设备页-获取本机设备信息获取失败"
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
if (!_device) {
|
|
257
|
+
(_c2 = app == null ? void 0 : app.logger) == null ? void 0 : _c2.addLog({
|
|
258
|
+
type: "error",
|
|
259
|
+
title: "选择设备页-绑定设备失败-本机设备信息获取失败"
|
|
260
|
+
});
|
|
261
|
+
return;
|
|
262
|
+
} else {
|
|
263
|
+
(_d = app == null ? void 0 : app.logger) == null ? void 0 : _d.addLog({
|
|
264
|
+
type: "info",
|
|
265
|
+
title: "选择设备页-绑定设备-本机设备信息获取成功",
|
|
266
|
+
metadata: _device || {}
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
const dissociateRes = await handleDissociateDevice();
|
|
270
|
+
if (!dissociateRes) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
const res = await (0, import_service.selectDevice)({
|
|
274
|
+
deviceNumber,
|
|
275
|
+
..._device || {}
|
|
276
|
+
});
|
|
277
|
+
if (!res) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
app.storage.setStorage("loginStatus", "success");
|
|
281
|
+
app.storage.setStorage("isLogin", true);
|
|
282
|
+
reloadAfterLogin == null ? void 0 : reloadAfterLogin();
|
|
283
|
+
app == null ? void 0 : app.storage.setStorage("boundCloudDevice", JSON.stringify(res || {}));
|
|
284
|
+
app.pubsub.publish("dataManager", {
|
|
285
|
+
type: "get",
|
|
286
|
+
key: "DEVICE_NUMBER",
|
|
287
|
+
metadata: { msg: "webpo主动推送" }
|
|
288
|
+
});
|
|
289
|
+
(_e = app == null ? void 0 : app.logger) == null ? void 0 : _e.addLog({
|
|
290
|
+
type: "info",
|
|
291
|
+
title: "选择设备页-绑定设备成功",
|
|
292
|
+
metadata: res || {}
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
const handleChangeAccount = () => {
|
|
296
|
+
setStep("login");
|
|
297
|
+
};
|
|
298
|
+
const handleChangeStore = () => {
|
|
299
|
+
setStep("store");
|
|
300
|
+
};
|
|
301
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
302
|
+
import_WebPosLoginCpt.default,
|
|
303
|
+
{
|
|
304
|
+
loginConfig: config,
|
|
305
|
+
backgroundImage,
|
|
306
|
+
brandConfig: {
|
|
307
|
+
carouselItems: [{
|
|
308
|
+
type: "image",
|
|
309
|
+
url: "https://static.pisellcdn.com/defaultLogo.png"
|
|
310
|
+
}]
|
|
311
|
+
},
|
|
312
|
+
step,
|
|
313
|
+
showBackButton: isShowGoBack,
|
|
314
|
+
storeList,
|
|
315
|
+
deviceList,
|
|
316
|
+
userInfo,
|
|
317
|
+
selectedStore,
|
|
318
|
+
lastUsedStoreId,
|
|
319
|
+
lastUsedDeviceId,
|
|
320
|
+
locale: ((_c = (_b = context == null ? void 0 : context.engine) == null ? void 0 : _b.props) == null ? void 0 : _c.locale) || "en",
|
|
321
|
+
loading: false,
|
|
322
|
+
onStoreSelect: handleStoreSelect,
|
|
323
|
+
onDeviceSelect: handleDeviceSelect,
|
|
324
|
+
onChangeAccount: handleChangeAccount,
|
|
325
|
+
onChangeStore: handleChangeStore,
|
|
326
|
+
onBack,
|
|
327
|
+
onLoginSuccess
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
};
|
|
331
|
+
var WebPosLogin_default = WebPosLogin;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WebPosLoginCptProps } from './types';
|
|
3
|
+
import './WebPosLoginCpt.less';
|
|
4
|
+
/**
|
|
5
|
+
* WebPosLoginCpt 主组件
|
|
6
|
+
* @description WebPOS 登录流程组件,包含登录、店铺选择、设备选择三个步骤
|
|
7
|
+
*/
|
|
8
|
+
declare const WebPosLoginCpt: React.FC<WebPosLoginCptProps>;
|
|
9
|
+
export default WebPosLoginCpt;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/plus/webPosLogin/WebPosLoginCpt.tsx
|
|
30
|
+
var WebPosLoginCpt_exports = {};
|
|
31
|
+
__export(WebPosLoginCpt_exports, {
|
|
32
|
+
default: () => WebPosLoginCpt_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(WebPosLoginCpt_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_utils = require("@pisell/utils");
|
|
37
|
+
var import_locales = __toESM(require("./locales"));
|
|
38
|
+
var import_BrandPanel = __toESM(require("./components/BrandPanel"));
|
|
39
|
+
var import_LoginPanel = __toESM(require("./components/LoginPanel"));
|
|
40
|
+
var import_SelectStore = __toESM(require("./components/SelectStore"));
|
|
41
|
+
var import_SelectDevice = __toESM(require("./components/SelectDevice"));
|
|
42
|
+
var import_UserFooter = __toESM(require("./components/UserFooter"));
|
|
43
|
+
var import_WebPosLoginCpt = require("./WebPosLoginCpt.less");
|
|
44
|
+
var DEFAULT_BACKGROUND = "http://static.pisellcdn.com/defaultBg.png";
|
|
45
|
+
var WebPosLoginCpt = (0, import_react.memo)((props) => {
|
|
46
|
+
const {
|
|
47
|
+
className = "",
|
|
48
|
+
style,
|
|
49
|
+
loginConfig,
|
|
50
|
+
backgroundImage,
|
|
51
|
+
brandConfig,
|
|
52
|
+
step = "login",
|
|
53
|
+
showBackButton = true,
|
|
54
|
+
storeList = [],
|
|
55
|
+
deviceList = [],
|
|
56
|
+
userInfo,
|
|
57
|
+
selectedStore,
|
|
58
|
+
lastUsedStoreId,
|
|
59
|
+
lastUsedDeviceId,
|
|
60
|
+
locale = "en",
|
|
61
|
+
loading = false,
|
|
62
|
+
onStoreSelect,
|
|
63
|
+
onDeviceSelect,
|
|
64
|
+
onChangeAccount,
|
|
65
|
+
onChangeStore,
|
|
66
|
+
onBack,
|
|
67
|
+
onLoginSuccess
|
|
68
|
+
} = props;
|
|
69
|
+
console.log(props, onLoginSuccess, "onLoginSuccess");
|
|
70
|
+
import_utils.locales.init(import_locales.default, locale);
|
|
71
|
+
const stepTitle = (0, import_react.useMemo)(() => {
|
|
72
|
+
const titles = {
|
|
73
|
+
login: "",
|
|
74
|
+
store: import_utils.locales.getText("webpos-login-select-store-title"),
|
|
75
|
+
device: import_utils.locales.getText("webpos-login-select-device-title")
|
|
76
|
+
};
|
|
77
|
+
return titles[step];
|
|
78
|
+
}, [step, locale]);
|
|
79
|
+
const shouldShowBackButton = (0, import_react.useMemo)(() => {
|
|
80
|
+
if (step === "login") return false;
|
|
81
|
+
return showBackButton;
|
|
82
|
+
}, [step, showBackButton]);
|
|
83
|
+
const renderRightContent = () => {
|
|
84
|
+
switch (step) {
|
|
85
|
+
case "login":
|
|
86
|
+
return /* @__PURE__ */ import_react.default.createElement(import_LoginPanel.default, { onLoginSuccess, config: loginConfig });
|
|
87
|
+
case "store":
|
|
88
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
89
|
+
import_SelectStore.default,
|
|
90
|
+
{
|
|
91
|
+
storeList,
|
|
92
|
+
locale,
|
|
93
|
+
loading,
|
|
94
|
+
lastUsedStoreId,
|
|
95
|
+
onSelect: onStoreSelect
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
case "device":
|
|
99
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
100
|
+
import_SelectDevice.default,
|
|
101
|
+
{
|
|
102
|
+
deviceList,
|
|
103
|
+
locale,
|
|
104
|
+
loading,
|
|
105
|
+
lastUsedDeviceId,
|
|
106
|
+
onSelect: onDeviceSelect
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
default:
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const renderFooter = () => {
|
|
114
|
+
if (step === "login") return null;
|
|
115
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
116
|
+
import_UserFooter.default,
|
|
117
|
+
{
|
|
118
|
+
isShowChangeStore: storeList.length > 1,
|
|
119
|
+
userInfo,
|
|
120
|
+
selectedStore,
|
|
121
|
+
step,
|
|
122
|
+
locale,
|
|
123
|
+
onChangeAccount,
|
|
124
|
+
onChangeStore
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
className: `webpos-login ${className}`.trim(),
|
|
132
|
+
style: {
|
|
133
|
+
...style,
|
|
134
|
+
backgroundImage: `url(${backgroundImage || DEFAULT_BACKGROUND})`
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "webpos-login__backdrop" }),
|
|
138
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "webpos-login__card" }, /* @__PURE__ */ import_react.default.createElement(import_BrandPanel.default, { config: brandConfig }), /* @__PURE__ */ import_react.default.createElement("div", { className: "webpos-login__right-panel" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "webpos-login__header" }, shouldShowBackButton && /* @__PURE__ */ import_react.default.createElement(
|
|
139
|
+
"button",
|
|
140
|
+
{
|
|
141
|
+
className: "webpos-login__back-btn",
|
|
142
|
+
onClick: onBack,
|
|
143
|
+
type: "button",
|
|
144
|
+
"aria-label": import_utils.locales.getText("webpos-login-back")
|
|
145
|
+
},
|
|
146
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
147
|
+
"svg",
|
|
148
|
+
{
|
|
149
|
+
width: "24",
|
|
150
|
+
height: "24",
|
|
151
|
+
viewBox: "0 0 24 24",
|
|
152
|
+
fill: "none",
|
|
153
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
154
|
+
},
|
|
155
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
156
|
+
"path",
|
|
157
|
+
{
|
|
158
|
+
d: "M15 18L9 12L15 6",
|
|
159
|
+
stroke: "currentColor",
|
|
160
|
+
strokeWidth: "2",
|
|
161
|
+
strokeLinecap: "round",
|
|
162
|
+
strokeLinejoin: "round"
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
)
|
|
166
|
+
), stepTitle && /* @__PURE__ */ import_react.default.createElement("h1", { className: "webpos-login__title" }, stepTitle)), /* @__PURE__ */ import_react.default.createElement("div", { className: "webpos-login__content" }, renderRightContent()), /* @__PURE__ */ import_react.default.createElement("div", { className: "webpos-login__footer" }, renderFooter())))
|
|
167
|
+
);
|
|
168
|
+
});
|
|
169
|
+
WebPosLoginCpt.displayName = "WebPosLoginCpt";
|
|
170
|
+
var WebPosLoginCpt_default = WebPosLoginCpt;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebPosLogin 主组件样式
|
|
3
|
+
*/
|
|
4
|
+
.webpos-login {
|
|
5
|
+
position: relative;
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
background-size: cover;
|
|
12
|
+
background-position: center;
|
|
13
|
+
background-repeat: no-repeat;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
|
|
16
|
+
/* 背景模糊遮罩层 */
|
|
17
|
+
&__backdrop {
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 0;
|
|
20
|
+
left: 0;
|
|
21
|
+
right: 0;
|
|
22
|
+
bottom: 0;
|
|
23
|
+
background: inherit;
|
|
24
|
+
background-size: inherit;
|
|
25
|
+
background-position: inherit;
|
|
26
|
+
filter: blur(20px);
|
|
27
|
+
transform: scale(1.1); /* 放大以避免边缘模糊不完整 */
|
|
28
|
+
z-index: 0;
|
|
29
|
+
|
|
30
|
+
/* 添加暗色遮罩增强对比 */
|
|
31
|
+
&::after {
|
|
32
|
+
content: '';
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: 0;
|
|
35
|
+
left: 0;
|
|
36
|
+
right: 0;
|
|
37
|
+
bottom: 0;
|
|
38
|
+
background: rgba(0, 0, 0, 0.3);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* 主内容卡片 */
|
|
43
|
+
&__card {
|
|
44
|
+
position: relative;
|
|
45
|
+
display: flex;
|
|
46
|
+
width: 83%;
|
|
47
|
+
max-width: 1600px;
|
|
48
|
+
min-height: 620px;
|
|
49
|
+
max-height: 700px;
|
|
50
|
+
background: #fff;
|
|
51
|
+
border-radius: 24px;
|
|
52
|
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
z-index: 1;
|
|
55
|
+
height: 81%;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* 右侧交互区 */
|
|
59
|
+
&__right-panel {
|
|
60
|
+
flex: 1;
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
min-width: 400px;
|
|
64
|
+
padding: 32px 40px;
|
|
65
|
+
background: #fafafa;
|
|
66
|
+
border-radius: 0 24px 24px 0;
|
|
67
|
+
height: 100%;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* 头部区域 */
|
|
71
|
+
&__header {
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
gap: 16px;
|
|
75
|
+
min-height: 40px;
|
|
76
|
+
margin-bottom: 24px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* 返回按钮 */
|
|
80
|
+
&__back-btn {
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
width: 40px;
|
|
85
|
+
height: 40px;
|
|
86
|
+
padding: 0;
|
|
87
|
+
background: transparent;
|
|
88
|
+
border: none;
|
|
89
|
+
border-radius: 8px;
|
|
90
|
+
color: #333;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
transition: all 0.2s ease;
|
|
93
|
+
|
|
94
|
+
&:hover {
|
|
95
|
+
background: rgba(0, 0, 0, 0.05);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&:active {
|
|
99
|
+
background: rgba(0, 0, 0, 0.1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* 步骤标题 */
|
|
104
|
+
&__title {
|
|
105
|
+
flex: 1;
|
|
106
|
+
margin: 0;
|
|
107
|
+
font-size: 20px;
|
|
108
|
+
font-weight: 600;
|
|
109
|
+
color: #1a1a1a;
|
|
110
|
+
text-align: center;
|
|
111
|
+
padding-right: 56px; /* 平衡返回按钮的宽度,使标题居中 */
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* 内容区 */
|
|
115
|
+
&__content {
|
|
116
|
+
flex: 1;
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
overflow: hidden;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* 底部用户信息区域 */
|
|
123
|
+
&__footer {
|
|
124
|
+
margin-top: auto;
|
|
125
|
+
padding-top: 16px;
|
|
126
|
+
border-top: 1px solid #eee;
|
|
127
|
+
|
|
128
|
+
&:empty {
|
|
129
|
+
display: none;
|
|
130
|
+
padding: 0;
|
|
131
|
+
border: none;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* 响应式适配 */
|
|
137
|
+
@media screen and (max-width: 1024px) {
|
|
138
|
+
.webpos-login {
|
|
139
|
+
&__card {
|
|
140
|
+
width: 83%;
|
|
141
|
+
min-height: 550px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&__right-panel {
|
|
145
|
+
padding: 24px 28px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&__title {
|
|
149
|
+
font-size: 18px;
|
|
150
|
+
padding-right: 48px;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* 小屏幕适配 */
|
|
156
|
+
@media screen and (max-width: 768px) {
|
|
157
|
+
.webpos-login {
|
|
158
|
+
&__card {
|
|
159
|
+
flex-direction: column;
|
|
160
|
+
width: 95%;
|
|
161
|
+
min-height: auto;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&__right-panel {
|
|
165
|
+
min-width: auto;
|
|
166
|
+
border-radius: 0 0 24px 24px;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BrandPanelProps } from '../../types';
|
|
3
|
+
import './index.less';
|
|
4
|
+
/**
|
|
5
|
+
* BrandPanel 品牌区组件
|
|
6
|
+
* @description 登录页面左侧品牌展示区域,支持轮播图片/视频(预留),当前仅展示 Logo
|
|
7
|
+
*/
|
|
8
|
+
declare const BrandPanel: React.FC<BrandPanelProps>;
|
|
9
|
+
export default BrandPanel;
|