diff --git a/src/main/ui/static/application/apply_open_quickly.js b/src/main/ui/static/application/apply_open_quickly.js index 8c2693b82..8dda0f28b 100644 --- a/src/main/ui/static/application/apply_open_quickly.js +++ b/src/main/ui/static/application/apply_open_quickly.js @@ -90,38 +90,46 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadShopPhoto = function (file) { if (file != null) { - $scope.photoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.photoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.photoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}); + } else { + $scope.photoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.photoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.photoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; diff --git a/src/main/ui/static/application/clientAuthentication.js b/src/main/ui/static/application/clientAuthentication.js index 913f48b09..b6150c976 100644 --- a/src/main/ui/static/application/clientAuthentication.js +++ b/src/main/ui/static/application/clientAuthentication.js @@ -90,38 +90,46 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }; $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadShopPhoto = function (file) { if (file != null) { - $scope.photoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.photoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.photoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}); + } else { + $scope.photoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.photoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.photoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; @@ -176,37 +184,45 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS //audit files $scope.uploadBankFile = function (file) { if (file != null) { - $scope.bankFileProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.bankFileProgress; - $scope.partner.file.file_bank_info = resp.data.url; - }, function (resp) { - delete $scope.bankFileProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.bankFileProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + } else { + $scope.bankFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.bankFileProgress; + $scope.partner.file.file_bank_info = resp.data.url; + }, function (resp) { + delete $scope.bankFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.bankFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadCompanyFile = function (file) { if (file != null) { - $scope.companyFileProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.companyFileProgress; - $scope.partner.file.file_company_info = resp.data.url; - }, function (resp) { - delete $scope.companyFileProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.companyFileProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}); + } else { + $scope.companyFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.companyFileProgress; + $scope.partner.file.file_company_info = resp.data.url; + }, function (resp) { + delete $scope.companyFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.companyFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; diff --git a/src/main/ui/static/application/templates/apply_basicinfo.html b/src/main/ui/static/application/templates/apply_basicinfo.html index 1305c0914..d7d89784a 100644 --- a/src/main/ui/static/application/templates/apply_basicinfo.html +++ b/src/main/ui/static/application/templates/apply_basicinfo.html @@ -63,7 +63,7 @@
@@ -110,7 +110,7 @@
diff --git a/src/main/ui/static/application/templates/clientAuthentication.html b/src/main/ui/static/application/templates/clientAuthentication.html index 9e39e569e..641f22bea 100644 --- a/src/main/ui/static/application/templates/clientAuthentication.html +++ b/src/main/ui/static/application/templates/clientAuthentication.html @@ -84,7 +84,7 @@
@@ -186,7 +186,7 @@
@@ -492,7 +492,7 @@
@@ -512,7 +512,7 @@
diff --git a/src/main/ui/static/config/onedollarday/onedollarday.js b/src/main/ui/static/config/onedollarday/onedollarday.js index dd3800bd0..ba4258ced 100644 --- a/src/main/ui/static/config/onedollarday/onedollarday.js +++ b/src/main/ui/static/config/onedollarday/onedollarday.js @@ -200,7 +200,7 @@ define(['angular'], function (angular) { }; }]); - app.controller('merchantConfigDialogCtrl', ['$scope', '$http', 'Upload', 'merchant', function ($scope, $http, Upload, merchant) { + app.controller('merchantConfigDialogCtrl', ['$scope', '$http', 'Upload', 'merchant', 'commonDialog', function ($scope, $http, Upload, merchant, commonDialog) { $scope.merchant = angular.copy(merchant); $scope.save = function () { $scope.errmsg = null; @@ -219,6 +219,10 @@ define(['angular'], function (angular) { if(!file){ return; } + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + return; + } $scope.photoProgress = {value: 0}; Upload.upload({ url: '/attachment/files', diff --git a/src/main/ui/static/config/onedollarday/templates/merchant_config.html b/src/main/ui/static/config/onedollarday/templates/merchant_config.html index 56f79185f..e39e62ab0 100644 --- a/src/main/ui/static/config/onedollarday/templates/merchant_config.html +++ b/src/main/ui/static/config/onedollarday/templates/merchant_config.html @@ -10,7 +10,7 @@
diff --git a/src/main/ui/static/config/organizations/organizations.js b/src/main/ui/static/config/organizations/organizations.js index 750a5e4ca..be688acaa 100644 --- a/src/main/ui/static/config/organizations/organizations.js +++ b/src/main/ui/static/config/organizations/organizations.js @@ -108,6 +108,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { if (file == null) { return; } + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + return; + } $scope.logoProgress = {value: 0}; Upload.upload({ url: '/attachment/files', @@ -215,6 +219,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { if (file == null) { return; } + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + return; + } $scope.logoProgress = {value: 0}; Upload.upload({ url: '/attachment/files', @@ -321,6 +329,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { if (file == null) { return; } + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}); + return; + } $scope.logoProgress = {value: 0}; Upload.upload({ url: '/attachment/files', diff --git a/src/main/ui/static/config/organizations/templates/new_org.html b/src/main/ui/static/config/organizations/templates/new_org.html index f8296afb5..13eaf2fed 100644 --- a/src/main/ui/static/config/organizations/templates/new_org.html +++ b/src/main/ui/static/config/organizations/templates/new_org.html @@ -24,7 +24,7 @@

diff --git a/src/main/ui/static/config/organizations/templates/org_detail.html b/src/main/ui/static/config/organizations/templates/org_detail.html index 2140946c9..9fa311101 100644 --- a/src/main/ui/static/config/organizations/templates/org_detail.html +++ b/src/main/ui/static/config/organizations/templates/org_detail.html @@ -36,7 +36,7 @@

diff --git a/src/main/ui/static/config/organizations/templates/org_detail_parent.html b/src/main/ui/static/config/organizations/templates/org_detail_parent.html index 464290749..3464f49de 100644 --- a/src/main/ui/static/config/organizations/templates/org_detail_parent.html +++ b/src/main/ui/static/config/organizations/templates/org_detail_parent.html @@ -173,7 +173,7 @@

diff --git a/src/main/ui/static/payment/cashiers/cashier-manage.js b/src/main/ui/static/payment/cashiers/cashier-manage.js index 721f8f3fa..5982e122c 100644 --- a/src/main/ui/static/payment/cashiers/cashier-manage.js +++ b/src/main/ui/static/payment/cashiers/cashier-manage.js @@ -51,19 +51,23 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.cashier = {}; $scope.uploadPhoto = function (file) { if (file != null) { - $scope.photoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.photoProgress; - $scope.cashier.photo = resp.data.url; - }, function (resp) { - delete $scope.photoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.photoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.photoProgress; + $scope.cashier.photo = resp.data.url; + }, function (resp) { + delete $scope.photoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.save = function (form) { @@ -178,19 +182,23 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.cashier = angular.copy(cashier.data); $scope.uploadPhoto = function (file) { if (file != null) { - $scope.photoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.photoProgress; - $scope.cashier.photo = resp.data.url; - }, function (resp) { - delete $scope.photoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.photoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.photoProgress; + $scope.cashier.photo = resp.data.url; + }, function (resp) { + delete $scope.photoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.photoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.updateCashier = function (form) { diff --git a/src/main/ui/static/payment/cashiers/templates/cashier_add.html b/src/main/ui/static/payment/cashiers/templates/cashier_add.html index 070a596de..fdf0b33ee 100644 --- a/src/main/ui/static/payment/cashiers/templates/cashier_add.html +++ b/src/main/ui/static/payment/cashiers/templates/cashier_add.html @@ -71,7 +71,7 @@

diff --git a/src/main/ui/static/payment/cashiers/templates/cashier_edit.html b/src/main/ui/static/payment/cashiers/templates/cashier_edit.html index 2fae846ce..6e20bba43 100644 --- a/src/main/ui/static/payment/cashiers/templates/cashier_edit.html +++ b/src/main/ui/static/payment/cashiers/templates/cashier_edit.html @@ -59,7 +59,7 @@
diff --git a/src/main/ui/static/payment/good/good-manage.js b/src/main/ui/static/payment/good/good-manage.js index cf2324d83..d89378dca 100644 --- a/src/main/ui/static/payment/good/good-manage.js +++ b/src/main/ui/static/payment/good/good-manage.js @@ -93,22 +93,26 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.good.images = []; $scope.uploadImage = function (file) { if (file != null) { - $scope.imageProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.imageProgress; - var image = {}; - image.fileId = resp.data.fileid; - image.url = resp.data.url; - $scope.good.images.push(image); - }, function (resp) { - delete $scope.imageProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.imageProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.imageProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.imageProgress; + var image = {}; + image.fileId = resp.data.fileid; + image.url = resp.data.url; + $scope.good.images.push(image); + }, function (resp) { + delete $scope.imageProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.imageProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; }]); @@ -172,22 +176,26 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }; $scope.uploadImage = function (file) { if (file != null) { - $scope.imageProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.imageProgress; - var image = {}; - image.fileId = resp.data.fileid; - image.url = resp.data.url; - $scope.good.images.push(image); - }, function (resp) { - delete $scope.imageProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.imageProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.imageProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.imageProgress; + var image = {}; + image.fileId = resp.data.fileid; + image.url = resp.data.url; + $scope.good.images.push(image); + }, function (resp) { + delete $scope.imageProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.imageProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; }]); diff --git a/src/main/ui/static/payment/good/templates/add_good.html b/src/main/ui/static/payment/good/templates/add_good.html index 53c0c97a5..82d0a5f07 100644 --- a/src/main/ui/static/payment/good/templates/add_good.html +++ b/src/main/ui/static/payment/good/templates/add_good.html @@ -136,7 +136,7 @@
diff --git a/src/main/ui/static/payment/good/templates/good_edit.html b/src/main/ui/static/payment/good/templates/good_edit.html index 7623a4ed0..d280e96e8 100644 --- a/src/main/ui/static/payment/good/templates/good_edit.html +++ b/src/main/ui/static/payment/good/templates/good_edit.html @@ -147,7 +147,7 @@
diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index dc1e11dfd..0084d5263 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -439,56 +439,68 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadShopPhoto = function (file) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.shopPhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadStorePhoto = function (file) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - delete $scope.storePhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; @@ -677,24 +689,28 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.uploadAgreeFile = function (file) { if (file != null) { - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - $scope.agree_file_import = resp.data.url; - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/import/agreepdf', {source_agree_file: $scope.agree_file_import}).then(function () { - commonDialog.alert({ - title: 'Success', - content: 'Succeed Imported! Please notify BD', - type: 'success' - }); - $state.reload(); + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.agree_file_import = resp.data.url; + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/import/agreepdf', {source_agree_file: $scope.agree_file_import}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Succeed Imported! Please notify BD', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) }) - }, function (resp) { - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }) + } } }; $scope.notifyBD = function () { @@ -1093,56 +1109,68 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadShopPhoto = function (file) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.shopPhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadStorePhoto = function (file) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - delete $scope.storePhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; @@ -2108,56 +2136,68 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadShopPhoto = function (file) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.shopPhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadStorePhoto = function (file) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - delete $scope.storePhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.updateMerchantLocation = function () { diff --git a/src/main/ui/static/payment/partner/partner.js b/src/main/ui/static/payment/partner/partner.js index 989273068..9e5a7e7d8 100644 --- a/src/main/ui/static/payment/partner/partner.js +++ b/src/main/ui/static/payment/partner/partner.js @@ -72,56 +72,68 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadShopPhoto = function (file) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.shopPhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadStorePhoto = function (file) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - delete $scope.storePhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; @@ -223,56 +235,68 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], funct $scope.uploadLogo = function (file) { if (file != null) { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadShopPhoto = function (file) { if (file != null) { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.shopPhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; $scope.uploadStorePhoto = function (file) { if (file != null) { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - delete $scope.storePhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } } }; diff --git a/src/main/ui/static/payment/partner/templates/add_partner.html b/src/main/ui/static/payment/partner/templates/add_partner.html index 70595e710..5aa55efa2 100644 --- a/src/main/ui/static/payment/partner/templates/add_partner.html +++ b/src/main/ui/static/payment/partner/templates/add_partner.html @@ -127,7 +127,7 @@
@@ -230,8 +230,7 @@
1: 
@@ -242,8 +241,7 @@
2: 
diff --git a/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html b/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html index 07814fd95..52463ae66 100644 --- a/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html +++ b/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html @@ -98,7 +98,7 @@
@@ -188,8 +188,7 @@
1: 
@@ -200,8 +199,7 @@
2: 
diff --git a/src/main/ui/static/payment/partner/templates/client_partner_detail.html b/src/main/ui/static/payment/partner/templates/client_partner_detail.html index 5725d8577..9c8ebcfa4 100644 --- a/src/main/ui/static/payment/partner/templates/client_partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/client_partner_detail.html @@ -363,7 +363,7 @@
@@ -430,8 +430,7 @@
1: 
@@ -443,8 +442,7 @@
2: 
diff --git a/src/main/ui/static/payment/partner/templates/client_partner_edit.html b/src/main/ui/static/payment/partner/templates/client_partner_edit.html index 9dd641196..2ab021514 100644 --- a/src/main/ui/static/payment/partner/templates/client_partner_edit.html +++ b/src/main/ui/static/payment/partner/templates/client_partner_edit.html @@ -58,7 +58,7 @@
@@ -105,7 +105,7 @@
1: 
@@ -116,8 +116,7 @@
2: 
diff --git a/src/main/ui/static/payment/partner/templates/partner_detail.html b/src/main/ui/static/payment/partner/templates/partner_detail.html index 35cde22f8..0c1b85386 100644 --- a/src/main/ui/static/payment/partner/templates/partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/partner_detail.html @@ -85,7 +85,7 @@ 制作全支付合同 + accept="pdf/*"> 上传合同 (通用合同请选择制作合同,非通用合同模板请人工制作合同后上传)
diff --git a/src/main/ui/static/payment/partner/templates/partner_edit.html b/src/main/ui/static/payment/partner/templates/partner_edit.html index c351e7a31..7380f340f 100644 --- a/src/main/ui/static/payment/partner/templates/partner_edit.html +++ b/src/main/ui/static/payment/partner/templates/partner_edit.html @@ -166,7 +166,7 @@
@@ -255,7 +255,7 @@
1: 
@@ -266,8 +266,7 @@
2: 
diff --git a/src/main/ui/static/payment/product/product_manager.js b/src/main/ui/static/payment/product/product_manager.js index 41050759a..87bd1421e 100644 --- a/src/main/ui/static/payment/product/product_manager.js +++ b/src/main/ui/static/payment/product/product_manager.js @@ -30,26 +30,30 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.importExcel = function (file) { if (file != null) { - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - $scope.agree_file_import = resp.data.url; - $http.put('/sys/product/importExcel', {source_agree_file: $scope.agree_file_import}).then(function () { - commonDialog.alert({ - title: 'Success', - content: 'Succeed Imported', - type: 'success' - }); - $state.reload(); + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.agree_file_import = resp.data.url; + $http.put('/sys/product/importExcel', {source_agree_file: $scope.agree_file_import}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Succeed Imported', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) }) - }, function (resp) { - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }) + } } - } + }; $scope.deleteProduct = function (product) { commonDialog.confirm({ title: 'Confirm', diff --git a/src/main/ui/static/payment/product/templates/product.html b/src/main/ui/static/payment/product/templates/product.html index 9e66b1834..08a1a31bf 100644 --- a/src/main/ui/static/payment/product/templates/product.html +++ b/src/main/ui/static/payment/product/templates/product.html @@ -31,7 +31,7 @@