tianheng-ui 0.0.95 → 0.0.98

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tianheng-ui",
3
3
  "description": "A Vue.js project",
4
- "version": "0.0.95",
4
+ "version": "0.0.98",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -372,14 +372,28 @@
372
372
  </template>
373
373
 
374
374
  <template v-if="widget.type == 'image'">
375
- <el-image
375
+ <!-- <el-image
376
376
  :style="{
377
377
  width: widget.options.width,
378
378
  height: widget.options.height
379
379
  }"
380
380
  :src="widget.options.defaultValue"
381
381
  :fit="widget.options.fit"
382
- lazy
382
+ :preview-src-list="[widget.options.defaultValue]"
383
+ :lazy="widget.options.isLazy"
384
+ ></el-image> -->
385
+ <el-image
386
+ v-for="(item, index) in widget.options.defaultValue"
387
+ :key="index"
388
+ :style="{
389
+ width: widget.options.width,
390
+ height: widget.options.height,
391
+ borderRadius: widget.options.borderRadius
392
+ }"
393
+ :src="item.url"
394
+ :fit="widget.options.fit"
395
+ :preview-src-list="imagePreviewList"
396
+ :lazy="widget.options.isLazy"
383
397
  ></el-image>
384
398
  </template>
385
399
 
@@ -743,6 +757,13 @@ export default {
743
757
  } else {
744
758
  return this.widget.options.action;
745
759
  }
760
+ },
761
+ imagePreviewList() {
762
+ const list = [];
763
+ this.widget.options.defaultValue.forEach(item => {
764
+ list.push(item.url);
765
+ });
766
+ return list;
746
767
  }
747
768
  },
748
769
  created() {},
@@ -2,7 +2,7 @@
2
2
  <el-form-item
3
3
  class="widget-view"
4
4
  :class="{
5
- active: selectWidget.key == widget.key,
5
+ active: selectWidget.model == widget.model,
6
6
  is_req: widget.options.required,
7
7
  hideLabel: widget.options.hideLabel,
8
8
  'widget-col': ['grid', 'tabs', 'table', 'table_h5', 'alliance'].includes(
@@ -25,7 +25,7 @@
25
25
  ></component>
26
26
 
27
27
  <div
28
- v-if="selectWidget.key == widget.key"
28
+ v-if="selectWidget.model == widget.model"
29
29
  class="widget-actions"
30
30
  :class="{
31
31
  'widget-actions-col': [
@@ -117,36 +117,66 @@ export default {
117
117
  },
118
118
 
119
119
  handleWidgetClone(index) {
120
- const key =
121
- Date.parse(new Date().toString()) +
122
- "_" +
123
- Math.ceil(Math.random() * 99999);
124
- let cloneData = {
125
- ...this.widgetArray.list[index],
126
- options: {
127
- ...this.widgetArray.list[index].options,
128
- remoteFunc: "func_" + key
129
- },
130
- key,
131
- model: this.widgetArray.list[index].type + "_" + key,
132
- rules: this.widgetArray.list[index].rules || []
120
+ const data = JSON.parse(JSON.stringify(this.widgetArray.list[index]));
121
+
122
+ const initKey = item => {
123
+ const key =
124
+ Date.parse(new Date().toString()) +
125
+ "_" +
126
+ Math.ceil(Math.random() * 99999);
127
+
128
+ item.options.remoteFunc = `func__${key}`;
129
+ item.key = key;
130
+ item.model = item.type + "_" + key;
131
+
132
+ if (["table", "table_h5"].includes(item.type)) {
133
+ item.list.forEach(element => {
134
+ initKey(element);
135
+ });
136
+ }
137
+ if (["tabs"].includes(item.type)) {
138
+ item.tabs.forEach(tab => {
139
+ tab.forEach(element => {
140
+ initKey(element);
141
+ });
142
+ });
143
+ }
144
+ if (["grid"].includes(item.type)) {
145
+ item.columns.forEach(column => {
146
+ column.list.forEach(element => {
147
+ initKey(element);
148
+ });
149
+ });
150
+ }
133
151
  };
152
+ initKey(data);
134
153
 
135
- if (
136
- this.widgetArray.list[index].type === "radio" ||
137
- this.widgetArray.list[index].type === "checkbox" ||
138
- this.widgetArray.list[index].type === "select"
139
- ) {
140
- cloneData = {
141
- ...cloneData,
142
- options: {
143
- ...cloneData.options,
144
- options: cloneData.options.options.map(item => ({ ...item }))
145
- }
146
- };
147
- }
154
+ // let cloneData = {
155
+ // ...JSON.parse(JSON.stringify(this.widgetArray.list[index])),
156
+ // options: {
157
+ // ...this.widgetArray.list[index].options,
158
+ // remoteFunc: "func_" + key
159
+ // },
160
+ // key,
161
+ // model: this.widgetArray.list[index].type + "_" + key,
162
+ // rules: this.widgetArray.list[index].rules || []
163
+ // };
164
+
165
+ // if (
166
+ // this.widgetArray.list[index].type === "radio" ||
167
+ // this.widgetArray.list[index].type === "checkbox" ||
168
+ // this.widgetArray.list[index].type === "select"
169
+ // ) {
170
+ // cloneData = {
171
+ // ...cloneData,
172
+ // options: {
173
+ // ...cloneData.options,
174
+ // options: cloneData.options.options.map(item => ({ ...item }))
175
+ // }
176
+ // };
177
+ // }
148
178
 
149
- this.widgetArray.list.splice(index, 0, cloneData);
179
+ this.widgetArray.list.splice(index, 0, data);
150
180
 
151
181
  this.$nextTick(() => {
152
182
  this.selectWidget = this.widgetArray.list[index + 1];
@@ -442,24 +442,12 @@ export const basicComponents = [
442
442
  onChange: ""
443
443
  }
444
444
  },
445
- {
446
- name: "填充物",
447
- type: "filler",
448
- icon: "icon-ic",
449
- options: {
450
- defaultValue: "",
451
- width: "100%",
452
- height: "20px"
453
- }
454
- },
455
445
  {
456
446
  name: "图片",
457
447
  type: "image",
458
448
  icon: "icon-ic",
459
449
  options: {
460
- defaultValue:
461
- "https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg",
462
- defaultValueArr: [
450
+ defaultValue: [
463
451
  {
464
452
  url:
465
453
  "https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg"
@@ -473,7 +461,6 @@ export const basicComponents = [
473
461
  "https://fuss10.elemecdn.com/0/6f/e35ff375812e6b0020b6b4e8f9583jpeg.jpeg"
474
462
  }
475
463
  ],
476
- remote: false,
477
464
  width: "",
478
465
  height: "200px",
479
466
  fit: "fill",
@@ -482,7 +469,8 @@ export const basicComponents = [
482
469
  errorSrc: "",
483
470
  isLoding: false,
484
471
  hidden: false,
485
- hideLabel: false
472
+ hideLabel: false,
473
+ isLazy: true
486
474
  }
487
475
  },
488
476
  {
@@ -717,7 +705,20 @@ export const layoutComponents = [
717
705
  hideLabel: true
718
706
  }
719
707
  },
720
-
708
+ {
709
+ name: "填充物",
710
+ type: "filler",
711
+ icon: "icon-ic",
712
+ options: {
713
+ defaultValue: "",
714
+ width: "100%",
715
+ height: "20px",
716
+ labelWidth: 100,
717
+ isLabelWidth: false,
718
+ hideLabel: true,
719
+ hidden: false,
720
+ }
721
+ },
721
722
  {
722
723
  name: "分割线",
723
724
  type: "divider",
@@ -31,6 +31,11 @@
31
31
  <el-form-item label="高度">
32
32
  <el-input v-model="widget.options.height"></el-input>
33
33
  </el-form-item>
34
+
35
+ <el-form-item label="操作属性">
36
+ <el-checkbox v-model="widget.options.hidden">隐藏组件 </el-checkbox>
37
+ <el-checkbox v-model="widget.options.hideLabel">隐藏标签 </el-checkbox>
38
+ </el-form-item>
34
39
  </el-form>
35
40
  </div>
36
41
  </template>
@@ -25,39 +25,26 @@
25
25
  </el-form-item>
26
26
 
27
27
  <el-form-item label="图片路径">
28
- <div style="marginBottom:10px">
29
- <el-radio-group v-model="widget.options.remote" size="mini">
30
- <el-radio-button :label="false">图片路径</el-radio-button>
31
- <el-radio-button :label="true">大图预览</el-radio-button>
32
- </el-radio-group>
28
+ <div
29
+ style="display: flex;"
30
+ v-for="(item, index) in widget.options.defaultValue"
31
+ :key="item.url"
32
+ >
33
+ <div style="width:80px;">地址{{ index + 1 }}:</div>
34
+ <el-input v-model="item.url"></el-input>
35
+ <el-button
36
+ style="padding: 8px;margin-left: 5px;"
37
+ type="danger"
38
+ icon="el-icon-minus"
39
+ size="mini"
40
+ circle
41
+ plain
42
+ @click="handleImageRemove(index)"
43
+ ></el-button>
33
44
  </div>
34
- <div style="display: flex;" v-if="!widget.options.remote">
35
- <div style="width:80px;">地址:</div>
36
- <el-input v-model="widget.options.defaultValue"></el-input>
37
- </div>
38
-
39
- <div v-if="widget.options.remote">
40
- <div
41
- style="display: flex;"
42
- v-for="(item, index) in widget.options.defaultValueArr"
43
- :key="item.url"
44
- >
45
- <div style="width:80px;">地址:{{ index + 1 }}</div>
46
- <el-input v-model="item.url"></el-input>
47
-
48
- <el-button
49
- style="padding: 8px;margin-left: 5px;"
50
- type="danger"
51
- icon="el-icon-minus"
52
- circle
53
- plain
54
- @click="handleImageRemove(index)"
55
- ></el-button>
56
- </div>
57
45
 
58
- <div style="margin-left: 22px;">
59
- <el-button type="text" @click="handleAddImage">添加选项</el-button>
60
- </div>
46
+ <div style="margin-left: 22px;">
47
+ <el-button type="text" @click="handleAddImage">添加选项</el-button>
61
48
  </div>
62
49
  </el-form-item>
63
50
 
@@ -111,7 +98,10 @@
111
98
  <el-form-item label="操作属性">
112
99
  <el-checkbox v-model="widget.options.hidden">隐藏组件</el-checkbox>
113
100
  <el-checkbox v-model="widget.options.hideLabel">隐藏标签</el-checkbox>
114
- <el-checkbox v-model="widget.options.isLoding">加载中</el-checkbox>
101
+ <el-checkbox v-model="widget.options.isLoding"
102
+ >开启加载动画</el-checkbox
103
+ >
104
+ <el-checkbox v-model="widget.options.isLazy">开启懒加载</el-checkbox>
115
105
  </el-form-item>
116
106
  </el-form>
117
107
  </div>
@@ -136,10 +126,10 @@ export default {
136
126
  const obj = {
137
127
  url: ""
138
128
  };
139
- this.widget.options.defaultValueArr.push(obj);
129
+ this.widget.options.defaultValue.push(obj);
140
130
  },
141
131
  handleImageRemove(index) {
142
- this.widget.options.defaultValueArr.splice(index, 1);
132
+ this.widget.options.defaultValue.splice(index, 1);
143
133
  }
144
134
  }
145
135
  };
@@ -15,7 +15,6 @@ const basicComponents = [
15
15
  "slider",
16
16
  "number",
17
17
  "rate",
18
- "filler",
19
18
  "image",
20
19
  "upload",
21
20
  "editor",
@@ -24,7 +23,7 @@ const basicComponents = [
24
23
 
25
24
  const advanceComponents = ["table", "table_h5", "tabs", "blank"];
26
25
 
27
- const layoutComponents = ["grid", "alliance", "divider"];
26
+ const layoutComponents = ["grid", "alliance", "filler", "divider"];
28
27
 
29
28
  module.exports = {
30
29
  basicComponents,
@@ -1,6 +1,7 @@
1
1
  <template>
2
+ <!-- widget.key -->
2
3
  <th-row
3
- :class="{ active: selectWidget.key == widget.key }"
4
+ :class="{ active: selectWidget.model == widget.model }"
4
5
  :gutter="widget.options.gutter ? widget.options.gutter : 0"
5
6
  :justify="widget.options.justify"
6
7
  :align="widget.options.align"
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div>
2
+ <!-- <div>
3
3
  <th-image
4
4
  v-if="!widget.options.remote"
5
5
  :src="widget.options.defaultValue"
@@ -26,6 +26,17 @@
26
26
  :is-loding="widget.options.isLoding"
27
27
  ></th-image>
28
28
  </div>
29
+ </div> -->
30
+ <div>
31
+ <el-image
32
+ v-for="(item, index) in widget.options.defaultValue"
33
+ :key="index"
34
+ :style="selfStyle"
35
+ :src="item.url"
36
+ :fit="widget.options.fit"
37
+ :preview-src-list="widget.options.defaultValue"
38
+ :lazy="widget.options.isLazy"
39
+ ></el-image>
29
40
  </div>
30
41
  </template>
31
42
 
@@ -35,7 +46,16 @@ import ThImage from "ui/Image/index.vue";
35
46
 
36
47
  export default {
37
48
  components: { ThImage },
38
- mixins: [itemsComponent]
49
+ mixins: [itemsComponent],
50
+ computed: {
51
+ selfStyle() {
52
+ const style = { display: "inline-block" };
53
+ style.width = this.widget.options.width;
54
+ style.height = this.widget.options.height;
55
+ style.borderRadius = `${this.widget.options.borderRadius || 0}`;
56
+ return style;
57
+ }
58
+ }
39
59
  };
40
60
  </script>
41
61
 
@@ -1,6 +1,9 @@
1
1
  <template>
2
2
  <div class="fm-container">
3
- <el-container v-if="Object.keys(widgetFormData.config).length" class="container-box">
3
+ <el-container
4
+ v-if="Object.keys(widgetFormData.config).length"
5
+ class="container-box"
6
+ >
4
7
  <el-main>
5
8
  <el-container>
6
9
  <!-- 左侧字段区 -->
@@ -441,7 +444,6 @@ export default {
441
444
  "slider",
442
445
  "text",
443
446
  "button",
444
- "filler",
445
447
  "image",
446
448
  "upload",
447
449
  "editor",
@@ -454,7 +456,7 @@ export default {
454
456
  },
455
457
  layoutFields: {
456
458
  type: Array,
457
- default: () => ["grid", "alliance", "divider"]
459
+ default: () => ["grid", "filler", "divider"]
458
460
  },
459
461
  remoteApis: {
460
462
  type: Array,
@@ -463,8 +465,8 @@ export default {
463
465
  },
464
466
  data() {
465
467
  this.basicComponents = basicComponents;
466
- this.layoutComponents = layoutComponents;
467
468
  this.advanceComponents = advanceComponents;
469
+ this.layoutComponents = layoutComponents;
468
470
  this.baseConfig = JSON.parse(JSON.stringify(baseConfig));
469
471
  return {
470
472
  widgetFormData: this.data,
@@ -523,6 +525,7 @@ export default {
523
525
  const list = this.layoutComponents.filter(e => {
524
526
  return this.layoutFields.includes(e.type);
525
527
  });
528
+ console.log(this.layoutComponents)
526
529
  return list;
527
530
  }
528
531
  },
@@ -547,13 +550,10 @@ export default {
547
550
  this.baseConfig,
548
551
  this.widgetFormData.config
549
552
  );
550
- if (
551
- this.widgetFormData.list &&
552
- this.widgetFormData.list.length
553
- ) {
553
+ if (this.widgetFormData.list && this.widgetFormData.list.length) {
554
554
  this.widgetFormSelect = this.widgetFormData.list[0];
555
- }else {
556
- this.widgetFormData.list = []
555
+ } else {
556
+ this.widgetFormData.list = [];
557
557
  }
558
558
  },
559
559
  mounted() {},
@@ -113,7 +113,7 @@ export default {
113
113
  default: () => {
114
114
  return {
115
115
  page: {
116
- url: "/viewManage/getViewManageDetailById",
116
+ url: "/preview/getViewManageDetailById",
117
117
  method: "POST",
118
118
  params: {}
119
119
  },
@@ -218,15 +218,17 @@ export default {
218
218
  // 初始化组件配置
219
219
  initConfig() {
220
220
  this.initData();
221
- const info = sessionStorage.getItem("th_oauth_info");
222
- if (info) {
223
- this.requestConfigData();
224
- } else if (this.oauthConfig.token) {
221
+
222
+ if (this.oauthConfig.token) {
225
223
  const oauthInfo = {
226
224
  token: this.oauthConfig.token,
227
225
  baseUrl: this.oauthConfig.baseUrl
228
226
  };
229
227
  sessionStorage.setItem("th_oauth_info", JSON.stringify(oauthInfo));
228
+ }
229
+
230
+ const info = sessionStorage.getItem("th_oauth_info");
231
+ if (info) {
230
232
  this.requestConfigData();
231
233
  } else if (this.oauthConfig.oauth) {
232
234
  // 模拟授权认证流程
@@ -261,7 +263,7 @@ export default {
261
263
  data: { ...this.network.page.params, moduleId: this.id }
262
264
  })
263
265
  .then(res => {
264
- const resultData = res.data.viewManage;
266
+ const resultData = res.data;
265
267
  if (!resultData) {
266
268
  this.tableJson = null;
267
269
  return;