From 2a9081c7d9463b9e0d5d557cea6087cfcbacdfa4 Mon Sep 17 00:00:00 2001 From: Karson <karsonzhang@163.com> Date: Sun, 23 Apr 2017 12:25:41 +0800 Subject: [PATCH] 移除后台无关的JS文件 修复上传链接错误 --- public/assets/js/backend/cover.js | 53 ----------------------------------------------------- public/assets/js/backend/editor.js | 57 --------------------------------------------------------- public/assets/js/backend/general/attachment.js | 19 ++++++++++++++++--- public/assets/js/backend/help.js | 61 ------------------------------------------------------------- public/assets/js/backend/item.js | 60 ------------------------------------------------------------ public/assets/js/backend/order.js | 111 --------------------------------------------------------------------------------------------------------------- 6 files changed, 16 insertions(+), 345 deletions(-) delete mode 100644 public/assets/js/backend/cover.js delete mode 100644 public/assets/js/backend/editor.js delete mode 100644 public/assets/js/backend/help.js delete mode 100644 public/assets/js/backend/item.js delete mode 100644 public/assets/js/backend/order.js diff --git a/public/assets/js/backend/cover.js b/public/assets/js/backend/cover.js deleted file mode 100644 index 5108b9a..0000000 --- a/public/assets/js/backend/cover.js +++ /dev/null @@ -1,53 +0,0 @@ -define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) { - - var Controller = { - index: function () { - // 初始化表格参数配置 - Table.api.init({ - extend: { - index_url: 'cover/index', - add_url: 'cover/add', - edit_url: 'cover/edit', - del_url: 'cover/del', - multi_url: 'cover/multi', - } - }); - - var table = $("#table"); - - // 初始化表格 - table.bootstrapTable({ - url: $.fn.bootstrapTable.defaults.extend.index_url, - sortName: 'weigh', - columns: [ - [ - {field: 'state', checkbox: true, }, - {field: 'id', title: __('Id')}, - {field: 'class', title: __('Class')}, - {field: 'design', title: __('Design')}, - {field: 'weigh', title: __('Weigh')}, - {field: 'status', title: __('Status'), formatter: Table.api.formatter.status}, - {field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: Table.api.formatter.operate} - ] - ] - }); - - // 为表格绑定事件 - Table.api.bindevent(table); - - }, - add: function () { - Controller.api.bindevent(); - }, - edit: function () { - Controller.api.bindevent(); - }, - api: { - bindevent: function () { - Form.api.bindevent($("form[role=form]")); - } - } - - }; - return Controller; -}); \ No newline at end of file diff --git a/public/assets/js/backend/editor.js b/public/assets/js/backend/editor.js deleted file mode 100644 index fd43122..0000000 --- a/public/assets/js/backend/editor.js +++ /dev/null @@ -1,57 +0,0 @@ -define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) { - - var Controller = { - index: function () { - // 初始化表格参数配置 - Table.api.init({ - extend: { - index_url: 'editor/index', - add_url: 'editor/add', - edit_url: 'editor/edit', - del_url: 'editor/del', - multi_url: 'editor/multi', - } - }); - - var table = $("#table"); - - // 初始化表格 - table.bootstrapTable({ - url: $.fn.bootstrapTable.defaults.extend.index_url, - sortName: 'id', - columns: [ - [ - {field: 'state', checkbox: true, }, -{field: 'id', title: __('Id')}, -{field: 'name', title: __('Name')}, -{field: 'wxid', title: __('Wxid')}, -{field: 'qrcode', title: __('Qrcode')}, -{field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime}, -{field: 'friends', title: __('Friends')}, -{field: 'city', title: __('City')}, -{field: 'avatar', title: __('Avatar')}, -{field: 'status', title: __('Status'), formatter: Table.api.formatter.status}, -{field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: Table.api.formatter.operate} - ] - ] - }); - - // 为表格绑定事件 - Table.api.bindevent(table); - - }, - add: function () { - Controller.api.bindevent(); - }, - edit: function () { - Controller.api.bindevent(); - }, - api: { - bindevent: function () { - Form.api.bindevent($("form[role=form]")); - } - } - - }; - return Controller; -}); \ No newline at end of file diff --git a/public/assets/js/backend/general/attachment.js b/public/assets/js/backend/general/attachment.js index 3d3ca5d..51ec4fa 100644 --- a/public/assets/js/backend/general/attachment.js +++ b/public/assets/js/backend/general/attachment.js @@ -1,4 +1,4 @@ -define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) { +define(['jquery', 'bootstrap', 'backend', 'form', 'table', 'config'], function ($, undefined, Backend, Form, Table, Config) { var Controller = { index: function () { @@ -24,14 +24,14 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin [ {field: 'state', checkbox: true, }, {field: 'id', title: __('Id')}, - {field: 'url', title: __('Url'), formatter: Table.api.formatter.url}, + {field: 'url', title: __('Preview'), formatter: Controller.api.formatter.thumb}, + {field: 'url', title: __('Url'), formatter: Controller.api.formatter.url}, {field: 'imagewidth', title: __('Imagewidth')}, {field: 'imageheight', title: __('Imageheight')}, {field: 'imagetype', title: __('Imagetype')}, {field: 'imageframes', title: __('Imageframes')}, {field: 'filesize', title: __('Filesize')}, {field: 'mimetype', title: __('Mimetype')}, - {field: 'extparam', title: __('Extparam')}, {field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime}, {field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: Table.api.formatter.operate} ] @@ -51,6 +51,19 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); + }, + formatter: { + thumb: function (value, row, index) { + console.log(row); + if (row.mimetype.indexOf("image") > -1) { + return '<a href="' + Config.upload.cdnurl + value + '" target="_blank"><img src="' + Config.upload.cdnurl + value + '!/fwfh/50x50" alt=""></a>'; + } else { + return '无'; + } + }, + url: function (value, row, index) { + return '<a href="' + Config.upload.cdnurl + value + '" target="_blank" class="label bg-green">' + value + '</a>'; + }, } } diff --git a/public/assets/js/backend/help.js b/public/assets/js/backend/help.js deleted file mode 100644 index d025b90..0000000 --- a/public/assets/js/backend/help.js +++ /dev/null @@ -1,61 +0,0 @@ -define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) { - - var Controller = { - index: function () { - // 初始化表格参数配置 - Table.api.init({ - extend: { - index_url: 'help/index', - add_url: 'help/add', - edit_url: 'help/edit', - del_url: 'help/del', - multi_url: 'help/multi', - } - }); - - var table = $("#table"); - - // 初始化表格 - table.bootstrapTable({ - url: $.fn.bootstrapTable.defaults.extend.index_url, - sortName: 'weigh', - columns: [ - [ - {field: 'state', checkbox: true, }, - {field: 'id', title: __('Id')}, - {field: 'category_id', title: __('Category_id')}, - {field: 'title', title: __('Title')}, - {field: 'keywords', title: __('Keywords')}, - {field: 'description', title: __('Description')}, - {field: 'intro', title: __('Intro')}, - {field: 'image', title: __('Image'), formatter: Table.api.formatter.image}, - {field: 'flag', title: __('Flag')}, - {field: 'outlink', title: __('Outlink')}, - {field: 'views', title: __('Views')}, - {field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime}, - {field: 'weigh', title: __('Weigh')}, - {field: 'status', title: __('Status'), formatter: Table.api.formatter.status}, - {field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: Table.api.formatter.operate} - ] - ] - }); - - // 为表格绑定事件 - Table.api.bindevent(table); - - }, - add: function () { - Controller.api.bindevent(); - }, - edit: function () { - Controller.api.bindevent(); - }, - api: { - bindevent: function () { - Form.api.bindevent($("form[role=form]")); - } - } - - }; - return Controller; -}); \ No newline at end of file diff --git a/public/assets/js/backend/item.js b/public/assets/js/backend/item.js deleted file mode 100644 index 8f94e4e..0000000 --- a/public/assets/js/backend/item.js +++ /dev/null @@ -1,60 +0,0 @@ -define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) { - - var Controller = { - index: function () { - // 初始化表格参数配置 - Table.api.init({ - extend: { - index_url: 'item/index', - add_url: 'item/add', - edit_url: 'item/edit', - del_url: 'item/del', - multi_url: 'item/multi', - } - }); - - var table = $("#table"); - - // 初始化表格 - table.bootstrapTable({ - url: $.fn.bootstrapTable.defaults.extend.index_url, - sortName: 'id', - columns: [ - [ - {field: 'state', checkbox: true, }, - {field: 'id', title: __('Id')}, - {field: 'user_id', title: __('User_id')}, - {field: 'book_id', title: __('Book_id')}, - {field: 'origin_id', title: __('Origin_id')}, - {field: 'type', title: __('Type')}, - {field: 'year', title: __('Year')}, - {field: 'month', title: __('Month')}, - {field: 'recycles', title: __('Recycles')}, - {field: 'content', title: __('Content')}, - {field: 'deletetime', title: __('Deletetime'), formatter: Table.api.formatter.datetime}, - {field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime}, - {field: 'status', title: __('Status'), formatter: Table.api.formatter.status}, - {field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: Table.api.formatter.operate} - ] - ] - }); - - // 为表格绑定事件 - Table.api.bindevent(table); - - }, - add: function () { - Controller.api.bindevent(); - }, - edit: function () { - Controller.api.bindevent(); - }, - api: { - bindevent: function () { - Form.api.bindevent($("form[role=form]")); - } - } - - }; - return Controller; -}); \ No newline at end of file diff --git a/public/assets/js/backend/order.js b/public/assets/js/backend/order.js deleted file mode 100644 index a28853a..0000000 --- a/public/assets/js/backend/order.js +++ /dev/null @@ -1,111 +0,0 @@ -define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) { - - var Controller = { - index: function () { - // 初始化表格参数配置 - Table.api.init({ - extend: { - index_url: 'order/index', - add_url: 'order/add', - edit_url: 'order/edit', - del_url: 'order/del', - multi_url: 'order/multi', - } - }); - - var table = $("#table"); - - // 初始化表格 - table.bootstrapTable({ - url: $.fn.bootstrapTable.defaults.extend.index_url, - sortName: 'id', - columns: [ - [ - {field: 'state', checkbox: true, }, - {field: 'id', title: __('Id')}, - {field: 'user_id', title: __('User_id')}, - {field: 'book_id', title: __('Book_id')}, - {field: 'title', title: __('Title')}, - {field: 'author', title: __('Author')}, - {field: 'amount', title: __('Amount')}, - {field: 'saleamount', title: __('Saleamount')}, - {field: 'nums', title: __('Nums')}, - {field: 'payamount', title: __('Payamount')}, - {field: 'paytime', title: __('Paytime'), formatter: Table.api.formatter.datetime}, - {field: 'paytype', title: __('Paytype')}, - {field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime}, - {field: 'status', title: __('Status'), formatter: Controller.api.formatter.status}, - {field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: Table.api.formatter.operate} - ] - ] - }); - - // 为表格绑定事件 - Table.api.bindevent(table); - - $(document).on('click', '.btn-filter-paid', function () { - table.bootstrapTable('refresh', {query: {filter: JSON.stringify({status: 'paid'}), op: JSON.stringify({status: '='})}}); - }); - - }, - add: function () { - Controller.api.bindevent(); - }, - edit: function () { - Controller.api.bindevent(); - }, - volume: function () { - Controller.api.bindevent(); - - require(['angular', 'angular-app', 'angular-ui-select', 'ngcontrol/volume'], function (angular, app, printapp) { - angular.bootstrap(document, ["ui.select", "App"]); - }); - }, - print: function () { - require(['frontend-ebook'], function (Ebook) { - window.imageLoaded = Ebook.imageLoaded; - $(".ebook_container").on("load", "img", function () { - $(this).parent().removeClass('img_loading'); - }); - require(['angular', 'angular-app', 'ngcontrol/preface', 'ngcontrol/preview'], function (angular, app) { - angular.bootstrap(document, ["App"]); - }); - }); - }, - api: { - bindevent: function () { - Form.api.bindevent($("form[role=form]")); - - $(document).bind("change", "input[name='row[status]']", function(){ - $("#expressdom").toggleClass("hidden", ['created', 'paid', 'printing', 'deleted'].indexOf($("input[name='row[status]']:checked").val())>-1); - }); - }, - formatter: { - icon: function (value, row, index) { - //渲染fontawesome图标 - return '<i class="fa fa-' + value + '"></i> ' + value; - }, - status: function (value, row, index) { - //渲染状态 - var html = ''; - if (value == 'created') { - html = '<span class="text-purple"><i class="fa fa-circle"></i> ' + __('Created') + '</span>'; - } else if (value == 'paid') { - html = '<a href="/order/volume/ids/' + row['id'] + '" class="btn btn-danger btn-xs btn-dialog" title="' + __('Print') + '"><i class="fa fa-print"></i> ' + __('Paid,Print Now') + '</a>'; - } else if (value == 'printing') { - html = '<span class="text-warning"><i class="fa fa-print"></i> ' + __('Printing') + '</span>'; - } else if (value == 'delivered') { - html = '<span class="text-success"><i class="fa fa-circle"></i> ' + __('Delivered') + '</span>'; - } else if (value == 'finished') { - html = '<span class="text-info"><i class="fa fa-ok"></i> ' + __('Finished') + '</span>'; - } else if (value == 'deleted') { - html = '<span class="text-maroon"><i class="fa fa-remove"></i> ' + __('Deleted') + '</span>'; - } - return html; - }, - } - } - - }; - return Controller; -}); \ No newline at end of file -- libgit2 0.24.0