define([], function () { require.config({ paths: { 'editable': '../libs/bootstrap-table/dist/extensions/editable/bootstrap-table-editable.min', 'x-editable': '../addons/editable/js/bootstrap-editable.min', }, shim: { 'editable': { deps: ['x-editable', 'bootstrap-table'] }, "x-editable": { deps: ["css!../addons/editable/css/bootstrap-editable.css"], } } }); if ($("table.table").size() > 0) { require(['editable', 'table'], function (Editable, Table) { $.fn.bootstrapTable.defaults.onEditableSave = function (field, row, oldValue, $el) { var data = {}; data["row[" + field + "]"] = row[field]; Fast.api.ajax({ url: this.extend.edit_url + "/ids/" + row[this.pk], data: data }); }; }); } require.config({ paths: { 'async': '../addons/example/js/async', 'BMap': ['//api.map.baidu.com/api?v=2.0&ak='], }, shim: { 'BMap': { deps: ['jquery'], exports: 'BMap' } } }); require([], function () { //绑定data-toggle=importguide属性点击事件 $(document).on('click', "[data-toggle='importguide']", function () { var that = this; var callback = $(that).data('callback'); var table = $(that).data("table") ? $(that).data("table") : ""; var update = $(that).data("update") ? $(that).data("update") : 0; var to = $(that).data("to") ? $(that).data("to") : 0; var url = "import/log/add"; url += (table) ? '?table=' + table : ''; url += (update) ? '&update=' + update : ''; url += (to) ? '&to=' + to : ''; Fast.api.open(url, $(that).attr('title')?$(that).attr('title'):'导入向导', { area:['95%', '90%'], callback: function (res) { try { //执行回调函数 if (typeof callback === 'function') { callback.call(that, res); } } catch (e) { } } }); }); }); require.config({ paths: { 'simditor': '../addons/simditor/js/simditor.min', }, shim: { 'simditor': [ 'css!../addons/simditor/css/simditor.min.css' ] } }); require(['form'], function (Form) { var _bindevent = Form.events.bindevent; Form.events.bindevent = function (form) { _bindevent.apply(this, [form]); if ($(".editor", form).size() > 0) { //修改上传的接口调用 require(['upload', 'simditor'], function (Upload, Simditor) { var editor, mobileToolbar, toolbar; Simditor.locale = 'zh-CN'; Simditor.list = {}; toolbar = ['title', 'bold', 'italic', 'underline', 'strikethrough', 'fontScale', 'color', '|', 'ol', 'ul', 'blockquote', 'code', 'table', '|', 'link', 'image', 'hr', '|', 'indent', 'outdent', 'alignment']; mobileToolbar = ["bold", "underline", "strikethrough", "color", "ul", "ol"]; $(".editor", form).each(function () { var id = $(this).attr("id"); editor = new Simditor({ textarea: this, toolbarFloat: false, toolbar: toolbar, pasteImage: true, defaultImage: Config.__CDN__ + '/assets/addons/simditor/images/image.png', upload: {url: '/'} }); editor.uploader.on('beforeupload', function (e, file) { Upload.api.send(file.obj, function (data) { var url = Fast.api.cdnurl(data.url); editor.uploader.trigger("uploadsuccess", [file, {success: true, file_path: url}]); }); return false; }); editor.on("blur", function () { this.textarea.trigger("blur"); }); Simditor.list[id] = editor; }); }); } } }); });