cloud-web-corejs 1.0.54-dev.396 → 1.0.54-dev.397

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": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.396",
4
+ "version": "1.0.54-dev.397",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -3,6 +3,7 @@ let tmixins, tViewMixins, pmixins;
3
3
  import axios from 'axios';
4
4
  import SparkMD5 from "spark-md5";
5
5
  import settingConfig from "@/settings.js";
6
+ import {openObsUploadDialog} from "@/components/obsUpload/index.js"
6
7
 
7
8
  let imFun = {
8
9
  axios,
@@ -248,6 +249,12 @@ tmixins = {
248
249
  });
249
250
  },
250
251
  handleShow(option) {
252
+ if(option.model === "obs"){
253
+ openObsUploadDialog({
254
+ ...option,
255
+ })
256
+ return
257
+ }
251
258
  this.title = this.$t2('上传', 'components.VabUpload.title');
252
259
  // this.data = data;
253
260
  this.option = option;
@@ -1050,7 +1057,9 @@ tViewMixins = {
1050
1057
  showPropertiesDialog: false,
1051
1058
  editAttachment: null,
1052
1059
  showViewer: false,
1053
- chooseIndex: 0
1060
+ chooseIndex: 0,
1061
+ fileServerInfo: {},
1062
+ model: null
1054
1063
  };
1055
1064
  },
1056
1065
  computed: {
@@ -1103,9 +1112,44 @@ tViewMixins = {
1103
1112
  }
1104
1113
  },
1105
1114
  created() {
1115
+ this.initFileServerInfo();
1106
1116
  this.initFile();
1107
1117
  },
1108
1118
  methods: {
1119
+ openUploadDialog(){
1120
+ this.$baseUpload.open({
1121
+ ...this.fileServerInfo,
1122
+ ...this._props,
1123
+ ...this.$attrs,
1124
+ limit: this.limit,
1125
+ multi: this.multi,
1126
+ accept: this.accept ? this.accept : 'file',
1127
+ auto: this.auto,
1128
+ size: this.fileMaxSize,
1129
+ chunkSize: this.chunkSize,
1130
+ callback: this.fileConfirm,
1131
+ pickPrivateProfile:this.pickPrivateProfile,
1132
+ confirmUpload: this.confirmUpload,
1133
+ otherParams: this.$attrs,
1134
+ })
1135
+ },
1136
+ initFileServerInfo(){
1137
+ if(this.$attrs.model && this.$attrs.fileServerInfo){
1138
+ this.model = this.$attrs.model;
1139
+ this.fileServerInfo = this.$attrs.fileServerInfo;
1140
+ }else{
1141
+ getFileServerInfo(this, (res) => {
1142
+ if (res) {
1143
+ let fileServerInfo = res;
1144
+ this.model = fileServerInfo.model
1145
+ this.fileServerInfo = fileServerInfo;
1146
+ }else{
1147
+ this.model = null;
1148
+ this.fileServerInfo = null;
1149
+ }
1150
+ })
1151
+ }
1152
+ },
1109
1153
  initFile() {
1110
1154
  if (this.file) {
1111
1155
  let typeStr = Object.prototype.toString.call(this.file);
@@ -1246,16 +1290,22 @@ tViewMixins = {
1246
1290
  this.showViewer = false
1247
1291
  },
1248
1292
  hasPreview(attachment) {
1293
+ let showImagePreview = this.getShowImagePreview();
1249
1294
  let typeStr = Object.prototype.toString.call(attachment);
1250
1295
  let url = typeStr == '[object Object]' ? (attachment.domain + attachment.url) : attachment;
1251
- return this.$commonFileUtil.isPictureFile(url) || this.$commonFileUtil.isPreviewFile(url);
1296
+ if(showImagePreview){
1297
+ return this.$commonFileUtil.isPictureFile(url) || this.$commonFileUtil.isPreviewFile(url);
1298
+ }else{
1299
+ return this.$commonFileUtil.isPictureFile(url)
1300
+ }
1252
1301
  },
1253
1302
  openPreview(attachment, index) {
1303
+ let showImagePreview = this.getShowImagePreview();
1254
1304
  let typeStr = Object.prototype.toString.call(attachment);
1255
1305
  let url = typeStr == '[object Object]' ? (attachment.domain + attachment.url) : attachment;
1256
1306
  if (this.$commonFileUtil.isPictureFile(url)) {
1257
1307
  this.openImagePreView(index);
1258
- } else if (this.$commonFileUtil.isPreviewFile(url)) {
1308
+ } else if (showImagePreview && this.$commonFileUtil.isPreviewFile(url)) {
1259
1309
  this.$openFilePreview(url)
1260
1310
  }
1261
1311
  },
@@ -1275,15 +1325,19 @@ tViewMixins = {
1275
1325
  }
1276
1326
  return name;
1277
1327
  },
1328
+ getShowImagePreview() {
1329
+ return !this.model;
1330
+ },
1278
1331
  getShowUrl(attachment, field) {
1279
1332
  let showUrl = null;
1333
+ let showImagePreview = this.getShowImagePreview();
1280
1334
  let typeStr = Object.prototype.toString.call(attachment);
1281
1335
  if (typeStr == '[object Object]') {
1282
1336
  let showField = field ? field : 'medium';
1283
1337
  let fullUrl = attachment.domain + (attachment[showField] ? attachment[showField] : attachment.url);
1284
- showUrl = this.$commonFileUtil.getShowUrl(fullUrl)
1338
+ showUrl = this.$commonFileUtil.getShowUrl(fullUrl, showImagePreview)
1285
1339
  } else {
1286
- showUrl = this.$commonFileUtil.getShowUrl(attachment)
1340
+ showUrl = this.$commonFileUtil.getShowUrl(attachment, showImagePreview)
1287
1341
  }
1288
1342
  return showUrl;
1289
1343
  },
@@ -1454,6 +1508,27 @@ pmixins = {
1454
1508
  }
1455
1509
  };
1456
1510
 
1511
+ function getFileServerInfo(that, callback){
1512
+ that.$http({
1513
+ url: USER_PREFIX + "/logic_param/getFileServerInfo",
1514
+ method: "post",
1515
+ data: {},
1516
+ failMsg: false,
1517
+ errorMsg: false,
1518
+ modal: false,
1519
+ success: (res) => {
1520
+ if(res.objx){
1521
+ callback && callback(res.objx);
1522
+ }else{
1523
+ callback && callback();
1524
+ }
1525
+ },
1526
+ error: (err) => {
1527
+ callback && callback();
1528
+ }
1529
+ })
1530
+ }
1531
+
1457
1532
  function formatFileSize(fileSize) {
1458
1533
  fileSize = fileSize || 0;
1459
1534
  if (fileSize < 1024) {
@@ -150,22 +150,7 @@
150
150
  v-if="showUploadBtn"
151
151
  @keyup.prevent
152
152
  @keydown.enter.prevent
153
- @click="
154
- $baseUpload.open({
155
- ..._props,
156
- ...$attrs,
157
- limit: limit,
158
- multi: multi,
159
- accept: accept ? accept : 'file',
160
- auto: auto,
161
- size: fileMaxSize,
162
- chunkSize: chunkSize,
163
- callback: fileConfirm,
164
- pickPrivateProfile: pickPrivateProfile,
165
- confirmUpload: confirmUpload,
166
- otherParams: $attrs,
167
- })
168
- "
153
+ @click="openUploadDialog()"
169
154
  >
170
155
  <i class="el-icon-plus avatar-uploader-icon"></i>
171
156
  </button>