buildResourceInitCtrl.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. angular.module('push')
  2. .controller('buildResourceInitCtrl', function ($scope, $ionicActionSheet, ModelService, $stateParams, UtilService) {
  3. if($scope.app){
  4. $scope.setStatusBar(0);
  5. }
  6. $scope.addListBack = function () {
  7. $scope.goback();
  8. };
  9. //有无知识产权:0:有 1:无
  10. $scope.typenam = ["未选择","能源", "新材料"];
  11. var listindex;
  12. if (UtilService.isDefined($stateParams.theme)) {
  13. $scope.temptheme = $stateParams.theme;
  14. $scope.index = $stateParams.theme.type +1;
  15. listindex = $stateParams.index;
  16. } else {
  17. $scope.temptheme = {title: "", type: 0, content: ""};
  18. $scope.index = 0;
  19. }
  20. /*有无知识产权*/
  21. $scope.show1= function () {
  22. $ionicActionSheet.show({
  23. buttons: [
  24. {text: '<a class="action-sheet-push">能源</a>'},
  25. {text: '<a class="action-sheet-push">新材料</a>'}
  26. ],
  27. cancelText: '取消',
  28. buttonClicked: function (index) {
  29. $scope.index = 2 - index;
  30. $scope.temptheme.type = 2 - index ;
  31. return true;
  32. }
  33. });
  34. };
  35. //有无知识产权:0:有 1:无
  36. $scope.typename2 = ["未选择","有", "无"];
  37. var listindex;
  38. if (UtilService.isDefined($stateParams.theme)) {
  39. $scope.temptheme2 = $stateParams.theme;
  40. $scope.index = $stateParams.theme.type +1;
  41. listindex = $stateParams.index;
  42. } else {
  43. $scope.temptheme2 = {title: "", type: 0, content: ""};
  44. $scope.index = 0;
  45. }
  46. /*有无知识产权*/
  47. $scope.show2= function () {
  48. $ionicActionSheet.show({
  49. buttons: [
  50. {text: '<a class="action-sheet-push">有</a>'},
  51. {text: '<a class="action-sheet-push">无</a>'}
  52. ],
  53. cancelText: '取消',
  54. buttonClicked: function (index) {
  55. $scope.index = 2 - index;
  56. $scope.temptheme2.type = 2 - index ;
  57. return true;
  58. }
  59. });
  60. };
  61. //研发进度:0:正在研发 1:已有小样 2:通过小试 3:通过中试 4:可以量产
  62. $scope.typename3 = ["未选择","正在研发", "已有小样" ,"通过小试","通过中试" ,"可以量产"];
  63. var listindex;
  64. if (UtilService.isDefined($stateParams.theme)) {
  65. $scope.temptheme3 = $stateParams.theme;
  66. $scope.index = $stateParams.theme.type +1;
  67. listindex = $stateParams.index;
  68. } else {
  69. $scope.temptheme3 = {title: "", type:1, content: ""};
  70. $scope.index = 0;
  71. }
  72. /*研发进度*/
  73. $scope.show3= function () {
  74. $ionicActionSheet.show({
  75. buttons: [
  76. {text: '<a class="action-sheet-push">正在研发</a>'},
  77. {text: '<a class="action-sheet-push">已有小样</a>'},
  78. {text: '<a class="action-sheet-push">通过小试</a>'},
  79. {text: '<a class="action-sheet-push">通过中试</a>'},
  80. {text: '<a class="action-sheet-push">可以量产</a>'}
  81. ],
  82. cancelText: '取消',
  83. buttonClicked: function (index) {
  84. $scope.index = 5 - index;
  85. $scope.temptheme3.type = 5 - index;
  86. return true;
  87. }
  88. });
  89. };
  90. //合作模式:0:委托开发 1:合作研发 2:成果转让 3:技术入股 4:技术咨询 5:其他
  91. $scope.typename4 = ["未选择","委托开发", "合作研发" ,"成果转让","技术入股" ,"技术咨询","其他"];
  92. var listindex;
  93. if (UtilService.isDefined($stateParams.theme)) {
  94. $scope.temptheme4 = $stateParams.theme;
  95. $scope.index = $stateParams.theme.type +1;
  96. listindex = $stateParams.index;
  97. } else {
  98. $scope.temptheme4 = {title: "", type:1, content: ""};
  99. $scope.index = 0;
  100. }
  101. /*合作模式*/
  102. $scope.show4= function () {
  103. $ionicActionSheet.show({
  104. buttons: [
  105. {text: '<a class="action-sheet-push">委托开发</a>'},
  106. {text: '<a class="action-sheet-push">合作研发</a>'},
  107. {text: '<a class="action-sheet-push">成果转让</a>'},
  108. {text: '<a class="action-sheet-push">技术入股</a>'},
  109. {text: '<a class="action-sheet-push">技术咨询</a>'},
  110. {text: '<a class="action-sheet-push">其他</a>'}
  111. ],
  112. cancelText: '取消',
  113. buttonClicked: function (index) {
  114. $scope.index =6 - index;
  115. $scope.temptheme4.type =6 - index;
  116. return true;
  117. }
  118. });
  119. };
  120. /*选取照片*/
  121. $scope.showPicture = function () {
  122. $ionicActionSheet.show({
  123. buttons: [
  124. {text: '<a class="action-sheet-push">拍照</a>'},
  125. {text: '<a class="action-sheet-push">从相册中添加</a>'}
  126. ],
  127. cancelText: '取消',
  128. buttonClicked: function (index) {
  129. if (index == 0) {
  130. $scope.openCamera = function () {
  131. if ($scope.images.length >= 18) {
  132. UtilService.showMess("最多选取18张图片");
  133. return;
  134. }
  135. UtilService.getPicture(1).then(function (results) {
  136. $scope.images.push(results);
  137. $scope.totalImglength = 600 * $scope.images.length;
  138. $ionicScrollDelegate.$getByHandle("scrollimage").resize();
  139. }, function (err) {
  140. });
  141. };
  142. } else if (index == 1) {
  143. getPictures();
  144. }
  145. return true;
  146. }
  147. });
  148. };
  149. var getPictures = function () {
  150. if (device.platform == "Android") {
  151. verifyStorage();
  152. } else {
  153. getPic();
  154. }
  155. };
  156. $scope.settingsList = [
  157. { text: "置顶", checked: true }
  158. ];
  159. });