resourceCommonDetailsPageCtrl.js 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698
  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. const lName = labelName === '其他'? '6709' : labelName;
  424. ResourceLibraryService.getResourceBySameLabel(lName).then(function (res) {
  425. if (res.code == 3350) {
  426. $scope.go('resourceLabelList', { resourceList: res.data, labelName: labelName });
  427. }
  428. })
  429. }
  430. //上传头像
  431. $scope.clickup = function () {
  432. if ($scope.privateName != '专家库') {
  433. return
  434. }
  435. $ionicActionSheet.show({
  436. buttons: [{ text: '<a class="action-sheet-push">从相册上传</a>' }],
  437. cancelText: '取消',
  438. buttonClicked: function () {
  439. var files = document.getElementById('file');
  440. files.click();
  441. $(files).unbind().on('change', function (e) {
  442. var data = new FormData();
  443. data.append('file', e.target.files[0]);
  444. // $scope.fatherdata.detailList[$scope.imgIndex].imagelist.push();
  445. CommonService.webUploadImage(data).then(function (res) {
  446. let params = {
  447. node: $scope.node,
  448. photo: res.originalName,
  449. resourceId: $stateParams.recourceid,
  450. restType: "8"
  451. }
  452. ResourceLibraryService.getdataupdatePhoto(params).then(function (row) {
  453. if (row.code = "3350") {
  454. $scope.resourceDetail.baseInfoModel.logo = res.originalName;
  455. CommonService.showMessage("上传成功!", $scope);
  456. } else {
  457. CommonService.showMessage("上传失败!", $scope);
  458. }
  459. })
  460. })
  461. })
  462. return true;
  463. }
  464. })
  465. };
  466. //获取基本信息详情
  467. var getPublicResourceList = function () {
  468. var deferred = $q.defer();
  469. $scope.isloadingPageFloor = true;
  470. //$scope.showLoadingToast();
  471. ResourceLibraryService.getPrivateResourceDetail(recourceid, recourcetype, $scope.node).then(function (response) {
  472. console.log('resource/detail--获取资源详情:', response);
  473. $scope.labelList = response.data.labelContentList;
  474. $scope.allLabel = response.otherObj;
  475. if ($scope.allLabel != null) {
  476. if ($scope.allLabel.length > 3) {
  477. $scope.showCollapse = {
  478. label: true,
  479. showMore: true
  480. };
  481. $scope.label = $scope.allLabel.slice(0, 3);
  482. } else {
  483. $scope.label = $scope.allLabel;
  484. }
  485. }
  486. if ($stateParams.recourcetype == '30') {
  487. for (var i = 0; i < response.data.infoSectionList[0].unitlist.length; i++) {
  488. if (response.data.infoSectionList[0].unitlist[i].tcname == 'category') {
  489. response.data.infoSectionList[0].unitlist.splice(i, 1);
  490. break;
  491. }
  492. }
  493. // angular.forEach(response.data.infoSectionList[0].unitlist,function(val){
  494. // if(val.tcname=='category'){
  495. //
  496. // }
  497. // })
  498. }
  499. // 基本信息
  500. orgtype = response.data.baseInfoModel.restype == 6 ? 10104 : response.data.baseInfoModel.restype == 7 ? 10105 : orgtype;
  501. $scope.contentList = response.data;
  502. $scope.resourceDetail = response.data;
  503. deferred.resolve(3350);
  504. // $(document).attr("title",$scope.resourceDetail.baseInfoModel.title);//修改title值
  505. document.title = $scope.resourceDetail.baseInfoModel.title;
  506. document.getElementById('shareSourc').setAttribute('src', ConfigService.imgurl + $scope.resourceDetail.baseInfoModel.logo);
  507. // angular.forEach($scope.contentList.infoSectionList,function (value) {
  508. // angular.forEach(value.unitlist,function (content) {
  509. // if(content.addimg==1){
  510. // $scope.imagelist=JSON.stringify(content.content).toString();
  511. // var imgWrap = JSON.parse($scope.imagelist);
  512. // var v1=eval(imgWrap);
  513. // $rootScope.imgUrlList=$rootScope.imgUrlList.concat(v1);
  514. // }
  515. // });
  516. // });
  517. $scope.scrollTitle = [];
  518. $scope.allData = [];
  519. angular.forEach(response.data.infoSectionList, function (val) {
  520. //桐庐政策库专用(添加编辑功能)
  521. if (val.title == "政策详情页") {
  522. $scope.policyResource = true;
  523. }
  524. if (val.title) {
  525. angular.forEach(val.unitlist, function (value, index) {
  526. if (value.toggle) {
  527. value.content = value.content == 0 ? '否' : '是';
  528. }
  529. if (value.type == 'cascade') {
  530. getCascadList(val.unitlist, index, value.content)
  531. }
  532. if (value.addimg) {
  533. value.imageList = [];
  534. value.imageList = JSON.parse(value.content);
  535. }
  536. })
  537. var i = 0;
  538. for (; i < val.unitlist.length; i++) {
  539. var value = val.unitlist[i];
  540. if (value.contentflag != 0 && value.type != 'hidden') {
  541. break;
  542. }
  543. }
  544. if (i != val.unitlist.length) {
  545. $scope.scrollTitle.push(val);
  546. if ($scope.scrollTitle.length == 1) {
  547. val.unitListLength = val.unitlist.length;
  548. $scope.allData.push(val);
  549. } else {
  550. $scope.allData.push({
  551. title: val.title,
  552. ishiddensection: val.ishiddensection,
  553. unitListLength: val.unitlist.length
  554. })
  555. }
  556. }
  557. }
  558. })
  559. // if($scope.scrollTitle[0]){
  560. // $scope.scrollTitle[0].ishiddensection=true;
  561. // }
  562. if ($scope.allData[0]) {
  563. $scope.allData[0].ishiddensection = true;
  564. // 处理初中学历
  565. if ($scope.allData[0].unitlist){
  566. angular.forEach($scope.allData[0].unitlist,function (val) {
  567. if (val.title === '学历' && val.content === '3795'){
  568. val.content = '初中';
  569. }
  570. if (val.title === '学位' && val.content === '6709'){
  571. val.content = '其他';
  572. }
  573. })
  574. }
  575. }
  576. $scope.isloadingPageFloor = false;
  577. $scope.isloadingPageFail = false;
  578. //$scope.hideLoadingToast();
  579. console.log($scope.allData)
  580. }, function () {
  581. $scope.isloadingPageFloor = false;
  582. //$scope.hideLoadingToast();
  583. if ($scope.app) {
  584. UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
  585. } else {
  586. CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
  587. }
  588. $scope.isloadingPageFail = true;
  589. deferred.resolve(3351);
  590. })
  591. ResourceLibraryService.getHistoryDetail(recourceid, $scope.node).then(function (res) {
  592. if (res.code == 3350) {
  593. $scope.historyList = res.data;
  594. }
  595. })
  596. return deferred.promise;
  597. };
  598. //点击切换页
  599. $scope.changeSelecteds = function (index) {
  600. angular.forEach($scope.allData, function (row) {
  601. row.ishiddensection = false
  602. })
  603. $scope.allData[index].ishiddensection = true
  604. $scope.allData[index].unitlist = $scope.scrollTitle[index].unitlist;
  605. }
  606. // 长按删除标签
  607. $scope.skipDown = function (index, row) {
  608. var confirmPopup = $ionicPopup.confirm({
  609. title: '提示',
  610. template: '确定要删除吗?',
  611. cancelText: '取消',
  612. okText: '确定'
  613. });
  614. confirmPopup.then(function (res) {
  615. if (res) {
  616. ResourceLibraryService.labelintelligentdel($stateParams.recourceid, row.labelName, row.labelKey).then(function (res) {
  617. if (res.code == 3350) {
  618. $scope.allLabel.splice(index, 1)
  619. CommonService.showMessage("删除成功", $scope);
  620. $state.reload();
  621. } else {
  622. CommonService.showMessage(res.message, $scope);
  623. }
  624. })
  625. } else {
  626. console.log('You are not sure');
  627. }
  628. });
  629. }
  630. // 获取其他信息
  631. getPublicResourceList().then(function (data) {
  632. if (data == 3350) {
  633. $scope.showLoadingToastUtilEnd();
  634. ResourceLibraryService.getOtherDetail(recourceid, recourcetype, $scope.node).then(function (response) {
  635. console.log('response', response)
  636. $scope.hideLoadingToast()
  637. if (response.code == 3350) {
  638. $scope.infoSectionList = response.data.infoSectionList;
  639. $scope.resourceDetail.infoSectionList = $scope.resourceDetail.infoSectionList.sort(function (a, b) {
  640. return a.sort - b.sort;
  641. });
  642. for (var key in response.data.typecodemap) {
  643. if (!$scope.resourceDetail.typecodemap) {
  644. $scope.resourceDetail.typecodemap = {};
  645. }
  646. $scope.resourceDetail.typecodemap[key] = response.data.typecodemap[key];
  647. }
  648. angular.forEach(response.data.infoSectionList, function (val, index) {
  649. if (val.title) {
  650. angular.forEach(val.unitlist, function (value) {
  651. if (value.addimg) {
  652. value.imageList = [];
  653. value.imageList = JSON.parse(value.content);
  654. }
  655. })
  656. var i = 0;
  657. for (; i < val.unitlist.length; i++) {
  658. var value = val.unitlist[i];
  659. if (value.contentflag != 0 && value.type != 'hidden') {
  660. break;
  661. }
  662. }
  663. if (i != val.unitlist.length) {
  664. $scope.scrollTitle.push(val);
  665. if ($scope.scrollTitle.length == 1) {
  666. val.unitListLength = val.unitlist.length;
  667. $scope.allData.push(val);
  668. } else {
  669. $scope.allData.push({
  670. title: val.title,
  671. ishiddensection: val.ishiddensection,
  672. unitListLength: val.unitlist.length
  673. })
  674. }
  675. }
  676. }
  677. })
  678. console.log($scope.allData)
  679. } else {
  680. $ionicPopup.alert({
  681. title: '提示',
  682. template: "服务器错误"
  683. });
  684. }
  685. }).catch(function (res) {
  686. $scope.hideLoadingToast();
  687. $ionicPopup.alert({
  688. title: '提示',
  689. template: "服务器错误"
  690. });
  691. })
  692. }
  693. });
  694. $scope.clickThis = function (url) {
  695. var wholeUrl = "http://" + url;
  696. window.open(wholeUrl, "_blank");
  697. };
  698. //获取热门评论列表
  699. var getInfoCommentList = function () {
  700. CommentService.getInfoCommentList($scope.paramsForInfoCommentList).then(function (response) {
  701. // 评论列表
  702. $scope.comments = response.data;
  703. }, function () {
  704. })
  705. };
  706. getInfoCommentList();
  707. // $scope.repeatLoad = function () {
  708. // $scope.isloadingPageFail = false;
  709. // getPublicResourceList();
  710. // };
  711. $scope.isHiddenAction = function (index) {
  712. $scope.allData[index].unitlist = $scope.scrollTitle[index].unitlist;
  713. $scope.allData[index].ishiddensection = !$scope.allData[index].ishiddensection;
  714. console.log($scope.allData)
  715. // $scope.scrollTitle[index].ishiddensection=!$scope.scrollTitle[index].ishiddensection;
  716. };
  717. // 详情页跳转
  718. $scope.jumpToLink = function (temp) {
  719. $scope.showSelectLink = false;
  720. if (temp.groupid == "0") {
  721. $scope.go('resourceDetails', {
  722. recourceid: temp.unique,
  723. recourcetype: temp.type,
  724. recourcecomefrom: UserService.node,
  725. title: temp.title,
  726. });
  727. } else {
  728. $scope.go('resourceCommonDetailsPage', {
  729. recourceid: temp.unique,
  730. recourcetype: temp.type,
  731. recourcecomefrom: UserService.node,
  732. creator: temp.clickthrough,
  733. title: temp.title,
  734. // label:$stateParams.label
  735. });
  736. }
  737. }
  738. $scope.showSelectLink = false;
  739. $scope.showSelectedBox = function (item, index, outerIndex, innerIndex) {
  740. if (item == undefined) {
  741. if (!$scope.allData[outerIndex].unitlist[index].linkList) {
  742. return;
  743. }
  744. var temp = $scope.allData[outerIndex].unitlist[index].linkList[0];
  745. $scope.jumpToLink(temp);
  746. } else {
  747. $scope.showSelectLink = true;
  748. }
  749. };
  750. $scope.isVisitHiddenAction = function (index, parentIndex) {
  751. $scope.historyList[parentIndex].infoSectionList[index].ishiddensection = !$scope.historyList[parentIndex].infoSectionList[index].ishiddensection;
  752. };
  753. // 弹出简单评论框
  754. $scope.showComment = true;
  755. $scope.focus_write = function () {
  756. $scope.showComment = false;
  757. };
  758. // 隐藏简单评论框
  759. $scope.hiddenComment = function () {
  760. $scope.showComment = true;
  761. };
  762. // 简单评论框内容变更,判断 发表 按钮颜色
  763. $scope.commentValue = function () {
  764. var search_history = angular.element(document.getElementsByClassName("my_comment"));
  765. if (UtilService.isDefined($scope.comment.content) && $scope.comment.content.length > 1000) {
  766. if ($scope.app) {
  767. UtilService.showMess("您的评论已超过1000字!");
  768. } else {
  769. CommonService.showMessage("您的评论已超过1000字!", $scope);
  770. }
  771. $scope.comment.content = $scope.comment.content.substr(0, 1000);
  772. }
  773. if (UtilService.isDefined($scope.comment.content) && $scope.comment.content != 0) {
  774. $scope.commentNotnull = {
  775. "background-color": "#2a90d7",
  776. "text-decoration": "underline"
  777. };
  778. } else {
  779. $scope.commentNotnull = {
  780. "background-color": "#ccc"
  781. };
  782. }
  783. };
  784. var search_history = angular.element(document.getElementsByClassName("my_comment"));
  785. //查看信息的详情时跳转
  786. $scope.goLibrary = function () {
  787. $scope.go('');
  788. };
  789. //单条履历信息展开并赋值
  790. $scope.opencardWrap = function (currentIndex) {
  791. $scope.showLoadingToast();
  792. dataToolsService.getConnectioninfoDetailByConnid($scope.historyList[currentIndex].id, 1000002, 0, $scope.node).then(function (res) {
  793. dataToolsService.getConnectionOtherInfoDetail($scope.historyList[currentIndex].id, 1000002, 0, $scope.node).then(function (response) {
  794. if (res.data.id) {
  795. // $scope.historyList[currentIndex]= res.data;
  796. $scope.historyList[currentIndex].baseInfoModel = res.data.baseInfoModel;
  797. $scope.historyList[currentIndex].infoSectionList = res.data.infoSectionList.concat(response.data.infoSectionList);
  798. $scope.historyList[currentIndex].typecodemap = Object.assign(res.data.typecodemap, response.data.typecodemap);
  799. } else {
  800. $scope.historyList[currentIndex].baseInfoModel = response.data.baseInfoModel;
  801. $scope.historyList[currentIndex].infoSectionList = response.data.infoSectionList;
  802. $scope.historyList[currentIndex].typecodemap = response.data.typecodemap;
  803. }
  804. if (UtilService.isDefined($scope.historyList[currentIndex])) {
  805. // console.log("=============opencardWrap获取走访履历详情=================");
  806. var tempArr = [];
  807. angular.forEach($scope.historyList[currentIndex].infoSectionList, function (val) {
  808. if (val != null && val.title) {
  809. angular.forEach(val.unitlist, function (value) {
  810. if (value.addimg) {
  811. value.imageList = [];
  812. value.imageList = JSON.parse(value.content);
  813. }
  814. })
  815. }
  816. var i = 0;
  817. if (val != null) {
  818. for (; i < val.unitlist.length; i++) {
  819. var value = val.unitlist[i];
  820. if (value.contentflag != 0 && value.type != 'hidden') {
  821. break;
  822. }
  823. }
  824. if (i != val.unitlist.length) {
  825. tempArr.push(val);
  826. }
  827. }
  828. })
  829. // 基本信息
  830. $scope.historyList[currentIndex].isShowVisitContent = !$scope.historyList[currentIndex].isShowVisitContent;
  831. $scope.historyList[currentIndex].infoSectionList = tempArr;
  832. $scope.historyList[currentIndex].infoSectionList[0].ishiddensection = true;
  833. }
  834. $scope.hideLoadingToast();
  835. }, function () {
  836. $scope.hideLoadingToast();
  837. if ($scope.app) {
  838. UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
  839. } else {
  840. CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
  841. }
  842. });
  843. })
  844. };
  845. //单条履历信息中的模块展开
  846. $scope.openCard = function () {
  847. $scope.historyList.isShowCard = !$scope.historyList.isShowCard;
  848. };
  849. //单挑履历的收起
  850. $scope.opencardHiddenWrap = function (currentIndex) {
  851. $scope.historyList[currentIndex].isShowVisitContent = !$scope.historyList[currentIndex].isShowVisitContent;
  852. };
  853. // 控制重复点击
  854. var flag = 1;
  855. // 操作:点赞、关注、收藏
  856. $scope.praiseAction = function (clicktype, recourceid, moduleid, ind) {
  857. console.log('点击收藏', clicktype, recourceid, moduleid, ind);
  858. if (flag == 0) {
  859. return;
  860. }
  861. flag = 0;
  862. // 点赞 or 收藏 资源
  863. // 取消点赞 or 取消收藏 资源
  864. if (clicktype == $scope.TRACE_TYPE_2615 || clicktype == $scope.TRACE_TYPE_2619
  865. || clicktype == $scope.TRACE_TYPE_2616 || clicktype == $scope.TRACE_TYPE_2620) {
  866. $scope.clickRecord.targetid = recourceid;
  867. $scope.clickRecord.moduleid = moduleid;
  868. } else if (clicktype == $scope.TRACE_TYPE_2617 || clicktype == $scope.TRACE_TYPE_2618) {
  869. // 关注 用户
  870. // 取消关注 用户
  871. $scope.clickRecord.targetid = $scope.resourceDetail.creator;
  872. $scope.clickRecord.moduleid = $scope.TABLE_CODE_30043;
  873. }
  874. $scope.clickRecord.clicktype = clicktype;
  875. CommentService.postClickFavour($scope.clickRecord).then(function (response) {
  876. if (response.code == ConstantService.INTERFACE_STATUS_CODE_3350) {
  877. // 点赞
  878. if (clicktype == $scope.TRACE_TYPE_2615) {
  879. // 信息
  880. if (moduleid == $scope.TABLE_CODE_30001) {
  881. $scope.resourceDetail.favourcount = $scope.resourceDetail.favourcount + 1;
  882. $scope.resourceDetail.favour = !$scope.resourceDetail.favour;
  883. } else
  884. // 评论
  885. if (moduleid == $scope.TABLE_CODE_30002) {
  886. $scope.comments[ind].favourcount = $scope.comments[ind].favourcount + 1;
  887. $scope.comments[ind].favour = !$scope.comments[ind].favour;
  888. }
  889. } else
  890. // 取消点赞
  891. if (clicktype == $scope.TRACE_TYPE_2616) {
  892. // 信息
  893. if (moduleid == $scope.TABLE_CODE_30001) {
  894. $scope.resourceDetail.favourcount = $scope.resourceDetail.favourcount - 1;
  895. $scope.resourceDetail.favour = !$scope.resourceDetail.favour;
  896. } else
  897. // 评论
  898. if (moduleid == $scope.TABLE_CODE_30002) {
  899. $scope.comments[ind].favourcount = $scope.comments[ind].favourcount - 1;
  900. $scope.comments[ind].favour = !$scope.comments[ind].favour;
  901. }
  902. }
  903. // 关注
  904. // 取消关注
  905. else if (clicktype == $scope.TRACE_TYPE_2617
  906. || clicktype == $scope.TRACE_TYPE_2618) {
  907. $scope.resourceDetail.focus = !$scope.resourceDetail.focus;
  908. }
  909. // 收藏
  910. // 取消收藏
  911. else if (clicktype == $scope.TRACE_TYPE_2619
  912. || clicktype == $scope.TRACE_TYPE_2620) {
  913. $scope.resourceDetail.collect = !$scope.resourceDetail.collect;
  914. }
  915. }
  916. // UtilService.showMess(response.clickStatus);
  917. // 若是评论点赞,则刷新评论列表
  918. if (moduleid == $scope.TABLE_CODE_30002) {
  919. $timeout(function () {
  920. getInfoCommentList();
  921. }, 650);
  922. }
  923. // 恢复可用
  924. flag = 1;
  925. }, function () {
  926. // 恢复可用
  927. flag = 1;
  928. if ($scope.app) {
  929. UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
  930. } else {
  931. CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
  932. }
  933. })
  934. };
  935. //分享
  936. $scope.shareflg = false;
  937. $scope.openShare = function () {
  938. if ($scope.app) {
  939. $scope.shareflg = true;
  940. } else {
  941. $scope.shareMessage();
  942. }
  943. };
  944. $scope.closeShareBox = function () {
  945. $scope.shareflg = false;
  946. };
  947. //TODO
  948. $scope.showShareWechat = false;
  949. $scope.closeShare = function () {
  950. $scope.showShareWechat = false;
  951. };
  952. var sharelink = "https://blog.csdn.net/molong421/article/details/51586194";
  953. //0:QQ,1:QQ空间,2:微信,3:微信朋友圈,4:新浪微博
  954. $scope.shareMessage = function (type) {
  955. $scope.shareflg = false;
  956. var linkUrl = ConfigService.webserver + '#/resourceCommonDetailsPage/' + $stateParams.recourceid + '/' + $stateParams.recourcetype + '/' + $scope.node + '/' + $stateParams.title;
  957. var imagurl = $scope.resourceDetail.baseInfoModel.logo ? (ConfigService.imgurl + $scope.resourceDetail.baseInfoModel.logo) : "https://cordova.apache.org/static/img/cordova_bot.png";
  958. var message = {
  959. title: $scope.resourceDetail.baseInfoModel.title,
  960. description: $scope.resourceDetail.baseInfoModel.title.substring(0, 19),
  961. url: linkUrl,
  962. imageurl: imagurl
  963. };
  964. if ($scope.app) {
  965. $scope.showLoadingToast();
  966. // var message = {
  967. // title: $scope.resourceDetail.title,
  968. // description: $scope.resourceDetail.title.substring(0,19),
  969. // url: sharelink,
  970. // imageurl: imagurl
  971. // };
  972. switch (type) {
  973. case 0:
  974. case 1:
  975. ShareService.shareToQQ(type, message).then(function () {
  976. $scope.hideLoadingToast();
  977. if ($scope.app) {
  978. UtilService.showMess("QQ分享成功");
  979. } else {
  980. CommonService.showMessage("QQ分享成功", $scope);
  981. }
  982. }, function (error) {
  983. $scope.hideLoadingToast();
  984. if ($scope.app) {
  985. UtilService.showMess(error);
  986. } else {
  987. CommonService.showMessage(error, $scope);
  988. }
  989. });
  990. break;
  991. case 2:
  992. ShareService.shareToWechat(type, message).then(function () {
  993. // UtilService.showMess("微信分享成功");
  994. $scope.hideLoadingToast();
  995. if ($scope.app) {
  996. UtilService.showMess("微信分享成功");
  997. } else {
  998. CommonService.showMessage("微信分享成功", $scope);
  999. }
  1000. }, function (error) {
  1001. // UtilService.showMess(error);
  1002. $scope.hideLoadingToast();
  1003. if ($scope.app) {
  1004. UtilService.showMess(error);
  1005. } else {
  1006. CommonService.showMessage(error, $scope);
  1007. }
  1008. });
  1009. break;
  1010. case 3:
  1011. ShareService.shareToWechat(type, message).then(function () {
  1012. // UtilService.showMess("微信分享成功");
  1013. $scope.hideLoadingToast();
  1014. if ($scope.app) {
  1015. UtilService.showMess("微信分享成功");
  1016. } else {
  1017. CommonService.showMessage("微信分享成功", $scope);
  1018. }
  1019. }, function (error) {
  1020. // UtilService.showMess(error);
  1021. $scope.hideLoadingToast();
  1022. if ($scope.app) {
  1023. UtilService.showMess(error);
  1024. } else {
  1025. CommonService.showMessage(error, $scope);
  1026. }
  1027. });
  1028. break;
  1029. case 4:
  1030. ShareService.shareToWeibo(message).then(function () {
  1031. // UtilService.showMess("新浪微博分享成功");
  1032. $scope.hideLoadingToast();
  1033. if ($scope.app) {
  1034. UtilService.showMess("新浪微博分享成功");
  1035. } else {
  1036. CommonService.showMessage("新浪微博分享成功", $scope);
  1037. }
  1038. }, function (error) {
  1039. // UtilService.showMess(error);
  1040. $scope.hideLoadingToast();
  1041. if ($scope.app) {
  1042. UtilService.showMess(error);
  1043. } else {
  1044. CommonService.showMessage(error, $scope);
  1045. }
  1046. });
  1047. break;
  1048. default:
  1049. break;
  1050. }
  1051. $timeout(function () {
  1052. $scope.hideLoadingToast();
  1053. }, 10000);
  1054. } else {
  1055. $scope.showShareWechat = true;
  1056. var content = document.getElementById('qrcode-dialog1');
  1057. content.innerHTML = '';
  1058. var qrcode = new QRCode(content, {
  1059. text: $scope.resourceDetail.baseInfoModel.title,
  1060. // title: $scope.resourceDetail.baseInfoModel.title,
  1061. // description: $scope.resourceDetail.baseInfoModel.title.substring(0,19),
  1062. // url: linkUrl,
  1063. // imageurl: imagurl,
  1064. width: 200,
  1065. height: 200
  1066. })
  1067. qrcode.makeCode(linkUrl);
  1068. }
  1069. };
  1070. //发布普通评论
  1071. $scope.publishComment = function (type, comment) {
  1072. $scope.showComment = true;
  1073. var content = $scope.comment.content;
  1074. $scope.infoComment.content = content;
  1075. // 评论
  1076. if (type == 1) {
  1077. $scope.infoComment.parentid = 0;// 评论回复时,记录父评论的id
  1078. $scope.infoComment.parentuserid = 0;// 评论回复时,记录父评论的创建者
  1079. }
  1080. // 评论回复
  1081. else if (type == 2) {
  1082. $scope.infoComment.parentid = comment.id;// 评论回复时,记录父评论的id
  1083. $scope.infoComment.parentuserid = comment.creator;// 评论回复时,记录父评论的创建者
  1084. }
  1085. //提交评论信息
  1086. $scope.showLoadingToast();
  1087. CommentService.publishSimpleComment($scope.infoComment).then(function () {
  1088. if ($scope.app) {
  1089. UtilService.showMess("评论成功");
  1090. } else {
  1091. CommonService.showMessage("评论成功", $scope);
  1092. }
  1093. $scope.infoComment.content = "";
  1094. getInfoCommentList();
  1095. /*if ($scope.comments.length >= 3) {
  1096. $timeout(function () {
  1097. $scope.getInfoCommentList();
  1098. }, 650);
  1099. }*/
  1100. $scope.hideLoadingToast();
  1101. }, function () {
  1102. $scope.hideLoadingToast();
  1103. });
  1104. };
  1105. //发表详细评论
  1106. $scope.releaseComment = function () {
  1107. $scope.go('releaseComment', {
  1108. infoid: recourceid,
  1109. infotype: recourcetype,
  1110. comlen: $scope.commentlist.length,
  1111. recourcecomefrom: $scope.node
  1112. })
  1113. };
  1114. //点击抢沙发
  1115. $scope.hadSoft = function () {
  1116. $scope.showComment = false;
  1117. $(".my_comment").focus();
  1118. };
  1119. $scope.showComment = true;
  1120. $scope.focus_write = function () {
  1121. scrollToBottom();//滚动至底部
  1122. $scope.showComment = false;
  1123. $(".my_comment").focus();
  1124. };
  1125. $scope.hiddenComment = function () {
  1126. $scope.showComment = true;
  1127. };
  1128. //跳转到评论详情页comment
  1129. $scope.goComment = function (comment) {
  1130. $scope.go("Reply", {
  1131. comment: comment,
  1132. infotype: comment.infotype,
  1133. infoid: comment.infoid,
  1134. comfrom: '资源详情页'
  1135. })
  1136. };
  1137. //跳转到评论发布者的主页
  1138. $scope.goPublisher = function () {
  1139. if ($scope.creatorId != 0) {
  1140. $scope.go('publisher', { Id: $scope.creatorId });
  1141. }
  1142. };
  1143. // 滚动至底部
  1144. var scrollToBottom = function () {
  1145. $timeout(function () {
  1146. $ionicScrollDelegate.$getByHandle("calenderContent").scrollBottom();
  1147. }, 0);
  1148. };
  1149. //进入评论列表页
  1150. // $scope.goCommentList = function () {
  1151. // $timeout(function () {
  1152. // $scope.go('comment', {
  1153. // mode: 2,
  1154. // infoid: $scope.resourceDetail.id,
  1155. // infotype: $scope.resourceDetail.restype
  1156. // });
  1157. // }, 350);
  1158. // };
  1159. //进入资源详情
  1160. $scope.jumpResourceDetail = function () {
  1161. // 再跳转到资源详情页
  1162. $scope.go('resourceCommonDetailsPage', {
  1163. recourceid: recourceid,
  1164. recourcetype: recourcetype,
  1165. recourcecomefrom: $scope.node + " ",
  1166. creator: creator,
  1167. isCache: true, // 是否要强制刷新,
  1168. // label:$stateParams.label
  1169. });
  1170. };
  1171. // 申请权限消耗普适积分
  1172. var consumptionPushPoints = function (authorityid) {
  1173. // 获取录入界面的传参
  1174. $scope.requestModel = {
  1175. data: [],
  1176. userid: UserService.id
  1177. };
  1178. // 传参格式
  1179. $scope.requestModel.data.push(authorityid);
  1180. AccountService.consumptionPushPoints($scope.requestModel).then(function (response) {
  1181. if (response.code == ConstantService.INTERFACE_STATUS_CODE_3350) {
  1182. // console.log("==============申请权限消耗普适积分成功================");
  1183. // 消耗成功后刷新页面
  1184. $scope.jumpResourceDetail();
  1185. } else if (response.code == ConstantService.INTERFACE_STATUS_CODE_21102) {
  1186. // 提示积分不足
  1187. if ($scope.app) {
  1188. UtilService.showMess(ConstantService.INTERFACE_MESSAGE_21102);
  1189. } else {
  1190. CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_21102, $scope);
  1191. }
  1192. }
  1193. }, function () {
  1194. // 购买失败
  1195. if ($scope.app) {
  1196. UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
  1197. } else {
  1198. CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
  1199. }
  1200. });
  1201. };
  1202. //查看将消耗
  1203. $scope.isCanApply = function (authorityid) {
  1204. /*// 正常访问,退出
  1205. if($scope.resourceDetail.contactorshowcode == ConstantService.TRACE_TYPE_2602 ||
  1206. $scope.resourceDetail.contactorshowcode == ConstantService.TRACE_TYPE_2603){
  1207. return;
  1208. }*/
  1209. // 获取权限详情
  1210. $scope.pushvalue = 0;
  1211. AccountService.getAuthorityInfo(authorityid).then(function (response) {
  1212. if (response.code == ConstantService.INTERFACE_STATUS_CODE_3350) {
  1213. // 消耗成功后刷新页面
  1214. $scope.authorityinfo = response.data;
  1215. $scope.pushvalue = $scope.authorityinfo.pushvalue;
  1216. $ionicPopup.show({
  1217. title: '查看将消耗',
  1218. template: "<p class='applyWrapFloor'>" +
  1219. "<i class='ion-ios-pricetags'></i>" +
  1220. "<em>{{pushvalue}}</em>" +
  1221. "<span>普适分</span></p>",
  1222. scope: $scope,
  1223. buttons: [
  1224. {
  1225. text: "取消",
  1226. onTap: function () {
  1227. // console.log('取消')
  1228. }
  1229. },
  1230. {
  1231. text: '<span class="ionicAction_span">申请</span>',
  1232. type: "button-positive",
  1233. onTap: function () {
  1234. // console.log('申请');
  1235. // 申请权限消耗普适积分
  1236. consumptionPushPoints(authorityid);
  1237. }
  1238. }
  1239. ]
  1240. });
  1241. }
  1242. }, function () {
  1243. // 购买失败
  1244. if ($scope.app) {
  1245. UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
  1246. } else {
  1247. CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
  1248. }
  1249. });
  1250. };
  1251. //是否可以申请权限
  1252. $scope.isApplyAuthority = function (authorityid) {
  1253. // var tempdata = {
  1254. // title: $scope.resourceDetail.title,
  1255. // recourceid: recourceid,
  1256. // recourcetype: recourcetype,
  1257. // recourcecomefrom: $scope.node,
  1258. // authorityid: authorityid,
  1259. // type: ConstantService.TRACE_TYPE_2640
  1260. // };
  1261. // $scope.go("resourceApply", { authoritydata: angular.toJson(tempdata) })
  1262. };
  1263. //打开操作表:设置/编辑
  1264. $scope.openActionSheet = function () {
  1265. // isedit:是否可以编辑资源,isset:是否可以设置权限
  1266. var buttonlist = [];
  1267. //TODO
  1268. // if($scope.resourceDetail.ishasedit){
  1269. // buttonlist.push({text: '编辑'})
  1270. // }
  1271. if ($scope.isuserInOrg) {
  1272. $scope.resourceDetail.ishasedit = true;
  1273. }
  1274. if ($scope.resourceDetail.ishasset) {
  1275. buttonlist.push({ text: '设置' })
  1276. }
  1277. // if ($scope.resourceDetail.ishasedit&&(recourcetype==30||recourcetype==31||recourcetype==32||recourcetype==33||recourcetype==34)) {
  1278. if ($scope.resourceDetail.ishasedit) {
  1279. buttonlist.push({ text: '编辑' })
  1280. }
  1281. //桐庐政策库专用
  1282. if ($scope.policyResource) {
  1283. buttonlist.push({ text: '编辑' });
  1284. }
  1285. $ionicActionSheet.show({
  1286. buttons: buttonlist,
  1287. cancelText: '取消',
  1288. buttonClicked: function (index) {
  1289. //桐庐政策库专用
  1290. if ($scope.policyResource || $scope.isuserInOrg) {
  1291. index = 1;
  1292. }
  1293. if (index == 0) {
  1294. $scope.go("selectFieldsToSet", {
  1295. typecodemap: $scope.resourceDetail.typecodemap,
  1296. resid: recourceid,
  1297. typecode: ConstantService.TABLE_CODE_30001
  1298. });
  1299. } else if (index == 1) {
  1300. if ($scope.policyResource || $stateParams.restype == 30 || $stateParams.restype == 31 || $stateParams.restype == 32 || $stateParams.restype == 33 || $stateParams.restype == 34) {
  1301. $scope.go('visitModularForm', {
  1302. companyid: $scope.resourceDetail.baseInfoModel.oid,
  1303. pageid: $stateParams.recourcetype,
  1304. orgtype: orgtype,
  1305. isedit: 1,// isedit:对应的是0新增/1编辑/2复制并新建
  1306. connid: $scope.resourceDetail.id,
  1307. node: $scope.node,
  1308. pagecode: 1000030,
  1309. title: $scope.resourceDetail.baseInfoModel.title,
  1310. pageTitle: '编辑 ' + $scope.resourceDetail.baseInfoModel.title,
  1311. comfrom: 'resource',
  1312. restype: recourcetype
  1313. });
  1314. } else {
  1315. ResourceLibraryService.getPageId($stateParams.recourcetype).then(function (res) {
  1316. $scope.go('visitModularForm', {
  1317. companyid: $scope.resourceDetail.baseInfoModel.oid,
  1318. pageid: res.data,
  1319. orgtype: orgtype,
  1320. isedit: 1,// isedit:对应的是0新增/1编辑/2复制并新建
  1321. connid: $scope.resourceDetail.id,
  1322. node: $scope.node,
  1323. pagecode: 1000030,
  1324. title: $scope.resourceDetail.baseInfoModel.title,
  1325. pageTitle: '编辑 ' + $scope.resourceDetail.baseInfoModel.title,
  1326. comfrom: 'resourceCommonDetailsPage',
  1327. restype: recourcetype,
  1328. resourcetype: recourcetype,
  1329. });
  1330. });
  1331. }
  1332. }
  1333. return true;
  1334. }
  1335. });
  1336. };
  1337. // 新建走访
  1338. $scope.createNewPage = function (type, companyid) {
  1339. console.log({
  1340. companyid: $scope.resourceDetail.oid,
  1341. pageid: 1,
  1342. orgtype: $stateParams.recourcetype == '6' ? 10104 : 10105,
  1343. isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  1344. connid: 0,
  1345. node: $scope.node,
  1346. pagecode: 1000003,
  1347. title: $scope.resourceDetail.baseInfoModel.title,
  1348. pageTitle: $scope.comfrom == 'typein' ? '新建录入' : '新建走访'
  1349. })
  1350. // return;
  1351. $scope.go('visitModularForm', {
  1352. companyid: $scope.resourceDetail.baseInfoModel.oid,
  1353. pageid: $stateParams.recourcetype == '6' ? 1 : 2,
  1354. orgtype: $stateParams.recourcetype == '6' ? 10104 : 10105,
  1355. isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  1356. connid: 0,
  1357. node: $scope.node,
  1358. pagecode: $stateParams.recourcetype == '6' ? 1000003 : 1000004,
  1359. title: $scope.resourceDetail.baseInfoModel.title,
  1360. pageTitle: $scope.comfrom == 'typein' ? '新建录入' : '新建走访',
  1361. comfrom: 'resourceLibrary',
  1362. templettype: $stateParams.recourcetype,
  1363. resid: $scope.resourceDetail.id
  1364. });
  1365. // switch (type) {
  1366. // case 6:
  1367. // if($scope.comfrom=='typein'){
  1368. // if($stateParams.recourcecomefrom=='320117005'||$stateParams.recourcecomefrom=='320117003'||$stateParams.recourcecomefrom=='320117002'||$stateParams.recourcecomefrom=='320117001'||$stateParams.recourcecomefrom=='320117004'){
  1369. // $scope.go('typeinAllModal', {
  1370. // companyid: companyid,
  1371. // pageid: 11,
  1372. // orgtype: orgtype,
  1373. // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  1374. // connid: 0,
  1375. // node:$stateParams.recourcecomefrom,
  1376. // pagecode:1000003,
  1377. // title:$stateParams.title
  1378. // });
  1379. // }else{
  1380. // $scope.go('typeinInformation', {
  1381. // companyid: companyid,
  1382. // pageid: 3,
  1383. // orgtype: orgtype,
  1384. // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  1385. // connid: 0,
  1386. // node:$stateParams.recourcecomefrom,
  1387. // pagecode:1000003,
  1388. // title:$stateParams.title
  1389. // });
  1390. // }
  1391. // }else{
  1392. // if($stateParams.recourcecomefrom=='320117005'||$stateParams.recourcecomefrom=='320117003'||$stateParams.recourcecomefrom=='320117002'||$stateParams.recourcecomefrom=='320117001'||$stateParams.recourcecomefrom=='320117004'){
  1393. // $scope.go('visitModularForm', {
  1394. // companyid: companyid,
  1395. // pageid: 12,
  1396. // orgtype: orgtype,
  1397. // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  1398. // connid: 0,
  1399. // node:$stateParams.recourcecomefrom,
  1400. // pagecode:1000003,
  1401. // title:$stateParams.title
  1402. // });
  1403. // }else{
  1404. // $scope.go('visitModularForm', {
  1405. // companyid: companyid,
  1406. // pageid: 1,
  1407. // orgtype: orgtype,
  1408. // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  1409. // connid: 0,
  1410. // node:$stateParams.recourcecomefrom,
  1411. // pagecode:1000003,
  1412. // title:$stateParams.title
  1413. // });
  1414. // }
  1415. // }
  1416. // break;
  1417. // case 7:
  1418. // $scope.go('visitModularForm', {
  1419. // companyid: companyid,
  1420. // pageid: 2,
  1421. // orgtype: 10105,
  1422. // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
  1423. // connid: 0,
  1424. // node:$stateParams.recourcecomefrom,
  1425. // pagecode:1000003,
  1426. // title:$stateParams.title
  1427. // });
  1428. // break;
  1429. // return;
  1430. // }
  1431. };
  1432. // 复制并新建
  1433. $scope.copyAndNewPage = function (pageid, connid, node, pagecode) {
  1434. $scope.go('visitModularForm', {
  1435. companyid: 0,
  1436. pageid: pageid,
  1437. orgtype: orgtype,
  1438. isedit: 2,// isedit:对应的是0新增/1编辑/2复制并新建
  1439. connid: connid,
  1440. // node:$stateParams.recourcecomefrom,
  1441. pagecode: pagecode,
  1442. node: node,
  1443. title: $stateParams.title,
  1444. pageTitle: $scope.comfrom == 'typein' ? '复制并编辑录入' : '复制并编辑走访'
  1445. });
  1446. // switch (pageid) {
  1447. // case 3:
  1448. // $scope.go("unitOrPersonalBaseInfo", {pageid: pageid, connid: connid, isedit: 2});
  1449. // break;
  1450. // case 4:
  1451. // $scope.go("recordDemandInfo", {pageid: pageid, connid: connid, isedit: 2});
  1452. // break;
  1453. // case 5:
  1454. // $scope.go("recordAchievementsInfo", {pageid: pageid, connid: connid, isedit: 2});
  1455. // break;
  1456. // case 6:
  1457. // $scope.go("recordProductInfo", {pageid: pageid, connid: connid, isedit: 2});
  1458. // break;
  1459. // case 7:
  1460. // $scope.go("recordPatentInfo", {pageid: pageid, connid: connid, isedit: 2});
  1461. // break;
  1462. // case 8:
  1463. // $scope.go("recordTalentInfo", {pageid: pageid, connid: connid, isedit: 2});
  1464. // break;
  1465. // default:
  1466. // $scope.go('visitModularForm', {
  1467. // companyid: 0,
  1468. // pageid: pageid,
  1469. // orgtype: 1,
  1470. // isedit: 2,// isedit:对应的是0新增/1编辑/2复制并新建
  1471. // connid: connid,
  1472. // node:$stateParams.recourcecomefrom,
  1473. // pagecode:1000003,
  1474. // title:$stateParams.title
  1475. // });
  1476. // return;
  1477. // }
  1478. };
  1479. // 点击头像或名字进入个人主页
  1480. $scope.goPublisher = function (userid) {
  1481. if (userid != 0) {
  1482. $scope.go('publisher', { Id: userid });
  1483. }
  1484. };
  1485. //走访记录的其他信息
  1486. $scope.sourceInfo = [];
  1487. //点击图片放大
  1488. $scope.bigImage = false; //初始默认大图是隐藏的
  1489. $scope.hideBigImage = function () {
  1490. $timeout(function () {
  1491. if ($scope.app) {
  1492. $scope.setStatusBar(0);
  1493. }
  1494. $scope.bigImage = false;
  1495. }, 400);
  1496. };
  1497. $scope.shouBigImage = function (outerIndex, innerIndex, index) { //传递一个参数(图片的URl)
  1498. if ($scope.app) {
  1499. $scope.setStatusBar(1);
  1500. }
  1501. $scope.imgUrlList = $scope.allData[outerIndex].unitlist[innerIndex].imageList;
  1502. var str = $scope.imgUrlList[index].sourceName.split('.');
  1503. if (str && str.length > 0 && str[1] != 'jpg' && str[1] != 'gif' && str[1] != 'bmp' && str[1] != 'png' && str[1] != 'jpeg') {
  1504. if ($scope.imgUrlList[index]) {
  1505. window.open(ConfigService.imgurl + $scope.imgUrlList[index].sourceName);
  1506. return;
  1507. }
  1508. }
  1509. $scope.bigImage = true; //显示大图
  1510. $(function () {
  1511. $('div.pinch-zoom').each(function () {
  1512. new RTP.PinchZoom($(this), {});
  1513. });
  1514. });
  1515. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  1516. //图片总数量
  1517. setTimeout(function () {
  1518. // console.log(parseInt($ionicSlideBoxDelegate.slidesCount()));
  1519. // console.log(parseInt($ionicSlideBoxDelegate.currentIndex()));
  1520. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, 0);
  1521. //获取图片
  1522. var imgObj = document.getElementsByClassName('bigimage');
  1523. var n;
  1524. for (n = 0; n < imgObj.length; n++) {
  1525. // 获取图片的原始高度和宽度
  1526. var oldWid = imgObj[n].naturalWidth;
  1527. var oldHei = imgObj[n].naturalHeight;
  1528. var screen = document.body.offsetWidth;
  1529. var screenH = window.innerHeight;
  1530. // console.log(oldWid/oldHei);
  1531. // console.log(screen );
  1532. var rate = oldWid / oldHei;
  1533. if (oldWid >= screen && oldHei >= screenH) {
  1534. var tw = screen;
  1535. var th = tw / rate;
  1536. if (th < screenH) {
  1537. imgObj[n].style.width = tw + 'px';
  1538. imgObj[n].style.height = th + 'px';
  1539. imgObj[n].style.marginTop = (screenH - th) / 2 + 'px';
  1540. } else {
  1541. imgObj[n].style.width = screenH * rate + 'px';
  1542. imgObj[n].style.height = screenH + 'px';
  1543. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  1544. }
  1545. } else if (oldWid >= screen && oldHei <= screenH) {
  1546. imgObj[n].style.width = screen + 'px';
  1547. imgObj[n].style.height = screen / rate + 'px';
  1548. imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px';
  1549. } else if (oldWid <= screen && oldHei >= screenH) {
  1550. // var hh=screenH;
  1551. // var ww=screenH*rate;
  1552. imgObj[n].style.width = screenH * rate + 'px';
  1553. imgObj[n].style.height = screenH + 'px';
  1554. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  1555. } else {
  1556. imgObj[n].style.width = oldWid + 'px';
  1557. imgObj[n].style.height = oldHei + 'px';
  1558. imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px';
  1559. imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px';
  1560. }
  1561. }
  1562. }, 500);
  1563. };
  1564. //去认领企业
  1565. $scope.goClaim = function () {
  1566. $scope.go('identifyForm', {
  1567. pageTitle: "企业认证",
  1568. code: 4803,
  1569. type: 5100,
  1570. id: 0,
  1571. action: 'submit',
  1572. pagesize: 15,
  1573. pagenum: 1,
  1574. companyName: $scope.resourceDetail.baseInfoModel.title
  1575. });
  1576. }
  1577. $scope.goBackPage = function () {
  1578. if ($stateParams.comfrom == "privateResource") {
  1579. $scope.go('privateResource', {
  1580. res: angular.toJson($stateParams.res),
  1581. groupid: $stateParams.groupid,
  1582. restype: $stateParams.restype,
  1583. filterList: $stateParams.filterList,
  1584. MoreData: $stateParams.MoreData,
  1585. capacityparams: $stateParams.capacityparams,
  1586. checkedsort: $stateParams.checkedsort
  1587. })
  1588. } else {
  1589. $scope.goback();
  1590. }
  1591. }
  1592. $scope.goToMonthReport = function () {
  1593. //获取月报表数据中的年份数据(false)
  1594. statisticsReportService.getTongLuReportYear($scope.resourceDetail.baseInfoModel.oid, false).then(function (res) {
  1595. if (res.code == 3350) {
  1596. if (res.data.length != 0) {
  1597. $scope.go('tongluMonthReport', { resource: $scope.resourceDetail });
  1598. } else {
  1599. if ($scope.app) {
  1600. UtilService.showMess('');
  1601. } else {
  1602. CommonService.showMessage('暂无月报数据', $scope)
  1603. }
  1604. }
  1605. }
  1606. })
  1607. }
  1608. $scope.goToYearReport = function () {
  1609. $scope.go('tongluYearReport', {
  1610. datalist: $scope.datalist,
  1611. title: $stateParams.title,
  1612. orgid: $scope.resourceDetail.baseInfoModel.oid
  1613. });
  1614. }
  1615. }
  1616. )