@fonixtree/magic-design 0.1.71 → 0.1.73
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/es/common/ImagePicker/index.js +27 -16
- package/es/composite-comp/bol/components/Banner/defaultJSON.js +1 -1
- package/es/composite-comp/bol/components/Banner/mobile/index.js +1 -4
- package/es/composite-comp/bol/components/Banner/mobile/index.less +52 -78
- package/es/composite-comp/bol/components/Banner/pc/index.js +1 -4
- package/es/composite-comp/bol/components/Button/index.js +3 -4
- package/es/composite-comp/bol/components/Carousel/mobile/index.js +1 -4
- package/es/composite-comp/bol/components/Carousel/mobile/index.less +81 -100
- package/es/composite-comp/bol/components/Carousel/pc/index.js +1 -4
- package/es/composite-comp/bol/components/ImageGallery/mobile/index.js +1 -4
- package/es/composite-comp/bol/components/ImageGallery/mobile/index.less +15 -22
- package/es/composite-comp/bol/components/ImageGallery/pc/index.js +3 -4
- package/es/composite-comp/bol/components/ImageText/defaultJSON.js +11 -2
- package/es/composite-comp/bol/components/ImageText/mobile/index.js +1 -4
- package/es/composite-comp/bol/components/ImageText/mobile/index.less +233 -292
- package/es/composite-comp/bol/components/ImageText/pc/index.js +3 -4
- package/es/composite-comp/bol/components/Newsletter/index.js +1 -4
- package/es/composite-comp/bol/components/Tag/index.js +3 -4
- package/es/composite-comp/bol/components/Text/index.js +3 -4
- package/es/composite-comp/bol/components/Video/mobile/Layout1/index.js +1 -4
- package/es/composite-comp/bol/components/Video/mobile/Layout1/index.less +21 -27
- package/es/composite-comp/bol/components/Video/mobile/Layout2/index.js +1 -4
- package/es/composite-comp/bol/components/Video/mobile/Layout2/index.less +36 -45
- package/es/composite-comp/bol/components/Video/mobile/Layout3/index.js +1 -4
- package/es/composite-comp/bol/components/Video/mobile/Layout3/index.less +43 -54
- package/es/composite-comp/bol/components/Video/mobile/index.less +2 -3
- package/es/composite-comp/bol/components/Video/pc/Layout1/index.js +1 -4
- package/es/composite-comp/bol/components/Video/pc/Layout2/index.js +1 -4
- package/es/composite-comp/bol/components/Video/pc/Layout3/index.js +1 -4
- package/es/composite-comp/bol/components/Video/pc/Layout4/index.js +1 -4
- package/es/composite-comp/bol/components/Video/pc/Layout5/index.js +1 -4
- package/es/composite-comp/bol/components/Wallet/mobile/index.js +1 -4
- package/es/composite-comp/bol/components/Wallet/mobile/index.less +27 -40
- package/es/composite-comp/bol/components/Wallet/pc/index.js +1 -4
- package/es/composite-comp/bol/config-panels/BannerConfig/BannerConfigGroup/index.js +4 -0
- package/es/composite-comp/bol/config-panels/CarouselConfig/CarouselConfigImageGroup/index.js +1 -1
- package/es/composite-comp/bol/config-panels/ImageGalleryConfig/ImageGalleryConfigImageGroup/index.js +1 -1
- package/es/composite-comp/bol/config-panels/VideoConfig/VideoShareConfig/index.js +12 -2
- package/es/composite-comp/common/config-panels/BackgroundConfig/index.js +12 -2
- package/es/composite-comp/dito/components/FlashDeal/mobile/index.less +83 -97
- package/es/composite-comp/dito/components/MobileNavigation/mobile/index.less +18 -35
- package/es/composite-comp/dito/components/Recommend/mobile/index.less +73 -86
- package/es/composite-comp/dito/components/SearchBar/mobile/index.less +45 -52
- package/es/composite-comp/dito/components/SignBoard/mobile/index.less +76 -80
- package/es/core/Designer/AiImageGenerator/index.js +233 -3
- package/es/core/Designer/AiImageGenerator/index.less +33 -0
- package/es/core/Designer/ChatRobot/components/CopyBtn/index.js +49 -0
- package/es/core/Designer/ChatRobot/components/CopyBtn/index.less +0 -0
- package/es/core/Designer/ChatRobot/index.js +110 -8
- package/es/core/Designer/ChatRobot/index.less +54 -1
- package/es/core/Designer/ChatRobot/markdown.less +1 -0
- package/es/core/Designer/FonixtreeGpt/index.js +299 -0
- package/es/decorator/metaDecorator.js +1 -1
- package/es/locale/en/en.json +1 -0
- package/es/locale/es/es.json +1 -0
- package/es/locale/id/id.json +1 -0
- package/es/meta-comp/config-panels/ImageConfig/index.js +32 -11
- package/es/utils/commonUtil.js +15 -2
- package/lib/common/ImagePicker/index.js +27 -16
- package/lib/composite-comp/bol/components/Banner/defaultJSON.js +1 -1
- package/lib/composite-comp/bol/components/Banner/mobile/index.js +1 -4
- package/lib/composite-comp/bol/components/Banner/mobile/index.less +52 -78
- package/lib/composite-comp/bol/components/Banner/pc/index.js +1 -4
- package/lib/composite-comp/bol/components/Button/index.js +3 -4
- package/lib/composite-comp/bol/components/Carousel/mobile/index.js +1 -4
- package/lib/composite-comp/bol/components/Carousel/mobile/index.less +81 -100
- package/lib/composite-comp/bol/components/Carousel/pc/index.js +1 -4
- package/lib/composite-comp/bol/components/ImageGallery/mobile/index.js +1 -4
- package/lib/composite-comp/bol/components/ImageGallery/mobile/index.less +15 -22
- package/lib/composite-comp/bol/components/ImageGallery/pc/index.js +3 -4
- package/lib/composite-comp/bol/components/ImageText/defaultJSON.js +11 -2
- package/lib/composite-comp/bol/components/ImageText/mobile/index.js +1 -4
- package/lib/composite-comp/bol/components/ImageText/mobile/index.less +233 -292
- package/lib/composite-comp/bol/components/ImageText/pc/index.js +3 -4
- package/lib/composite-comp/bol/components/Newsletter/index.js +1 -4
- package/lib/composite-comp/bol/components/Tag/index.js +3 -4
- package/lib/composite-comp/bol/components/Text/index.js +3 -4
- package/lib/composite-comp/bol/components/Video/mobile/Layout1/index.js +1 -4
- package/lib/composite-comp/bol/components/Video/mobile/Layout1/index.less +21 -27
- package/lib/composite-comp/bol/components/Video/mobile/Layout2/index.js +1 -4
- package/lib/composite-comp/bol/components/Video/mobile/Layout2/index.less +36 -45
- package/lib/composite-comp/bol/components/Video/mobile/Layout3/index.js +1 -4
- package/lib/composite-comp/bol/components/Video/mobile/Layout3/index.less +43 -54
- package/lib/composite-comp/bol/components/Video/mobile/index.less +2 -3
- package/lib/composite-comp/bol/components/Video/pc/Layout1/index.js +1 -4
- package/lib/composite-comp/bol/components/Video/pc/Layout2/index.js +1 -4
- package/lib/composite-comp/bol/components/Video/pc/Layout3/index.js +1 -4
- package/lib/composite-comp/bol/components/Video/pc/Layout4/index.js +1 -4
- package/lib/composite-comp/bol/components/Video/pc/Layout5/index.js +1 -4
- package/lib/composite-comp/bol/components/Wallet/mobile/index.js +1 -4
- package/lib/composite-comp/bol/components/Wallet/mobile/index.less +27 -40
- package/lib/composite-comp/bol/components/Wallet/pc/index.js +1 -4
- package/lib/composite-comp/bol/config-panels/BannerConfig/BannerConfigGroup/index.js +4 -0
- package/lib/composite-comp/bol/config-panels/CarouselConfig/CarouselConfigImageGroup/index.js +1 -1
- package/lib/composite-comp/bol/config-panels/ImageGalleryConfig/ImageGalleryConfigImageGroup/index.js +1 -1
- package/lib/composite-comp/bol/config-panels/VideoConfig/VideoShareConfig/index.js +12 -2
- package/lib/composite-comp/common/config-panels/BackgroundConfig/index.js +12 -2
- package/lib/composite-comp/dito/components/FlashDeal/mobile/index.less +83 -97
- package/lib/composite-comp/dito/components/MobileNavigation/mobile/index.less +18 -35
- package/lib/composite-comp/dito/components/Recommend/mobile/index.less +73 -86
- package/lib/composite-comp/dito/components/SearchBar/mobile/index.less +45 -52
- package/lib/composite-comp/dito/components/SignBoard/mobile/index.less +76 -80
- package/lib/core/Designer/AiImageGenerator/index.js +233 -3
- package/lib/core/Designer/AiImageGenerator/index.less +33 -0
- package/lib/core/Designer/ChatRobot/components/CopyBtn/index.js +49 -0
- package/lib/core/Designer/ChatRobot/components/CopyBtn/index.less +0 -0
- package/lib/core/Designer/ChatRobot/index.js +110 -8
- package/lib/core/Designer/ChatRobot/index.less +54 -1
- package/lib/core/Designer/ChatRobot/markdown.less +1 -0
- package/lib/core/Designer/FonixtreeGpt/index.js +299 -0
- package/lib/decorator/metaDecorator.js +1 -1
- package/lib/locale/en/en.json +1 -0
- package/lib/locale/es/es.json +1 -0
- package/lib/locale/id/id.json +1 -0
- package/lib/meta-comp/config-panels/ImageConfig/index.js +32 -11
- package/lib/utils/commonUtil.js +15 -2
- package/package.json +2 -1
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _uuid = require("uuid");
|
|
9
|
+
|
|
10
|
+
var _commonUtil = require("../../../utils/commonUtil");
|
|
11
|
+
|
|
12
|
+
var _storeUtil = require("../../../utils/storeUtil");
|
|
13
|
+
|
|
14
|
+
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) {
|
|
16
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
17
|
+
resolve(value);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
22
|
+
function fulfilled(value) {
|
|
23
|
+
try {
|
|
24
|
+
step(generator.next(value));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function rejected(value) {
|
|
31
|
+
try {
|
|
32
|
+
step(generator["throw"](value));
|
|
33
|
+
} catch (e) {
|
|
34
|
+
reject(e);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function step(result) {
|
|
39
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
|
|
47
|
+
var _ = {
|
|
48
|
+
label: 0,
|
|
49
|
+
sent: function sent() {
|
|
50
|
+
if (t[0] & 1) throw t[1];
|
|
51
|
+
return t[1];
|
|
52
|
+
},
|
|
53
|
+
trys: [],
|
|
54
|
+
ops: []
|
|
55
|
+
},
|
|
56
|
+
f,
|
|
57
|
+
y,
|
|
58
|
+
t,
|
|
59
|
+
g;
|
|
60
|
+
return g = {
|
|
61
|
+
next: verb(0),
|
|
62
|
+
"throw": verb(1),
|
|
63
|
+
"return": verb(2)
|
|
64
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
65
|
+
return this;
|
|
66
|
+
}), g;
|
|
67
|
+
|
|
68
|
+
function verb(n) {
|
|
69
|
+
return function (v) {
|
|
70
|
+
return step([n, v]);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function step(op) {
|
|
75
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
76
|
+
|
|
77
|
+
while (_) {
|
|
78
|
+
try {
|
|
79
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
80
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
81
|
+
|
|
82
|
+
switch (op[0]) {
|
|
83
|
+
case 0:
|
|
84
|
+
case 1:
|
|
85
|
+
t = op;
|
|
86
|
+
break;
|
|
87
|
+
|
|
88
|
+
case 4:
|
|
89
|
+
_.label++;
|
|
90
|
+
return {
|
|
91
|
+
value: op[1],
|
|
92
|
+
done: false
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
case 5:
|
|
96
|
+
_.label++;
|
|
97
|
+
y = op[1];
|
|
98
|
+
op = [0];
|
|
99
|
+
continue;
|
|
100
|
+
|
|
101
|
+
case 7:
|
|
102
|
+
op = _.ops.pop();
|
|
103
|
+
|
|
104
|
+
_.trys.pop();
|
|
105
|
+
|
|
106
|
+
continue;
|
|
107
|
+
|
|
108
|
+
default:
|
|
109
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
110
|
+
_ = 0;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
115
|
+
_.label = op[1];
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
120
|
+
_.label = t[1];
|
|
121
|
+
t = op;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (t && _.label < t[2]) {
|
|
126
|
+
_.label = t[2];
|
|
127
|
+
|
|
128
|
+
_.ops.push(op);
|
|
129
|
+
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (t[2]) _.ops.pop();
|
|
134
|
+
|
|
135
|
+
_.trys.pop();
|
|
136
|
+
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
op = body.call(thisArg, _);
|
|
141
|
+
} catch (e) {
|
|
142
|
+
op = [6, e];
|
|
143
|
+
y = 0;
|
|
144
|
+
} finally {
|
|
145
|
+
f = t = 0;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (op[0] & 5) throw op[1];
|
|
150
|
+
return {
|
|
151
|
+
value: op[0] ? op[1] : void 0,
|
|
152
|
+
done: true
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// 角色
|
|
158
|
+
var roleMap = {
|
|
159
|
+
ASSISTANT: 'assistant',
|
|
160
|
+
USER: 'user'
|
|
161
|
+
}; // 上下文缓存key
|
|
162
|
+
|
|
163
|
+
var catchKey = 'fonixtree_chat_context';
|
|
164
|
+
|
|
165
|
+
var FonixtreeGpt =
|
|
166
|
+
/** @class */
|
|
167
|
+
function () {
|
|
168
|
+
function FonixtreeGpt(params) {
|
|
169
|
+
var _this = this; // 客户端标识
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
this.clientId = ''; // 是否正在生成
|
|
173
|
+
|
|
174
|
+
this.isGenerating = false; // 初始化参数
|
|
175
|
+
|
|
176
|
+
this.initParams = {}; // 初始化
|
|
177
|
+
|
|
178
|
+
this.initChatGpt = function () {
|
|
179
|
+
var _a = _this.initParams,
|
|
180
|
+
onMessage = _a.onMessage,
|
|
181
|
+
onEnd = _a.onEnd;
|
|
182
|
+
var text = '';
|
|
183
|
+
var sse;
|
|
184
|
+
_this.clientId = (0, _uuid.v4)();
|
|
185
|
+
var eventSource = new EventSource("/designer/v1/ai/sse/create?clientId=" + _this.clientId);
|
|
186
|
+
|
|
187
|
+
eventSource.onopen = function (event) {
|
|
188
|
+
sse = event.target;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
eventSource.onmessage = function (event) {
|
|
192
|
+
if (event.data == '[DONE]') {
|
|
193
|
+
_this.isGenerating = false;
|
|
194
|
+
|
|
195
|
+
_this.insertMessage2Context(text, roleMap.ASSISTANT);
|
|
196
|
+
|
|
197
|
+
text = '';
|
|
198
|
+
onEnd();
|
|
199
|
+
|
|
200
|
+
if (sse) {
|
|
201
|
+
sse.close();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
var jsonData = JSON.parse(event.data); // 没有数据
|
|
208
|
+
|
|
209
|
+
if (!jsonData.choices.length) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
text += jsonData.choices[0].delta.content || '';
|
|
214
|
+
onMessage(text);
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
eventSource.onerror = function (event) {
|
|
218
|
+
console.log('onerror', event);
|
|
219
|
+
};
|
|
220
|
+
}; // 获取chat上下文
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
this.getContext = function () {
|
|
224
|
+
var messages = (0, _storeUtil.getSessionStore)(catchKey) || [];
|
|
225
|
+
return messages;
|
|
226
|
+
}; // 消息插入上下文中
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
this.insertMessage2Context = function (message, role) {
|
|
230
|
+
if (role === void 0) {
|
|
231
|
+
role = roleMap.USER;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
var messages = (0, _storeUtil.getSessionStore)(catchKey) || [];
|
|
235
|
+
messages.push({
|
|
236
|
+
content: message,
|
|
237
|
+
role: role
|
|
238
|
+
});
|
|
239
|
+
(0, _storeUtil.setSessionStore)(catchKey, messages);
|
|
240
|
+
}; // 发送消息
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
this.sendMessage = function (message) {
|
|
244
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
245
|
+
var messages;
|
|
246
|
+
return __generator(this, function (_a) {
|
|
247
|
+
if (!message) {
|
|
248
|
+
return [2
|
|
249
|
+
/*return*/
|
|
250
|
+
];
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
this.isGenerating = true;
|
|
254
|
+
this.insertMessage2Context(message);
|
|
255
|
+
messages = this.getContext();
|
|
256
|
+
(0, _commonUtil.commonFetch)('/designer/v1/ai/stream-chat-completion', {
|
|
257
|
+
clientId: this.clientId,
|
|
258
|
+
messages: messages
|
|
259
|
+
}, 'POST');
|
|
260
|
+
this.initChatGpt();
|
|
261
|
+
return [2
|
|
262
|
+
/*return*/
|
|
263
|
+
];
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
}; // 重新生成
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
this.regenerate = function () {
|
|
270
|
+
var messages = (0, _storeUtil.getSessionStore)(catchKey) || [];
|
|
271
|
+
|
|
272
|
+
if (!messages.length) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (!_this.isGenerating) {
|
|
277
|
+
// 清空上下文中的最后一次答案
|
|
278
|
+
messages.pop();
|
|
279
|
+
(0, _storeUtil.setSessionStore)(catchKey, messages);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
(0, _commonUtil.commonFetch)('/designer/v1/ai/stream-chat-completion', {
|
|
283
|
+
clientId: _this.clientId,
|
|
284
|
+
messages: messages
|
|
285
|
+
}, 'POST');
|
|
286
|
+
|
|
287
|
+
_this.initChatGpt();
|
|
288
|
+
}; // setSessionStore(catchKey, []);
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
this.clientId = (0, _uuid.v4)();
|
|
292
|
+
this.initParams = params;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return FonixtreeGpt;
|
|
296
|
+
}();
|
|
297
|
+
|
|
298
|
+
var _default = FonixtreeGpt;
|
|
299
|
+
exports["default"] = _default;
|
package/es/locale/en/en.json
CHANGED
package/es/locale/es/es.json
CHANGED
package/es/locale/id/id.json
CHANGED
|
@@ -205,7 +205,7 @@ function (_super) {
|
|
|
205
205
|
_this.onClick = function (event) {// console.log(event);
|
|
206
206
|
};
|
|
207
207
|
|
|
208
|
-
_this.getImg = function (v) {
|
|
208
|
+
_this.getImg = function (v, way) {
|
|
209
209
|
return __awaiter(_this, void 0, void 0, function () {
|
|
210
210
|
var data, _scale, pcImg, h5Img;
|
|
211
211
|
|
|
@@ -214,6 +214,9 @@ function (_super) {
|
|
|
214
214
|
case 0:
|
|
215
215
|
data = this.props.data;
|
|
216
216
|
_scale = 1;
|
|
217
|
+
if (!v) return [3
|
|
218
|
+
/*break*/
|
|
219
|
+
, 6];
|
|
217
220
|
if (!(0, _coreUtil.isPc)()) return [3
|
|
218
221
|
/*break*/
|
|
219
222
|
, 3];
|
|
@@ -267,6 +270,10 @@ function (_super) {
|
|
|
267
270
|
_a.label = 6;
|
|
268
271
|
|
|
269
272
|
case 6:
|
|
273
|
+
if (way) {
|
|
274
|
+
data.content.imageSelectedWay = way;
|
|
275
|
+
}
|
|
276
|
+
|
|
270
277
|
this.selfRender();
|
|
271
278
|
return [2
|
|
272
279
|
/*return*/
|
|
@@ -276,17 +283,23 @@ function (_super) {
|
|
|
276
283
|
});
|
|
277
284
|
};
|
|
278
285
|
|
|
279
|
-
_this.getImgHoverUrl = function (v) {
|
|
286
|
+
_this.getImgHoverUrl = function (v, way) {
|
|
280
287
|
var data = _this.props.data;
|
|
281
288
|
|
|
282
|
-
if (
|
|
283
|
-
|
|
289
|
+
if (v) {
|
|
290
|
+
if ((0, _coreUtil.isPc)()) {
|
|
291
|
+
data.hover.pcImgHoverUrl = v.url;
|
|
284
292
|
|
|
285
|
-
|
|
293
|
+
if (!data.hover.h5ImgHoverUrl) {
|
|
294
|
+
data.hover.h5ImgHoverUrl = v.url;
|
|
295
|
+
}
|
|
296
|
+
} else {
|
|
286
297
|
data.hover.h5ImgHoverUrl = v.url;
|
|
287
298
|
}
|
|
288
|
-
}
|
|
289
|
-
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (way) {
|
|
302
|
+
data.hover.imageSelectedWay = way;
|
|
290
303
|
}
|
|
291
304
|
|
|
292
305
|
_this.selfRender();
|
|
@@ -310,8 +323,12 @@ function (_super) {
|
|
|
310
323
|
var selectImg = this.getSelectedImg(data);
|
|
311
324
|
|
|
312
325
|
var ContentSetting = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_common.ImagePicker, {
|
|
313
|
-
|
|
314
|
-
|
|
326
|
+
imageSelectedWay: data.content.imageSelectedWay || {
|
|
327
|
+
pc: '',
|
|
328
|
+
mobile: ''
|
|
329
|
+
},
|
|
330
|
+
onChange: function onChange(v, way) {
|
|
331
|
+
_this.getImg(v, way);
|
|
315
332
|
},
|
|
316
333
|
value: selectImg
|
|
317
334
|
}), needClickArea && selectImg && /*#__PURE__*/_react["default"].createElement(_HotAreaConfig["default"], {
|
|
@@ -364,8 +381,12 @@ function (_super) {
|
|
|
364
381
|
count: data.hover.magnification
|
|
365
382
|
}
|
|
366
383
|
})), data.hover.backgroundType === 'new' && /*#__PURE__*/_react["default"].createElement(_common.ImagePicker, {
|
|
367
|
-
|
|
368
|
-
|
|
384
|
+
imageSelectedWay: data.hover.imageSelectedWay || {
|
|
385
|
+
pc: '',
|
|
386
|
+
mobile: ''
|
|
387
|
+
},
|
|
388
|
+
onChange: function onChange(v, way) {
|
|
389
|
+
return _this.getImgHoverUrl(v, way);
|
|
369
390
|
},
|
|
370
391
|
value: (0, _coreUtil.isPc)() ? data.hover.pcImgHoverUrl : data.hover.h5ImgHoverUrl
|
|
371
392
|
}));
|
package/es/utils/commonUtil.js
CHANGED
|
@@ -14,7 +14,7 @@ exports.copy2ClipBoard = copy2ClipBoard;
|
|
|
14
14
|
exports.covertKey = covertKey;
|
|
15
15
|
exports.dragSource = void 0;
|
|
16
16
|
exports.ensure = ensure;
|
|
17
|
-
exports.getColorRgba = void 0;
|
|
17
|
+
exports.getGAData = exports.getColorRgba = void 0;
|
|
18
18
|
exports.getPageDataMap = getPageDataMap;
|
|
19
19
|
exports.nextTick = exports.navigateTo = exports.importAsync = exports.getUrlParams = void 0;
|
|
20
20
|
exports.pushGA = pushGA;
|
|
@@ -33,6 +33,8 @@ var _uuid = require("uuid");
|
|
|
33
33
|
|
|
34
34
|
var _qs = _interopRequireDefault(require("qs"));
|
|
35
35
|
|
|
36
|
+
var _constants = require("../constants");
|
|
37
|
+
|
|
36
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
37
39
|
|
|
38
40
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
@@ -843,4 +845,15 @@ var compatibleNewPageData = function compatibleNewPageData(pageData) {
|
|
|
843
845
|
}
|
|
844
846
|
};
|
|
845
847
|
|
|
846
|
-
exports.compatibleNewPageData = compatibleNewPageData;
|
|
848
|
+
exports.compatibleNewPageData = compatibleNewPageData;
|
|
849
|
+
|
|
850
|
+
var getGAData = function getGAData(data) {
|
|
851
|
+
var _a;
|
|
852
|
+
|
|
853
|
+
return {
|
|
854
|
+
moduleId: data.id,
|
|
855
|
+
moduleName: data.moduleIndex + '.' + ((_a = _constants.compInfoMap[data.type]) === null || _a === void 0 ? void 0 : _a.name)
|
|
856
|
+
};
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
exports.getGAData = getGAData;
|
|
@@ -19,6 +19,8 @@ var _ = require("..");
|
|
|
19
19
|
|
|
20
20
|
var _Iconfont = _interopRequireDefault(require("../Iconfont"));
|
|
21
21
|
|
|
22
|
+
var _coreUtil = require("../../utils/coreUtil");
|
|
23
|
+
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
25
|
|
|
24
26
|
var __extends = void 0 && (void 0).__extends || function () {
|
|
@@ -66,7 +68,6 @@ function (_super) {
|
|
|
66
68
|
|
|
67
69
|
_this.state = {
|
|
68
70
|
visible: false,
|
|
69
|
-
imageWay: 'upload',
|
|
70
71
|
inputVal: ''
|
|
71
72
|
};
|
|
72
73
|
|
|
@@ -198,6 +199,21 @@ function (_super) {
|
|
|
198
199
|
}))));
|
|
199
200
|
};
|
|
200
201
|
|
|
202
|
+
_this.changePickerWay = function (way) {
|
|
203
|
+
var tempObj = _this.props.imageSelectedWay;
|
|
204
|
+
|
|
205
|
+
if ((0, _coreUtil.isPc)()) {
|
|
206
|
+
tempObj.pc = way;
|
|
207
|
+
if (!tempObj.mobile) tempObj.mobile = way;
|
|
208
|
+
} else {
|
|
209
|
+
tempObj.mobile = way;
|
|
210
|
+
if (!tempObj.pc) tempObj.pc = way;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
var onChange = _this.props.onChange;
|
|
214
|
+
onChange(null, tempObj);
|
|
215
|
+
};
|
|
216
|
+
|
|
201
217
|
return _this;
|
|
202
218
|
}
|
|
203
219
|
|
|
@@ -218,7 +234,8 @@ function (_super) {
|
|
|
218
234
|
ImagePicker.prototype.render = function () {
|
|
219
235
|
var _this = this;
|
|
220
236
|
|
|
221
|
-
var
|
|
237
|
+
var imageSelectedWay = this.props.imageSelectedWay;
|
|
238
|
+
var way = (0, _coreUtil.isPc)() ? imageSelectedWay.pc : imageSelectedWay.mobile;
|
|
222
239
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
223
240
|
className: "image-picker-wrap"
|
|
224
241
|
}, /*#__PURE__*/_react["default"].createElement(_.Field, {
|
|
@@ -228,31 +245,25 @@ function (_super) {
|
|
|
228
245
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Select, {
|
|
229
246
|
className: "image-picker-select",
|
|
230
247
|
onChange: function onChange(value) {
|
|
231
|
-
_this.
|
|
232
|
-
imageWay: value
|
|
233
|
-
});
|
|
248
|
+
_this.changePickerWay(value);
|
|
234
249
|
},
|
|
235
250
|
size: "large",
|
|
236
|
-
value:
|
|
251
|
+
value: way || 'upload'
|
|
237
252
|
}, selectList.map(function (v) {
|
|
238
253
|
return /*#__PURE__*/_react["default"].createElement(Option, {
|
|
239
254
|
key: v.key,
|
|
240
255
|
value: v.key
|
|
241
256
|
}, v.value);
|
|
242
|
-
})),
|
|
243
|
-
className: "ai-btn"
|
|
244
|
-
}, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
|
|
245
|
-
color: "#2F54EB",
|
|
246
|
-
size: 20,
|
|
247
|
-
type: "icon-ai"
|
|
248
|
-
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
249
|
-
className: "btn-txt"
|
|
250
|
-
}, (0, _locale.i18n)('AI_IMAGE'))))), imageWay === 'upload' ? this.getImagePick() : this.getImageUrl());
|
|
257
|
+
})))), way === 'url' ? this.getImageUrl() : this.getImagePick());
|
|
251
258
|
};
|
|
252
259
|
|
|
253
260
|
ImagePicker.defaultProps = {
|
|
254
261
|
value: '',
|
|
255
|
-
onChange: function onChange() {}
|
|
262
|
+
onChange: function onChange() {},
|
|
263
|
+
imageSelectedWay: {
|
|
264
|
+
pc: '',
|
|
265
|
+
mobile: ''
|
|
266
|
+
}
|
|
256
267
|
};
|
|
257
268
|
return ImagePicker;
|
|
258
269
|
}(_react["default"].Component);
|
|
@@ -182,10 +182,7 @@ function (_super) {
|
|
|
182
182
|
carouseIndex = _a.carouseIndex,
|
|
183
183
|
hoverState = _a.hoverState;
|
|
184
184
|
var autoplay = data.setting.autoplay.open;
|
|
185
|
-
var GAData =
|
|
186
|
-
moduleId: data.id,
|
|
187
|
-
moduleName: data.moduleIndex + '.' + data.type
|
|
188
|
-
};
|
|
185
|
+
var GAData = (0, _commonUtil.getGAData)(data);
|
|
189
186
|
/** 设计器模式下 如果选中特定group 自动播放关闭 */
|
|
190
187
|
|
|
191
188
|
if ((0, _coreUtil.isDesignMode)() && _mobx.store.clickedGroup) {
|