123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
-
- UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
- UE.Editor.prototype.getActionUrl = function(action) {
-
- if (action == 'uploadimage' || action == 'uploadscrawl') {
- return 'https://upload.qiniup.com';
- } else if (action == 'uploadvideo') {
- return 'https://upload.qiniup.com';
- } else {
- return this._bkGetActionUrl.call(this, action);
- }
- }
-
-
- window.UEDITOR_CONFIG['imageUploadService'] = function(context, editor) {
- return {
-
-
- setUploadData: function(file) {
- return file;
- },
-
-
- setFormData: function(object, data, headers) {
-
- var date = new Date()
- var ext = object.file.source.ext;
- var uid = object.file.source.uid;
- var key = "" + date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours() + date.getMinutes() + date.getSeconds() +'_oi_' + uid + '.' + ext;
-
-
- $.ajax({
- url: editor.getOpt('uptokenUrl'),
- type: 'get',
- async:false,
- }).done(function(res) {
- if (res.state == 1) {
- data['token'] = res.data.uptoken;
- data['key'] = key;
- }
-
- }).fail(function(err) {
-
- });
-
- console.log(object, data, headers)
-
-
-
- return data;
- },
-
-
- setUploaderOptions: function(uploader) {
- return uploader;
- },
-
-
- getResponseSuccess: function(res) {
- return res.state == "SUCCESS";
- },
-
-
- imageSrcField: 'url'
- }
- };
-
-
- window.UEDITOR_CONFIG['videoUploadService'] = function(context, editor) {
- return {
-
-
- setUploadData: function(file) {
- return file;
- },
-
-
- setFormData: function(object, data, headers) {
- var date = new Date()
- var ext = object.file.source.ext;
- var uid = object.file.source.uid;
- var key = "" + date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours() + date.getMinutes() + date.getSeconds() +'_oi_' + uid + '.' + ext;
-
-
- $.ajax({
- url: editor.getOpt('uptokenUrl'),
- type: 'get',
- async:false,
- }).done(function(res) {
- if (res.state == 1) {
- data['token'] = res.data.uptoken;
- data['key'] = key;
- }
-
- }).fail(function(err) {
-
- });
-
- return data;
- },
-
-
- setUploaderOptions: function(uploader) {
- return uploader;
- },
-
-
- getResponseSuccess: function(res) {
- return res.state == "SUCCESS";
-
- },
-
-
- videoSrcField: 'url'
- }
- };
-
-
- window.UEDITOR_CONFIG['scrawlUploadService'] = function(context, editor) {
- return scrawlUploadService = {
-
-
-
-
-
- uploadScraw: function(file, base64, success, fail) {
-
-
- var formData = new FormData();
- formData.append('file', file, file.name);
-
- $.ajax({
- url: editor.getActionUrl(editor.getOpt('scrawlActionName')),
- type: 'POST',
-
- contentType: false,
-
- processData: false,
- data: formData
- }).done(function(res) {
- var res = JSON.parse(res);
-
-
- res.responseSuccess = res.code == 200;
-
-
-
- res.scrawlSrcField = 'url';
-
-
- success.call(context, res);
- }).fail(function(err) {
-
- fail.call(context, err);
- });
- }
- }
- }
-
-
- window.UEDITOR_CONFIG['fileUploadService'] = function(context, editor) {
- return {
-
-
- setUploadData: function(file) {
- return file;
- },
-
-
- setFormData: function(object, data, headers) {
- return data;
- },
-
-
- setUploaderOptions: function(uploader) {
- return uploader;
- },
-
-
- getResponseSuccess: function(res) {
- return res.code == 200;
- },
-
-
- fileSrcField: 'url'
- }
- };
|