@xtdev/xt-miniprogram-ui 1.2.74 → 1.2.76

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.
@@ -1,4 +1,5 @@
1
1
  {
2
2
  "component": true,
3
+ "styleIsolation": "apply-shared",
3
4
  "usingComponents": {}
4
5
  }
@@ -63,6 +63,17 @@ Component({
63
63
  type: Object,
64
64
  value: {},
65
65
  },
66
+ /**
67
+ * 打水印参数
68
+ * {
69
+ * content: '',
70
+ * postion: ''
71
+ * }
72
+ */
73
+ waterData: {
74
+ type: Object | null,
75
+ value: null
76
+ },
66
77
  },
67
78
 
68
79
  /**
@@ -113,6 +124,7 @@ Component({
113
124
  sourceType,
114
125
  fileList,
115
126
  fileType,
127
+ waterData,
116
128
  } = this.properties;
117
129
  if (customUpload) {
118
130
  this.triggerEvent("upload", {});
@@ -147,7 +159,7 @@ Component({
147
159
  if (Array.isArray(tempFilePaths) && tempFilePaths.length) {
148
160
  Promise.allSettled(
149
161
  tempFilePaths.map((temp) =>
150
- _this.uploadImage_v(temp.tempFilePath || temp.path)
162
+ _this[waterData?'uploadWaterFile' : 'uploadImage_v'](temp.tempFilePath || temp.path, waterData)
151
163
  )
152
164
  ).then((uploadRes) => {
153
165
  wx.hideLoading();
@@ -184,6 +196,43 @@ Component({
184
196
  platform,
185
197
  };
186
198
  },
199
+ /** 上传水印照片 */
200
+ async uploadWaterFile(
201
+ path,
202
+ data = {},
203
+ url = "core/file/upload/multiV2",
204
+ baseUrl = "https://gateway.tanjiu.cn/",
205
+ ) {
206
+ return new Promise((reslove, reject) => {
207
+ let fullUrl = baseUrl + url;
208
+ wx.showLoading("上传中");
209
+ wx.uploadFile({
210
+ url: fullUrl,
211
+ filePath: path,
212
+ name: "file",
213
+ formData: data,
214
+ header: {
215
+ "Content-Type": "multipart/form-data",
216
+ "wow-token": "c9fbecb5fdeecb78e8745db9225d88e1",
217
+ },
218
+ success: (res) => {
219
+ let result = JSON.parse(res.data);
220
+ if (result.code == "0000") {
221
+ reslove(result.data[0]);
222
+ } else {
223
+ reject(result.msg)
224
+ }
225
+ },
226
+ fail: (err) => {
227
+ wx.showToast({
228
+ title: '上传失败',
229
+ icon: "error",
230
+ })
231
+ reject(err);
232
+ },
233
+ });
234
+ });
235
+ },
187
236
  // 上传文件
188
237
  uploadImage_v(filePaths) {
189
238
  return new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtdev/xt-miniprogram-ui",
3
- "version": "1.2.74",
3
+ "version": "1.2.76",
4
4
  "description": "",
5
5
  "miniprogram": "libs",
6
6
  "publishConfig": {