cloudcc-cli 1.2.4 → 1.2.6

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/README.md CHANGED
@@ -1,3 +1,19 @@
1
+ # ReleaseV1.2.6
2
+ #### 发布日期:2022-11-21
3
+ #### 发布范围:全量
4
+ #### 发布内容
5
+ * 迭代
6
+ * 替换组件开发模板
7
+ * 优化
8
+
9
+ # ReleaseV1.2.5
10
+ #### 发布日期:2022-11-17
11
+ #### 发布范围:全量
12
+ #### 发布内容
13
+ * 迭代
14
+ * 编辑组件添加组件参数
15
+ * 优化
16
+
1
17
  # ReleaseV1.2.4
2
18
  #### 发布日期:2022-11-17
3
19
  #### 发布范围:全量
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "cloudcc-cli",
5
5
  "keywords": [
6
6
  "cloudcc",
@@ -1,4 +1,4 @@
1
- const { exec, execSync, spawn, spawnSync } = require('child_process');
1
+ const { exec } = require('child_process');
2
2
  const { post } = require('../utils/http');
3
3
  const fs = require('fs');
4
4
  const path = require("path")
@@ -16,6 +16,7 @@ class Builder {
16
16
  devConsoleConfig: {
17
17
  },
18
18
  }
19
+ this.plugin = process.argv.splice(2)[0]
19
20
  }
20
21
  async init() {
21
22
  let res = await checkUpdate();
@@ -27,7 +28,12 @@ class Builder {
27
28
  config = { "accessToken": await this.getToken(config) };
28
29
  }
29
30
  // 获得用户输入
30
- let answers = await this.ask();
31
+ let answers;
32
+ if (this.plugin) {
33
+ answers = { buildFileName: this.plugin }
34
+ } else {
35
+ answers = await this.ask();
36
+ }
31
37
  // 如果输入的是*.vue,那么表示编译全部文件
32
38
  if ("*.vue" == answers.buildFileName) {
33
39
  let dirs = fs.readdirSync("plugin")
package/template/Appvue CHANGED
@@ -1,26 +1,36 @@
1
1
  <template>
2
- <div id="app">
3
- <cloudcc-input />
2
+ <div class="app">
3
+ <div @click="hello">hello CloudCC</div>
4
+ <Plugin />
4
5
  </div>
5
6
  </template>
6
7
 
7
8
  <script>
8
- import CloudccInput from "../plugin/index.vue";
9
- export default {
10
- name: "App",
11
- components: {
12
- CloudccInput,
13
- },
14
- };
9
+ import Plugin from "../plugin/index.vue";
10
+ export default {
11
+ name: "App",
12
+ components: {
13
+ Plugin,
14
+ },
15
+ methods: {
16
+ hello() {
17
+ this.$CCDK.CCMessage.showMessage("Hello CloudCC");
18
+ },
19
+ },
20
+ };
15
21
  </script>
16
22
 
17
- <style>
18
- #app {
19
- font-family: Avenir, Helvetica, Arial, sans-serif;
20
- -webkit-font-smoothing: antialiased;
21
- -moz-osx-font-smoothing: grayscale;
22
- text-align: center;
23
- color: #2c3e50;
24
- margin-top: 60px;
25
- }
26
- </style>
23
+ <style lang="scss">
24
+ html body {
25
+ padding: 0;
26
+ margin: 0;
27
+ height: 100vh;
28
+ width: 100%;
29
+ }
30
+
31
+ .app {
32
+ margin: auto;
33
+ height: 100px;
34
+ width: 200px;
35
+ }
36
+ </style>
package/template/httpjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import axios from 'axios'
2
2
  import packageJson from '../package.json'
3
- import * as CCDK from "cloudcc-ccdk/lib/ccdk.min.js";
4
3
  const service = axios.create({
5
4
  timeout: 60000, // request timeout
6
5
  headers: {
@@ -11,7 +10,7 @@ const service = axios.create({
11
10
  // request interceptor
12
11
  service.interceptors.request.use(
13
12
  config => {
14
- config.headers.accessToken = CCDK.CCToken.getToken()
13
+ config.headers.accessToken = window.$CCDK.CCToken.getToken()
15
14
  return config
16
15
  },
17
16
  error => {
@@ -39,7 +38,7 @@ const formateData = data => {
39
38
  head: {
40
39
  appType: packageJson.name,
41
40
  appVersion: packageJson.version,
42
- accessToken: CCDK.CCToken.getToken()
41
+ accessToken: window.$CCDK.CCToken.getToken()
43
42
  },
44
43
  body: {
45
44
  ...data
package/template/index.js CHANGED
@@ -44,6 +44,7 @@ module.exports = function (creator, options, callback) {
44
44
 
45
45
  creator.copyTpl('indexhtml', path.join(public, "index.html"))
46
46
 
47
+
47
48
  creator.fs.commit(() => {
48
49
  console.log();
49
50
  console.log(`${chalk.grey(`创建项目: ${name}`)} ${chalk.green('✔ ')}`);
package/template/indexvue CHANGED
@@ -1,20 +1,20 @@
1
1
  <template>
2
- <div class="dev-button" :class="elePropObj.className" @mouseover="myMouseover">
3
- <el-button
4
- v-loading.fullscreen.lock="fullscreenLoading"
5
- element-loading-text="加载中,请稍后..."
6
- :style="`font-size:` + elePropObj.fontSize + `px`"
7
- :type="elePropObj.type"
8
- @click="handleClick"
2
+ <div class="cloudccButton" @mouseover="myMouseover">
3
+ <el-button
4
+ v-loading.fullscreen.lock="fullscreenLoading"
5
+ element-loading-text="loading..."
6
+ :style="`font-size:` + elePropObj.fontSize + `px;` + elePropObj.style"
7
+ :type="elePropObj.type"
8
+ @click="handleClick"
9
9
  >{{ elePropObj.defaultValue }}</el-button
10
- >
11
- </div>
12
- </template>
10
+ >
11
+ </div >
12
+ </template >
13
13
 
14
14
  <script>
15
15
  import axios from "../utils/http";
16
16
  export default {
17
- name: "dev-button",
17
+ name: "my-button",
18
18
  props: {
19
19
  elePropObj: {
20
20
  type: Object,
@@ -22,24 +22,42 @@ export default {
22
22
  },
23
23
  eleEventObj: {
24
24
  type: Object,
25
- default: () => ({}),
26
- }
25
+ default: () => ({
26
+ myCreated: `function created(self) {
27
+ // self即this,本组件的vue实例
28
+ }`,
29
+ myMounted: `function mounted(self) {
30
+ // self即this,本组件的vue实例
31
+ }`,
32
+ myDestroyed: `function destroyed(self) {
33
+ // self即this,本组件的vue实例
34
+ }`,
35
+ myMouseover: `function myMouseover(self) {
36
+ // self即this,本组件的vue实例
37
+ }`,
38
+ }),
39
+ },
40
+ version: {
41
+ type: String,
42
+ default: "",
43
+ },
27
44
  },
28
45
  data() {
29
46
  return {
30
47
  fullscreenLoading: false,
31
48
  componentInfo: {
32
- component: "dev-button",
33
- compName: "按钮-dev",
49
+ component: "my-button",
50
+ // 按钮
51
+ compName: "我的按钮",
34
52
  icon: "#icon-anniu",
35
53
  sort: 1,
36
- bizType: "基础组件",
37
- compDesc: "常用的操作按钮。",
54
+ compDesc: "组件描述信息",
38
55
  /* 组件分类:
39
56
  * private:私有组件(自己组织可见)
40
57
  * beta:组件测试版本
41
58
  */
42
- category: "private",
59
+ category: "private", // public private
60
+ version: "0.0.1",
43
61
  },
44
62
  style: {
45
63
  unit: "px",
@@ -51,69 +69,97 @@ export default {
51
69
  opacity: 1,
52
70
  },
53
71
  styleOption: {
54
- unit: {
55
- lable: "单位",
56
- type: "option",
57
- options: [
58
- {
59
- value: "px",
60
- label: "像素",
61
- },
62
- {
63
- value: "%",
64
- label: "百分比",
65
- },
66
- {
67
- value: "hw",
68
- label: "视口",
69
- },
70
- ],
71
- },
72
- width: {
73
- lable: "宽",
74
- type: "input",
75
- inputType: "number",
76
- },
77
- height: {
78
- lable: "高",
79
- type: "input",
80
- inputType: "number",
72
+ word: {
73
+ lable: "label.help",
74
+ type: "word",
75
+ link: "https://zucfl0psd6.feishu.cn/wiki/wikcnJNCCWZB05fOrvRkBuNQ7re",
76
+ },
77
+ unit: {
78
+ lable: "label.custom.unit",
79
+ type: "option",
80
+ options: [
81
+ {
82
+ value: "px",
83
+ label: "label.custom.pixel",
81
84
  },
82
- top: {
83
- lable: "y 坐标",
84
- type: "input",
85
- inputType: "number",
85
+ {
86
+ value: "%",
87
+ label: "label.percent",
86
88
  },
87
- left: {
88
- lable: "x 坐标",
89
- type: "input",
90
- inputType: "number",
89
+ {
90
+ value: "hw",
91
+ label: "label.custom.viewport",
91
92
  },
93
+ ],
92
94
  },
95
+ width: {
96
+ lable: "label.custom.width",
97
+ type: "input",
98
+ inputType: "number",
99
+ },
100
+ height: {
101
+ lable: "label.custom.height",
102
+ type: "input",
103
+ inputType: "number",
104
+ },
105
+ top: {
106
+ lable: "label.dev.y.coordinate",
107
+ type: "input",
108
+ inputType: "number",
109
+ },
110
+ left: {
111
+ lable: "label.dev.x.coordinate",
112
+ type: "input",
113
+ inputType: "number",
114
+ },
115
+ },
93
116
  propObj: {
94
117
  id: "",
95
118
  pageApi: "createPage",
96
- defaultValue: "按钮-dev",
119
+ defaultValue: "Button",
97
120
  type: "primary",
98
121
  fontSize: 16,
99
122
  functionContent: `function test(conext,value) {
100
- alert(JSON.stringify(value.getObject()))
123
+ let requestParams = {
124
+ className: "TestUpdate", // 类名 string
125
+ methodName: "queryGao", // 方法名 string
126
+ params: [
127
+ {
128
+ "argType": "java.lang.String",
129
+ "argValue": "1111",
130
+ },
131
+ {
132
+ "argType": "java.lang.String",
133
+ "argValue": "2222",
134
+ }
135
+ ], // 请求参数
136
+ };
137
+ return requestParams;
101
138
  }`,
102
139
  handleComponentId: "",
103
140
  axiosAddres: "http://localhost:8080/api/pc/1.0/school/add",
104
- className: "",
141
+ returnBody: `function test(self,res) {
142
+ console.log(res)
143
+ if (res.returnCode == 200 || "1" == res.returnCode) {
144
+ self.$message({
145
+ message: "提交成功",
146
+ type: "success",
147
+ });
148
+ }
149
+ }`,
150
+ style: "",
105
151
  },
106
152
  propOption: {
107
- className: {
108
- lable: "tailwind样式,'cc-'开头,多个空格隔开",
153
+ style: {
154
+ lable: "label.style",
109
155
  type: "input",
110
156
  },
111
157
  defaultValue: {
112
- lable: "默认值",
158
+ lable: "label.dev.defaultvalue",
113
159
  type: "defaultValueInput",
114
160
  },
115
161
  type: {
116
- lable: "主题",
162
+ lable: "label.dev.button.type",
117
163
  type: "option",
118
164
  options: [
119
165
  {
@@ -139,54 +185,58 @@ export default {
139
185
  ],
140
186
  },
141
187
  fontSize: {
142
- lable: "字号",
188
+ lable: "label.dev.font.size",
143
189
  type: "input",
144
190
  inputType: "number",
145
191
  },
146
192
  handleComponentId: {
147
- lable: "组件ID,使用英文逗号分隔",
193
+ lable: "label.dev.associated.compid",
148
194
  type: "input",
149
195
  },
150
196
  functionContent: {
151
- lable: "方法体",
197
+ lable: "label.dev.request.body",
152
198
  type: "code",
153
199
  },
154
200
  axiosAddres: {
155
- lable: "网络请求地址",
201
+ lable: "label.dev.interface.address",
202
+ type: "code",
203
+ },
204
+ returnBody: {
205
+ lable: "label.dev.return.body",
156
206
  type: "code",
157
207
  },
158
208
  },
159
- events:{
160
- myCreated: `function created(self) {
209
+ events: {
210
+ myCreated: `function created(self) {
161
211
  // self即this,本组件的vue实例
162
212
  }`,
163
- myMounted: `function mounted(self) {
213
+ myMounted: `function mounted(self) {
164
214
  // self即this,本组件的vue实例
165
215
  }`,
166
- myDestroyed: `function destroyed(self) {
216
+ myDestroyed: `function destroyed(self) {
167
217
  // self即this,本组件的vue实例
168
218
  }`,
169
- myMouseover: `function myMouseover(self) {
219
+ myMouseover: `function myMouseover(self) {
170
220
  // self即this,本组件的vue实例
171
221
  }`,
172
222
  },
173
- eventsOption:{
174
- myCreated: {
175
- lable: "创建:",
176
- type: "code",
177
- },
178
- myMounted: {
179
- lable: "显示:",
180
- type: "code",
181
- },
182
- myDestroyed: {
183
- lable: "销毁:",
184
- type: "code",
185
- },
186
- myMouseover: {
187
- lable: "鼠标移入:",
188
- type: "code",
189
- },
223
+ eventsOption: {
224
+ myCreated: {
225
+ lable: "label.dev.created",
226
+ type: "code",
227
+ },
228
+ myMounted: {
229
+ lable: "label.dev.mounted",
230
+ type: "code",
231
+ },
232
+ myDestroyed: {
233
+ lable: "label.dev.destroyed",
234
+ type: "code",
235
+ },
236
+ myMouseover: {
237
+ lable: "label.dev.mouseover",
238
+ type: "code",
239
+ },
190
240
  },
191
241
  animations: [],
192
242
  groupStyle: {},
@@ -194,35 +244,37 @@ export default {
194
244
  };
195
245
  },
196
246
  created() {
197
- if (this.$Components.get('editMode') == "edit") { // 编辑模式不触发
198
- return
199
- }
200
- let myCreated = eval(
201
- "(false || " + this.eleEventObj.myCreated + ")"
202
- );
203
- myCreated(this)
247
+ this.$Components.set(this.elePropObj.id, this);
248
+ if (this.$Components.get("editMode") == "edit") {
249
+ // 编辑模式不触发
250
+ return;
251
+ }
252
+ let myCreated = eval("(false || " + this.eleEventObj.myCreated + ")");
253
+ myCreated(this);
204
254
  },
205
255
  mounted() {
206
- if (this.$Components.get('editMode') == "edit") { // 编辑模式不触发
207
- return
208
- }
209
- let myMounted = eval(
210
- "(false || " + this.eleEventObj.myMounted + ")"
211
- );
212
- myMounted(this)
256
+ if (this.$Components.get("editMode") == "edit") {
257
+ // 编辑模式不触发
258
+ return;
259
+ }
260
+ let myMounted = eval("(false || " + this.eleEventObj.myMounted + ")");
261
+ myMounted(this);
213
262
  },
214
263
  destroyed() {
215
- let myDestroyed = eval(
216
- "(false || " + this.eleEventObj.myDestroyed + ")"
217
- );
218
- myDestroyed(this)
264
+ let myDestroyed = eval("(false || " + this.eleEventObj.myDestroyed + ")");
265
+ myDestroyed(this);
219
266
  },
220
267
  methods: {
221
268
  myMouseover() {
222
269
  let mouseoverEvent = eval(
223
- "(false || " + this.eleEventObj.myMouseover + ")"
270
+ "(false || " + this.eleEventObj.myMouseover + ")"
224
271
  );
225
- mouseoverEvent(this)
272
+ mouseoverEvent(this);
273
+ },
274
+ returnBodyHandle(res) {
275
+ let self = this;
276
+ let getReturnBody = eval("(false || " + this.elePropObj.returnBody + ")");
277
+ getReturnBody(self, res);
226
278
  },
227
279
  handleClick() {
228
280
  if (
@@ -256,12 +308,7 @@ export default {
256
308
  .then(
257
309
  (res) => {
258
310
  this.fullscreenLoading = false;
259
- if (res.returnCode == 200 || "1" == res.returnCode) {
260
- this.$message({
261
- message: "提交成功",
262
- type: "success",
263
- });
264
- }
311
+ this.returnBodyHandle(res);
265
312
  },
266
313
  (err) => {
267
314
  this.fullscreenLoading = false;
@@ -282,15 +329,15 @@ export default {
282
329
  },
283
330
  };
284
331
  </script>
285
- <style scoped>
286
- .dev-button {
332
+ <style >
333
+ .cloudccButton {
287
334
  height: 100%;
288
335
  width: 100%;
289
336
  padding: 0px !important;
290
337
  }
291
- .dev-button .el-button {
338
+ .cloudccButton .el-button {
292
339
  height: 100%;
293
340
  width: 100%;
294
341
  padding: 0px !important;
295
342
  }
296
- </style>
343
+ </style>
package/template/mainjs CHANGED
@@ -4,9 +4,12 @@ Vue.use(ElementUI);
4
4
  import 'element-ui/lib/theme-chalk/index.css';
5
5
  import App from './App.vue';
6
6
 
7
- Vue.config.productionTip = false
7
+ import * as CCDK from "cloudcc-ccdk/lib/ccdk.min.js";
8
+ Vue.prototype.$CCDK = CCDK
9
+ window.$CCDK = CCDK
8
10
 
9
11
  Vue.prototype.$Components = new Map()
12
+ Vue.config.productionTip = false
10
13
 
11
14
  new Vue({
12
15
  render: h => h(App),