technicalBrokerCompanyInfoCtrl.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. angular.module('push')
  2. .controller('technicalBrokerCompanyInfoCtrl', function ($scope,$stateParams,$ionicSlideBoxDelegate,$timeout,TechnicalBrokerPublishTrainService) {
  3. // // 获取参与企业信息详情
  4. // var companyid = $stateParams.companyid;
  5. var getJoinComInfoDetail = function () {
  6. $timeout(function () {
  7. $(".Chanel_scroll_a").eq(0).addClass("scroll_a_on").siblings().removeClass("scroll_a_on");
  8. }, 50);
  9. $scope.showLoadingToast();
  10. TechnicalBrokerPublishTrainService.getTaskInfo(companyid).then(function (response) {
  11. // console.log(response);
  12. $scope.taskinfo = response.model;
  13. $scope.hideLoadingToast();
  14. }, function () {
  15. $scope.hideLoadingToast();
  16. })
  17. };
  18. //getJoinComInfoDetail();
  19. var initScroll=function () {
  20. $timeout(function () {
  21. $(".Chanel_scroll_a").eq(0).addClass("scroll_a_on").siblings().removeClass("scroll_a_on");
  22. }, 50);
  23. };
  24. initScroll();
  25. var chooseIndex = 0;//当前频道索引
  26. $scope.index = chooseIndex;
  27. $scope.tabs = [{appModuleName:'简要'},{appModuleName:'产品'},{appModuleName:'需求'},{appModuleName:'项目'},{appModuleName:'人才'},{appModuleName:'专利'}];//默认频道
  28. //滑动频道
  29. $scope.slideChanged = function (index) {
  30. chooseIndex = index;
  31. $(".Chanel_scroll_a").eq(index).addClass("scroll_a_on").siblings().removeClass("scroll_a_on");
  32. $ionicSlideBoxDelegate.slide(index);
  33. };
  34. $scope.clickTab = function (index) {
  35. if (index == chooseIndex) {
  36. return;
  37. }
  38. $ionicSlideBoxDelegate.slide(index);
  39. };
  40. //获取企业信息详情
  41. $scope.companyInfoDetail=
  42. {
  43. userid: 0,
  44. usercomefrom: "",
  45. claid: 0,// 选中的文件夹id
  46. taskid: 0,// 任务id
  47. connid: 0,
  48. company: {
  49. companyid: 0,
  50. companyname: "",
  51. contact: "",
  52. contactnum: "",
  53. district: "",//地区
  54. categoryid: "",
  55. categoryName: "",
  56. rdinstitutiontype: 0,// 企业研发机构等级
  57. rdinstitutiontypeName: "",// 企业研发机构等级
  58. ishigh: 0,// 是否高企
  59. logo: "",// 企业logo
  60. high:true,
  61. ishigh:0,
  62. ishighInfo:"是"
  63. },
  64. //产品信息
  65. companyProductlist : [{
  66. id: 0,
  67. productname: "",// 产品名称
  68. productdescription: ""//产品描述
  69. }],
  70. //高新产品
  71. companyHignendProductlist: [{
  72. id: 0,
  73. productname: "",// 产品名称
  74. productdescription: ""//产品描述
  75. }],
  76. //需求信息
  77. companyTechrequirementlist:[{
  78. id: 0,
  79. companyid: 0,
  80. techrequirementname: "",
  81. techtype: 0,
  82. techtypename: "",
  83. cooperationmodel: "",
  84. cooperationmodelName: "",// 合作模式名称
  85. capitalScale: 0,
  86. techrequirementdetail: "",
  87. images: "", // 图片
  88. demandInfoimagelist:[],// app端图片插件进行传递的变量(需求图片)
  89. }],
  90. //工程中心信息
  91. projectCenterInfoList: [{
  92. id: 0,
  93. yid: 0,
  94. yearsetupname: "",// 选择项名称
  95. yvalue1: ""// 金额
  96. }],
  97. //研发投入信息
  98. researchInfoList : [{
  99. id: 0,
  100. yid: 0,
  101. yearsetupname: "",// 选择项名称
  102. yvalue1: ""// 金额
  103. }],
  104. //实际收入与预计投入信息
  105. realInfoList: [{
  106. id: 0,
  107. yid: 0,
  108. yearsetupname: "",//选择项名称
  109. yvalue1: "",// 销售收入
  110. yvalue2: "",// 净利润
  111. yvalue3: "" // 上缴税收
  112. }],
  113. //重大科研项目信息
  114. importantProjectList: [{
  115. id: 0,
  116. yid: 0,
  117. yearsetupname: "",// 选择项名称
  118. yvalue1: ""// 项目内容
  119. }],
  120. //项目建议
  121. companyDeclareprojectlist: [{
  122. id: 0,
  123. projectname: "",//
  124. projectdescription: "",//
  125. projectsuggest: ""// 申报项目建议
  126. }],
  127. //产学研经验
  128. companyIURlist:[{
  129. id: 0,
  130. cooperateschool: "",// 合作院校
  131. cooperatedetail: ""// 合作内容
  132. }],
  133. //人才
  134. companyHighleveltalentslist:[{
  135. id: 0,
  136. name: "",// 人才姓名
  137. tel: "",// 手机号
  138. position: "",// 职位
  139. academicdegree: "",// 学位
  140. academicdegreeName: "",// 学位名称
  141. responsible: "",// 负责工作
  142. about: ""// 人才简介
  143. }],
  144. //专利
  145. intellectualpropertylist:[{
  146. id: 0,
  147. intellectualpropertyname: "",// 名称
  148. applyperson: "",// 主要完成人
  149. licensenumber: "",// 申请号/授权号
  150. // licensedate: ""// 授权日期
  151. }]
  152. };
  153. // 获取企业走访详情
  154. // TODO
  155. var connid = $stateParams.connid;
  156. // var connid = 1971;
  157. var getConnCompanyInfo = function () {
  158. $scope.showLoadingToast();
  159. console.log(connid);
  160. TechnicalBrokerPublishTrainService.getConnCompanyInfo(connid).then(function (response) {
  161. console.log(response);
  162. $scope.companyInfoDetail = response;
  163. $scope.hideLoadingToast();
  164. }, function () {
  165. $scope.hideLoadingToast();
  166. })
  167. };
  168. getConnCompanyInfo();
  169. // 编辑企业信息
  170. $scope.goEditCompanyInfo = function (connid) {
  171. $scope.go('technicalBrokerEditCompanyInfo', {connid: connid});
  172. };
  173. //点击图片放大
  174. $scope.bigImage = false; //初始默认大图是隐藏的
  175. //缩小图片
  176. $scope.hideBigImage = function () {
  177. $timeout(function () {
  178. $scope.bigImage = false;
  179. }, 400);
  180. };
  181. //放大图片
  182. $scope.shouBigImage = function (piclist, index) { //传递一个参数(图片的URl)
  183. $scope.bigImage = true; //显示大图
  184. $scope.commentpiclist = piclist;
  185. // console.log(index);
  186. $(function () {
  187. $('div.pinch-zoom').each(function () {
  188. new RTP.PinchZoom($(this), {});
  189. });
  190. });
  191. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  192. //图片总数量
  193. setTimeout(function () {
  194. // console.log(parseInt($ionicSlideBoxDelegate.slidesCount()));
  195. // console.log(parseInt($ionicSlideBoxDelegate.currentIndex()));
  196. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, -5);
  197. // var nowIndex=parseInt($ionicSlideBoxDelegate.currentIndex());
  198. var totalIndex = parseInt($ionicSlideBoxDelegate.slidesCount());
  199. // console.log(index);
  200. $scope.nowIndex = index + 1;
  201. $scope.totalIndex = totalIndex;
  202. //获取图片
  203. var imgObj = document.getElementsByClassName('bigimage');
  204. var n;
  205. for (n = 0; n < imgObj.length; n++) {
  206. // 获取图片的原始高度和宽度
  207. var oldWid = imgObj[n].naturalWidth;
  208. var oldHei = imgObj[n].naturalHeight;
  209. var screen = document.body.offsetWidth;
  210. var screenH = window.innerHeight;
  211. // console.log(oldWid / oldHei);
  212. // console.log(screen);
  213. var cc = screen / (oldWid / oldHei);
  214. imgObj[n].style.height = cc + 'px';
  215. if (cc < screenH) {
  216. imgObj[n].style.marginTop = (screenH - cc) / 2 + 'px';
  217. // console.log("e:" + imgObj[n].style.marginTop);
  218. } else {
  219. imgObj[n].style.marginTop = 0 + 'px';
  220. // console.log((cc - screenH) + 'px')
  221. }
  222. }
  223. }, 0);
  224. };
  225. //查看原图
  226. $scope.viewOldImg = function (index) {
  227. // console.log($scope.commentpiclist[index]);
  228. // console.log("查看原图" + index);
  229. var url = UtilService.isDefined($scope.commentpiclist[index].source_name) ? $scope.commentpiclist[index].source_name : $scope.commentpiclist[index].photo_name;
  230. $(".bigimage").eq(index).attr("src", $scope.imgUrl + url);
  231. $timeout(function () {
  232. $scope.commentpiclist[index].loadsource = true;
  233. }, 20);
  234. };
  235. //图片下载
  236. var downloadPicture = function (image) {
  237. $scope.showLoadingToast();
  238. var fileTransfer = new FileTransfer();
  239. var url = UtilService.isDefined(image.source_name) ? image.source_name : image.photo_name;
  240. var imgname = url.substring(url.lastIndexOf('/') + 1);//图片名称
  241. var loadurl = $scope.imgUrl + url;//图片下载地址
  242. var fileURL = "";//下载后的地址
  243. if (UtilService.checkPlatform()) {
  244. fileURL = cordova.file.externalRootDirectory + "pushpicture/" + imgname;
  245. } else {
  246. fileURL = cordova.file.documentsDirectory + imgname;
  247. }
  248. // console.log(loadurl);
  249. // console.log(fileURL);
  250. fileTransfer.download(
  251. loadurl,
  252. fileURL,
  253. function (entry) {
  254. // console.log(entry);
  255. if (UtilService.checkPlatform()) {
  256. var tempstr = entry.toURL().replace("file://", "");
  257. UtilService.showMess("图片下载成功,地址:" + tempstr);
  258. } else {
  259. UtilService.showMess("图片下载成功");
  260. }
  261. $scope.hideLoadingToast();
  262. },
  263. function (error) {
  264. // console.log(error);
  265. $scope.hideLoadingToast();
  266. UtilService.showMess("网络不给力,请重试");
  267. },
  268. null, // or, pass false
  269. {
  270. //headers: {
  271. // "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
  272. //}
  273. }
  274. );
  275. };
  276. });