2 Commitit

Tekijä SHA1 Viesti Päivämäärä
  Roxas e8f9c7967e run build 4 vuotta sitten
  Roxas e6f4c20aa9 fix: UploadToOss改为props注入,删除掉winow.oss的调用依赖 4 vuotta sitten

+ 1
- 1
lib/components/AudioPlayer/index.js.map
File diff suppressed because it is too large
Näytä tiedosto


+ 30
- 25
lib/components/Editor/Upload.js Näytä tiedosto

@@ -68,30 +68,35 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
68 68
 
69 69
 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
70 70
 
71
-var client = function client(oss) {
72
-  return new window.OSS.Wrapper({
73
-    accessKeyId: oss.access_key_id,
74
-    accessKeySecret: oss.access_key_secret,
75
-    stsToken: oss.security_token,
76
-    endpoint: _constant.OSS_ENDPOINT, //常量,你可以自己定义
77
-    bucket: _constant.OSS_BUCKET
78
-  });
79
-};
80
-
81
-var uploadPath = function uploadPath(path, file) {
82
-  return path + "/" + (0, _dayjs2.default)().format("YYYYMMDD") + "/" + _shortid2.default.generate() + "." + file.type.split("/")[1];
83
-};
84
-
85
-var UploadToOss = function UploadToOss(oss, path, file) {
86
-  var url = uploadPath(path, file);
87
-  return new Promise(function (resolve, reject) {
88
-    client(oss).multipartUpload(url, file).then(function (data) {
89
-      resolve(data);
90
-    }).catch(function (error) {
91
-      reject(error);
92
-    });
93
-  });
94
-};
71
+// const client = oss => {
72
+//   return new window.OSS.Wrapper({
73
+//     accessKeyId: oss.access_key_id,
74
+//     accessKeySecret: oss.access_key_secret,
75
+//     stsToken: oss.security_token,
76
+//     endpoint: OSS_ENDPOINT, //常量,你可以自己定义
77
+//     bucket: OSS_BUCKET
78
+//   });
79
+// };
80
+
81
+// const uploadPath = (path, file) => {
82
+//   return `${path}/${dayjs().format("YYYYMMDD")}/${shortid.generate()}.${
83
+//     file.type.split("/")[1]
84
+//   }`;
85
+// };
86
+
87
+// const UploadToOss = (oss, path, file) => {
88
+//   const url = uploadPath(path, file);
89
+//   return new Promise((resolve, reject) => {
90
+//     client(oss)
91
+//       .multipartUpload(url, file)
92
+//       .then(data => {
93
+//         resolve(data);
94
+//       })
95
+//       .catch(error => {
96
+//         reject(error);
97
+//       });
98
+//   });
99
+// };
95 100
 
96 101
 var App = function (_React$Component) {
97 102
   _inherits(App, _React$Component);
@@ -163,7 +168,7 @@ var App = function (_React$Component) {
163 168
       reader.onloadend = function () {
164 169
         info.onProgress({ percent: 20 });
165 170
         // DRIVER_LICENSE_PATH oss 的存储路径位置
166
-        UploadToOss(_this2.props.app.oss, _constant.DRIVER_LICENSE_PATH, file).then(function (data) {
171
+        _this2.props.app.UploadToOss(_this2.props.app.oss, _constant.DRIVER_LICENSE_PATH, file).then(function (data) {
167 172
           info.onProgress({ percent: 100 });
168 173
           info.onSuccess(data);
169 174
           _this2.props.onUpload({ path: data.name, uid: file.uid });

+ 1
- 1
lib/components/Editor/Upload.js.map
File diff suppressed because it is too large
Näytä tiedosto


+ 30
- 26
lib/components/Editor/index.js Näytä tiedosto

@@ -90,31 +90,35 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
90 90
 
91 91
 var TextArea = _input2.default.TextArea;
92 92
 
93
-
94
-var client = function client(oss) {
95
-  return new window.OSS.Wrapper({
96
-    accessKeyId: oss.access_key_id,
97
-    accessKeySecret: oss.access_key_secret,
98
-    stsToken: oss.security_token,
99
-    endpoint: _constant.OSS_ENDPOINT, //常量,你可以自己定义
100
-    bucket: _constant.OSS_BUCKET
101
-  });
102
-};
103
-
104
-var uploadPath = function uploadPath(path, file) {
105
-  return path + "/" + (0, _dayjs2.default)().format("YYYYMMDD") + "/" + _shortid2.default.generate() + "." + file.type.split("/")[1];
106
-};
107
-
108
-var UploadToOss = function UploadToOss(oss, path, file) {
109
-  var url = uploadPath(path, file);
110
-  return new Promise(function (resolve, reject) {
111
-    client(oss).multipartUpload(url, file).then(function (data) {
112
-      resolve(data);
113
-    }).catch(function (error) {
114
-      reject(error);
115
-    });
116
-  });
117
-};
93
+// const client = oss => {
94
+//   return new window.OSS.Wrapper({
95
+//     accessKeyId: oss.access_key_id,
96
+//     accessKeySecret: oss.access_key_secret,
97
+//     stsToken: oss.security_token,
98
+//     endpoint: OSS_ENDPOINT, //常量,你可以自己定义
99
+//     bucket: OSS_BUCKET
100
+//   });
101
+// };
102
+
103
+// const uploadPath = (path, file) => {
104
+//   return `${path}/${dayjs().format("YYYYMMDD")}/${shortid.generate()}.${
105
+//     file.type.split("/")[1]
106
+//   }`;
107
+// };
108
+
109
+// const UploadToOss = (oss, path, file) => {
110
+//   const url = uploadPath(path, file);
111
+//   return new Promise((resolve, reject) => {
112
+//     client(oss)
113
+//       .multipartUpload(url, file)
114
+//       .then(data => {
115
+//         resolve(data);
116
+//       })
117
+//       .catch(error => {
118
+//         reject(error);
119
+//       });
120
+//   });
121
+// };
118 122
 
119 123
 var Editor = function (_React$Component) {
120 124
   _inherits(Editor, _React$Component);
@@ -313,7 +317,7 @@ var Editor = function (_React$Component) {
313 317
       reader.readAsDataURL(file);
314 318
       reader.onloadend = function () {
315 319
         // DRIVER_LICENSE_PATH oss 的存储路径位置
316
-        UploadToOss(_this2.props.app.oss, _constant.DRIVER_LICENSE_PATH, file).then(function (data) {
320
+        _this2.props.app.UploadToOss(_this2.props.app.oss, _constant.DRIVER_LICENSE_PATH, file).then(function (data) {
317 321
           var fileList = _this2.state.fileList.concat({
318 322
             url: _constant.OSS_LINK + data.name,
319 323
             thumbUrl: _constant.OSS_LINK + data.name,

+ 1
- 1
lib/components/Editor/index.js.map
File diff suppressed because it is too large
Näytä tiedosto


+ 0
- 2
lib/constant.js Näytä tiedosto

@@ -7,8 +7,6 @@ var ERROR_DEFAULT = exports.ERROR_DEFAULT = "出错了!";
7 7
 
8 8
 var LIMIT = exports.LIMIT = 10; // 默认 limit
9 9
 
10
-var OSS_ENDPOINT = exports.OSS_ENDPOINT = "oss-cn-beijing.aliyuncs.com";
11
-var OSS_BUCKET = exports.OSS_BUCKET = "links-comment";
12 10
 var DRIVER_LICENSE_PATH = exports.DRIVER_LICENSE_PATH = "/comment";
13 11
 
14 12
 var OSS_LINK = exports.OSS_LINK = "//links-comment.oss-cn-beijing.aliyuncs.com";

+ 1
- 1
lib/constant.js.map Näytä tiedosto

@@ -1 +1 @@
1
-{"version":3,"sources":["../src/constant.js"],"names":["ERROR_DEFAULT","LIMIT","OSS_ENDPOINT","OSS_BUCKET","DRIVER_LICENSE_PATH","OSS_LINK","MAX_UPLOAD_NUMBER","URL_REGEXP","REGEXP","AVATAR","IMAGE_SPLIT","IMAGE_PROCESS","IMAGE_PROCESS_SMALL","IMAGE_PROCESS_LARGE","COMMENT_TYPE","COMMENT","REPLY","LANGUAGE_LINK","process","env","NODE_ENV"],"mappings":";;;;;AAAO,IAAMA,wCAAgB,MAAtB;;AAEA,IAAMC,wBAAQ,EAAd,C,CAAkB;;AAElB,IAAMC,sCAAe,6BAArB;AACA,IAAMC,kCAAa,eAAnB;AACA,IAAMC,oDAAsB,UAA5B;;AAEA,IAAMC,8BAAW,6CAAjB;;AAEA,IAAMC,gDAAoB,CAA1B;;AAEA,IAAMC,kCAAa,oGAAnB;;AAEA,IAAMC,0BAAS,eAAf;;AAEA,IAAMC,0BAAS,EAAf;;AAEA,IAAMC,oCAAc,aAApB;;AAEA,IAAMC,wCAAgB,mCAAtB;AACA,IAAMC,oDAAsB,mCAA5B;AACA,IAAMC,oDAAsB,mCAA5B;;AAEA,IAAMC,sCAAe;AAC1BC,WAAS,SADiB;AAE1BC,SAAO;AAFmB,CAArB;;AAKP;AACO,IAAMC,wCACXC,QAAQC,GAAR,CAAYC,QAAZ,KAAyB,YAAzB,GACI,sBADJ,GAEI,uBAHC","file":"constant.js","sourcesContent":["export const ERROR_DEFAULT = \"出错了!\";\n\nexport const LIMIT = 10; // 默认 limit\n\nexport const OSS_ENDPOINT = \"oss-cn-beijing.aliyuncs.com\";\nexport const OSS_BUCKET = \"links-comment\";\nexport const DRIVER_LICENSE_PATH = \"/comment\";\n\nexport const OSS_LINK = \"//links-comment.oss-cn-beijing.aliyuncs.com\";\n\nexport const MAX_UPLOAD_NUMBER = 4;\n\nexport const URL_REGEXP = /((http(s)?:)?\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g;\n\nexport const REGEXP = /\\[[^[\\]]+?\\]/g;\n\nexport const AVATAR = \"\";\n\nexport const IMAGE_SPLIT = \"IMAGE_SPLIT\";\n\nexport const IMAGE_PROCESS = \"?x-oss-process=image/resize,h_350\";\nexport const IMAGE_PROCESS_SMALL = \"?x-oss-process=image/resize,h_100\";\nexport const IMAGE_PROCESS_LARGE = \"?x-oss-process=image/resize,h_500\";\n\nexport const COMMENT_TYPE = {\n  COMMENT: \"comment\",\n  REPLY: \"reply\"\n};\n\n// 线上静态库地址\nexport const LANGUAGE_LINK =\n  process.env.NODE_ENV === \"production\"\n    ? \"//a.links123.cn/lang\"\n    : \"//a.links123.net/lang\";\n"]}
1
+{"version":3,"sources":["../src/constant.js"],"names":["ERROR_DEFAULT","LIMIT","DRIVER_LICENSE_PATH","OSS_LINK","MAX_UPLOAD_NUMBER","URL_REGEXP","REGEXP","AVATAR","IMAGE_SPLIT","IMAGE_PROCESS","IMAGE_PROCESS_SMALL","IMAGE_PROCESS_LARGE","COMMENT_TYPE","COMMENT","REPLY","LANGUAGE_LINK","process","env","NODE_ENV"],"mappings":";;;;;AAAO,IAAMA,wCAAgB,MAAtB;;AAEA,IAAMC,wBAAQ,EAAd,C,CAAkB;;AAElB,IAAMC,oDAAsB,UAA5B;;AAEA,IAAMC,8BAAW,6CAAjB;;AAEA,IAAMC,gDAAoB,CAA1B;;AAEA,IAAMC,kCAAa,oGAAnB;;AAEA,IAAMC,0BAAS,eAAf;;AAEA,IAAMC,0BAAS,EAAf;;AAEA,IAAMC,oCAAc,aAApB;;AAEA,IAAMC,wCAAgB,mCAAtB;AACA,IAAMC,oDAAsB,mCAA5B;AACA,IAAMC,oDAAsB,mCAA5B;;AAEA,IAAMC,sCAAe;AAC1BC,WAAS,SADiB;AAE1BC,SAAO;AAFmB,CAArB;;AAKP;AACO,IAAMC,wCACXC,QAAQC,GAAR,CAAYC,QAAZ,KAAyB,YAAzB,GACI,sBADJ,GAEI,uBAHC","file":"constant.js","sourcesContent":["export const ERROR_DEFAULT = \"出错了!\";\n\nexport const LIMIT = 10; // 默认 limit\n\nexport const DRIVER_LICENSE_PATH = \"/comment\";\n\nexport const OSS_LINK = \"//links-comment.oss-cn-beijing.aliyuncs.com\";\n\nexport const MAX_UPLOAD_NUMBER = 4;\n\nexport const URL_REGEXP = /((http(s)?:)?\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g;\n\nexport const REGEXP = /\\[[^[\\]]+?\\]/g;\n\nexport const AVATAR = \"\";\n\nexport const IMAGE_SPLIT = \"IMAGE_SPLIT\";\n\nexport const IMAGE_PROCESS = \"?x-oss-process=image/resize,h_350\";\nexport const IMAGE_PROCESS_SMALL = \"?x-oss-process=image/resize,h_100\";\nexport const IMAGE_PROCESS_LARGE = \"?x-oss-process=image/resize,h_500\";\n\nexport const COMMENT_TYPE = {\n  COMMENT: \"comment\",\n  REPLY: \"reply\"\n};\n\n// 线上静态库地址\nexport const LANGUAGE_LINK =\n  process.env.NODE_ENV === \"production\"\n    ? \"//a.links123.cn/lang\"\n    : \"//a.links123.net/lang\";\n"]}

+ 4
- 4
lib/version.json Näytä tiedosto

@@ -1,8 +1,8 @@
1 1
 {
2 2
     "name":       "comment",
3
-    "buildDate":  1588435719936,
3
+    "buildDate":  1594135597777,
4 4
     "version":    "1.0.4",
5
-    "numCommits": 215,
6
-    "hash":       "7d03c9b",
7
-    "dirty":      true
5
+    "numCommits": 217,
6
+    "hash":       "e6f4c20",
7
+    "dirty":      false
8 8
 }

+ 30
- 34
src/components/Editor/Upload.js Näytä tiedosto

@@ -3,44 +3,39 @@ import { Upload, Icon, Modal, message, Spin } from "antd";
3 3
 import dayjs from "dayjs";
4 4
 import shortid from "shortid";
5 5
 import intl from "react-intl-universal";
6
-import {
7
-  OSS_ENDPOINT,
8
-  OSS_BUCKET,
9
-  DRIVER_LICENSE_PATH,
10
-  ERROR_DEFAULT
11
-} from "../../constant";
6
+import { DRIVER_LICENSE_PATH, ERROR_DEFAULT } from "../../constant";
12 7
 import Comment from "../../Comment";
13 8
 import "./Upload.css";
14 9
 
15
-const client = oss => {
16
-  return new window.OSS.Wrapper({
17
-    accessKeyId: oss.access_key_id,
18
-    accessKeySecret: oss.access_key_secret,
19
-    stsToken: oss.security_token,
20
-    endpoint: OSS_ENDPOINT, //常量,你可以自己定义
21
-    bucket: OSS_BUCKET
22
-  });
23
-};
10
+// const client = oss => {
11
+//   return new window.OSS.Wrapper({
12
+//     accessKeyId: oss.access_key_id,
13
+//     accessKeySecret: oss.access_key_secret,
14
+//     stsToken: oss.security_token,
15
+//     endpoint: OSS_ENDPOINT, //常量,你可以自己定义
16
+//     bucket: OSS_BUCKET
17
+//   });
18
+// };
24 19
 
25
-const uploadPath = (path, file) => {
26
-  return `${path}/${dayjs().format("YYYYMMDD")}/${shortid.generate()}.${
27
-    file.type.split("/")[1]
28
-  }`;
29
-};
20
+// const uploadPath = (path, file) => {
21
+//   return `${path}/${dayjs().format("YYYYMMDD")}/${shortid.generate()}.${
22
+//     file.type.split("/")[1]
23
+//   }`;
24
+// };
30 25
 
31
-const UploadToOss = (oss, path, file) => {
32
-  const url = uploadPath(path, file);
33
-  return new Promise((resolve, reject) => {
34
-    client(oss)
35
-      .multipartUpload(url, file)
36
-      .then(data => {
37
-        resolve(data);
38
-      })
39
-      .catch(error => {
40
-        reject(error);
41
-      });
42
-  });
43
-};
26
+// const UploadToOss = (oss, path, file) => {
27
+//   const url = uploadPath(path, file);
28
+//   return new Promise((resolve, reject) => {
29
+//     client(oss)
30
+//       .multipartUpload(url, file)
31
+//       .then(data => {
32
+//         resolve(data);
33
+//       })
34
+//       .catch(error => {
35
+//         reject(error);
36
+//       });
37
+//   });
38
+// };
44 39
 
45 40
 class App extends React.Component {
46 41
   constructor(props) {
@@ -94,7 +89,8 @@ class App extends React.Component {
94 89
     reader.onloadend = () => {
95 90
       info.onProgress({ percent: 20 });
96 91
       // DRIVER_LICENSE_PATH oss 的存储路径位置
97
-      UploadToOss(this.props.app.oss, DRIVER_LICENSE_PATH, file)
92
+      this.props.app
93
+        .UploadToOss(this.props.app.oss, DRIVER_LICENSE_PATH, file)
98 94
         .then(data => {
99 95
           info.onProgress({ percent: 100 });
100 96
           info.onSuccess(data);

+ 30
- 34
src/components/Editor/index.js Näytä tiedosto

@@ -11,45 +11,40 @@ import Comment from "../../Comment";
11 11
 import { isMobile } from "./../../utils";
12 12
 import { OSS_LINK } from "../../constant";
13 13
 import { isFunction } from "../../helper";
14
-import {
15
-  OSS_ENDPOINT,
16
-  OSS_BUCKET,
17
-  DRIVER_LICENSE_PATH,
18
-  ERROR_DEFAULT
19
-} from "../../constant";
14
+import { DRIVER_LICENSE_PATH, ERROR_DEFAULT } from "../../constant";
20 15
 import "./index.css";
21 16
 
22 17
 const { TextArea } = Input;
23 18
 
24
-const client = oss => {
25
-  return new window.OSS.Wrapper({
26
-    accessKeyId: oss.access_key_id,
27
-    accessKeySecret: oss.access_key_secret,
28
-    stsToken: oss.security_token,
29
-    endpoint: OSS_ENDPOINT, //常量,你可以自己定义
30
-    bucket: OSS_BUCKET
31
-  });
32
-};
19
+// const client = oss => {
20
+//   return new window.OSS.Wrapper({
21
+//     accessKeyId: oss.access_key_id,
22
+//     accessKeySecret: oss.access_key_secret,
23
+//     stsToken: oss.security_token,
24
+//     endpoint: OSS_ENDPOINT, //常量,你可以自己定义
25
+//     bucket: OSS_BUCKET
26
+//   });
27
+// };
33 28
 
34
-const uploadPath = (path, file) => {
35
-  return `${path}/${dayjs().format("YYYYMMDD")}/${shortid.generate()}.${
36
-    file.type.split("/")[1]
37
-  }`;
38
-};
29
+// const uploadPath = (path, file) => {
30
+//   return `${path}/${dayjs().format("YYYYMMDD")}/${shortid.generate()}.${
31
+//     file.type.split("/")[1]
32
+//   }`;
33
+// };
39 34
 
40
-const UploadToOss = (oss, path, file) => {
41
-  const url = uploadPath(path, file);
42
-  return new Promise((resolve, reject) => {
43
-    client(oss)
44
-      .multipartUpload(url, file)
45
-      .then(data => {
46
-        resolve(data);
47
-      })
48
-      .catch(error => {
49
-        reject(error);
50
-      });
51
-  });
52
-};
35
+// const UploadToOss = (oss, path, file) => {
36
+//   const url = uploadPath(path, file);
37
+//   return new Promise((resolve, reject) => {
38
+//     client(oss)
39
+//       .multipartUpload(url, file)
40
+//       .then(data => {
41
+//         resolve(data);
42
+//       })
43
+//       .catch(error => {
44
+//         reject(error);
45
+//       });
46
+//   });
47
+// };
53 48
 
54 49
 class Editor extends React.Component {
55 50
   constructor(props) {
@@ -214,7 +209,8 @@ class Editor extends React.Component {
214 209
     reader.readAsDataURL(file);
215 210
     reader.onloadend = () => {
216 211
       // DRIVER_LICENSE_PATH oss 的存储路径位置
217
-      UploadToOss(this.props.app.oss, DRIVER_LICENSE_PATH, file)
212
+      this.props.app
213
+        .UploadToOss(this.props.app.oss, DRIVER_LICENSE_PATH, file)
218 214
         .then(data => {
219 215
           const fileList = this.state.fileList.concat({
220 216
             url: OSS_LINK + data.name,

+ 0
- 2
src/constant.js Näytä tiedosto

@@ -2,8 +2,6 @@ export const ERROR_DEFAULT = "出错了!";
2 2
 
3 3
 export const LIMIT = 10; // 默认 limit
4 4
 
5
-export const OSS_ENDPOINT = "oss-cn-beijing.aliyuncs.com";
6
-export const OSS_BUCKET = "links-comment";
7 5
 export const DRIVER_LICENSE_PATH = "/comment";
8 6
 
9 7
 export const OSS_LINK = "//links-comment.oss-cn-beijing.aliyuncs.com";