12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- angular.module('push')
- .controller('activityChooseTeacherCtrl', function ($scope, $stateParams, ActivityService, UtilService, $timeout) {
- /* $scope.setStatusBar(1);*/
- var activityid = $stateParams.activityid;
- var getIntentionStatus = function () {
- $scope.showLoadingToast();
- ActivityService.getIntentionStatus(activityid).then(function (response) {
- // console.log(response);
- // result 0未选择 1已选择
- $scope.intentionstatus = response.result;
- getSelUnivInfo();
- }, function () {
- $scope.hideLoadingToast();
- $scope.hideLoadingToast();
- })
- };
- getIntentionStatus();
- // 获取参与专家列表
- var getSelUnivInfo = function () {
- $scope.showLoadingToast();
- ActivityService.getSelUnivInfo(" ", " ", activityid).then(function (response) {
- // console.log(response);
- $scope.expertlist = response.teachers;
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- })
- };
- var indexlist = [];
- $scope.selectedLength = 0;
- // 选择专家
- $scope.selectOrgType = function (intentionid, index) {
- if($scope.intentionstatus != 0){
- return;
- }
- if ($scope.expertlist[index].isChecked) {
- var ind = indexlist.indexOf(index);
- indexlist.splice(ind);
- } else {
- indexlist.push(intentionid);
- }
- $scope.expertlist[index].isChecked = !$scope.expertlist[index].isChecked;
- $scope.selectedLength = indexlist.length;
- };
- // 提交专家
- $scope.submitExpert = function () {
- $scope.showLoadingToast();
- var idlist = indexlist.join(",");
- ActivityService.submitSelUnivInfo(activityid, idlist).then(function (response) {
- // console.log(response);
- if (response.result == 1) {
- UtilService.showMess("提交成功!");
- $timeout(function () {
- $scope.goback();
- }, 1000);
- }
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- })
- };
- // 进入专家信息页
- $scope.goEpxertDeatil = function (userid) {
- $scope.go("activityChooseTeacherDetail", {userid: userid})
- };
- });
|