cloudcc-cli 2.2.2 → 2.2.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/template/Appvue CHANGED
@@ -1,25 +1,465 @@
1
1
  <template>
2
- <div class="cc-container">
3
- <div>hello World</div>
2
+ <div class="welcome-container">
3
+ <!-- 渐变背景线条 -->
4
+ <div class="bg-lines">
5
+ <div class="line line-1"></div>
6
+ <div class="line line-2"></div>
7
+ <div class="line line-3"></div>
8
+ </div>
9
+
10
+ <!-- 主要内容 -->
11
+ <div class="welcome-content">
12
+ <div class="header">
13
+ <div class="logo-mark"></div>
14
+ <span class="tag">Welcome</span>
15
+ </div>
16
+
17
+ <div class="title-section">
18
+ <h1 class="main-title">{{ mainTitle }}</h1>
19
+ <div class="title-underline"></div>
20
+ </div>
21
+
22
+ <p class="description">{{ description }}</p>
23
+
24
+ <div class="stats">
25
+ <div class="stat-item" v-for="(stat, index) in stats" :key="index">
26
+ <div class="stat-number">{{ stat.number }}</div>
27
+ <div class="stat-label">{{ stat.label }}</div>
28
+ </div>
29
+ </div>
30
+
31
+ <button class="cta-button" @click="handleClick">
32
+ <span class="button-text">探索更多</span>
33
+ <span class="button-arrow">→</span>
34
+ </button>
35
+ </div>
36
+
37
+ <!-- 装饰线 -->
38
+ <div class="decorative-line"></div>
4
39
  </div>
5
40
  </template>
6
41
 
7
42
  <script>
8
- export default {
9
- name: "App",
10
- };
43
+ export default {
44
+ name: "App",
45
+ data() {
46
+ return {
47
+ mainTitle: "CloudCC开发者,您好",
48
+ description: "开发文档:https://dev-help.cloudcc.cn/",
49
+ stats: [
50
+ { number: "∞", label: "可能性" },
51
+ { number: "⚡", label: "高效开发" },
52
+ { number: "🚀", label: "快速上手" },
53
+ ],
54
+ };
55
+ },
56
+ methods: {
57
+ handleClick() {
58
+ console.log("探索开始");
59
+ },
60
+ },
61
+ };
11
62
  </script>
12
63
 
13
64
  <style lang="scss" scoped>
14
- html body {
15
- padding: 0;
16
- margin: 0;
17
- height: 100vh;
65
+ * {
66
+ margin: 0;
67
+ padding: 0;
68
+ box-sizing: border-box;
69
+ }
70
+
71
+ .welcome-container {
72
+ position: relative;
73
+ width: 100%;
74
+ height: 100vh;
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: center;
78
+ overflow: hidden;
79
+ background: #fafafa;
80
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
81
+ "Ubuntu", "Cantarell", sans-serif;
82
+ }
83
+
84
+ // 背景线条
85
+ .bg-lines {
86
+ position: absolute;
87
+ top: 0;
88
+ left: 0;
89
+ width: 100%;
90
+ height: 100%;
91
+ z-index: 0;
92
+ opacity: 0.3;
93
+ }
94
+
95
+ .line {
96
+ position: absolute;
97
+ background: linear-gradient(90deg, transparent, #000, transparent);
98
+ opacity: 0.05;
99
+
100
+ &-1 {
101
+ width: 200%;
102
+ height: 1px;
103
+ top: 20%;
104
+ left: -50%;
105
+ animation: moveLine 8s linear infinite;
106
+ }
107
+
108
+ &-2 {
109
+ width: 200%;
110
+ height: 1px;
111
+ top: 50%;
112
+ right: -50%;
113
+ animation: moveLine 10s linear infinite reverse;
114
+ }
115
+
116
+ &-3 {
117
+ width: 200%;
118
+ height: 1px;
119
+ bottom: 20%;
120
+ left: -50%;
121
+ animation: moveLine 12s linear infinite;
122
+ }
123
+ }
124
+
125
+ @keyframes moveLine {
126
+ 0% {
127
+ transform: translateX(0);
128
+ }
129
+ 100% {
130
+ transform: translateX(50%);
131
+ }
132
+ }
133
+
134
+ // 主要内容
135
+ .welcome-content {
136
+ position: relative;
137
+ z-index: 10;
138
+ max-width: 600px;
139
+ margin: 0 auto;
140
+ padding: 0 40px;
141
+ text-align: center;
142
+ animation: fadeInContent 0.8s ease-out;
143
+ }
144
+
145
+ @keyframes fadeInContent {
146
+ 0% {
147
+ opacity: 0;
148
+ transform: translateY(20px);
149
+ }
150
+ 100% {
151
+ opacity: 1;
152
+ transform: translateY(0);
153
+ }
154
+ }
155
+
156
+ // 头部
157
+ .header {
158
+ display: flex;
159
+ align-items: center;
160
+ justify-content: center;
161
+ gap: 12px;
162
+ margin-bottom: 40px;
163
+ }
164
+
165
+ .logo-mark {
166
+ width: 24px;
167
+ height: 24px;
168
+ border: 2px solid #000;
169
+ border-radius: 4px;
170
+ position: relative;
171
+ animation: logoRotate 2s ease-in-out infinite;
172
+
173
+ &::after {
174
+ content: "";
175
+ position: absolute;
176
+ width: 8px;
177
+ height: 8px;
178
+ background: #000;
179
+ border-radius: 50%;
180
+ top: 50%;
181
+ left: 50%;
182
+ transform: translate(-50%, -50%);
183
+ }
184
+ }
185
+
186
+ @keyframes logoRotate {
187
+ 0%,
188
+ 100% {
189
+ transform: rotate(0deg);
190
+ }
191
+ 50% {
192
+ transform: rotate(90deg);
193
+ }
194
+ }
195
+
196
+ .tag {
197
+ font-size: 12px;
198
+ font-weight: 600;
199
+ letter-spacing: 1.2px;
200
+ color: #666;
201
+ text-transform: uppercase;
202
+ padding: 4px 12px;
203
+ border: 1px solid #ddd;
204
+ border-radius: 20px;
205
+ background: rgba(255, 255, 255, 0.8);
206
+ }
207
+
208
+ // 标题部分
209
+ .title-section {
210
+ margin-bottom: 30px;
211
+ position: relative;
212
+ }
213
+
214
+ .main-title {
215
+ font-size: 48px;
216
+ font-weight: 700;
217
+ line-height: 1.3;
218
+ color: #000;
219
+ margin-bottom: 16px;
220
+ letter-spacing: -0.5px;
221
+ }
222
+
223
+ .title-underline {
224
+ width: 60px;
225
+ height: 3px;
226
+ background: linear-gradient(90deg, #000, transparent);
227
+ margin: 0 auto;
228
+ border-radius: 2px;
229
+ animation: expandWidth 0.8s ease-out 0.3s backwards;
230
+ }
231
+
232
+ @keyframes expandWidth {
233
+ 0% {
234
+ width: 0;
235
+ }
236
+ 100% {
237
+ width: 60px;
238
+ }
239
+ }
240
+
241
+ // 描述文本
242
+ .description {
243
+ font-size: 16px;
244
+ color: #666;
245
+ line-height: 1.6;
246
+ margin-bottom: 50px;
247
+ font-weight: 400;
248
+ letter-spacing: 0.3px;
249
+ }
250
+
251
+ // 统计数据
252
+ .stats {
253
+ display: flex;
254
+ justify-content: center;
255
+ gap: 60px;
256
+ margin-bottom: 50px;
257
+ }
258
+
259
+ .stat-item {
260
+ text-align: center;
261
+ opacity: 0;
262
+ animation: slideInStats 0.6s ease-out forwards;
263
+
264
+ &:nth-child(1) {
265
+ animation-delay: 0.2s;
266
+ }
267
+
268
+ &:nth-child(2) {
269
+ animation-delay: 0.3s;
270
+ }
271
+
272
+ &:nth-child(3) {
273
+ animation-delay: 0.4s;
274
+ }
275
+ }
276
+
277
+ @keyframes slideInStats {
278
+ 0% {
279
+ opacity: 0;
280
+ transform: translateY(10px);
281
+ }
282
+ 100% {
283
+ opacity: 1;
284
+ transform: translateY(0);
285
+ }
286
+ }
287
+
288
+ .stat-number {
289
+ font-size: 28px;
290
+ font-weight: 700;
291
+ color: #000;
292
+ margin-bottom: 4px;
293
+ }
294
+
295
+ .stat-label {
296
+ font-size: 12px;
297
+ color: #999;
298
+ font-weight: 500;
299
+ letter-spacing: 0.5px;
300
+ }
301
+
302
+ // 按钮
303
+ .cta-button {
304
+ padding: 14px 32px;
305
+ font-size: 16px;
306
+ font-weight: 600;
307
+ color: #fff;
308
+ background: #000;
309
+ border: 2px solid #000;
310
+ border-radius: 4px;
311
+ cursor: pointer;
312
+ transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
313
+ display: inline-flex;
314
+ align-items: center;
315
+ gap: 8px;
316
+ position: relative;
317
+ overflow: hidden;
318
+ animation: fadeInUp 0.8s ease-out 0.5s backwards;
319
+
320
+ &::before {
321
+ content: "";
322
+ position: absolute;
323
+ top: 0;
324
+ left: -100%;
325
+ width: 100%;
326
+ height: 100%;
327
+ background: #333;
328
+ z-index: -1;
329
+ transition: left 0.3s ease;
330
+ }
331
+
332
+ &:hover {
333
+ background: #333;
334
+ border-color: #333;
335
+ transform: translateX(4px);
336
+
337
+ .button-arrow {
338
+ animation: arrowMove 0.3s ease;
339
+ }
340
+ }
341
+
342
+ &:active {
343
+ transform: translateX(2px);
344
+ }
345
+ }
346
+
347
+ .button-text {
348
+ position: relative;
349
+ }
350
+
351
+ .button-arrow {
352
+ display: inline-block;
353
+ transition: transform 0.3s ease;
354
+ }
355
+
356
+ @keyframes arrowMove {
357
+ 0%,
358
+ 100% {
359
+ transform: translateX(0);
360
+ }
361
+ 50% {
362
+ transform: translateX(4px);
363
+ }
364
+ }
365
+
366
+ @keyframes fadeInUp {
367
+ 0% {
368
+ opacity: 0;
369
+ transform: translateY(10px);
370
+ }
371
+ 100% {
372
+ opacity: 1;
373
+ transform: translateY(0);
374
+ }
375
+ }
376
+
377
+ // 装饰线
378
+ .decorative-line {
379
+ position: absolute;
380
+ bottom: 40px;
381
+ left: 50%;
382
+ width: 40px;
383
+ height: 2px;
384
+ background: #000;
385
+ transform: translateX(-50%);
386
+ opacity: 0.2;
387
+ animation: pulse 2s ease-in-out infinite;
388
+ }
389
+
390
+ @keyframes pulse {
391
+ 0%,
392
+ 100% {
393
+ opacity: 0.2;
394
+ width: 40px;
395
+ }
396
+ 50% {
397
+ opacity: 0.5;
398
+ width: 50px;
399
+ }
400
+ }
401
+
402
+ // 响应式
403
+ @media (max-width: 768px) {
404
+ .welcome-content {
405
+ padding: 0 30px;
406
+ }
407
+
408
+ .main-title {
409
+ font-size: 36px;
410
+ }
411
+
412
+ .description {
413
+ font-size: 14px;
414
+ margin-bottom: 40px;
415
+ }
416
+
417
+ .stats {
418
+ gap: 40px;
419
+ margin-bottom: 40px;
420
+ }
421
+
422
+ .stat-number {
423
+ font-size: 24px;
424
+ }
425
+
426
+ .cta-button {
427
+ padding: 12px 28px;
428
+ font-size: 14px;
429
+ }
430
+
431
+ .header {
432
+ margin-bottom: 30px;
433
+ }
434
+
435
+ .title-section {
436
+ margin-bottom: 25px;
437
+ }
438
+ }
439
+
440
+ @media (max-width: 480px) {
441
+ .main-title {
442
+ font-size: 28px;
443
+ }
444
+
445
+ .description {
446
+ font-size: 13px;
447
+ }
448
+
449
+ .stats {
450
+ gap: 30px;
451
+ }
452
+
453
+ .stat-number {
454
+ font-size: 20px;
455
+ }
456
+
457
+ .cta-button {
18
458
  width: 100%;
19
459
  }
20
460
 
21
- .cc-container {
22
- text-align: center;
23
- padding: 8px;
461
+ .bg-lines {
462
+ display: none;
24
463
  }
464
+ }
25
465
  </style>
package/utils/utils.js CHANGED
@@ -21,7 +21,12 @@ const formateData = (data, header = { appVersion: "1.0.0" }) => {
21
21
  * @param {object} config 配置参数
22
22
  */
23
23
  async function getBaseUrl(config) {
24
- if (config.baseUrl) {
24
+ // 如果已经有apiSvc和setupSvc则直接返回
25
+ if (config.apiSvc && config.setupSvc) {
26
+ return config;
27
+ }
28
+ // 优先使用baseUrl,其次使用orgId获取
29
+ else if (config.baseUrl) {
25
30
  config.apiSvc = config.baseUrl + (config.apiSvcPrefix || "/apisvc")
26
31
  config.setupSvc = config.baseUrl + (config.setupSvcPrefix || "/setup")
27
32
  } else if (config.orgId) {
@@ -192,17 +197,35 @@ function parseVueDataFunction(vueContent) {
192
197
  // }
193
198
 
194
199
  try {
195
- // 提取 <script> 标签中的内容
196
- const scriptMatch = vueContent.match(/<script[^>]*>([\s\S]*?)<\/script>/);
197
- if (!scriptMatch) {
200
+ // 提取 <script> 标签中的内容,排除带 src 属性的外部脚本
201
+ // 匹配所有 script 标签
202
+ const scriptRegex = /<script([^>]*)>([\s\S]*?)<\/script>/g;
203
+ let scriptContent = null;
204
+ let match;
205
+
206
+ while ((match = scriptRegex.exec(vueContent)) !== null) {
207
+ const attributes = match[1];
208
+ const content = match[2];
209
+
210
+ // 跳过带 src 属性的外部脚本标签
211
+ if (attributes && attributes.includes('src=')) {
212
+ continue;
213
+ }
214
+
215
+ // 查找包含 export default 的 script 标签
216
+ if (content && content.includes('export default')) {
217
+ scriptContent = content;
218
+ break;
219
+ }
220
+ }
221
+
222
+ if (!scriptContent) {
198
223
  console.log()
199
- console.log(chalk.red("Error: Cannot find <script> tag in the vue file."));
224
+ console.log(chalk.red("Error: Cannot find <script> tag with component code in the vue file."));
200
225
  console.log()
201
226
  return null;
202
227
  }
203
228
 
204
- const scriptContent = scriptMatch[1];
205
-
206
229
  // 使用 Babel 解析 JavaScript 代码
207
230
  const ast = babelParser.parse(scriptContent, {
208
231
  sourceType: 'module',
@@ -215,7 +238,7 @@ function parseVueDataFunction(vueContent) {
215
238
  babelTraverse(ast, {
216
239
  ObjectMethod(path) {
217
240
  // 查找名为 data 的方法
218
- if (path.node.key.name === 'data' && path.node.params.length === 0) {
241
+ if (path.node.key && path.node.key.name === 'data' && path.node.params.length === 0) {
219
242
  // 查找 return 语句
220
243
  path.traverse({
221
244
  ReturnStatement(returnPath) {
@@ -231,7 +254,7 @@ function parseVueDataFunction(vueContent) {
231
254
  },
232
255
  // 也处理 data: function() {} 的形式
233
256
  ObjectProperty(path) {
234
- if (path.node.key.name === 'data' &&
257
+ if (path.node.key && path.node.key.name === 'data' &&
235
258
  (path.node.value.type === 'FunctionExpression' || path.node.value.type === 'ArrowFunctionExpression')) {
236
259
  // 查找 return 语句
237
260
  path.traverse({