|
|
@ -255,11 +255,41 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}]);
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
|
|
app.controller('cmsAddArticleCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog','industryMap','stateMap', function ($scope, $http, $state, $stateParams, commonDialog,industryMap,stateMap) {
|
|
|
|
app.controller('cmsAddArticleCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog','industryMap','stateMap','Upload', function ($scope, $http, $state, $stateParams, commonDialog,industryMap,stateMap,Upload) {
|
|
|
|
|
|
|
|
$scope.catId = $scope.catId
|
|
|
|
$scope.industries = industryMap.configs();
|
|
|
|
$scope.industries = industryMap.configs();
|
|
|
|
$scope.states = stateMap.configs();
|
|
|
|
$scope.states = stateMap.configs();
|
|
|
|
|
|
|
|
|
|
|
|
$scope.publishall = 1;
|
|
|
|
$scope.publishall = 1;
|
|
|
|
|
|
|
|
$scope.isImage = true;
|
|
|
|
|
|
|
|
$scope.uploadImageFile = function (file) {
|
|
|
|
|
|
|
|
if(typeof $scope.article =='undefined'){
|
|
|
|
|
|
|
|
$scope.article={}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (file != null) {
|
|
|
|
|
|
|
|
if (file.size > 3 * 1024 * 1024) {
|
|
|
|
|
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$scope.imageFileProgress = {value: 0};
|
|
|
|
|
|
|
|
Upload.upload({
|
|
|
|
|
|
|
|
url: '/attachment/files',
|
|
|
|
|
|
|
|
data: {file: file}
|
|
|
|
|
|
|
|
}).then(function (resp) {
|
|
|
|
|
|
|
|
delete $scope.imageFileProgress;
|
|
|
|
|
|
|
|
$scope.article.image = resp.data.url;
|
|
|
|
|
|
|
|
if ($scope.article.image.endsWith('pdf')) {
|
|
|
|
|
|
|
|
$scope.isImage = false;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$scope.isImage = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
|
|
|
delete $scope.imageFileProgress;
|
|
|
|
|
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
|
|
|
|
|
}, function (evt) {
|
|
|
|
|
|
|
|
$scope.imageFileProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$scope.saveArticle = function () {
|
|
|
|
$scope.saveArticle = function () {
|
|
|
|
$scope.article.publishall = $scope.publishall;
|
|
|
|
$scope.article.publishall = $scope.publishall;
|
|
|
@ -279,6 +309,10 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if($scope.catId=='news' && $scope.article.image==null){
|
|
|
|
|
|
|
|
alert("请上传封面图");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
$scope.article.reference = $scope.reference;
|
|
|
|
$scope.article.reference = $scope.reference;
|
|
|
|
|
|
|
|
|
|
|
|
$http.post('/app/cms/categories/' + $stateParams.catId + '/articles', $scope.article).then(function (resp) {
|
|
|
|
$http.post('/app/cms/categories/' + $stateParams.catId + '/articles', $scope.article).then(function (resp) {
|
|
|
@ -363,8 +397,9 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
|
|
|
|
|
|
|
|
|
|
|
|
}]);
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
|
|
app.controller('cmsArticleEditCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', 'article', 'industryMap','stateMap',function ($scope, $http, $state, $stateParams, commonDialog, article,industryMap,stateMap) {
|
|
|
|
app.controller('cmsArticleEditCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', 'article', 'industryMap','stateMap','Upload',function ($scope, $http, $state, $stateParams, commonDialog, article,industryMap,stateMap,Upload) {
|
|
|
|
$scope.article = article.data;
|
|
|
|
$scope.article = article.data;
|
|
|
|
|
|
|
|
$scope.catId=$stateParams.catId;
|
|
|
|
$scope.article.publishall = $scope.article.publishall +"";
|
|
|
|
$scope.article.publishall = $scope.article.publishall +"";
|
|
|
|
|
|
|
|
|
|
|
|
$scope.industries = industryMap.configs();
|
|
|
|
$scope.industries = industryMap.configs();
|
|
|
@ -393,8 +428,39 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
|
|
|
|
$scope.reference = {};
|
|
|
|
$scope.reference = {};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$scope.saveArticle = function () {
|
|
|
|
$scope.isImage = true;
|
|
|
|
|
|
|
|
if ($scope.article.image && $scope.article.image.endsWith('pdf')) {
|
|
|
|
|
|
|
|
$scope.isImage = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.uploadImageFile = function (file) {
|
|
|
|
|
|
|
|
if (file != null) {
|
|
|
|
|
|
|
|
if (file.size > 3 * 1024 * 1024) {
|
|
|
|
|
|
|
|
commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$scope.imageFileProgress = {value: 0};
|
|
|
|
|
|
|
|
Upload.upload({
|
|
|
|
|
|
|
|
url: '/attachment/files',
|
|
|
|
|
|
|
|
data: {file: file}
|
|
|
|
|
|
|
|
}).then(function (resp) {
|
|
|
|
|
|
|
|
delete $scope.imageFileProgress;
|
|
|
|
|
|
|
|
$scope.article.image = resp.data.url;
|
|
|
|
|
|
|
|
if ($scope.article.image.endsWith('pdf')) {
|
|
|
|
|
|
|
|
$scope.isImage = false;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$scope.isImage = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
|
|
|
delete $scope.imageFileProgress;
|
|
|
|
|
|
|
|
commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'})
|
|
|
|
|
|
|
|
}, function (evt) {
|
|
|
|
|
|
|
|
$scope.imageFileProgress.value = parseInt(100 * evt.loaded / evt.total);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.saveArticle = function () {
|
|
|
|
$scope.article.publishall = $scope.publishall;
|
|
|
|
$scope.article.publishall = $scope.publishall;
|
|
|
|
if( $scope.publishall == 0){
|
|
|
|
if( $scope.publishall == 0){
|
|
|
|
if($scope.select_industries.length <= 0 || $scope.select_industries == "") {
|
|
|
|
if($scope.select_industries.length <= 0 || $scope.select_industries == "") {
|
|
|
@ -412,8 +478,11 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if($scope.catId=='news' && $scope.article.image==null){
|
|
|
|
|
|
|
|
alert("请上传封面图");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
$scope.article.reference = $scope.reference;
|
|
|
|
$scope.article.reference = $scope.reference;
|
|
|
|
|
|
|
|
|
|
|
|
$http.put('/app/cms/categories/' + $stateParams.catId + '/articles/' + $stateParams.articleId, $scope.article).then(function (resp) {
|
|
|
|
$http.put('/app/cms/categories/' + $stateParams.catId + '/articles/' + $stateParams.articleId, $scope.article).then(function (resp) {
|
|
|
|
$state.go('^.article_view', {articleId: $stateParams.articleId});
|
|
|
|
$state.go('^.article_view', {articleId: $stateParams.articleId});
|
|
|
|
}, function (resp) {
|
|
|
|
}, function (resp) {
|
|
|
|