64 lines
1.8 KiB
JavaScript
64 lines
1.8 KiB
JavaScript
|
app.controller('ProjectController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms', function($scope, config, $http, auth, $location, $routeParams,alertService,rms){
|
||
|
|
||
|
var vm = $scope;
|
||
|
var projectid = $routeParams.id;
|
||
|
|
||
|
vm.project_activities = [];
|
||
|
vm.project_activities_page = 0;
|
||
|
|
||
|
|
||
|
vm.project_members = [];
|
||
|
vm.project_members_page = 0;
|
||
|
|
||
|
|
||
|
vm.currentTab = 1;
|
||
|
vm.tab = function(index){
|
||
|
vm.currentTab = index;
|
||
|
vm.searchText = '';
|
||
|
|
||
|
if(index == 1){
|
||
|
$http.get(config.apiUrl + 'project/activities?token='+auth.token()+'&project_id='+projectid).then(
|
||
|
function(response) {
|
||
|
console.log(response.data);
|
||
|
vm.project_activities = response.data.data;
|
||
|
}
|
||
|
)
|
||
|
}
|
||
|
else if(index == 2){
|
||
|
$http.get(config.apiUrl + 'project/members?token='+auth.token()+'&project_id='+projectid).then(
|
||
|
function(response) {
|
||
|
console.log(response.data);
|
||
|
vm.project_activities = response.data.data;
|
||
|
}
|
||
|
)
|
||
|
}
|
||
|
};
|
||
|
|
||
|
|
||
|
$http.get(config.apiUrl+ 'project/'+projectid+"?token="+auth.token()).then(
|
||
|
function(response) {
|
||
|
console.log(response.data);
|
||
|
|
||
|
if (response.data.status == 0){
|
||
|
vm.project = response.data.data;
|
||
|
resetMenu(vm.project.can_setting);
|
||
|
vm.tab(1);
|
||
|
}
|
||
|
else{
|
||
|
vm.alertService.showMessage('提示', response.data.message);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
);
|
||
|
|
||
|
|
||
|
var resetMenu = function(can_setting){
|
||
|
if(can_setting){
|
||
|
vm.menus = ["项目动态", "成员管理"];
|
||
|
} else {
|
||
|
vm.menus = ['项目动态', "我的伙伴"];
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}]);
|