centaline-data-driven 1.4.62 → 1.4.63

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,6 +1,6 @@
1
1
  {
2
2
  "name": "centaline-data-driven",
3
- "version": "1.4.62",
3
+ "version": "1.4.63",
4
4
  "description": "ccai",
5
5
  "author": "hjc <3226136347@qq.com>",
6
6
  "private": false,
@@ -15,13 +15,13 @@
15
15
  "axios": "^0.24.0",
16
16
  "babel-polyfill": "^6.26.0",
17
17
  "compression-webpack-plugin": "^2.0.0",
18
- "cropperjs": "^1.5.13",
19
18
  "element-ui": "^2.15.7",
20
19
  "module": "^1.2.5",
21
20
  "sass": "^1.34.0",
22
21
  "save": "^2.4.0",
23
22
  "v-viewer": "^1.6.4",
24
23
  "vue": "2.5.17",
24
+ "vue-cropper": "^0.5.8",
25
25
  "vue-ueditor-wrap": "^2.5.6",
26
26
  "vuedraggable": "^2.24.3"
27
27
  },
@@ -918,7 +918,16 @@ export default {
918
918
  else if (field.isSearchPageInTab) {// 外部框架tab页打开
919
919
  submitData = field.getActionPara(submitData).para;
920
920
  self.$common.getDataDrivenOpts().handler.openTabSearch(field, submitData);
921
- }
921
+ }
922
+ else if (field.isUrlInSystemTab) {//外部框架tab页打开URl
923
+ submitData = field.getActionPara(submitData).para;
924
+ let query = self.$common.objectToQueryStr(submitData);
925
+ let urlTab = field.action + query;
926
+ if(field.action.indexOf('?')>-1 && query.indexOf('?')>-1){
927
+ urlTab = field.action + '&' +query.substr(1, query.length);
928
+ }
929
+ self.$common.getDataDrivenOpts().handler.openTabUrl(urlTab,field.pageTitle||field.label);
930
+ }
922
931
  else if (field.isBrowserNewTab) {// 浏览器打开
923
932
  submitData = field.getActionPara(submitData).para;
924
933
  let query = self.$common.objectToQueryStr(submitData);
@@ -928,6 +928,15 @@ export default {
928
928
  submitData = field.getActionPara(submitData).para;
929
929
  self.$common.getDataDrivenOpts().handler.openTabSearch(field, submitData);
930
930
  }
931
+ else if (field.isUrlInSystemTab) {//外部框架tab页打开URl
932
+ submitData = field.getActionPara(submitData).para;
933
+ let query = self.$common.objectToQueryStr(submitData);
934
+ let urlTab = field.action + query;
935
+ if(field.action.indexOf('?')>-1 && query.indexOf('?')>-1){
936
+ urlTab = field.action + '&' +query.substr(1, query.length);
937
+ }
938
+ self.$common.getDataDrivenOpts().handler.openTabUrl(urlTab,field.pageTitle||field.label);
939
+ }
931
940
  else if (field.isBrowserNewTab) {// 浏览器打开
932
941
  submitData = field.getActionPara(submitData).para;
933
942
  let query = self.$common.objectToQueryStr(submitData);
@@ -438,6 +438,15 @@
438
438
  submitData = field.getActionPara(submitData).para;
439
439
  self.$common.getDataDrivenOpts().handler.openTabSearch(field, submitData);
440
440
  }
441
+ else if (field.isUrlInSystemTab) {//外部框架tab页打开URl
442
+ submitData = field.getActionPara(submitData).para;
443
+ let query = self.$common.objectToQueryStr(submitData);
444
+ let urlTab = field.action + query;
445
+ if(field.action.indexOf('?')>-1 && query.indexOf('?')>-1){
446
+ urlTab = field.action + '&' +query.substr(1, query.length);
447
+ }
448
+ self.$common.getDataDrivenOpts().handler.openTabUrl(urlTab,field.pageTitle||field.label);
449
+ }
441
450
  else if (field.isBrowserNewTab) {// 浏览器打开
442
451
  submitData = field.getActionPara(submitData).para;
443
452
  let query = self.$common.objectToQueryStr(submitData);
@@ -1,7 +1,31 @@
1
1
  <template>
2
2
  <div class="picedit-modal" style="width:100%; height:100%;background-color: #1e1e1e">
3
3
  <div class="picedit-stage">
4
- <canvas id="drawCanvas" ref="canvas" style="position:absolute;"></canvas>
4
+ <div style="width:100%; height:100%;" v-if="croppShow">
5
+ <vue-cropper ref="cropper"
6
+ :img="options.img"
7
+ :output-size="options.size"
8
+ :output-type="options.outputType"
9
+ :info="options.info"
10
+ :full="options.full"
11
+ :canScale="options.canScale"
12
+ :can-move="options.canMove"
13
+ :can-move-box="options.canMoveBox"
14
+ :fixed="options.fixed"
15
+ :fixed-box="options.fixedBox"
16
+ :original="options.original"
17
+ :auto-crop="options.autoCrop"
18
+ :auto-crop-width="options.autoCropWidth"
19
+ :auto-crop-height="options.autoCropHeight"
20
+ :center-box="options.centerBox"
21
+ :high="options.high"
22
+ :info-true="options.infoTrue"
23
+ :max-img-size="options.maxImageSize"
24
+ :enlarge="options.enlarge"
25
+ :mode="options.mode"
26
+ :maxImgSize="options.maxImgSize" />
27
+ </div>
28
+ <canvas v-else id="drawCanvas" ref="canvas" style="position:absolute;"></canvas>
5
29
  </div>
6
30
  <div class="picedit-Original" v-if="flagOriginal">
7
31
  <el-row>
@@ -21,7 +45,7 @@
21
45
  </a>
22
46
  </div>
23
47
  </div>
24
- <div class="stream-total-tips" v-if="progressFlag">
48
+ <div class="stream-total-tips" v-if="progressFlag">
25
49
  <el-progress type="circle"
26
50
  :percentage="typeof loadProgress !== 'undefined' && loadProgress !== null ? loadProgress : 0.00"
27
51
  :width="150" :height="150" class="file-cirle"></el-progress>
@@ -32,12 +56,11 @@
32
56
  <script>
33
57
  import dynamicElement from "../../mixins/dynamicElement";
34
58
  import { upload, uploadByPieces } from "../../loader/src/ctl/SliceUpload";
35
- import Enum from '../../loader/src/ctl/lib/Enum';
36
- import Cropper from 'cropperjs'
37
- import 'cropperjs/dist/cropper.min.css'
59
+ import { VueCropper } from "vue-cropper";
38
60
  export default {
39
61
  name: "ct-editpictures",
40
62
  mixins: [dynamicElement],
63
+ components: { VueCropper },
41
64
  props: {
42
65
  file: Object,
43
66
  api: String,
@@ -49,7 +72,6 @@
49
72
  flagOriginal: false,
50
73
  progressFlag: false,
51
74
  loadProgress: 0,
52
- cropper: null,
53
75
  croppShow: false,
54
76
  canvas: Object,
55
77
  ctx: Object,
@@ -60,7 +82,7 @@
60
82
  isActive: false,
61
83
  bodywidth: 0,
62
84
  bodyheight: 0,
63
- scale:1,
85
+ scale: 1,
64
86
  tx: 0,
65
87
  ty: 0,
66
88
  tl: 0,
@@ -71,23 +93,24 @@
71
93
  nt: 0,
72
94
  ratio: 0,
73
95
  cropBoxResizable: false,
74
- bntindex:-1,
96
+ bntindex: -1,
97
+ canvasImg:'',
75
98
  bntList: [
76
99
  {
77
100
  name: "左旋转",
78
101
  ico: "el-icon-refresh-left",
79
- key:"rotLeft",
102
+ key: "rotLeft",
80
103
  },
81
104
  {
82
105
  name: "右旋转",
83
106
  ico: "el-icon-refresh-right",
84
107
  key: "rotRight",
85
108
  },
86
- //{
87
- // name: "裁剪",
88
- // ico: "el-icon-crop",
89
- // key: "Crop",
90
- //},
109
+ {
110
+ name: "裁剪",
111
+ ico: "el-icon-crop",
112
+ key: "Crop",
113
+ },
91
114
  {
92
115
  name: "拖动",
93
116
  ico: "el-icon-rank",
@@ -119,6 +142,27 @@
119
142
  key: "preservation",
120
143
  },
121
144
  ],
145
+ options: {
146
+ img: '', //裁剪图片的地址
147
+ outputSize: 1, // 裁剪生成图片的质量
148
+ outputType: 'jpeg', // 裁剪生成图片的格式
149
+ full: false, // 是否输出原图比例的截图
150
+ info: true, // 图片大小信息
151
+ canScale: true, // 图片是否允许滚轮缩放
152
+ autoCrop: true, // 是否默认生成截图框
153
+ //autoCropWidth: 800, // 默认生成截图框宽度
154
+ //autoCropHeight: 600, // 默认生成截图框高度
155
+ canMove: true, // 上传图片是否可以移动
156
+ //fixedBox: true, // 固定截图框大小 不允许改变
157
+ fixed: false, // 是否开启截图框宽高固定比例
158
+ canMoveBox: true, // 截图框能否拖动
159
+ original: false, // 上传图片按照原始比例渲染
160
+ centerBox: true, // 截图框是否被限制在图片里面
161
+ height: true,
162
+ infoTrue: true, // true 为展示真实输出图片宽高 false 展示看到的截图框宽高
163
+ enlarge: 1, // 图片根据截图框输出比例倍数
164
+ //mode: 'cover', // 图片默认渲染方式
165
+ },
122
166
  }
123
167
  },
124
168
  computed: {
@@ -131,7 +175,7 @@
131
175
  width = width > 1160 ? 1160 : width;
132
176
  this.bodywidth = width;
133
177
  this.bodyheight = parseInt(window.document.body.clientHeight * 0.8);
134
- if (typeof this.minWidth == 'undefined' || typeof this.minWidth == 'undefined') {
178
+ if (typeof this.minWidth !== 'undefined' && typeof this.minWidth !== 'undefined') {
135
179
  this.cropBoxResizable = true;
136
180
  }
137
181
  if (typeof this.file.originalSavedFileName !== 'undefined' && this.file.originalSavedFileName !== this.file.savedFileName) {
@@ -143,14 +187,14 @@
143
187
  drawCanv(href) {
144
188
  this.$nextTick(() => {
145
189
  let _this = this
146
- _this.canvas = document.getElementById('drawCanvas');
190
+ _this.canvas = this.$refs.canvas;
147
191
  _this.ctx = _this.canvas.getContext("2d");
148
192
 
149
193
  _this.canvas.width = 0;
150
194
  _this.canvas.height = 0;
151
195
 
152
196
  _this.imgObj = new Image()
153
- _this.imgObj.src = href||_this.file.mediaUrl;
197
+ _this.imgObj.src = href || _this.file.mediaUrl;
154
198
  _this.imgObj.setAttribute("crossOrigin", 'Anonymous')
155
199
  _this.imgObj.onload = function (e) {
156
200
  //获取原始宽高
@@ -348,49 +392,36 @@
348
392
  this.scaleDomSize(canvas);
349
393
  },
350
394
  Crop() {
351
- let _this = this
352
- this.drawCanv()
353
- this.croppShow = true
354
- var w;
355
- var h;
395
+
356
396
  if (typeof this.minWidth !== 'undefined' && typeof this.minWidth !== 'undefined') {
357
- w = parseInt(this.minWidth)
358
- h = parseInt(this.minHeight);
397
+ if (parseInt(this.minWidth) > this.bodywidth || parseInt(this.minHeight) > this.bodyheight) {
398
+ this.options.enlarge = 2;
399
+ this.options.autoCropWidth = parseInt(this.minWidth)/2;
400
+ this.options.autoCropHeight = parseInt(this.minHeight)/2;
401
+ }
402
+ else {
403
+ this.options.autoCropWidth = parseInt(this.minWidth);
404
+ this.options.autoCropHeight = parseInt(this.minHeight);
405
+ }
359
406
  }
360
- let cropper = new Cropper(this.$refs.canvas, {
361
- checkCrossOrigin: true,
362
- viewMode: 1,
363
- dragMode: 'move',
364
- cropBoxResizable: _this.cropBoxResizable,
365
- data: {
366
- width: w,
367
- height: h
368
- },
369
- zoom(e) {
370
- if (_this.ratio == 0) {
371
- _this.ratio = e.detail.oldRatio
372
- }
373
- if (e.detail.ratio > _this.ratio) {
374
- e.preventDefault();
375
- }
376
- },
377
- })
378
- this.cropper = cropper
407
+ this.canvasImg = this.canvas.toDataURL('image/jpeg');
408
+ this.options.img = this.canvasImg;
409
+ this.options.fixedBox = this.cropBoxResizable;
410
+ this.croppShow = true
379
411
  },
380
412
  // 确认裁剪
381
413
  sureCropper() {
382
414
  let _this = this
383
- this.cropper.getCroppedCanvas().toBlob(function (blob) {
415
+ this.$refs.cropper.getCropBlob(blob => {
384
416
  const href = window.URL.createObjectURL(blob)
417
+ _this.croppShow = false;
385
418
  _this.drawCanv(href)
386
- }, 'image/jpeg')
387
- this.cancelCropper()
419
+ });
388
420
  },
389
421
  // 销毁裁剪框
390
422
  cancelCropper() {
391
- this.cropper.destroy()
392
423
  this.croppShow = false
393
- this.cropper = null
424
+ this.drawCanv(this.canvasImg);
394
425
  },
395
426
  Original() {
396
427
  var url = this.file.mediaUrl.replace(this.file.savedFileName, this.file.originalSavedFileName);
@@ -458,6 +489,8 @@
458
489
  this.file.mediaUrl = res.content.media.mediaUrl;
459
490
  this.file.savedFileName = res.content.media.savedFileName;
460
491
  this.file.mediaDate = res.content.media.mediaDate;
492
+ this.file.width = this.canvas.width;
493
+ this.file.height = this.canvas.height;
461
494
  this.$emit('handleEditPhoto', this.file);
462
495
  }
463
496
  return true;
@@ -579,6 +612,7 @@
579
612
  color: #fff;
580
613
  z-index: 9;
581
614
  }
615
+
582
616
  .picedit-cropper {
583
617
  height: 50px;
584
618
  bottom: 0;
@@ -588,6 +622,7 @@
588
622
  color: #fff;
589
623
  z-index: 9;
590
624
  }
625
+
591
626
  .picedit-Original {
592
627
  height: 50px;
593
628
  top: 50px;
@@ -596,6 +631,7 @@
596
631
  color: #fff;
597
632
  z-index: 9;
598
633
  }
634
+
599
635
  .picedit-toolbar {
600
636
  display: inline-block;
601
637
  height: 50px;
@@ -616,19 +652,22 @@
616
652
  font-size: 24px;
617
653
  cursor: pointer;
618
654
  }
655
+
619
656
  .picedit-toolbar .active {
620
657
  background-color: #fff;
621
- color:#333;
622
- }
623
- .rc-cropper {
624
- position: relative;
658
+ color: #333;
625
659
  }
626
660
 
661
+ .rc-cropper {
662
+ position: relative;
663
+ }
664
+
627
665
  .rc-cropper__iconCrop1 {
628
666
  position: absolute;
629
667
  right: 4%;
630
668
  top: 0%;
631
669
  }
670
+
632
671
  .mask {
633
672
  position: fixed;
634
673
  z-index: 9998;
@@ -638,11 +677,11 @@
638
677
  left: 0;
639
678
  background-color: rgba(0, 0, 0, .3);
640
679
  }
680
+
641
681
  .stream-total-tips {
642
682
  position: fixed;
643
683
  top: 40%;
644
684
  left: 45%;
645
685
  z-index: 9999;
646
686
  }
647
-
648
687
  </style>
@@ -561,6 +561,13 @@
561
561
  this.model.setByPieces(res, Progress, file);
562
562
 
563
563
  if (res.content.finished == 1) {
564
+ var self = this;
565
+ let img = new Image();
566
+ img.src = self.model.fileList[self.model.fileList.length - 1].mediaUrl;
567
+ img.onload = function () {
568
+ self.model.fileList[self.model.fileList.length - 1].width = img.width;
569
+ self.model.fileList[self.model.fileList.length - 1].height = img.height;
570
+ };
564
571
  this.handleChange();
565
572
  }
566
573
  return true;
@@ -510,6 +510,15 @@
510
510
  let query = self.$common.objectToQueryStr(submitData);
511
511
  window.open(field.action + query, "_blank");
512
512
  }
513
+ else if (field.isUrlInSystemTab) {//外部框架tab页打开URl
514
+ submitData = field.getActionPara(submitData).para;
515
+ let query = self.$common.objectToQueryStr(submitData);
516
+ let urlTab = field.action + query;
517
+ if(field.action.indexOf('?')>-1 && query.indexOf('?')>-1){
518
+ urlTab = field.action + '&' +query.substr(1, query.length);
519
+ }
520
+ self.$common.getDataDrivenOpts().handler.openTabUrl(urlTab,field.pageTitle||field.label);
521
+ }
513
522
  else if (field.isSeeVoice) {//看视频
514
523
  self.$common.browseVideo(field, submitData)
515
524
  }
@@ -886,6 +886,15 @@ export default {
886
886
  let query = self.$common.objectToQueryStr(submitData);
887
887
  window.open(action + query, "_blank");
888
888
  }
889
+ else if (field.isUrlInSystemTab) {//外部框架tab页打开URl
890
+ submitData = field.getActionPara(submitData).para;
891
+ let query = self.$common.objectToQueryStr(submitData);
892
+ let urlTab = field.action + query;
893
+ if(field.action.indexOf('?')>-1 && query.indexOf('?')>-1){
894
+ urlTab = field.action + '&' +query.substr(1, query.length);
895
+ }
896
+ self.$common.getDataDrivenOpts().handler.openTabUrl(urlTab,field.pageTitle||field.label);
897
+ }
889
898
  else if (field.isSeeVoice) {//看视频
890
899
  self.$common.browseVideo(field, submitData);
891
900
  }
@@ -334,16 +334,7 @@ const box = function (source, fileSourceList, router, optionApi,videoPlayIconUrl
334
334
  }
335
335
  rtn.fileList.push(awaitfile);
336
336
  },
337
- imgFn(url) {
338
- return new Promise(function (resolve, reject) {
339
- let img = new Image();
340
- img.src = url;
341
- img.onload = function () {
342
- resolve(img);
343
- };
344
- });
345
- },
346
- async setByPieces(res, Progress, file) {
337
+ setByPieces(res, Progress, file) {
347
338
  if (res.rtnCode === Enum.ReturnCode.Successful) {
348
339
  //下面的方式绑定,会有一些问题 todo 不强与页面关联
349
340
  var data = {};
@@ -356,11 +347,6 @@ const box = function (source, fileSourceList, router, optionApi,videoPlayIconUrl
356
347
  data = rtn.getFileData(res.content.media);
357
348
  data.progressFlag = false;
358
349
  data.loadProgress = 100;
359
- if (data.mediaTypeID == 2) {
360
- const img = await this.imgFn(data.mediaUrl);
361
- w = img.width;
362
- h = img.height;
363
- }
364
350
  Vue.set(file, "width", w);
365
351
  Vue.set(file, "height", h);
366
352
  Vue.set(file, "url", data.url);
@@ -98,6 +98,9 @@ const Router = function (source) {
98
98
  get isUrlInLayer() {
99
99
  return source.pageStyle === Enum.PageStyle.UrlInLayer;
100
100
  },
101
+ get isUrlInSystemTab() {
102
+ return source.pageStyle === Enum.PageStyle.UrlInSystemTab;
103
+ },
101
104
  get isOpenUrlInBrowse() {
102
105
  return source.actionType === Enum.ActionType.OpenUrlInBrowse;
103
106
  },
@@ -563,6 +563,11 @@ const Enum = {
563
563
  /// URL页面(弹层)
564
564
  /// </summary>
565
565
  UrlInLayer: 8,
566
+
567
+ /// <summary>
568
+ /// 根据 Action 的Url在系统内新开Tab页面
569
+ /// </summary>
570
+ UrlInSystemTab: 9,
566
571
  },
567
572
 
568
573
  /// <summary>
package/src/main.js CHANGED
@@ -40,6 +40,9 @@ Vue.use(centaline, {
40
40
  closeTab: function () {
41
41
  alert("关闭当前tab")
42
42
  },
43
+ openTabUrl: function (action) {
44
+ alert("打开tab页URL:" + action)
45
+ },
43
46
  // 获取请求头
44
47
  getRequestHeaders: function () {
45
48
  return {