|
|
|
@ -255,10 +255,32 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
|
|
|
|
|
}
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
app.controller('cmsAddArticleCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', function ($scope, $http, $state, $stateParams, commonDialog) {
|
|
|
|
|
app.controller('cmsAddArticleCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog','industryMap','stateMap', function ($scope, $http, $state, $stateParams, commonDialog,industryMap,stateMap) {
|
|
|
|
|
$scope.industries = industryMap.configs();
|
|
|
|
|
$scope.states = stateMap.configs();
|
|
|
|
|
|
|
|
|
|
$scope.publishall = 1;
|
|
|
|
|
|
|
|
|
|
$scope.saveArticle = function () {
|
|
|
|
|
$scope.article.publishall = $scope.publishall;
|
|
|
|
|
if( $scope.publishall == 0){
|
|
|
|
|
if($scope.select_industries.length <= 0 || $scope.select_industries == "") {
|
|
|
|
|
alert("所推送的行业不能为空");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if($scope.select_states.length <= 0 || $scope.select_states == "") {
|
|
|
|
|
alert("所推送的地区不能为空");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$scope.article.selectIndustries = $scope.select_industries.join(',');
|
|
|
|
|
$scope.article.selectStates = $scope.select_states.join(',');
|
|
|
|
|
if ($scope.select_clients) {
|
|
|
|
|
$scope.article.selectClients = $scope.select_clients.join(',');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$scope.article.reference = $scope.reference;
|
|
|
|
|
$scope.article.royalpay_industry = $scope.royalpay_industry;
|
|
|
|
|
|
|
|
|
|
$http.post('/app/cms/categories/' + $stateParams.catId + '/articles', $scope.article).then(function (resp) {
|
|
|
|
|
$state.go('^.article_view', {articleId: resp.data.article_id});
|
|
|
|
|
}, function (resp) {
|
|
|
|
@ -266,35 +288,131 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.loadRoyalpayindustry = function () {
|
|
|
|
|
$http.get('/static/data/rp_industry_apply.json').then(function (resp) {
|
|
|
|
|
$scope.royalpayindustry = resp.data;
|
|
|
|
|
})
|
|
|
|
|
$scope.params = {textType: 'all', org_name: 'ALL'};
|
|
|
|
|
$scope.loadPartners = function (page) {
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
|
|
$http.get('/sys/partners', {params: params}).then(function (resp) {
|
|
|
|
|
$scope.partners = resp.data.data;
|
|
|
|
|
$scope.pagination = resp.data.pagination;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
$scope.loadRoyalpayindustry();
|
|
|
|
|
|
|
|
|
|
$scope.onRoyalPayIndustrySelect = function (selectedItem) {
|
|
|
|
|
$scope.royalpay_label = selectedItem.label;
|
|
|
|
|
$scope.royalpay_industry = selectedItem.mccCode;
|
|
|
|
|
};
|
|
|
|
|
$scope.toggleSelectIndustries = function (industry) {
|
|
|
|
|
if (!$scope.select_industries) {
|
|
|
|
|
$scope.select_industries = [];
|
|
|
|
|
}
|
|
|
|
|
var $idx = $scope.select_industries.indexOf(industry);
|
|
|
|
|
if ($idx >= 0) {
|
|
|
|
|
$scope.select_industries.splice($idx, 1);
|
|
|
|
|
} else {
|
|
|
|
|
$scope.select_industries.push(industry);
|
|
|
|
|
$scope.select_industries.sort(compare);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$scope.selectAllIndustries = function() {
|
|
|
|
|
for(var i=0;i<$scope.industries.length;i++) {
|
|
|
|
|
$scope.toggleSelectIndustries($scope.industries[i].value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$scope.selectAllIndustries();
|
|
|
|
|
|
|
|
|
|
$scope.toggleStates =function(state){
|
|
|
|
|
if (!$scope.select_states) {
|
|
|
|
|
$scope.select_states = [];
|
|
|
|
|
}
|
|
|
|
|
var $idx = $scope.select_states.indexOf(state);
|
|
|
|
|
if ($idx >= 0) {
|
|
|
|
|
$scope.select_states.splice($idx, 1);
|
|
|
|
|
} else {
|
|
|
|
|
$scope.select_states.push(state);
|
|
|
|
|
$scope.select_states.sort(compare);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$scope.selectAllIndustries = function() {
|
|
|
|
|
for(var i=0;i<$scope.states.length;i++) {
|
|
|
|
|
$scope.toggleStates($scope.states[i].value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$scope.selectAllIndustries();
|
|
|
|
|
|
|
|
|
|
$scope.toggleClient =function(client_moniker){
|
|
|
|
|
if (!$scope.select_clients) {
|
|
|
|
|
$scope.select_clients = [];
|
|
|
|
|
}
|
|
|
|
|
var $idx = $scope.select_clients.indexOf(client_moniker);
|
|
|
|
|
if ($idx >= 0) {
|
|
|
|
|
$scope.select_clients.splice($idx, 1);
|
|
|
|
|
} else {
|
|
|
|
|
$scope.select_clients.push(client_moniker);
|
|
|
|
|
$scope.select_clients.sort(compare);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var compare = function (x, y) {
|
|
|
|
|
x = parseInt(x);
|
|
|
|
|
y = parseInt(y);
|
|
|
|
|
if (x < y) {
|
|
|
|
|
return -1;
|
|
|
|
|
} else if (x > y) {
|
|
|
|
|
return 1;
|
|
|
|
|
} else {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
app.controller('cmsArticleEditCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', 'article', function ($scope, $http, $state, $stateParams, commonDialog, article) {
|
|
|
|
|
app.controller('cmsArticleEditCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', 'article', 'industryMap','stateMap',function ($scope, $http, $state, $stateParams, commonDialog, article,industryMap,stateMap) {
|
|
|
|
|
$scope.article = article.data;
|
|
|
|
|
|
|
|
|
|
$scope.industries = industryMap.configs();
|
|
|
|
|
$scope.states = stateMap.configs();
|
|
|
|
|
|
|
|
|
|
if($scope.article.publishall){
|
|
|
|
|
$scope.publishall = $scope.article.publishall;
|
|
|
|
|
}else{
|
|
|
|
|
$scope.publishall = 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($scope.article.select_industries) {
|
|
|
|
|
$scope.select_industries = $scope.article.select_industries.split(",");
|
|
|
|
|
}
|
|
|
|
|
if($scope.article.select_clients){
|
|
|
|
|
$scope.select_clients = $scope.article.select_clients.split(",");
|
|
|
|
|
}
|
|
|
|
|
if($scope.article.select_states){
|
|
|
|
|
$scope.select_states = $scope.article.select_states.split(",");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($scope.article.reference) {
|
|
|
|
|
$scope.reference = JSON.parse($scope.article.reference);
|
|
|
|
|
} else {
|
|
|
|
|
$scope.reference = {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($scope.article.royalpay_industry){
|
|
|
|
|
$scope.royalpay_industry = $scope.article.royalpay_industry;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$scope.saveArticle = function () {
|
|
|
|
|
|
|
|
|
|
$scope.article.publishall = $scope.publishall;
|
|
|
|
|
if( $scope.publishall == 0){
|
|
|
|
|
if($scope.select_industries.length <= 0 || $scope.select_industries == "") {
|
|
|
|
|
alert("所推送的行业不能为空");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if($scope.select_states.length <= 0 || $scope.select_states == "") {
|
|
|
|
|
alert("所推送的地区不能为空");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$scope.article.select_industries = $scope.select_industries.join(',');
|
|
|
|
|
$scope.article.select_states = $scope.select_states.join(',');
|
|
|
|
|
if ($scope.select_clients) {
|
|
|
|
|
$scope.article.select_clients = $scope.select_clients.join(',');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$scope.article.reference = $scope.reference;
|
|
|
|
|
$scope.article.royalpay_industry = $scope.royalpay_industry;
|
|
|
|
|
|
|
|
|
|
$http.put('/app/cms/categories/' + $stateParams.catId + '/articles/' + $stateParams.articleId, $scope.article).then(function (resp) {
|
|
|
|
|
$state.go('^.article_view', {articleId: $stateParams.articleId});
|
|
|
|
|
}, function (resp) {
|
|
|
|
@ -302,17 +420,84 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.loadRoyalpayindustry = function () {
|
|
|
|
|
$http.get('/static/data/rp_industry_apply.json').then(function (resp) {
|
|
|
|
|
$scope.royalpayindustry = resp.data;
|
|
|
|
|
})
|
|
|
|
|
$scope.params = {textType: 'all', org_name: 'ALL'};
|
|
|
|
|
$scope.loadPartners = function (page) {
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
|
params.page = page || $scope.pagination.page || 1;
|
|
|
|
|
$http.get('/sys/partners', {params: params}).then(function (resp) {
|
|
|
|
|
$scope.partners = resp.data.data;
|
|
|
|
|
$scope.pagination = resp.data.pagination;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
$scope.loadRoyalpayindustry();
|
|
|
|
|
|
|
|
|
|
$scope.onRoyalPayIndustrySelect = function (selectedItem) {
|
|
|
|
|
$scope.royalpay_label = selectedItem.label;
|
|
|
|
|
$scope.royalpay_industry = selectedItem.mccCode;
|
|
|
|
|
};
|
|
|
|
|
$scope.toggleSelectIndustries = function (industry) {
|
|
|
|
|
if (!$scope.select_industries) {
|
|
|
|
|
$scope.select_industries = [];
|
|
|
|
|
}
|
|
|
|
|
var $idx = $scope.select_industries.indexOf(industry);
|
|
|
|
|
if ($idx >= 0) {
|
|
|
|
|
$scope.select_industries.splice($idx, 1);
|
|
|
|
|
} else {
|
|
|
|
|
$scope.select_industries.push(industry);
|
|
|
|
|
$scope.select_industries.sort(compare);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$scope.selectAllIndustries = function() {
|
|
|
|
|
for(var i=0;i<$scope.industries.length;i++) {
|
|
|
|
|
$scope.toggleSelectIndustries($scope.industries[i].value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!$scope.article.publishall){
|
|
|
|
|
$scope.selectAllIndustries();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.toggleStates =function(state){
|
|
|
|
|
if (!$scope.select_states) {
|
|
|
|
|
$scope.select_states = [];
|
|
|
|
|
}
|
|
|
|
|
var $idx = $scope.select_states.indexOf(state);
|
|
|
|
|
if ($idx >= 0) {
|
|
|
|
|
$scope.select_states.splice($idx, 1);
|
|
|
|
|
} else {
|
|
|
|
|
$scope.select_states.push(state);
|
|
|
|
|
$scope.select_states.sort(compare);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$scope.selectAllIndustries = function() {
|
|
|
|
|
for(var i=0;i<$scope.states.length;i++) {
|
|
|
|
|
$scope.toggleStates($scope.states[i].value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!$scope.article.publishall){
|
|
|
|
|
$scope.selectAllIndustries();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$scope.toggleClient =function(client_moniker){
|
|
|
|
|
if (!$scope.select_clients) {
|
|
|
|
|
$scope.select_clients = [];
|
|
|
|
|
}
|
|
|
|
|
var $idx = $scope.select_clients.indexOf(client_moniker);
|
|
|
|
|
if ($idx >= 0) {
|
|
|
|
|
$scope.select_clients.splice($idx, 1);
|
|
|
|
|
} else {
|
|
|
|
|
$scope.select_clients.push(client_moniker);
|
|
|
|
|
$scope.select_clients.sort(compare);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var compare = function (x, y) {
|
|
|
|
|
x = parseInt(x);
|
|
|
|
|
y = parseInt(y);
|
|
|
|
|
if (x < y) {
|
|
|
|
|
return -1;
|
|
|
|
|
} else if (x > y) {
|
|
|
|
|
return 1;
|
|
|
|
|
} else {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|