DockingThemeCtrl.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. angular.module('push')
  2. .controller('DockingThemeCtrl', function ($scope, $ionicActionSheet, ModelService, $stateParams, UtilService) {
  3. //主题类型:1:需求 2:成果 3:服务 4:其他
  4. $scope.typename = ["需求", "成果", "服务", "其他"];
  5. var listindex;
  6. if (UtilService.isDefined($stateParams.theme)) {
  7. $scope.temptheme = $stateParams.theme;
  8. $scope.index = $stateParams.theme.type - 1;
  9. listindex = $stateParams.index;
  10. } else {
  11. $scope.temptheme = {title: "", type: 1, content: ""};
  12. $scope.index = 0;
  13. }
  14. $scope.show = function () {
  15. $ionicActionSheet.show({
  16. buttons: [
  17. {text: '<a class="action-sheet-push">需求</a>'},
  18. {text: '<a class="action-sheet-push">成果</a>'},
  19. {text: '<a class="action-sheet-push">服务</a>'},
  20. {text: '<a class="action-sheet-push">其他</a>'}
  21. ],
  22. cancelText: '取消',
  23. buttonClicked: function (index) {
  24. $scope.index = index;
  25. $scope.temptheme.type = index + 1;
  26. return true;
  27. }
  28. });
  29. };
  30. $scope.saveTempTheme = function () {
  31. if (!UtilService.isDefined($scope.temptheme.title)) {
  32. UtilService.showMess("主题名称不能为空");
  33. return;
  34. }
  35. if (UtilService.isDefined($stateParams.theme)) {
  36. var tempThemeList = ModelService.getTempThemes();
  37. tempThemeList[listindex] = $scope.temptheme;
  38. ModelService.setTempThemes2(tempThemeList);
  39. } else {
  40. $scope.temptheme.localid = UtilService.formatDate().timestamp + "";
  41. ModelService.setTempThemes($scope.temptheme);
  42. }
  43. $scope.goback();
  44. }
  45. });