resourceCommonDetailsPageCtrl.js 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694
  1. angular.module('push')
  2. .controller('resourceCommonDetailsPageCtrl', function ($scope, $rootScope, $timeout, $state, $ionicPopup, $stateParams, $ionicScrollDelegate, $ionicActionSheet, $ionicSlideBoxDelegate, ResourceLibraryService, taskModuleService, CommentService, UserService, UtilService, ConstantService, ShareService, AccountService, dataToolsService, CommonService, ConfigService, $q, $ionicModal, statisticsReportService, $ionicHistory) {
  3. //TODO
  4. // 传入参数
  5. //1:需求,2:成果,6:企业,7:高校,8:人才
  6. $scope.showInterview = $stateParams.restype == '6';
  7. console.log('params', $stateParams)
  8. $scope.node = UserService.node;
  9. $scope.privateName = $stateParams.privateName
  10. $scope.defaultLan = UserService.defaultLan;
  11. //当前登陆人员是否是桐庐节点管理人员
  12. ResourceLibraryService.judgeManager(UserService.id, 0).then(function (res) {
  13. $scope.hasAuth = res.data
  14. $scope.showMonthReport = res.data && ($stateParams.recourcetype == "6");
  15. })
  16. // $scope.showManagmentSheet = function () {
  17. // $scope.go("exportField", { "reslist": $stateParams.row });
  18. // }
  19. //仅限节点人员和节点运营人员可操作,可为当前资源增设标签
  20. taskModuleService.getUserPermissionCheck($stateParams.recourceid, $stateParams.creator, UserService.id).then(function (res) {
  21. if (res.code == 3350) {
  22. $scope.canAddLabel = res.data;
  23. }
  24. })
  25. //获取企业年报数据
  26. ResourceLibraryService.getYearReport($stateParams.title).then(function (res) {
  27. if (res.code == 3350) {
  28. $scope.datalist = res.data;
  29. }
  30. })
  31. //点击加号,添加标签
  32. $scope.label = {};
  33. $scope.addLabel = function () {
  34. //权限判断(仅限节点人员和节点运营人员方可进行资源库自定义标签添加)
  35. taskModuleService.thisUserIsAdmin().then(function (res) {
  36. if (res.code == 3350 && res.data == true) {
  37. var ionicDialog = $ionicPopup.confirm({
  38. template: '<input type="text" ng-model="label.name">',
  39. title: '请输入自定义标签',
  40. scope: $scope,
  41. okText: '确定',
  42. cancelText: '取消'
  43. });
  44. ionicDialog.then(function (result) {
  45. if (result) {
  46. if ($scope.label.name != null && $scope.label.name != undefined && $scope.label.name.trim() != "") {
  47. ResourceLibraryService.addLabelToDB($stateParams.recourceid, $scope.label.name).then(function (res) {
  48. if (res.code == 3350) {
  49. if (res.data == true) {
  50. //添加成功
  51. $ionicPopup.alert({
  52. title: '提示',
  53. template: '添加标签成功!'
  54. });
  55. $state.reload();
  56. }
  57. if (res.data == false) {
  58. //添加失败
  59. $ionicPopup.alert({
  60. title: '提示',
  61. template: '标签已存在,添加失败!'
  62. });
  63. }
  64. }
  65. $scope.label = {};
  66. }
  67. )
  68. } else {
  69. $ionicPopup.alert({
  70. title: '提示',
  71. template: '请输入标签'
  72. });
  73. return;
  74. }
  75. }
  76. })
  77. } else {
  78. ResourceLibraryService.judgeManager(UserService.id, 10501).then(function (response) {
  79. if (response.code == 3350 && response.data == true) {
  80. var ionicDialog = $ionicPopup.confirm({
  81. template: '<input type="text" ng-model="label.name">',
  82. title: '请输入自定义标签',
  83. scope: $scope,
  84. okText: '确定',
  85. cancelText: '取消'
  86. });
  87. ionicDialog.then(function (result) {
  88. if (result) {
  89. if ($scope.label.name != null && $scope.label.name != undefined && $scope.label.name.trim() != "") {
  90. ResourceLibraryService.addLabelToDB($stateParams.recourceid, $scope.label.name).then(function (res) {
  91. if (res.code == 3350) {
  92. if (res.data == true) {
  93. //添加成功
  94. $ionicPopup.alert({
  95. title: '提示',
  96. template: '添加标签成功!'
  97. });
  98. $state.reload();
  99. }
  100. if (res.data == false) {
  101. //添加失败
  102. $ionicPopup.alert({
  103. title: '提示',
  104. template: '标签已存在,添加失败!'
  105. });
  106. }
  107. }
  108. $scope.label = {};
  109. }
  110. )
  111. } else {
  112. $ionicPopup.alert({
  113. title: '提示',
  114. template: '请输入标签'
  115. });
  116. return;
  117. }
  118. }
  119. })
  120. } else {
  121. $ionicPopup.alert({
  122. title: '提示',
  123. template: '仅限节点人员和节点运营人员方可进行标签添加功能'
  124. })
  125. return;
  126. }
  127. })
  128. }
  129. })
  130. }
  131. $scope.searchtype = 2;
  132. $scope.allLabel = [];
  133. $scope.showCollapse = {
  134. label: false,
  135. showMore: false
  136. };
  137. // $scope.showMoreLabel = function () {
  138. // $scope.showCollapse.showMore = !$scope.showCollapse.showMore;
  139. // if ($scope.showCollapse.showMore) {
  140. // $scope.label = $scope.allLabel.slice(0, 3);
  141. // } else {
  142. // $scope.label = $scope.allLabel;
  143. // }
  144. // }
  145. // 按标签查询页面
  146. var labelResourceListModal = function () {
  147. $ionicModal.fromTemplateUrl('./modules/common/views/labelResourceListModal.html', {
  148. scope: $scope,
  149. animation: 'slide-in-left'
  150. }).then(function (modal) {
  151. $scope.labelResourceListModal = modal;
  152. });
  153. }
  154. labelResourceListModal();
  155. $scope.keyfilter = {
  156. key: ''
  157. }
  158. // 搜索关键字标红
  159. $scope.badge = function (title) {
  160. var re = eval("/" + $scope.keyfilter.key + "/g");
  161. title = title.replace(re, '<span style="color:red">' + $scope.keyfilter.key + '</span>');
  162. return $sce.trustAsHtml(title)
  163. };
  164. $scope.isShowSearchButton = true;
  165. $scope.showSearchButtonLeft = function () {
  166. $scope.isShowSearchButton = false;
  167. $timeout(function () {
  168. $(".showSearchInput").focus();
  169. }, 300)
  170. }
  171. $scope.clearSearch = function () {
  172. $scope.isShowSearchButton = true;
  173. $scope.keyfilter.key = "";
  174. }
  175. // 标签点击事件
  176. $scope.showResourceAboutTheLabel = function (item) {
  177. ResourceLibraryService.getResourceBySameLabel(item.labelName).then(function (res) {
  178. if (res.code == 3350) {
  179. $scope.go('resourceLabelList', { resourceList: res.data, labelName: item.labelName });
  180. }
  181. })
  182. /*$scope.labelResourceListModal.show();
  183. $scope.labelTitle = item.labelName;
  184. $scope.clearSearch();
  185. $scope.showLoadingToast();
  186. ResourceLibraryService.getResourceFromLabel(item.labelName, $stateParams.recourcecomefrom).then(function (res) {
  187. if (res.code == 3350) {
  188. $scope.allList = res.data.result;
  189. $scope.hideLoadingToast();
  190. }
  191. })*/
  192. }
  193. //进入记录详情
  194. $scope.goDockingdetails = function (rec) {
  195. $scope.islogin = ConfigService.islogin;
  196. if (!$scope.islogin) {
  197. if (localStorage.wxFlag == "true") {
  198. if (localStorage.isUserFocusXW == 0) {
  199. var title = localStorage.appidStr;
  200. $ionicPopup.alert({
  201. title: '提示',
  202. template: '请先关注微信公众号"' + title + '"!'
  203. });
  204. return;
  205. } else {
  206. if (localStorage.isUserBindWx == 0) {
  207. var wxFlag = JSON.parse(localStorage.params);
  208. if (wxFlag.weChatModel) {
  209. $scope.go('bindPhone', {
  210. params: localStorage.params,
  211. comfrom: 'maincontroller',
  212. url: window.location.href.split('#/')[1]
  213. });
  214. } else {
  215. $scope.go('login');
  216. return;
  217. }
  218. } else {
  219. $scope.go('login');
  220. return;
  221. }
  222. }
  223. } else {
  224. $scope.go('login');
  225. return;
  226. }
  227. } else {
  228. $scope.labelResourceListModal.hide();
  229. $scope.go('resourceCommonInfoDetailsPage', { resid: rec.id, isAllVisitor: 1, node: UserService.node });
  230. }
  231. };
  232. //进入资源详情
  233. $scope.goResourceDetail = function (resource) {
  234. $scope.islogin = ConfigService.islogin;
  235. if (!$scope.islogin) {
  236. if (localStorage.wxFlag == "true") {
  237. if (localStorage.isUserFocusXW == 0) {
  238. var title = localStorage.appidStr;
  239. $ionicPopup.alert({
  240. title: '提示',
  241. template: '请先关注微信公众号"' + title + '"!'
  242. });
  243. return;
  244. } else {
  245. if (localStorage.isUserBindWx == 0) {
  246. var wxFlag = JSON.parse(localStorage.params);
  247. if (wxFlag.weChatModel) {
  248. $scope.go('bindPhone', {
  249. params: localStorage.params,
  250. comfrom: 'maincontroller',
  251. url: window.location.href.split('#/')[1]
  252. });
  253. } else {
  254. $scope.go('login');
  255. return;
  256. }
  257. } else {
  258. $scope.go('login');
  259. return;
  260. }
  261. }
  262. } else {
  263. $scope.go('login');
  264. return;
  265. }
  266. } else {
  267. $scope.labelResourceListModal.hide();
  268. $scope.go('resourceCommonDetailsPage', {
  269. recourceid: resource.unique,
  270. recourcetype: resource.type,
  271. recourcecomefrom: $scope.node,
  272. creator: resource.clickthrough,
  273. title: resource.title
  274. });
  275. }
  276. };
  277. // $stateParams.label?$scope.label=JSON.parse($stateParams.label):'';
  278. var orgtype = $stateParams.orgtype;
  279. $scope.comfrom = $stateParams.comfrom;
  280. $scope.pageTitle = $stateParams.title;
  281. var recourceid = $stateParams.recourceid;
  282. var recourcetype = $scope.type = $stateParams.recourcetype;
  283. var recourcecomefrom = $stateParams.recourcecomefrom;
  284. var creator = $stateParams.creator;
  285. var isCache = $stateParams.isCache;
  286. $scope.imagelist = [];
  287. $rootScope.imgUrlList = [];
  288. //登录者id
  289. $scope.userId = UserService.id;
  290. /*var recourceid = 100865;
  291. var recourcetype = $scope.type = 6;
  292. var recourcecomefrom = "320412000";
  293. var creator = 670;
  294. $scope.userId = 670;*/
  295. //加载等待页
  296. $scope.isloadingPageFloor = false;
  297. //加载失败页
  298. $scope.isloadingPageFail = false;
  299. // 提交的评论
  300. $scope.comment = { content: "" };
  301. // 点赞
  302. $scope.TRACE_TYPE_2615 = ConstantService.TRACE_TYPE_2615;
  303. // 取消点赞
  304. $scope.TRACE_TYPE_2616 = ConstantService.TRACE_TYPE_2616;
  305. // 关注
  306. $scope.TRACE_TYPE_2617 = ConstantService.TRACE_TYPE_2617;
  307. // 取消关注
  308. $scope.TRACE_TYPE_2618 = ConstantService.TRACE_TYPE_2618;
  309. // 收藏
  310. $scope.TRACE_TYPE_2619 = ConstantService.TRACE_TYPE_2619;
  311. // 取消收藏
  312. $scope.TRACE_TYPE_2620 = ConstantService.TRACE_TYPE_2620;
  313. // 分享
  314. $scope.TRACE_TYPE_2628 = ConstantService.TRACE_TYPE_2628;
  315. // 无权限显示内容
  316. $scope.TRACE_TYPE_STRING_2600 = ConstantService.TRACE_TYPE_STRING_2600;
  317. // 私密显示内容
  318. $scope.TRACE_TYPE_STRING_2603 = ConstantService.TRACE_TYPE_STRING_2603;
  319. // 基本信息表 resourcelibrary
  320. $scope.TABLE_CODE_30001 = ConstantService.TABLE_CODE_30001;
  321. // 评论表 info_comment
  322. $scope.TABLE_CODE_30002 = ConstantService.TABLE_CODE_30002;
  323. // 用户基本信息 sys_users
  324. $scope.TABLE_CODE_30043 = ConstantService.TABLE_CODE_30043;
  325. //详情页评论
  326. $scope.appComment = function () {
  327. $scope.showComment = true;
  328. var islogin = ConfigService.islogin;
  329. if (!islogin) {
  330. $ionicLoading.show({
  331. template: '请登录!',
  332. noBackdrop: true
  333. });
  334. $timeout(function () {
  335. $ionicLoading.hide();
  336. }, 1000);
  337. return;
  338. } else {
  339. var content = $scope.comment.say;
  340. //提交评论信息
  341. DetailsService.appComment(id, $stateParams.restype, content, siteName).then(function () {
  342. //评论成功后重新获取评论列表
  343. DetailsService.commentList(id, $stateParams.restype).then(function (response) {
  344. $scope.comments = response.res.comment;
  345. }, function () {
  346. });
  347. //重置评论内容为空
  348. $scope.comment.say = "";
  349. }, function () {
  350. });
  351. }
  352. };
  353. $scope.resource = {};
  354. var getResourceIndustryList = function () {
  355. ResourceLibraryService.getResourceIndustryList().then(function (res) {
  356. if (res.code == 3350) {
  357. $scope.industryList = res.data;
  358. }
  359. })
  360. }
  361. getResourceIndustryList();
  362. // 点赞、收藏、分享的传参
  363. $scope.clickRecord =
  364. {
  365. //TODO
  366. targetid: $stateParams.recourceid,
  367. // targetid: 124,
  368. moduleid: ConstantService.TABLE_CODE_30001,
  369. userid: UserService.id,
  370. // userid:1,
  371. clicktype: 1,
  372. content: '资源详情页'
  373. };
  374. // 评论/评论回复的传参
  375. $scope.infoComment =
  376. {
  377. infoid: recourceid,//资源id
  378. infotype: recourcetype,// 资源类别
  379. parentid: 0,// 评论回复时,记录父评论的id
  380. parentuserid: 0,// 评论回复时,记录父评论的创建者
  381. content: "",// 评论/回复内容
  382. //TODO
  383. creator: UserService.id,// 创建者
  384. updater: UserService.id,// 更新者
  385. // creator:1,// 创建者
  386. // updater:1// 更新者
  387. contenttype: '资源详情页'
  388. };
  389. // 获取评论列表的传参
  390. $scope.paramsForInfoCommentList =
  391. {
  392. mode: 1,// 显示样式:1热门 2全部
  393. infoid: recourceid,// 资源id
  394. infotype: recourcetype,// 资源类型
  395. sortkey: 0,// 排序字段
  396. sorttype: "ASC",// 排序方式
  397. moduleid: ConstantService.TABLE_CODE_30002,// 评论表对应的code
  398. //TODO
  399. userid: UserService.id// 登录者id
  400. // userid:1// 登录者id
  401. };
  402. /*参数设置*/
  403. /*========================================================================================================================*/
  404. /*逻辑操作*/
  405. var getCascadList = function (arr, index, key) {
  406. dataToolsService.getWebCascade(key, 1).then(function (response) {
  407. if (UtilService.isDefined(response.data) && response.data.length > 0) {
  408. arr[index].content = response.data[0].name;
  409. dataToolsService.getWebCascade(response.data[0].code, 0).then(function (res) {
  410. var temp = res.data.filter(function (val) {
  411. return val.code == key;
  412. })
  413. if (temp.length > 0) {
  414. arr[index + 1].content = temp[0].name;
  415. }
  416. })
  417. }
  418. }, function () {
  419. })
  420. }
  421. //点击显示具有相同标签信息的资源
  422. $scope.showSameLabelResource = function (labelName) {
  423. ResourceLibraryService.getResourceBySameLabel(labelName).then(function (res) {
  424. if (res.code == 3350) {
  425. $scope.go('resourceLabelList', { resourceList: res.data, labelName: labelName });
  426. }
  427. })
  428. }
  429. //上传头像
  430. $scope.clickup = function () {
  431. if ($scope.privateName != '专家库') {
  432. return
  433. }
  434. $ionicActionSheet.show({
  435. buttons: [{ text: '<a class="action-sheet-push">从相册上传</a>' }],
  436. cancelText: '取消',
  437. buttonClicked: function () {
  438. var files = document.getElementById('file');
  439. files.click();
  440. $(files).unbind().on('change', function (e) {
  441. var data = new FormData();
  442. data.append('file', e.target.files[0]);
  443. // $scope.fatherdata.detailList[$scope.imgIndex].imagelist.push();
  444. CommonService.webUploadImage(data).then(function (res) {
  445. let params = {
  446. node: $scope.node,
  447. photo: res.originalName,
  448. resourceId: $stateParams.recourceid,
  449. restType: "8"
  450. }
  451. ResourceLibraryService.getdataupdatePhoto(params).then(function (row) {
  452. if (row.code = "3350") {
  453. $scope.resourceDetail.baseInfoModel.logo = res.originalName;
  454. CommonService.showMessage("上传成功!", $scope);
  455. } else {
  456. CommonService.showMessage("上传失败!", $scope);
  457. }
  458. })
  459. })
  460. })
  461. return true;
  462. }
  463. })
  464. };
  465. //获取基本信息详情
  466. var getPublicResourceList = function () {
  467. var deferred = $q.defer();
  468. $scope.isloadingPageFloor = true;
  469. //$scope.showLoadingToast();
  470. ResourceLibraryService.getPrivateResourceDetail(recourceid, recourcetype, $scope.node).then(function (response) {
  471. console.log('resource/detail--获取资源详情:', response);
  472. $scope.labelList = response.data.labelContentList;
  473. $scope.allLabel = response.otherObj;
  474. if ($scope.allLabel != null) {
  475. if ($scope.allLabel.length > 3) {
  476. $scope.showCollapse = {
  477. label: true,
  478. showMore: true
  479. };
  480. $scope.label = $scope.allLabel.slice(0, 3);
  481. } else {
  482. $scope.label = $scope.allLabel;
  483. }
  484. }
  485. if ($stateParams.recourcetype == '30') {
  486. for (var i = 0; i < response.data.infoSectionList[0].unitlist.length; i++) {
  487. if (response.data.infoSectionList[0].unitlist[i].tcname == 'category') {
  488. response.data.infoSectionList[0].unitlist.splice(i, 1);
  489. break;
  490. }
  491. }
  492. // angular.forEach(response.data.infoSectionList[0].unitlist,function(val){
  493. // if(val.tcname=='category'){
  494. //
  495. // }
  496. // })
  497. }
  498. // 基本信息
  499. orgtype = response.data.baseInfoModel.restype == 6 ? 10104 : response.data.baseInfoModel.restype == 7 ? 10105 : orgtype;
  500. $scope.contentList = response.data;
  501. $scope.resourceDetail = response.data;
  502. deferred.resolve(3350);
  503. // $(document).attr("title",$scope.resourceDetail.baseInfoModel.title);//修改title值
  504. document.title = $scope.resourceDetail.baseInfoModel.title;
  505. document.getElementById('shareSourc').setAttribute('src', ConfigService.imgurl + $scope.resourceDetail.baseInfoModel.logo);
  506. // angular.forEach($scope.contentList.infoSectionList,function (value) {
  507. // angular.forEach(value.unitlist,function (content) {
  508. // if(content.addimg==1){
  509. // $scope.imagelist=JSON.stringify(content.content).toString();
  510. // var imgWrap = JSON.parse($scope.imagelist);
  511. // var v1=eval(imgWrap);
  512. // $rootScope.imgUrlList=$rootScope.imgUrlList.concat(v1);
  513. // }
  514. // });
  515. // });
  516. $scope.scrollTitle = [];
  517. $scope.allData = [];
  518. angular.forEach(response.data.infoSectionList, function (val) {
  519. //桐庐政策库专用(添加编辑功能)
  520. if (val.title == "政策详情页") {
  521. $scope.policyResource = true;
  522. }
  523. if (val.title) {
  524. angular.forEach(val.unitlist, function (value, index) {
  525. if (value.toggle) {
  526. value.content = value.content == 0 ? '否' : '是';
  527. }
  528. if (value.type == 'cascade') {
  529. getCascadList(val.unitlist, index, value.content)
  530. }
  531. if (value.addimg) {
  532. value.imageList = [];
  533. value.imageList = JSON.parse(value.content);
  534. }
  535. })
  536. var i = 0;
  537. for (; i < val.unitlist.length; i++) {
  538. var value = val.unitlist[i];
  539. if (value.contentflag != 0 && value.type != 'hidden') {
  540. break;
  541. }
  542. }
  543. if (i != val.unitlist.length) {
  544. $scope.scrollTitle.push(val);
  545. if ($scope.scrollTitle.length == 1) {
  546. val.unitListLength = val.unitlist.length;
  547. $scope.allData.push(val);
  548. } else {
  549. $scope.allData.push({
  550. title: val.title,
  551. ishiddensection: val.ishiddensection,
  552. unitListLength: val.unitlist.length
  553. })
  554. }
  555. }
  556. }
  557. })
  558. // if($scope.scrollTitle[0]){
  559. // $scope.scrollTitle[0].ishiddensection=true;
  560. // }
  561. if ($scope.allData[0]) {
  562. $scope.allData[0].ishiddensection = true;
  563. // 处理初中学历
  564. if ($scope.allData[0].unitlist){
  565. angular.forEach($scope.allData[0].unitlist,function (val) {
  566. if (val.title === '学历' && val.content === '3795'){
  567. val.content = '初中';
  568. }
  569. })
  570. }
  571. }
  572. $scope.isloadingPageFloor = false;
  573. $scope.isloadingPageFail = false;
  574. //$scope.hideLoadingToast();
  575. console.log($scope.allData)
  576. }, function () {
  577. $scope.isloadingPageFloor = false;
  578. //$scope.hideLoadingToast();
  579. if ($scope.app) {
  580. UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
  581. } else {
  582. CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
  583. }
  584. $scope.isloadingPageFail = true;
  585. deferred.resolve(3351);
  586. })
  587. ResourceLibraryService.getHistoryDetail(recourceid, $scope.node).then(function (res) {
  588. if (res.code == 3350) {
  589. $scope.historyList = res.data;
  590. }
  591. })
  592. return deferred.promise;
  593. };
  594. //点击切换页
  595. $scope.changeSelecteds = function (index) {
  596. angular.forEach($scope.allData, function (row) {
  597. row.ishiddensection = false
  598. })
  599. $scope.allData[index].ishiddensection = true
  600. $scope.allData[index].unitlist = $scope.scrollTitle[index].unitlist;
  601. }
  602. // 长按删除标签
  603. $scope.skipDown = function (index, row) {
  604. var confirmPopup = $ionicPopup.confirm({
  605. title: '提示',
  606. template: '确定要删除吗?',
  607. cancelText: '取消',
  608. okText: '确定'
  609. });
  610. confirmPopup.then(function (res) {
  611. if (res) {
  612. ResourceLibraryService.labelintelligentdel($stateParams.recourceid, row.labelName, row.labelKey).then(function (res) {
  613. if (res.code == 3350) {
  614. $scope.allLabel.splice(index, 1)
  615. CommonService.showMessage("删除成功", $scope);
  616. $state.reload();
  617. } else {
  618. CommonService.showMessage(res.message, $scope);
  619. }
  620. })
  621. } else {
  622. console.log('You are not sure');
  623. }
  624. });
  625. }
  626. // 获取其他信息
  627. getPublicResourceList().then(function (data) {
  628. if (data == 3350) {
  629. $scope.showLoadingToastUtilEnd();
  630. ResourceLibraryService.getOtherDetail(recourceid, recourcetype, $scope.node).then(function (response) {
  631. console.log('response', response)
  632. $scope.hideLoadingToast()
  633. if (response.code == 3350) {
  634. $scope.infoSectionList = response.data.infoSectionList;
  635. $scope.resourceDetail.infoSectionList = $scope.resourceDetail.infoSectionList.sort(function (a, b) {
  636. return a.sort - b.sort;
  637. });
  638. for (var key in response.data.typecodemap) {
  639. if (!$scope.resourceDetail.typecodemap) {
  640. $scope.resourceDetail.typecodemap = {};
  641. }
  642. $scope.resourceDetail.typecodemap[key] = response.data.typecodemap[key];
  643. }
  644. angular.forEach(response.data.infoSectionList, function (val, index) {
  645. if (val.title) {
  646. angular.forEach(val.unitlist, function (value) {
  647. if (value.addimg) {
  648. value.imageList = [];
  649. value.imageList = JSON.parse(value.content);
  650. }
  651. })
  652. var i = 0;
  653. for (; i < val.unitlist.length; i++) {
  654. var value = val.unitlist[i];
  655. if (value.contentflag != 0 && value.type != 'hidden') {
  656. break;
  657. }
  658. }
  659. if (i != val.unitlist.length) {
  660. $scope.scrollTitle.push(val);
  661. if ($scope.scrollTitle.length == 1) {
  662. val.unitListLength = val.unitlist.length;
  663. $scope.allData.push(val);
  664. } else {
  665. $scope.allData.push({
  666. title: val.title,
  667. ishiddensection: val.ishiddensection,
  668. unitListLength: val.unitlist.length
  669. })
  670. }
  671. }
  672. }
  673. })
  674. console.log($scope.allData)
  675. } else {
  676. $ionicPopup.alert({
  677. title: '提示',
  678. template: "服务器错误"
  679. });
  680. }
  681. }).catch(function (res) {
  682. $scope.hideLoadingToast();
  683. $ionicPopup.alert({
  684. title: '提示',
  685. template: "服务器错误"
  686. });
  687. })
  688. }
  689. });
  690. $scope.clickThis = function (url) {
  691. var wholeUrl = "http://" + url;
  692. window.open(wholeUrl, "_blank");
  693. };
  694. //获取热门评论列表
  695. var getInfoCommentList = function () {
  696. CommentService.getInfoCommentList($scope.paramsForInfoCommentList).then(function (response) {
  697. // 评论列表
  698. $scope.comments = response.data;
  699. }, function () {
  700. })
  701. };
  702. getInfoCommentList();
  703. // $scope.repeatLoad = function () {
  704. // $scope.isloadingPageFail = false;
  705. // getPublicResourceList();
  706. // };
  707. $scope.isHiddenAction = function (index) {
  708. $scope.allData[index].unitlist = $scope.scrollTitle[index].unitlist;
  709. $scope.allData[index].ishiddensection = !$scope.allData[index].ishiddensection;
  710. console.log($scope.allData)
  711. // $scope.scrollTitle[index].ishiddensection=!$scope.scrollTitle[index].ishiddensection;
  712. };
  713. // 详情页跳转
  714. $scope.jumpToLink = function (temp) {
  715. $scope.showSelectLink = false;
  716. if (temp.groupid == "0") {
  717. $scope.go('resourceDetails', {
  718. recourceid: temp.unique,
  719. recourcetype: temp.type,
  720. recourcecomefrom: UserService.node,
  721. title: temp.title,
  722. });
  723. } else {
  724. $scope.go('resourceCommonDetailsPage', {
  725. recourceid: temp.unique,
  726. recourcetype: temp.type,
  727. recourcecomefrom: UserService.node,
  728. creator: temp.clickthrough,
  729. title: temp.title,
  730. // label:$stateParams.label
  731. });
  732. }
  733. }
  734. $scope.showSelectLink = false;
  735. $scope.showSelectedBox = function (item, index, outerIndex, innerIndex) {
  736. if (item == undefined) {
  737. if (!$scope.allData[outerIndex].unitlist[index].linkList) {
  738. return;
  739. }
  740. var temp = $scope.allData[outerIndex].unitlist[index].linkList[0];
  741. $scope.jumpToLink(temp);
  742. } else {
  743. $scope.showSelectLink = true;
  744. }
  745. };
  746. $scope.isVisitHiddenAction = function (index, parentIndex) {
  747. $scope.historyList[parentIndex].infoSectionList[index].ishiddensection = !$scope.historyList[parentIndex].infoSectionList[index].ishiddensection;
  748. };
  749. // 弹出简单评论框
  750. $scope.showComment = true;
  751. $scope.focus_write = function () {
  752. $scope.showComment = false;
  753. };
  754. // 隐藏简单评论框
  755. $scope.hiddenComment = function () {
  756. $scope.showComment = true;
  757. };
  758. // 简单评论框内容变更,判断 发表 按钮颜色
  759. $scope.commentValue = function () {
  760. var search_history = angular.element(document.getElementsByClassName("my_comment"));
  761. if (UtilService.isDefined($scope.comment.content) && $scope.comment.content.length > 1000) {
  762. if ($scope.app) {
  763. UtilService.showMess("您的评论已超过1000字!");
  764. } else {
  765. CommonService.showMessage("您的评论已超过1000字!", $scope);
  766. }
  767. $scope.comment.content = $scope.comment.content.substr(0, 1000);
  768. }
  769. if (UtilService.isDefined($scope.comment.content) && $scope.comment.content != 0) {
  770. $scope.commentNotnull = {
  771. "background-color": "#2a90d7",
  772. "text-decoration": "underline"
  773. };
  774. } else {
  775. $scope.commentNotnull = {
  776. "background-color": "#ccc"
  777. };
  778. }
  779. };
  780. var search_history = angular.element(document.getElementsByClassName("my_comment"));
  781. //查看信息的详情时跳转
  782. $scope.goLibrary = function () {
  783. $scope.go('');
  784. };
  785. //单条履历信息展开并赋值
  786. $scope.opencardWrap = function (currentIndex) {
  787. $scope.showLoadingToast();
  788. dataToolsService.getConnectioninfoDetailByConnid($scope.historyList[currentIndex].id, 1000002, 0, $scope.node).then(function (res) {
  789. dataToolsService.getConnectionOtherInfoDetail($scope.historyList[currentIndex].id, 1000002, 0, $scope.node).then(function (response) {
  790. if (res.data.id) {
  791. // $scope.historyList[currentIndex]= res.data;
  792. $scope.historyList[currentIndex].baseInfoModel = res.data.baseInfoModel;
  793. $scope.historyList[currentIndex].infoSectionList = res.data.infoSectionList.concat(response.data.infoSectionList);
  794. $scope.historyList[currentIndex].typecodemap = Object.assign(res.data.typecodemap, response.data.typecodemap);
  795. } else {
  796. $scope.historyList[currentIndex].baseInfoModel = response.data.baseInfoModel;
  797. $scope.historyList[currentIndex].infoSectionList = response.data.infoSectionList;
  798. $scope.historyList[currentIndex].typecodemap = response.data.typecodemap;
  799. }
  800. if (UtilService.isDefined($scope.historyList[currentIndex])) {
  801. // console.log("=============opencardWrap获取走访履历详情=================");
  802. var tempArr = [];
  803. angular.forEach($scope.historyList[currentIndex].infoSectionList, function (val) {
  804. if (val != null && val.title) {
  805. angular.forEach(val.unitlist, function (value) {
  806. if (value.addimg) {
  807. value.imageList = [];
  808. value.imageList = JSON.parse(value.content);
  809. }
  810. })
  811. }
  812. var i = 0;
  813. if (val != null) {
  814. for (; i < val.unitlist.length; i++) {
  815. var value = val.unitlist[i];
  816. if (value.contentflag != 0 && value.type != 'hidden') {
  817. break;
  818. }
  819. }
  820. if (i != val.unitlist.length) {
  821. tempArr.push(val);
  822. }
  823. }
  824. })
  825. // 基本信息
  826. $scope.historyList[currentIndex].isShowVisitContent = !$scope.historyList[currentIndex].isShowVisitContent;
  827. $scope.historyList[currentIndex].infoSectionList = tempArr;
  828. $scope.historyList[currentIndex].infoSectionList[0].ishiddensection = true;
  829. }
  830. $scope.hideLoadingToast();
  831. }, function () {
  832. $scope.hideLoadingToast();
  833. if ($scope.app) {
  834. UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
  835. } else {
  836. CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
  837. }
  838. });
  839. })
  840. };
  841. //单条履历信息中的模块展开
  842. $scope.openCard = function () {
  843. $scope.historyList.isShowCard = !$scope.historyList.isShowCard;
  844. };
  845. //单挑履历的收起
  846. $scope.opencardHiddenWrap = function (currentIndex) {
  847. $scope.historyList[currentIndex].isShowVisitContent = !$scope.historyList[currentIndex].isShowVisitContent;
  848. };
  849. // 控制重复点击
  850. var flag = 1;
  851. // 操作:点赞、关注、收藏
  852. $scope.praiseAction = function (clicktype, recourceid, moduleid, ind) {
  853. console.log('点击收藏', clicktype, recourceid, moduleid, ind);
  854. if (flag == 0) {
  855. return;
  856. }
  857. flag = 0;
  858. // 点赞 or 收藏 资源
  859. // 取消点赞 or 取消收藏 资源
  860. if (clicktype == $scope.TRACE_TYPE_2615 || clicktype == $scope.TRACE_TYPE_2619
  861. || clicktype == $scope.TRACE_TYPE_2616 || clicktype == $scope.TRACE_TYPE_2620) {
  862. $scope.clickRecord.targetid = recourceid;
  863. $scope.clickRecord.moduleid = moduleid;
  864. } else if (clicktype == $scope.TRACE_TYPE_2617 || clicktype == $scope.TRACE_TYPE_2618) {
  865. // 关注 用户
  866. // 取消关注 用户
  867. $scope.clickRecord.targetid = $scope.resourceDetail.creator;
  868. $scope.clickRecord.moduleid = $scope.TABLE_CODE_30043;
  869. }
  870. $scope.clickRecord.clicktype = clicktype;
  871. CommentService.postClickFavour($scope.clickRecord).then(function (response) {
  872. if (response.code == ConstantService.INTERFACE_STATUS_CODE_3350) {
  873. // 点赞
  874. if (clicktype == $scope.TRACE_TYPE_2615) {
  875. // 信息
  876. if (moduleid == $scope.TABLE_CODE_30001) {
  877. $scope.resourceDetail.favourcount = $scope.resourceDetail.favourcount + 1;
  878. $scope.resourceDetail.favour = !$scope.resourceDetail.favour;
  879. } else
  880. // 评论
  881. if (moduleid == $scope.TABLE_CODE_30002) {
  882. $scope.comments[ind].favourcount = $scope.comments[ind].favourcount + 1;
  883. $scope.comments[ind].favour = !$scope.comments[ind].favour;
  884. }
  885. } else
  886. // 取消点赞
  887. if (clicktype == $scope.TRACE_TYPE_2616) {
  888. // 信息
  889. if (moduleid == $scope.TABLE_CODE_30001) {
  890. $scope.resourceDetail.favourcount = $scope.resourceDetail.favourcount - 1;
  891. $scope.resourceDetail.favour = !$scope.resourceDetail.favour;
  892. } else
  893. // 评论
  894. if (moduleid == $scope.TABLE_CODE_30002) {
  895. $scope.comments[ind].favourcount = $scope.comments[ind].favourcount - 1;
  896. $scope.comments[ind].favour = !$scope.comments[ind].favour;
  897. }
  898. }
  899. // 关注
  900. // 取消关注
  901. else if (clicktype == $scope.TRACE_TYPE_2617
  902. || clicktype == $scope.TRACE_TYPE_2618) {
  903. $scope.resourceDetail.focus = !$scope.resourceDetail.focus;
  904. }
  905. // 收藏
  906. // 取消收藏
  907. else if (clicktype == $scope.TRACE_TYPE_2619
  908. || clicktype == $scope.TRACE_TYPE_2620) {
  909. $scope.resourceDetail.collect = !$scope.resourceDetail.collect;
  910. }
  911. }
  912. // UtilService.showMess(response.clickStatus);
  913. // 若是评论点赞,则刷新评论列表
  914. if (moduleid == $scope.TABLE_CODE_30002) {
  915. $timeout(function () {
  916. getInfoCommentList();
  917. }, 650);
  918. }
  919. // 恢复可用
  920. flag = 1;
  921. }, function () {
  922. // 恢复可用
  923. flag = 1;
  924. if ($scope.app) {
  925. UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
  926. } else {
  927. CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
  928. }
  929. })
  930. };
  931. //分享
  932. $scope.shareflg = false;
  933. $scope.openShare = function () {
  934. if ($scope.app) {
  935. $scope.shareflg = true;
  936. } else {
  937. $scope.shareMessage();
  938. }
  939. };
  940. $scope.closeShareBox = function () {
  941. $scope.shareflg = false;
  942. };
  943. //TODO
  944. $scope.showShareWechat = false;
  945. $scope.closeShare = function () {
  946. $scope.showShareWechat = false;
  947. };
  948. var sharelink = "https://blog.csdn.net/molong421/article/details/51586194";
  949. //0:QQ,1:QQ空间,2:微信,3:微信朋友圈,4:新浪微博
  950. $scope.shareMessage = function (type) {
  951. $scope.shareflg = false;
  952. var linkUrl = ConfigService.webserver + '#/resourceCommonDetailsPage/' + $stateParams.recourceid + '/' + $stateParams.recourcetype + '/' + $scope.node + '/' + $stateParams.title;
  953. var imagurl = $scope.resourceDetail.baseInfoModel.logo ? (ConfigService.imgurl + $scope.resourceDetail.baseInfoModel.logo) : "https://cordova.apache.org/static/img/cordova_bot.png";
  954. var message = {
  955. title: $scope.resourceDetail.baseInfoModel.title,
  956. description: $scope.resourceDetail.baseInfoModel.title.substring(0, 19),
  957. url: linkUrl,
  958. imageurl: imagurl
  959. };
  960. if ($scope.app) {
  961. $scope.showLoadingToast();
  962. // var message = {
  963. // title: $scope.resourceDetail.title,
  964. // description: $scope.resourceDetail.title.substring(0,19),
  965. // url: sharelink,
  966. // imageurl: imagurl
  967. // };
  968. switch (type) {
  969. case 0:
  970. case 1:
  971. ShareService.shareToQQ(type, message).then(function () {
  972. $scope.hideLoadingToast();
  973. if ($scope.app) {
  974. UtilService.showMess("QQ分享成功");
  975. } else {
  976. CommonService.showMessage("QQ分享成功", $scope);
  977. }
  978. }, function (error) {
  979. $scope.hideLoadingToast();
  980. if ($scope.app) {
  981. UtilService.showMess(error);
  982. } else {
  983. CommonService.showMessage(error, $scope);
  984. }
  985. });
  986. break;
  987. case 2:
  988. ShareService.shareToWechat(type, message).then(function () {
  989. // UtilService.showMess("微信分享成功");
  990. $scope.hideLoadingToast();
  991. if ($scope.app) {
  992. UtilService.showMess("微信分享成功");
  993. } else {
  994. CommonService.showMessage("微信分享成功", $scope);
  995. }
  996. }, function (error) {
  997. // UtilService.showMess(error);
  998. $scope.hideLoadingToast();
  999. if ($scope.app) {
  1000. UtilService.showMess(error);
  1001. } else {
  1002. CommonService.showMessage(error, $scope);
  1003. }
  1004. });
  1005. break;
  1006. case 3:
  1007. ShareService.shareToWechat(type, message).then(function () {
  1008. // UtilService.showMess("微信分享成功");
  1009. $scope.hideLoadingToast();
  1010. if ($scope.app) {
  1011. UtilService.showMess("微信分享成功");
  1012. } else {
  1013. CommonService.showMessage("微信分享成功", $scope);
  1014. }
  1015. }, function (error) {
  1016. // UtilService.showMess(error);
  1017. $scope.hideLoadingToast();
  1018. if ($scope.app) {
  1019. UtilService.showMess(error);
  1020. } else {
  1021. CommonService.showMessage(error, $scope);
  1022. }
  1023. });
  1024. break;
  1025. case 4:
  1026. ShareService.shareToWeibo(message).then(function () {
  1027. // UtilService.showMess("新浪微博分享成功");
  1028. $scope.hideLoadingToast();
  1029. if ($scope.app) {
  1030. UtilService.showMess("新浪微博分享成功");
  1031. } else {
  1032. CommonService.showMessage("新浪微博分享成功", $scope);
  1033. }
  1034. }, function (error) {
  1035. // UtilService.showMess(error);
  1036. $scope.hideLoadingToast();
  1037. if ($scope.app) {
  1038. UtilService.showMess(error);
  1039. } else {
  1040. CommonService.showMessage(error, $scope);
  1041. }
  1042. });
  1043. break;
  1044. default:
  1045. break;
  1046. }
  1047. $timeout(function () {
  1048. $scope.hideLoadingToast();
  1049. }, 10000);
  1050. } else {
  1051. $scope.showShareWechat = true;
  1052. var content = document.getElementById('qrcode-dialog1');
  1053. content.innerHTML = '';
  1054. var qrcode = new QRCode(content, {
  1055. text: $scope.resourceDetail.baseInfoModel.title,
  1056. // title: $scope.resourceDetail.baseInfoModel.title,
  1057. // description: $scope.resourceDetail.baseInfoModel.title.substring(0,19),
  1058. // url: linkUrl,
  1059. // imageurl: imagurl,
  1060. width: 200,
  1061. height: 200
  1062. })
  1063. qrcode.makeCode(linkUrl);
  1064. }
  1065. };
  1066. //发布普通评论
  1067. $scope.publishComment = function (type, comment) {
  1068. $scope.showComment = true;
  1069. var content = $scope.comment.content;
  1070. $scope.infoComment.content = content;
  1071. // 评论
  1072. if (type == 1) {
  1073. $scope.infoComment.parentid = 0;// 评论回复时,记录父评论的id
  1074. $scope.infoComment.parentuserid = 0;// 评论回复时,记录父评论的创建者
  1075. }
  1076. // 评论回复
  1077. else if (type == 2) {
  1078. $scope.infoComment.parentid = comment.id;// 评论回复时,记录父评论的id
  1079. $scope.infoComment.parentuserid = comment.creator;// 评论回复时,记录父评论的创建者
  1080. }
  1081. //提交评论信息
  1082. $scope.showLoadingToast();
  1083. CommentService.publishSimpleComment($scope.infoComment).then(function () {
  1084. if ($scope.app) {
  1085. UtilService.showMess("评论成功");
  1086. } else {
  1087. CommonService.showMessage("评论成功", $scope);
  1088. }
  1089. $scope.infoComment.content = "";
  1090. getInfoCommentList();
  1091. /*if ($scope.comments.length >= 3) {
  1092. $timeout(function () {
  1093. $scope.getInfoCommentList();
  1094. }, 650);
  1095. }*/
  1096. $scope.hideLoadingToast();
  1097. }, function () {
  1098. $scope.hideLoadingToast();
  1099. });
  1100. };
  1101. //发表详细评论
  1102. $scope.releaseComment = function () {
  1103. $scope.go('releaseComment', {
  1104. infoid: recourceid,
  1105. infotype: recourcetype,
  1106. comlen: $scope.commentlist.length,
  1107. recourcecomefrom: $scope.node
  1108. })
  1109. };
  1110. //点击抢沙发
  1111. $scope.hadSoft = function () {
  1112. $scope.showComment = false;
  1113. $(".my_comment").focus();
  1114. };
  1115. $scope.showComment = true;
  1116. $scope.focus_write = function () {
  1117. scrollToBottom();//滚动至底部
  1118. $scope.showComment = false;
  1119. $(".my_comment").focus();
  1120. };
  1121. $scope.hiddenComment = function () {
  1122. $scope.showComment = true;
  1123. };
  1124. //跳转到评论详情页comment
  1125. $scope.goComment = function (comment) {
  1126. $scope.go("Reply", {
  1127. comment: comment,
  1128. infotype: comment.infotype,
  1129. infoid: comment.infoid,
  1130. comfrom: '资源详情页'
  1131. })
  1132. };
  1133. //跳转到评论发布者的主页
  1134. $scope.goPublisher = function () {
  1135. if ($scope.creatorId != 0) {
  1136. $scope.go('publisher', { Id: $scope.creatorId });
  1137. }
  1138. };
  1139. // 滚动至底部
  1140. var scrollToBottom = function () {
  1141. $timeout(function () {
  1142. $ionicScrollDelegate.$getByHandle("calenderContent").scrollBottom();
  1143. }, 0);
  1144. };
  1145. //进入评论列表页
  1146. // $scope.goCommentList = function () {
  1147. // $timeout(function () {
  1148. // $scope.go('comment', {
  1149. // mode: 2,
  1150. // infoid: $scope.resourceDetail.id,
  1151. // infotype: $scope.resourceDetail.restype
  1152. // });
  1153. // }, 350);
  1154. // };
  1155. //进入资源详情
  1156. $scope.jumpResourceDetail = function () {
  1157. // 再跳转到资源详情页
  1158. $scope.go('resourceCommonDetailsPage', {
  1159. recourceid: recourceid,
  1160. recourcetype: recourcetype,
  1161. recourcecomefrom: $scope.node + " ",
  1162. creator: creator,
  1163. isCache: true, // 是否要强制刷新,
  1164. // label:$stateParams.label
  1165. });
  1166. };
  1167. // 申请权限消耗普适积分
  1168. var consumptionPushPoints = function (authorityid) {
  1169. // 获取录入界面的传参
  1170. $scope.requestModel = {
  1171. data: [],
  1172. userid: UserService.id
  1173. };
  1174. // 传参格式
  1175. $scope.requestModel.data.push(authorityid);
  1176. AccountService.consumptionPushPoints($scope.requestModel).then(function (response) {
  1177. if (response.code == ConstantService.INTERFACE_STATUS_CODE_3350) {
  1178. // console.log("==============申请权限消耗普适积分成功================");
  1179. // 消耗成功后刷新页面
  1180. $scope.jumpResourceDetail();
  1181. } else if (response.code == ConstantService.INTERFACE_STATUS_CODE_21102) {
  1182. // 提示积分不足
  1183. if ($scope.app) {
  1184. UtilService.showMess(ConstantService.INTERFACE_MESSAGE_21102);
  1185. } else {
  1186. CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_21102, $scope);
  1187. }
  1188. }
  1189. }, function () {
  1190. // 购买失败
  1191. if ($scope.app) {
  1192. UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
  1193. } else {
  1194. CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
  1195. }
  1196. });
  1197. };
  1198. //查看将消耗
  1199. $scope.isCanApply = function (authorityid) {
  1200. /*// 正常访问,退出
  1201. if($scope.resourceDetail.contactorshowcode == ConstantService.TRACE_TYPE_2602 ||
  1202. $scope.resourceDetail.contactorshowcode == ConstantService.TRACE_TYPE_2603){
  1203. return;
  1204. }*/
  1205. // 获取权限详情
  1206. $scope.pushvalue = 0;
  1207. AccountService.getAuthorityInfo(authorityid).then(function (response) {
  1208. if (response.code == ConstantService.INTERFACE_STATUS_CODE_3350) {
  1209. // 消耗成功后刷新页面
  1210. $scope.authorityinfo = response.data;
  1211. $scope.pushvalue = $scope.authorityinfo.pushvalue;
  1212. $ionicPopup.show({
  1213. title: '查看将消耗',
  1214. template: "<p class='applyWrapFloor'>" +
  1215. "<i class='ion-ios-pricetags'></i>" +
  1216. "<em>{{pushvalue}}</em>" +
  1217. "<span>普适分</span></p>",
  1218. scope: $scope,
  1219. buttons: [
  1220. {
  1221. text: "取消",
  1222. onTap: function () {
  1223. // console.log('取消')
  1224. }
  1225. },
  1226. {
  1227. text: '<span class="ionicAction_span">申请</span>',
  1228. type: "button-positive",
  1229. onTap: function () {
  1230. // console.log('申请');
  1231. // 申请权限消耗普适积分
  1232. consumptionPushPoints(authorityid);
  1233. }
  1234. }
  1235. ]
  1236. });
  1237. }
  1238. }, function () {
  1239. // 购买失败
  1240. if ($scope.app) {
  1241. UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
  1242. } else {
  1243. CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
  1244. }
  1245. });
  1246. };
  1247. //是否可以申请权限
  1248. $scope.isApplyAuthority = function (authorityid) {
  1249. // var tempdata = {
  1250. // title: $scope.resourceDetail.title,
  1251. // recourceid: recourceid,
  1252. // recourcetype: recourcetype,
  1253. // recourcecomefrom: $scope.node,
  1254. // authorityid: authorityid,
  1255. // type: ConstantService.TRACE_TYPE_2640
  1256. // };
  1257. // $scope.go("resourceApply", { authoritydata: angular.toJson(tempdata) })
  1258. };
  1259. //打开操作表:设置/编辑
  1260. $scope.openActionSheet = function () {
  1261. // isedit:是否可以编辑资源,isset:是否可以设置权限
  1262. var buttonlist = [];
  1263. //TODO
  1264. // if($scope.resourceDetail.ishasedit){
  1265. // buttonlist.push({text: '编辑'})
  1266. // }
  1267. if ($scope.isuserInOrg) {
  1268. $scope.resourceDetail.ishasedit = true;
  1269. }
  1270. if ($scope.resourceDetail.ishasset) {
  1271. buttonlist.push({ text: '设置' })
  1272. }
  1273. // if ($scope.resourceDetail.ishasedit&&(recourcetype==30||recourcetype==31||recourcetype==32||recourcetype==33||recourcetype==34)) {
  1274. if ($scope.resourceDetail.ishasedit) {
  1275. buttonlist.push({ text: '编辑' })
  1276. }
  1277. //桐庐政策库专用
  1278. if ($scope.policyResource) {
  1279. buttonlist.push({ text: '编辑' });
  1280. }
  1281. $ionicActionSheet.show({
  1282. buttons: buttonlist,
  1283. cancelText: '取消',
  1284. buttonClicked: function (index) {
  1285. //桐庐政策库专用
  1286. if ($scope.policyResource || $scope.isuserInOrg) {
  1287. index = 1;
  1288. }
  1289. if (index == 0) {
  1290. $scope.go("selectFieldsToSet", {
  1291. typecodemap: $scope.resourceDetail.typecodemap,
  1292. resid: recourceid,
  1293. typecode: ConstantService.TABLE_CODE_30001
  1294. });
  1295. } else if (index == 1) {
  1296. if ($scope.policyResource || $stateParams.restype == 30 || $stateParams.restype == 31 || $stateParams.restype == 32 || $stateParams.restype == 33 || $stateParams.restype == 34) {
  1297. $scope.go('visitModularForm', {
  1298. companyid: $scope.resourceDetail.baseInfoModel.oid,
  1299. pageid: $stateParams.recourcetype,
  1300. orgtype: orgtype,
  1301. isedit: 1,// isedit:对应的是0新增/1编辑/2复制并新建
  1302. connid: $scope.resourceDetail.id,
  1303. node: $scope.node,
  1304. pagecode: 1000030,
  1305. title: $scope.resourceDetail.baseInfoModel.title,
  1306. pageTitle: '编辑 ' + $scope.resourceDetail.baseInfoModel.title,
  1307. comfrom: 'resource',
  1308. restype: recourcetype
  1309. });
  1310. } else {
  1311. ResourceLibraryService.getPageId($stateParams.recourcetype).then(function (res) {
  1312. $scope.go('visitModularForm', {
  1313. companyid: $scope.resourceDetail.baseInfoModel.oid,
  1314. pageid: res.data,
  1315. orgtype: orgtype,
  1316. isedit: 1,// isedit:对应的是0新增/1编辑/2复制并新建
  1317. connid: $scope.resourceDetail.id,
  1318. node: $scope.node,
  1319. pagecode: 1000030,
  1320. title: $scope.resourceDetail.baseInfoModel.title,
  1321. pageTitle: '编辑 ' + $scope.resourceDetail.baseInfoModel.title,
  1322. comfrom: 'resourceCommonDetailsPage',
  1323. restype: recourcetype,
  1324. resourcetype: recourcetype,
  1325. });
  1326. });
  1327. }
  1328. }
  1329. return true;
  1330. }
  1331. });
  1332. };
  1333. // 新建走访
  1334. $scope.createNewPage = function (type, companyid) {
  1335. console.log({
  1336. companyid: $scope.resourceDetail.oid,
  1337. pageid: 1,
  1338. orgtype: $stateParams.recourcetype == '6' ? 10104 : 10105,
  1339. isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  1340. connid: 0,
  1341. node: $scope.node,
  1342. pagecode: 1000003,
  1343. title: $scope.resourceDetail.baseInfoModel.title,
  1344. pageTitle: $scope.comfrom == 'typein' ? '新建录入' : '新建走访'
  1345. })
  1346. // return;
  1347. $scope.go('visitModularForm', {
  1348. companyid: $scope.resourceDetail.baseInfoModel.oid,
  1349. pageid: $stateParams.recourcetype == '6' ? 1 : 2,
  1350. orgtype: $stateParams.recourcetype == '6' ? 10104 : 10105,
  1351. isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  1352. connid: 0,
  1353. node: $scope.node,
  1354. pagecode: $stateParams.recourcetype == '6' ? 1000003 : 1000004,
  1355. title: $scope.resourceDetail.baseInfoModel.title,
  1356. pageTitle: $scope.comfrom == 'typein' ? '新建录入' : '新建走访',
  1357. comfrom: 'resourceLibrary',
  1358. templettype: $stateParams.recourcetype,
  1359. resid: $scope.resourceDetail.id
  1360. });
  1361. // switch (type) {
  1362. // case 6:
  1363. // if($scope.comfrom=='typein'){
  1364. // if($stateParams.recourcecomefrom=='320117005'||$stateParams.recourcecomefrom=='320117003'||$stateParams.recourcecomefrom=='320117002'||$stateParams.recourcecomefrom=='320117001'||$stateParams.recourcecomefrom=='320117004'){
  1365. // $scope.go('typeinAllModal', {
  1366. // companyid: companyid,
  1367. // pageid: 11,
  1368. // orgtype: orgtype,
  1369. // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  1370. // connid: 0,
  1371. // node:$stateParams.recourcecomefrom,
  1372. // pagecode:1000003,
  1373. // title:$stateParams.title
  1374. // });
  1375. // }else{
  1376. // $scope.go('typeinInformation', {
  1377. // companyid: companyid,
  1378. // pageid: 3,
  1379. // orgtype: orgtype,
  1380. // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  1381. // connid: 0,
  1382. // node:$stateParams.recourcecomefrom,
  1383. // pagecode:1000003,
  1384. // title:$stateParams.title
  1385. // });
  1386. // }
  1387. // }else{
  1388. // if($stateParams.recourcecomefrom=='320117005'||$stateParams.recourcecomefrom=='320117003'||$stateParams.recourcecomefrom=='320117002'||$stateParams.recourcecomefrom=='320117001'||$stateParams.recourcecomefrom=='320117004'){
  1389. // $scope.go('visitModularForm', {
  1390. // companyid: companyid,
  1391. // pageid: 12,
  1392. // orgtype: orgtype,
  1393. // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  1394. // connid: 0,
  1395. // node:$stateParams.recourcecomefrom,
  1396. // pagecode:1000003,
  1397. // title:$stateParams.title
  1398. // });
  1399. // }else{
  1400. // $scope.go('visitModularForm', {
  1401. // companyid: companyid,
  1402. // pageid: 1,
  1403. // orgtype: orgtype,
  1404. // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  1405. // connid: 0,
  1406. // node:$stateParams.recourcecomefrom,
  1407. // pagecode:1000003,
  1408. // title:$stateParams.title
  1409. // });
  1410. // }
  1411. // }
  1412. // break;
  1413. // case 7:
  1414. // $scope.go('visitModularForm', {
  1415. // companyid: companyid,
  1416. // pageid: 2,
  1417. // orgtype: 10105,
  1418. // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  1419. // connid: 0,
  1420. // node:$stateParams.recourcecomefrom,
  1421. // pagecode:1000003,
  1422. // title:$stateParams.title
  1423. // });
  1424. // break;
  1425. // return;
  1426. // }
  1427. };
  1428. // 复制并新建
  1429. $scope.copyAndNewPage = function (pageid, connid, node, pagecode) {
  1430. $scope.go('visitModularForm', {
  1431. companyid: 0,
  1432. pageid: pageid,
  1433. orgtype: orgtype,
  1434. isedit: 2,// isedit:对应的是0新增/1编辑/2复制并新建
  1435. connid: connid,
  1436. // node:$stateParams.recourcecomefrom,
  1437. pagecode: pagecode,
  1438. node: node,
  1439. title: $stateParams.title,
  1440. pageTitle: $scope.comfrom == 'typein' ? '复制并编辑录入' : '复制并编辑走访'
  1441. });
  1442. // switch (pageid) {
  1443. // case 3:
  1444. // $scope.go("unitOrPersonalBaseInfo", {pageid: pageid, connid: connid, isedit: 2});
  1445. // break;
  1446. // case 4:
  1447. // $scope.go("recordDemandInfo", {pageid: pageid, connid: connid, isedit: 2});
  1448. // break;
  1449. // case 5:
  1450. // $scope.go("recordAchievementsInfo", {pageid: pageid, connid: connid, isedit: 2});
  1451. // break;
  1452. // case 6:
  1453. // $scope.go("recordProductInfo", {pageid: pageid, connid: connid, isedit: 2});
  1454. // break;
  1455. // case 7:
  1456. // $scope.go("recordPatentInfo", {pageid: pageid, connid: connid, isedit: 2});
  1457. // break;
  1458. // case 8:
  1459. // $scope.go("recordTalentInfo", {pageid: pageid, connid: connid, isedit: 2});
  1460. // break;
  1461. // default:
  1462. // $scope.go('visitModularForm', {
  1463. // companyid: 0,
  1464. // pageid: pageid,
  1465. // orgtype: 1,
  1466. // isedit: 2,// isedit:对应的是0新增/1编辑/2复制并新建
  1467. // connid: connid,
  1468. // node:$stateParams.recourcecomefrom,
  1469. // pagecode:1000003,
  1470. // title:$stateParams.title
  1471. // });
  1472. // return;
  1473. // }
  1474. };
  1475. // 点击头像或名字进入个人主页
  1476. $scope.goPublisher = function (userid) {
  1477. if (userid != 0) {
  1478. $scope.go('publisher', { Id: userid });
  1479. }
  1480. };
  1481. //走访记录的其他信息
  1482. $scope.sourceInfo = [];
  1483. //点击图片放大
  1484. $scope.bigImage = false; //初始默认大图是隐藏的
  1485. $scope.hideBigImage = function () {
  1486. $timeout(function () {
  1487. if ($scope.app) {
  1488. $scope.setStatusBar(0);
  1489. }
  1490. $scope.bigImage = false;
  1491. }, 400);
  1492. };
  1493. $scope.shouBigImage = function (outerIndex, innerIndex, index) { //传递一个参数(图片的URl)
  1494. if ($scope.app) {
  1495. $scope.setStatusBar(1);
  1496. }
  1497. $scope.imgUrlList = $scope.allData[outerIndex].unitlist[innerIndex].imageList;
  1498. var str = $scope.imgUrlList[index].sourceName.split('.');
  1499. if (str && str.length > 0 && str[1] != 'jpg' && str[1] != 'gif' && str[1] != 'bmp' && str[1] != 'png' && str[1] != 'jpeg') {
  1500. if ($scope.imgUrlList[index]) {
  1501. window.open(ConfigService.imgurl + $scope.imgUrlList[index].sourceName);
  1502. return;
  1503. }
  1504. }
  1505. $scope.bigImage = true; //显示大图
  1506. $(function () {
  1507. $('div.pinch-zoom').each(function () {
  1508. new RTP.PinchZoom($(this), {});
  1509. });
  1510. });
  1511. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  1512. //图片总数量
  1513. setTimeout(function () {
  1514. // console.log(parseInt($ionicSlideBoxDelegate.slidesCount()));
  1515. // console.log(parseInt($ionicSlideBoxDelegate.currentIndex()));
  1516. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, 0);
  1517. //获取图片
  1518. var imgObj = document.getElementsByClassName('bigimage');
  1519. var n;
  1520. for (n = 0; n < imgObj.length; n++) {
  1521. // 获取图片的原始高度和宽度
  1522. var oldWid = imgObj[n].naturalWidth;
  1523. var oldHei = imgObj[n].naturalHeight;
  1524. var screen = document.body.offsetWidth;
  1525. var screenH = window.innerHeight;
  1526. // console.log(oldWid/oldHei);
  1527. // console.log(screen );
  1528. var rate = oldWid / oldHei;
  1529. if (oldWid >= screen && oldHei >= screenH) {
  1530. var tw = screen;
  1531. var th = tw / rate;
  1532. if (th < screenH) {
  1533. imgObj[n].style.width = tw + 'px';
  1534. imgObj[n].style.height = th + 'px';
  1535. imgObj[n].style.marginTop = (screenH - th) / 2 + 'px';
  1536. } else {
  1537. imgObj[n].style.width = screenH * rate + 'px';
  1538. imgObj[n].style.height = screenH + 'px';
  1539. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  1540. }
  1541. } else if (oldWid >= screen && oldHei <= screenH) {
  1542. imgObj[n].style.width = screen + 'px';
  1543. imgObj[n].style.height = screen / rate + 'px';
  1544. imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px';
  1545. } else if (oldWid <= screen && oldHei >= screenH) {
  1546. // var hh=screenH;
  1547. // var ww=screenH*rate;
  1548. imgObj[n].style.width = screenH * rate + 'px';
  1549. imgObj[n].style.height = screenH + 'px';
  1550. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  1551. } else {
  1552. imgObj[n].style.width = oldWid + 'px';
  1553. imgObj[n].style.height = oldHei + 'px';
  1554. imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px';
  1555. imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px';
  1556. }
  1557. }
  1558. }, 500);
  1559. };
  1560. //去认领企业
  1561. $scope.goClaim = function () {
  1562. $scope.go('identifyForm', {
  1563. pageTitle: "企业认证",
  1564. code: 4803,
  1565. type: 5100,
  1566. id: 0,
  1567. action: 'submit',
  1568. pagesize: 15,
  1569. pagenum: 1,
  1570. companyName: $scope.resourceDetail.baseInfoModel.title
  1571. });
  1572. }
  1573. $scope.goBackPage = function () {
  1574. if ($stateParams.comfrom == "privateResource") {
  1575. $scope.go('privateResource', {
  1576. res: angular.toJson($stateParams.res),
  1577. groupid: $stateParams.groupid,
  1578. restype: $stateParams.restype,
  1579. filterList: $stateParams.filterList,
  1580. MoreData: $stateParams.MoreData,
  1581. capacityparams: $stateParams.capacityparams,
  1582. checkedsort: $stateParams.checkedsort
  1583. })
  1584. } else {
  1585. $scope.goback();
  1586. }
  1587. }
  1588. $scope.goToMonthReport = function () {
  1589. //获取月报表数据中的年份数据(false)
  1590. statisticsReportService.getTongLuReportYear($scope.resourceDetail.baseInfoModel.oid, false).then(function (res) {
  1591. if (res.code == 3350) {
  1592. if (res.data.length != 0) {
  1593. $scope.go('tongluMonthReport', { resource: $scope.resourceDetail });
  1594. } else {
  1595. if ($scope.app) {
  1596. UtilService.showMess('');
  1597. } else {
  1598. CommonService.showMessage('暂无月报数据', $scope)
  1599. }
  1600. }
  1601. }
  1602. })
  1603. }
  1604. $scope.goToYearReport = function () {
  1605. $scope.go('tongluYearReport', {
  1606. datalist: $scope.datalist,
  1607. title: $stateParams.title,
  1608. orgid: $scope.resourceDetail.baseInfoModel.oid
  1609. });
  1610. }
  1611. }
  1612. )