12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694 |
- angular.module('push')
- .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) {
- //TODO
- // 传入参数
- //1:需求,2:成果,6:企业,7:高校,8:人才
- $scope.showInterview = $stateParams.restype == '6';
- console.log('params', $stateParams)
- $scope.node = UserService.node;
- $scope.privateName = $stateParams.privateName
- $scope.defaultLan = UserService.defaultLan;
- //当前登陆人员是否是桐庐节点管理人员
- ResourceLibraryService.judgeManager(UserService.id, 0).then(function (res) {
- $scope.hasAuth = res.data
- $scope.showMonthReport = res.data && ($stateParams.recourcetype == "6");
- })
- // $scope.showManagmentSheet = function () {
- // $scope.go("exportField", { "reslist": $stateParams.row });
- // }
- //仅限节点人员和节点运营人员可操作,可为当前资源增设标签
- taskModuleService.getUserPermissionCheck($stateParams.recourceid, $stateParams.creator, UserService.id).then(function (res) {
- if (res.code == 3350) {
- $scope.canAddLabel = res.data;
- }
- })
- //获取企业年报数据
- ResourceLibraryService.getYearReport($stateParams.title).then(function (res) {
- if (res.code == 3350) {
- $scope.datalist = res.data;
- }
- })
- //点击加号,添加标签
- $scope.label = {};
- $scope.addLabel = function () {
- //权限判断(仅限节点人员和节点运营人员方可进行资源库自定义标签添加)
- taskModuleService.thisUserIsAdmin().then(function (res) {
- if (res.code == 3350 && res.data == true) {
- var ionicDialog = $ionicPopup.confirm({
- template: '<input type="text" ng-model="label.name">',
- title: '请输入自定义标签',
- scope: $scope,
- okText: '确定',
- cancelText: '取消'
- });
- ionicDialog.then(function (result) {
- if (result) {
- if ($scope.label.name != null && $scope.label.name != undefined && $scope.label.name.trim() != "") {
- ResourceLibraryService.addLabelToDB($stateParams.recourceid, $scope.label.name).then(function (res) {
- if (res.code == 3350) {
- if (res.data == true) {
- //添加成功
- $ionicPopup.alert({
- title: '提示',
- template: '添加标签成功!'
- });
- $state.reload();
- }
- if (res.data == false) {
- //添加失败
- $ionicPopup.alert({
- title: '提示',
- template: '标签已存在,添加失败!'
- });
- }
- }
- $scope.label = {};
- }
- )
- } else {
- $ionicPopup.alert({
- title: '提示',
- template: '请输入标签'
- });
- return;
- }
- }
- })
- } else {
- ResourceLibraryService.judgeManager(UserService.id, 10501).then(function (response) {
- if (response.code == 3350 && response.data == true) {
- var ionicDialog = $ionicPopup.confirm({
- template: '<input type="text" ng-model="label.name">',
- title: '请输入自定义标签',
- scope: $scope,
- okText: '确定',
- cancelText: '取消'
- });
- ionicDialog.then(function (result) {
- if (result) {
- if ($scope.label.name != null && $scope.label.name != undefined && $scope.label.name.trim() != "") {
- ResourceLibraryService.addLabelToDB($stateParams.recourceid, $scope.label.name).then(function (res) {
- if (res.code == 3350) {
- if (res.data == true) {
- //添加成功
- $ionicPopup.alert({
- title: '提示',
- template: '添加标签成功!'
- });
- $state.reload();
- }
- if (res.data == false) {
- //添加失败
- $ionicPopup.alert({
- title: '提示',
- template: '标签已存在,添加失败!'
- });
- }
- }
- $scope.label = {};
- }
- )
- } else {
- $ionicPopup.alert({
- title: '提示',
- template: '请输入标签'
- });
- return;
- }
- }
- })
- } else {
- $ionicPopup.alert({
- title: '提示',
- template: '仅限节点人员和节点运营人员方可进行标签添加功能'
- })
- return;
- }
- })
- }
- })
- }
- $scope.searchtype = 2;
- $scope.allLabel = [];
- $scope.showCollapse = {
- label: false,
- showMore: false
- };
- // $scope.showMoreLabel = function () {
- // $scope.showCollapse.showMore = !$scope.showCollapse.showMore;
- // if ($scope.showCollapse.showMore) {
- // $scope.label = $scope.allLabel.slice(0, 3);
- // } else {
- // $scope.label = $scope.allLabel;
- // }
- // }
- // 按标签查询页面
- var labelResourceListModal = function () {
- $ionicModal.fromTemplateUrl('./modules/common/views/labelResourceListModal.html', {
- scope: $scope,
- animation: 'slide-in-left'
- }).then(function (modal) {
- $scope.labelResourceListModal = modal;
- });
- }
- labelResourceListModal();
- $scope.keyfilter = {
- key: ''
- }
- // 搜索关键字标红
- $scope.badge = function (title) {
- var re = eval("/" + $scope.keyfilter.key + "/g");
- title = title.replace(re, '<span style="color:red">' + $scope.keyfilter.key + '</span>');
- return $sce.trustAsHtml(title)
- };
- $scope.isShowSearchButton = true;
- $scope.showSearchButtonLeft = function () {
- $scope.isShowSearchButton = false;
- $timeout(function () {
- $(".showSearchInput").focus();
- }, 300)
- }
- $scope.clearSearch = function () {
- $scope.isShowSearchButton = true;
- $scope.keyfilter.key = "";
- }
- // 标签点击事件
- $scope.showResourceAboutTheLabel = function (item) {
- ResourceLibraryService.getResourceBySameLabel(item.labelName).then(function (res) {
- if (res.code == 3350) {
- $scope.go('resourceLabelList', { resourceList: res.data, labelName: item.labelName });
- }
- })
- /*$scope.labelResourceListModal.show();
- $scope.labelTitle = item.labelName;
- $scope.clearSearch();
- $scope.showLoadingToast();
- ResourceLibraryService.getResourceFromLabel(item.labelName, $stateParams.recourcecomefrom).then(function (res) {
- if (res.code == 3350) {
- $scope.allList = res.data.result;
- $scope.hideLoadingToast();
- }
- })*/
- }
- //进入记录详情
- $scope.goDockingdetails = function (rec) {
- $scope.islogin = ConfigService.islogin;
- if (!$scope.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $ionicPopup.alert({
- title: '提示',
- template: '请先关注微信公众号"' + title + '"!'
- });
- return;
- } else {
- if (localStorage.isUserBindWx == 0) {
- var wxFlag = JSON.parse(localStorage.params);
- if (wxFlag.weChatModel) {
- $scope.go('bindPhone', {
- params: localStorage.params,
- comfrom: 'maincontroller',
- url: window.location.href.split('#/')[1]
- });
- } else {
- $scope.go('login');
- return;
- }
- } else {
- $scope.go('login');
- return;
- }
- }
- } else {
- $scope.go('login');
- return;
- }
- } else {
- $scope.labelResourceListModal.hide();
- $scope.go('resourceCommonInfoDetailsPage', { resid: rec.id, isAllVisitor: 1, node: UserService.node });
- }
- };
- //进入资源详情
- $scope.goResourceDetail = function (resource) {
- $scope.islogin = ConfigService.islogin;
- if (!$scope.islogin) {
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $ionicPopup.alert({
- title: '提示',
- template: '请先关注微信公众号"' + title + '"!'
- });
- return;
- } else {
- if (localStorage.isUserBindWx == 0) {
- var wxFlag = JSON.parse(localStorage.params);
- if (wxFlag.weChatModel) {
- $scope.go('bindPhone', {
- params: localStorage.params,
- comfrom: 'maincontroller',
- url: window.location.href.split('#/')[1]
- });
- } else {
- $scope.go('login');
- return;
- }
- } else {
- $scope.go('login');
- return;
- }
- }
- } else {
- $scope.go('login');
- return;
- }
- } else {
- $scope.labelResourceListModal.hide();
- $scope.go('resourceCommonDetailsPage', {
- recourceid: resource.unique,
- recourcetype: resource.type,
- recourcecomefrom: $scope.node,
- creator: resource.clickthrough,
- title: resource.title
- });
- }
- };
- // $stateParams.label?$scope.label=JSON.parse($stateParams.label):'';
- var orgtype = $stateParams.orgtype;
- $scope.comfrom = $stateParams.comfrom;
- $scope.pageTitle = $stateParams.title;
- var recourceid = $stateParams.recourceid;
- var recourcetype = $scope.type = $stateParams.recourcetype;
- var recourcecomefrom = $stateParams.recourcecomefrom;
- var creator = $stateParams.creator;
- var isCache = $stateParams.isCache;
- $scope.imagelist = [];
- $rootScope.imgUrlList = [];
- //登录者id
- $scope.userId = UserService.id;
- /*var recourceid = 100865;
- var recourcetype = $scope.type = 6;
- var recourcecomefrom = "320412000";
- var creator = 670;
- $scope.userId = 670;*/
- //加载等待页
- $scope.isloadingPageFloor = false;
- //加载失败页
- $scope.isloadingPageFail = false;
- // 提交的评论
- $scope.comment = { content: "" };
- // 点赞
- $scope.TRACE_TYPE_2615 = ConstantService.TRACE_TYPE_2615;
- // 取消点赞
- $scope.TRACE_TYPE_2616 = ConstantService.TRACE_TYPE_2616;
- // 关注
- $scope.TRACE_TYPE_2617 = ConstantService.TRACE_TYPE_2617;
- // 取消关注
- $scope.TRACE_TYPE_2618 = ConstantService.TRACE_TYPE_2618;
- // 收藏
- $scope.TRACE_TYPE_2619 = ConstantService.TRACE_TYPE_2619;
- // 取消收藏
- $scope.TRACE_TYPE_2620 = ConstantService.TRACE_TYPE_2620;
- // 分享
- $scope.TRACE_TYPE_2628 = ConstantService.TRACE_TYPE_2628;
- // 无权限显示内容
- $scope.TRACE_TYPE_STRING_2600 = ConstantService.TRACE_TYPE_STRING_2600;
- // 私密显示内容
- $scope.TRACE_TYPE_STRING_2603 = ConstantService.TRACE_TYPE_STRING_2603;
- // 基本信息表 resourcelibrary
- $scope.TABLE_CODE_30001 = ConstantService.TABLE_CODE_30001;
- // 评论表 info_comment
- $scope.TABLE_CODE_30002 = ConstantService.TABLE_CODE_30002;
- // 用户基本信息 sys_users
- $scope.TABLE_CODE_30043 = ConstantService.TABLE_CODE_30043;
- //详情页评论
- $scope.appComment = function () {
- $scope.showComment = true;
- var islogin = ConfigService.islogin;
- if (!islogin) {
- $ionicLoading.show({
- template: '请登录!',
- noBackdrop: true
- });
- $timeout(function () {
- $ionicLoading.hide();
- }, 1000);
- return;
- } else {
- var content = $scope.comment.say;
- //提交评论信息
- DetailsService.appComment(id, $stateParams.restype, content, siteName).then(function () {
- //评论成功后重新获取评论列表
- DetailsService.commentList(id, $stateParams.restype).then(function (response) {
- $scope.comments = response.res.comment;
- }, function () {
- });
- //重置评论内容为空
- $scope.comment.say = "";
- }, function () {
- });
- }
- };
- $scope.resource = {};
- var getResourceIndustryList = function () {
- ResourceLibraryService.getResourceIndustryList().then(function (res) {
- if (res.code == 3350) {
- $scope.industryList = res.data;
- }
- })
- }
- getResourceIndustryList();
- // 点赞、收藏、分享的传参
- $scope.clickRecord =
- {
- //TODO
- targetid: $stateParams.recourceid,
- // targetid: 124,
- moduleid: ConstantService.TABLE_CODE_30001,
- userid: UserService.id,
- // userid:1,
- clicktype: 1,
- content: '资源详情页'
- };
- // 评论/评论回复的传参
- $scope.infoComment =
- {
- infoid: recourceid,//资源id
- infotype: recourcetype,// 资源类别
- parentid: 0,// 评论回复时,记录父评论的id
- parentuserid: 0,// 评论回复时,记录父评论的创建者
- content: "",// 评论/回复内容
- //TODO
- creator: UserService.id,// 创建者
- updater: UserService.id,// 更新者
- // creator:1,// 创建者
- // updater:1// 更新者
- contenttype: '资源详情页'
- };
- // 获取评论列表的传参
- $scope.paramsForInfoCommentList =
- {
- mode: 1,// 显示样式:1热门 2全部
- infoid: recourceid,// 资源id
- infotype: recourcetype,// 资源类型
- sortkey: 0,// 排序字段
- sorttype: "ASC",// 排序方式
- moduleid: ConstantService.TABLE_CODE_30002,// 评论表对应的code
- //TODO
- userid: UserService.id// 登录者id
- // userid:1// 登录者id
- };
- /*参数设置*/
- /*========================================================================================================================*/
- /*逻辑操作*/
- var getCascadList = function (arr, index, key) {
- dataToolsService.getWebCascade(key, 1).then(function (response) {
- if (UtilService.isDefined(response.data) && response.data.length > 0) {
- arr[index].content = response.data[0].name;
- dataToolsService.getWebCascade(response.data[0].code, 0).then(function (res) {
- var temp = res.data.filter(function (val) {
- return val.code == key;
- })
- if (temp.length > 0) {
- arr[index + 1].content = temp[0].name;
- }
- })
- }
- }, function () {
- })
- }
- //点击显示具有相同标签信息的资源
- $scope.showSameLabelResource = function (labelName) {
- ResourceLibraryService.getResourceBySameLabel(labelName).then(function (res) {
- if (res.code == 3350) {
- $scope.go('resourceLabelList', { resourceList: res.data, labelName: labelName });
- }
- })
- }
- //上传头像
- $scope.clickup = function () {
- if ($scope.privateName != '专家库') {
- return
- }
- $ionicActionSheet.show({
- buttons: [{ text: '<a class="action-sheet-push">从相册上传</a>' }],
- cancelText: '取消',
- buttonClicked: function () {
- var files = document.getElementById('file');
- files.click();
- $(files).unbind().on('change', function (e) {
- var data = new FormData();
- data.append('file', e.target.files[0]);
- // $scope.fatherdata.detailList[$scope.imgIndex].imagelist.push();
- CommonService.webUploadImage(data).then(function (res) {
- let params = {
- node: $scope.node,
- photo: res.originalName,
- resourceId: $stateParams.recourceid,
- restType: "8"
- }
- ResourceLibraryService.getdataupdatePhoto(params).then(function (row) {
- if (row.code = "3350") {
- $scope.resourceDetail.baseInfoModel.logo = res.originalName;
- CommonService.showMessage("上传成功!", $scope);
- } else {
- CommonService.showMessage("上传失败!", $scope);
- }
- })
- })
- })
- return true;
- }
- })
- };
- //获取基本信息详情
- var getPublicResourceList = function () {
- var deferred = $q.defer();
- $scope.isloadingPageFloor = true;
- //$scope.showLoadingToast();
- ResourceLibraryService.getPrivateResourceDetail(recourceid, recourcetype, $scope.node).then(function (response) {
- console.log('resource/detail--获取资源详情:', response);
- $scope.labelList = response.data.labelContentList;
- $scope.allLabel = response.otherObj;
- if ($scope.allLabel != null) {
- if ($scope.allLabel.length > 3) {
- $scope.showCollapse = {
- label: true,
- showMore: true
- };
- $scope.label = $scope.allLabel.slice(0, 3);
- } else {
- $scope.label = $scope.allLabel;
- }
- }
- if ($stateParams.recourcetype == '30') {
- for (var i = 0; i < response.data.infoSectionList[0].unitlist.length; i++) {
- if (response.data.infoSectionList[0].unitlist[i].tcname == 'category') {
- response.data.infoSectionList[0].unitlist.splice(i, 1);
- break;
- }
- }
- // angular.forEach(response.data.infoSectionList[0].unitlist,function(val){
- // if(val.tcname=='category'){
- //
- // }
- // })
- }
- // 基本信息
- orgtype = response.data.baseInfoModel.restype == 6 ? 10104 : response.data.baseInfoModel.restype == 7 ? 10105 : orgtype;
- $scope.contentList = response.data;
- $scope.resourceDetail = response.data;
- deferred.resolve(3350);
- // $(document).attr("title",$scope.resourceDetail.baseInfoModel.title);//修改title值
- document.title = $scope.resourceDetail.baseInfoModel.title;
- document.getElementById('shareSourc').setAttribute('src', ConfigService.imgurl + $scope.resourceDetail.baseInfoModel.logo);
- // angular.forEach($scope.contentList.infoSectionList,function (value) {
- // angular.forEach(value.unitlist,function (content) {
- // if(content.addimg==1){
- // $scope.imagelist=JSON.stringify(content.content).toString();
- // var imgWrap = JSON.parse($scope.imagelist);
- // var v1=eval(imgWrap);
- // $rootScope.imgUrlList=$rootScope.imgUrlList.concat(v1);
- // }
- // });
- // });
- $scope.scrollTitle = [];
- $scope.allData = [];
- angular.forEach(response.data.infoSectionList, function (val) {
- //桐庐政策库专用(添加编辑功能)
- if (val.title == "政策详情页") {
- $scope.policyResource = true;
- }
- if (val.title) {
- angular.forEach(val.unitlist, function (value, index) {
- if (value.toggle) {
- value.content = value.content == 0 ? '否' : '是';
- }
- if (value.type == 'cascade') {
- getCascadList(val.unitlist, index, value.content)
- }
- if (value.addimg) {
- value.imageList = [];
- value.imageList = JSON.parse(value.content);
- }
- })
- var i = 0;
- for (; i < val.unitlist.length; i++) {
- var value = val.unitlist[i];
- if (value.contentflag != 0 && value.type != 'hidden') {
- break;
- }
- }
- if (i != val.unitlist.length) {
- $scope.scrollTitle.push(val);
- if ($scope.scrollTitle.length == 1) {
- val.unitListLength = val.unitlist.length;
- $scope.allData.push(val);
- } else {
- $scope.allData.push({
- title: val.title,
- ishiddensection: val.ishiddensection,
- unitListLength: val.unitlist.length
- })
- }
- }
- }
- })
- // if($scope.scrollTitle[0]){
- // $scope.scrollTitle[0].ishiddensection=true;
- // }
- if ($scope.allData[0]) {
- $scope.allData[0].ishiddensection = true;
- // 处理初中学历
- if ($scope.allData[0].unitlist){
- angular.forEach($scope.allData[0].unitlist,function (val) {
- if (val.title === '学历' && val.content === '3795'){
- val.content = '初中';
- }
- })
- }
- }
- $scope.isloadingPageFloor = false;
- $scope.isloadingPageFail = false;
- //$scope.hideLoadingToast();
- console.log($scope.allData)
- }, function () {
- $scope.isloadingPageFloor = false;
- //$scope.hideLoadingToast();
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- $scope.isloadingPageFail = true;
- deferred.resolve(3351);
- })
- ResourceLibraryService.getHistoryDetail(recourceid, $scope.node).then(function (res) {
- if (res.code == 3350) {
- $scope.historyList = res.data;
- }
- })
- return deferred.promise;
- };
- //点击切换页
- $scope.changeSelecteds = function (index) {
- angular.forEach($scope.allData, function (row) {
- row.ishiddensection = false
- })
- $scope.allData[index].ishiddensection = true
- $scope.allData[index].unitlist = $scope.scrollTitle[index].unitlist;
- }
- // 长按删除标签
- $scope.skipDown = function (index, row) {
- var confirmPopup = $ionicPopup.confirm({
- title: '提示',
- template: '确定要删除吗?',
- cancelText: '取消',
- okText: '确定'
- });
- confirmPopup.then(function (res) {
- if (res) {
- ResourceLibraryService.labelintelligentdel($stateParams.recourceid, row.labelName, row.labelKey).then(function (res) {
- if (res.code == 3350) {
- $scope.allLabel.splice(index, 1)
- CommonService.showMessage("删除成功", $scope);
- $state.reload();
- } else {
- CommonService.showMessage(res.message, $scope);
- }
- })
- } else {
- console.log('You are not sure');
- }
- });
- }
- // 获取其他信息
- getPublicResourceList().then(function (data) {
- if (data == 3350) {
- $scope.showLoadingToastUtilEnd();
- ResourceLibraryService.getOtherDetail(recourceid, recourcetype, $scope.node).then(function (response) {
- console.log('response', response)
- $scope.hideLoadingToast()
- if (response.code == 3350) {
- $scope.infoSectionList = response.data.infoSectionList;
- $scope.resourceDetail.infoSectionList = $scope.resourceDetail.infoSectionList.sort(function (a, b) {
- return a.sort - b.sort;
- });
- for (var key in response.data.typecodemap) {
- if (!$scope.resourceDetail.typecodemap) {
- $scope.resourceDetail.typecodemap = {};
- }
- $scope.resourceDetail.typecodemap[key] = response.data.typecodemap[key];
- }
- angular.forEach(response.data.infoSectionList, function (val, index) {
- if (val.title) {
- angular.forEach(val.unitlist, function (value) {
- if (value.addimg) {
- value.imageList = [];
- value.imageList = JSON.parse(value.content);
- }
- })
- var i = 0;
- for (; i < val.unitlist.length; i++) {
- var value = val.unitlist[i];
- if (value.contentflag != 0 && value.type != 'hidden') {
- break;
- }
- }
- if (i != val.unitlist.length) {
- $scope.scrollTitle.push(val);
- if ($scope.scrollTitle.length == 1) {
- val.unitListLength = val.unitlist.length;
- $scope.allData.push(val);
- } else {
- $scope.allData.push({
- title: val.title,
- ishiddensection: val.ishiddensection,
- unitListLength: val.unitlist.length
- })
- }
- }
- }
- })
- console.log($scope.allData)
- } else {
- $ionicPopup.alert({
- title: '提示',
- template: "服务器错误"
- });
- }
- }).catch(function (res) {
- $scope.hideLoadingToast();
- $ionicPopup.alert({
- title: '提示',
- template: "服务器错误"
- });
- })
- }
- });
- $scope.clickThis = function (url) {
- var wholeUrl = "http://" + url;
- window.open(wholeUrl, "_blank");
- };
- //获取热门评论列表
- var getInfoCommentList = function () {
- CommentService.getInfoCommentList($scope.paramsForInfoCommentList).then(function (response) {
- // 评论列表
- $scope.comments = response.data;
- }, function () {
- })
- };
- getInfoCommentList();
- // $scope.repeatLoad = function () {
- // $scope.isloadingPageFail = false;
- // getPublicResourceList();
- // };
- $scope.isHiddenAction = function (index) {
- $scope.allData[index].unitlist = $scope.scrollTitle[index].unitlist;
- $scope.allData[index].ishiddensection = !$scope.allData[index].ishiddensection;
- console.log($scope.allData)
- // $scope.scrollTitle[index].ishiddensection=!$scope.scrollTitle[index].ishiddensection;
- };
- // 详情页跳转
- $scope.jumpToLink = function (temp) {
- $scope.showSelectLink = false;
- if (temp.groupid == "0") {
- $scope.go('resourceDetails', {
- recourceid: temp.unique,
- recourcetype: temp.type,
- recourcecomefrom: UserService.node,
- title: temp.title,
- });
- } else {
- $scope.go('resourceCommonDetailsPage', {
- recourceid: temp.unique,
- recourcetype: temp.type,
- recourcecomefrom: UserService.node,
- creator: temp.clickthrough,
- title: temp.title,
- // label:$stateParams.label
- });
- }
- }
- $scope.showSelectLink = false;
- $scope.showSelectedBox = function (item, index, outerIndex, innerIndex) {
- if (item == undefined) {
- if (!$scope.allData[outerIndex].unitlist[index].linkList) {
- return;
- }
- var temp = $scope.allData[outerIndex].unitlist[index].linkList[0];
- $scope.jumpToLink(temp);
- } else {
- $scope.showSelectLink = true;
- }
- };
- $scope.isVisitHiddenAction = function (index, parentIndex) {
- $scope.historyList[parentIndex].infoSectionList[index].ishiddensection = !$scope.historyList[parentIndex].infoSectionList[index].ishiddensection;
- };
- // 弹出简单评论框
- $scope.showComment = true;
- $scope.focus_write = function () {
- $scope.showComment = false;
- };
- // 隐藏简单评论框
- $scope.hiddenComment = function () {
- $scope.showComment = true;
- };
- // 简单评论框内容变更,判断 发表 按钮颜色
- $scope.commentValue = function () {
- var search_history = angular.element(document.getElementsByClassName("my_comment"));
- if (UtilService.isDefined($scope.comment.content) && $scope.comment.content.length > 1000) {
- if ($scope.app) {
- UtilService.showMess("您的评论已超过1000字!");
- } else {
- CommonService.showMessage("您的评论已超过1000字!", $scope);
- }
- $scope.comment.content = $scope.comment.content.substr(0, 1000);
- }
- if (UtilService.isDefined($scope.comment.content) && $scope.comment.content != 0) {
- $scope.commentNotnull = {
- "background-color": "#2a90d7",
- "text-decoration": "underline"
- };
- } else {
- $scope.commentNotnull = {
- "background-color": "#ccc"
- };
- }
- };
- var search_history = angular.element(document.getElementsByClassName("my_comment"));
- //查看信息的详情时跳转
- $scope.goLibrary = function () {
- $scope.go('');
- };
- //单条履历信息展开并赋值
- $scope.opencardWrap = function (currentIndex) {
- $scope.showLoadingToast();
- dataToolsService.getConnectioninfoDetailByConnid($scope.historyList[currentIndex].id, 1000002, 0, $scope.node).then(function (res) {
- dataToolsService.getConnectionOtherInfoDetail($scope.historyList[currentIndex].id, 1000002, 0, $scope.node).then(function (response) {
- if (res.data.id) {
- // $scope.historyList[currentIndex]= res.data;
- $scope.historyList[currentIndex].baseInfoModel = res.data.baseInfoModel;
- $scope.historyList[currentIndex].infoSectionList = res.data.infoSectionList.concat(response.data.infoSectionList);
- $scope.historyList[currentIndex].typecodemap = Object.assign(res.data.typecodemap, response.data.typecodemap);
- } else {
- $scope.historyList[currentIndex].baseInfoModel = response.data.baseInfoModel;
- $scope.historyList[currentIndex].infoSectionList = response.data.infoSectionList;
- $scope.historyList[currentIndex].typecodemap = response.data.typecodemap;
- }
- if (UtilService.isDefined($scope.historyList[currentIndex])) {
- // console.log("=============opencardWrap获取走访履历详情=================");
- var tempArr = [];
- angular.forEach($scope.historyList[currentIndex].infoSectionList, function (val) {
- if (val != null && val.title) {
- angular.forEach(val.unitlist, function (value) {
- if (value.addimg) {
- value.imageList = [];
- value.imageList = JSON.parse(value.content);
- }
- })
- }
- var i = 0;
- if (val != null) {
- for (; i < val.unitlist.length; i++) {
- var value = val.unitlist[i];
- if (value.contentflag != 0 && value.type != 'hidden') {
- break;
- }
- }
- if (i != val.unitlist.length) {
- tempArr.push(val);
- }
- }
- })
- // 基本信息
- $scope.historyList[currentIndex].isShowVisitContent = !$scope.historyList[currentIndex].isShowVisitContent;
- $scope.historyList[currentIndex].infoSectionList = tempArr;
- $scope.historyList[currentIndex].infoSectionList[0].ishiddensection = true;
- }
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- });
- })
- };
- //单条履历信息中的模块展开
- $scope.openCard = function () {
- $scope.historyList.isShowCard = !$scope.historyList.isShowCard;
- };
- //单挑履历的收起
- $scope.opencardHiddenWrap = function (currentIndex) {
- $scope.historyList[currentIndex].isShowVisitContent = !$scope.historyList[currentIndex].isShowVisitContent;
- };
- // 控制重复点击
- var flag = 1;
- // 操作:点赞、关注、收藏
- $scope.praiseAction = function (clicktype, recourceid, moduleid, ind) {
- console.log('点击收藏', clicktype, recourceid, moduleid, ind);
- if (flag == 0) {
- return;
- }
- flag = 0;
- // 点赞 or 收藏 资源
- // 取消点赞 or 取消收藏 资源
- if (clicktype == $scope.TRACE_TYPE_2615 || clicktype == $scope.TRACE_TYPE_2619
- || clicktype == $scope.TRACE_TYPE_2616 || clicktype == $scope.TRACE_TYPE_2620) {
- $scope.clickRecord.targetid = recourceid;
- $scope.clickRecord.moduleid = moduleid;
- } else if (clicktype == $scope.TRACE_TYPE_2617 || clicktype == $scope.TRACE_TYPE_2618) {
- // 关注 用户
- // 取消关注 用户
- $scope.clickRecord.targetid = $scope.resourceDetail.creator;
- $scope.clickRecord.moduleid = $scope.TABLE_CODE_30043;
- }
- $scope.clickRecord.clicktype = clicktype;
- CommentService.postClickFavour($scope.clickRecord).then(function (response) {
- if (response.code == ConstantService.INTERFACE_STATUS_CODE_3350) {
- // 点赞
- if (clicktype == $scope.TRACE_TYPE_2615) {
- // 信息
- if (moduleid == $scope.TABLE_CODE_30001) {
- $scope.resourceDetail.favourcount = $scope.resourceDetail.favourcount + 1;
- $scope.resourceDetail.favour = !$scope.resourceDetail.favour;
- } else
- // 评论
- if (moduleid == $scope.TABLE_CODE_30002) {
- $scope.comments[ind].favourcount = $scope.comments[ind].favourcount + 1;
- $scope.comments[ind].favour = !$scope.comments[ind].favour;
- }
- } else
- // 取消点赞
- if (clicktype == $scope.TRACE_TYPE_2616) {
- // 信息
- if (moduleid == $scope.TABLE_CODE_30001) {
- $scope.resourceDetail.favourcount = $scope.resourceDetail.favourcount - 1;
- $scope.resourceDetail.favour = !$scope.resourceDetail.favour;
- } else
- // 评论
- if (moduleid == $scope.TABLE_CODE_30002) {
- $scope.comments[ind].favourcount = $scope.comments[ind].favourcount - 1;
- $scope.comments[ind].favour = !$scope.comments[ind].favour;
- }
- }
- // 关注
- // 取消关注
- else if (clicktype == $scope.TRACE_TYPE_2617
- || clicktype == $scope.TRACE_TYPE_2618) {
- $scope.resourceDetail.focus = !$scope.resourceDetail.focus;
- }
- // 收藏
- // 取消收藏
- else if (clicktype == $scope.TRACE_TYPE_2619
- || clicktype == $scope.TRACE_TYPE_2620) {
- $scope.resourceDetail.collect = !$scope.resourceDetail.collect;
- }
- }
- // UtilService.showMess(response.clickStatus);
- // 若是评论点赞,则刷新评论列表
- if (moduleid == $scope.TABLE_CODE_30002) {
- $timeout(function () {
- getInfoCommentList();
- }, 650);
- }
- // 恢复可用
- flag = 1;
- }, function () {
- // 恢复可用
- flag = 1;
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- })
- };
- //分享
- $scope.shareflg = false;
- $scope.openShare = function () {
- if ($scope.app) {
- $scope.shareflg = true;
- } else {
- $scope.shareMessage();
- }
- };
- $scope.closeShareBox = function () {
- $scope.shareflg = false;
- };
- //TODO
- $scope.showShareWechat = false;
- $scope.closeShare = function () {
- $scope.showShareWechat = false;
- };
- var sharelink = "https://blog.csdn.net/molong421/article/details/51586194";
- //0:QQ,1:QQ空间,2:微信,3:微信朋友圈,4:新浪微博
- $scope.shareMessage = function (type) {
- $scope.shareflg = false;
- var linkUrl = ConfigService.webserver + '#/resourceCommonDetailsPage/' + $stateParams.recourceid + '/' + $stateParams.recourcetype + '/' + $scope.node + '/' + $stateParams.title;
- var imagurl = $scope.resourceDetail.baseInfoModel.logo ? (ConfigService.imgurl + $scope.resourceDetail.baseInfoModel.logo) : "https://cordova.apache.org/static/img/cordova_bot.png";
- var message = {
- title: $scope.resourceDetail.baseInfoModel.title,
- description: $scope.resourceDetail.baseInfoModel.title.substring(0, 19),
- url: linkUrl,
- imageurl: imagurl
- };
- if ($scope.app) {
- $scope.showLoadingToast();
- // var message = {
- // title: $scope.resourceDetail.title,
- // description: $scope.resourceDetail.title.substring(0,19),
- // url: sharelink,
- // imageurl: imagurl
- // };
- switch (type) {
- case 0:
- case 1:
- ShareService.shareToQQ(type, message).then(function () {
- $scope.hideLoadingToast();
- if ($scope.app) {
- UtilService.showMess("QQ分享成功");
- } else {
- CommonService.showMessage("QQ分享成功", $scope);
- }
- }, function (error) {
- $scope.hideLoadingToast();
- if ($scope.app) {
- UtilService.showMess(error);
- } else {
- CommonService.showMessage(error, $scope);
- }
- });
- break;
- case 2:
- ShareService.shareToWechat(type, message).then(function () {
- // UtilService.showMess("微信分享成功");
- $scope.hideLoadingToast();
- if ($scope.app) {
- UtilService.showMess("微信分享成功");
- } else {
- CommonService.showMessage("微信分享成功", $scope);
- }
- }, function (error) {
- // UtilService.showMess(error);
- $scope.hideLoadingToast();
- if ($scope.app) {
- UtilService.showMess(error);
- } else {
- CommonService.showMessage(error, $scope);
- }
- });
- break;
- case 3:
- ShareService.shareToWechat(type, message).then(function () {
- // UtilService.showMess("微信分享成功");
- $scope.hideLoadingToast();
- if ($scope.app) {
- UtilService.showMess("微信分享成功");
- } else {
- CommonService.showMessage("微信分享成功", $scope);
- }
- }, function (error) {
- // UtilService.showMess(error);
- $scope.hideLoadingToast();
- if ($scope.app) {
- UtilService.showMess(error);
- } else {
- CommonService.showMessage(error, $scope);
- }
- });
- break;
- case 4:
- ShareService.shareToWeibo(message).then(function () {
- // UtilService.showMess("新浪微博分享成功");
- $scope.hideLoadingToast();
- if ($scope.app) {
- UtilService.showMess("新浪微博分享成功");
- } else {
- CommonService.showMessage("新浪微博分享成功", $scope);
- }
- }, function (error) {
- // UtilService.showMess(error);
- $scope.hideLoadingToast();
- if ($scope.app) {
- UtilService.showMess(error);
- } else {
- CommonService.showMessage(error, $scope);
- }
- });
- break;
- default:
- break;
- }
- $timeout(function () {
- $scope.hideLoadingToast();
- }, 10000);
- } else {
- $scope.showShareWechat = true;
- var content = document.getElementById('qrcode-dialog1');
- content.innerHTML = '';
- var qrcode = new QRCode(content, {
- text: $scope.resourceDetail.baseInfoModel.title,
- // title: $scope.resourceDetail.baseInfoModel.title,
- // description: $scope.resourceDetail.baseInfoModel.title.substring(0,19),
- // url: linkUrl,
- // imageurl: imagurl,
- width: 200,
- height: 200
- })
- qrcode.makeCode(linkUrl);
- }
- };
- //发布普通评论
- $scope.publishComment = function (type, comment) {
- $scope.showComment = true;
- var content = $scope.comment.content;
- $scope.infoComment.content = content;
- // 评论
- if (type == 1) {
- $scope.infoComment.parentid = 0;// 评论回复时,记录父评论的id
- $scope.infoComment.parentuserid = 0;// 评论回复时,记录父评论的创建者
- }
- // 评论回复
- else if (type == 2) {
- $scope.infoComment.parentid = comment.id;// 评论回复时,记录父评论的id
- $scope.infoComment.parentuserid = comment.creator;// 评论回复时,记录父评论的创建者
- }
- //提交评论信息
- $scope.showLoadingToast();
- CommentService.publishSimpleComment($scope.infoComment).then(function () {
- if ($scope.app) {
- UtilService.showMess("评论成功");
- } else {
- CommonService.showMessage("评论成功", $scope);
- }
- $scope.infoComment.content = "";
- getInfoCommentList();
- /*if ($scope.comments.length >= 3) {
- $timeout(function () {
- $scope.getInfoCommentList();
- }, 650);
- }*/
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- });
- };
- //发表详细评论
- $scope.releaseComment = function () {
- $scope.go('releaseComment', {
- infoid: recourceid,
- infotype: recourcetype,
- comlen: $scope.commentlist.length,
- recourcecomefrom: $scope.node
- })
- };
- //点击抢沙发
- $scope.hadSoft = function () {
- $scope.showComment = false;
- $(".my_comment").focus();
- };
- $scope.showComment = true;
- $scope.focus_write = function () {
- scrollToBottom();//滚动至底部
- $scope.showComment = false;
- $(".my_comment").focus();
- };
- $scope.hiddenComment = function () {
- $scope.showComment = true;
- };
- //跳转到评论详情页comment
- $scope.goComment = function (comment) {
- $scope.go("Reply", {
- comment: comment,
- infotype: comment.infotype,
- infoid: comment.infoid,
- comfrom: '资源详情页'
- })
- };
- //跳转到评论发布者的主页
- $scope.goPublisher = function () {
- if ($scope.creatorId != 0) {
- $scope.go('publisher', { Id: $scope.creatorId });
- }
- };
- // 滚动至底部
- var scrollToBottom = function () {
- $timeout(function () {
- $ionicScrollDelegate.$getByHandle("calenderContent").scrollBottom();
- }, 0);
- };
- //进入评论列表页
- // $scope.goCommentList = function () {
- // $timeout(function () {
- // $scope.go('comment', {
- // mode: 2,
- // infoid: $scope.resourceDetail.id,
- // infotype: $scope.resourceDetail.restype
- // });
- // }, 350);
- // };
- //进入资源详情
- $scope.jumpResourceDetail = function () {
- // 再跳转到资源详情页
- $scope.go('resourceCommonDetailsPage', {
- recourceid: recourceid,
- recourcetype: recourcetype,
- recourcecomefrom: $scope.node + " ",
- creator: creator,
- isCache: true, // 是否要强制刷新,
- // label:$stateParams.label
- });
- };
- // 申请权限消耗普适积分
- var consumptionPushPoints = function (authorityid) {
- // 获取录入界面的传参
- $scope.requestModel = {
- data: [],
- userid: UserService.id
- };
- // 传参格式
- $scope.requestModel.data.push(authorityid);
- AccountService.consumptionPushPoints($scope.requestModel).then(function (response) {
- if (response.code == ConstantService.INTERFACE_STATUS_CODE_3350) {
- // console.log("==============申请权限消耗普适积分成功================");
- // 消耗成功后刷新页面
- $scope.jumpResourceDetail();
- } else if (response.code == ConstantService.INTERFACE_STATUS_CODE_21102) {
- // 提示积分不足
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_21102);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_21102, $scope);
- }
- }
- }, function () {
- // 购买失败
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- });
- };
- //查看将消耗
- $scope.isCanApply = function (authorityid) {
- /*// 正常访问,退出
- if($scope.resourceDetail.contactorshowcode == ConstantService.TRACE_TYPE_2602 ||
- $scope.resourceDetail.contactorshowcode == ConstantService.TRACE_TYPE_2603){
- return;
- }*/
- // 获取权限详情
- $scope.pushvalue = 0;
- AccountService.getAuthorityInfo(authorityid).then(function (response) {
- if (response.code == ConstantService.INTERFACE_STATUS_CODE_3350) {
- // 消耗成功后刷新页面
- $scope.authorityinfo = response.data;
- $scope.pushvalue = $scope.authorityinfo.pushvalue;
- $ionicPopup.show({
- title: '查看将消耗',
- template: "<p class='applyWrapFloor'>" +
- "<i class='ion-ios-pricetags'></i>" +
- "<em>{{pushvalue}}</em>" +
- "<span>普适分</span></p>",
- scope: $scope,
- buttons: [
- {
- text: "取消",
- onTap: function () {
- // console.log('取消')
- }
- },
- {
- text: '<span class="ionicAction_span">申请</span>',
- type: "button-positive",
- onTap: function () {
- // console.log('申请');
- // 申请权限消耗普适积分
- consumptionPushPoints(authorityid);
- }
- }
- ]
- });
- }
- }, function () {
- // 购买失败
- if ($scope.app) {
- UtilService.showMess(ConstantService.INTERFACE_MESSAGE_ERROR);
- } else {
- CommonService.showMessage(ConstantService.INTERFACE_MESSAGE_ERROR, $scope);
- }
- });
- };
- //是否可以申请权限
- $scope.isApplyAuthority = function (authorityid) {
- // var tempdata = {
- // title: $scope.resourceDetail.title,
- // recourceid: recourceid,
- // recourcetype: recourcetype,
- // recourcecomefrom: $scope.node,
- // authorityid: authorityid,
- // type: ConstantService.TRACE_TYPE_2640
- // };
- // $scope.go("resourceApply", { authoritydata: angular.toJson(tempdata) })
- };
- //打开操作表:设置/编辑
- $scope.openActionSheet = function () {
- // isedit:是否可以编辑资源,isset:是否可以设置权限
- var buttonlist = [];
- //TODO
- // if($scope.resourceDetail.ishasedit){
- // buttonlist.push({text: '编辑'})
- // }
- if ($scope.isuserInOrg) {
- $scope.resourceDetail.ishasedit = true;
- }
- if ($scope.resourceDetail.ishasset) {
- buttonlist.push({ text: '设置' })
- }
- // if ($scope.resourceDetail.ishasedit&&(recourcetype==30||recourcetype==31||recourcetype==32||recourcetype==33||recourcetype==34)) {
- if ($scope.resourceDetail.ishasedit) {
- buttonlist.push({ text: '编辑' })
- }
- //桐庐政策库专用
- if ($scope.policyResource) {
- buttonlist.push({ text: '编辑' });
- }
- $ionicActionSheet.show({
- buttons: buttonlist,
- cancelText: '取消',
- buttonClicked: function (index) {
- //桐庐政策库专用
- if ($scope.policyResource || $scope.isuserInOrg) {
- index = 1;
- }
- if (index == 0) {
- $scope.go("selectFieldsToSet", {
- typecodemap: $scope.resourceDetail.typecodemap,
- resid: recourceid,
- typecode: ConstantService.TABLE_CODE_30001
- });
- } else if (index == 1) {
- if ($scope.policyResource || $stateParams.restype == 30 || $stateParams.restype == 31 || $stateParams.restype == 32 || $stateParams.restype == 33 || $stateParams.restype == 34) {
- $scope.go('visitModularForm', {
- companyid: $scope.resourceDetail.baseInfoModel.oid,
- pageid: $stateParams.recourcetype,
- orgtype: orgtype,
- isedit: 1,// isedit:对应的是0新增/1编辑/2复制并新建
- connid: $scope.resourceDetail.id,
- node: $scope.node,
- pagecode: 1000030,
- title: $scope.resourceDetail.baseInfoModel.title,
- pageTitle: '编辑 ' + $scope.resourceDetail.baseInfoModel.title,
- comfrom: 'resource',
- restype: recourcetype
- });
- } else {
- ResourceLibraryService.getPageId($stateParams.recourcetype).then(function (res) {
- $scope.go('visitModularForm', {
- companyid: $scope.resourceDetail.baseInfoModel.oid,
- pageid: res.data,
- orgtype: orgtype,
- isedit: 1,// isedit:对应的是0新增/1编辑/2复制并新建
- connid: $scope.resourceDetail.id,
- node: $scope.node,
- pagecode: 1000030,
- title: $scope.resourceDetail.baseInfoModel.title,
- pageTitle: '编辑 ' + $scope.resourceDetail.baseInfoModel.title,
- comfrom: 'resourceCommonDetailsPage',
- restype: recourcetype,
- resourcetype: recourcetype,
- });
- });
- }
- }
- return true;
- }
- });
- };
- // 新建走访
- $scope.createNewPage = function (type, companyid) {
- console.log({
- companyid: $scope.resourceDetail.oid,
- pageid: 1,
- orgtype: $stateParams.recourcetype == '6' ? 10104 : 10105,
- isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
- connid: 0,
- node: $scope.node,
- pagecode: 1000003,
- title: $scope.resourceDetail.baseInfoModel.title,
- pageTitle: $scope.comfrom == 'typein' ? '新建录入' : '新建走访'
- })
- // return;
- $scope.go('visitModularForm', {
- companyid: $scope.resourceDetail.baseInfoModel.oid,
- pageid: $stateParams.recourcetype == '6' ? 1 : 2,
- orgtype: $stateParams.recourcetype == '6' ? 10104 : 10105,
- isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
- connid: 0,
- node: $scope.node,
- pagecode: $stateParams.recourcetype == '6' ? 1000003 : 1000004,
- title: $scope.resourceDetail.baseInfoModel.title,
- pageTitle: $scope.comfrom == 'typein' ? '新建录入' : '新建走访',
- comfrom: 'resourceLibrary',
- templettype: $stateParams.recourcetype,
- resid: $scope.resourceDetail.id
- });
- // switch (type) {
- // case 6:
- // if($scope.comfrom=='typein'){
- // if($stateParams.recourcecomefrom=='320117005'||$stateParams.recourcecomefrom=='320117003'||$stateParams.recourcecomefrom=='320117002'||$stateParams.recourcecomefrom=='320117001'||$stateParams.recourcecomefrom=='320117004'){
- // $scope.go('typeinAllModal', {
- // companyid: companyid,
- // pageid: 11,
- // orgtype: orgtype,
- // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
- // connid: 0,
- // node:$stateParams.recourcecomefrom,
- // pagecode:1000003,
- // title:$stateParams.title
- // });
- // }else{
- // $scope.go('typeinInformation', {
- // companyid: companyid,
- // pageid: 3,
- // orgtype: orgtype,
- // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
- // connid: 0,
- // node:$stateParams.recourcecomefrom,
- // pagecode:1000003,
- // title:$stateParams.title
- // });
- // }
- // }else{
- // if($stateParams.recourcecomefrom=='320117005'||$stateParams.recourcecomefrom=='320117003'||$stateParams.recourcecomefrom=='320117002'||$stateParams.recourcecomefrom=='320117001'||$stateParams.recourcecomefrom=='320117004'){
- // $scope.go('visitModularForm', {
- // companyid: companyid,
- // pageid: 12,
- // orgtype: orgtype,
- // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
- // connid: 0,
- // node:$stateParams.recourcecomefrom,
- // pagecode:1000003,
- // title:$stateParams.title
- // });
- // }else{
- // $scope.go('visitModularForm', {
- // companyid: companyid,
- // pageid: 1,
- // orgtype: orgtype,
- // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
- // connid: 0,
- // node:$stateParams.recourcecomefrom,
- // pagecode:1000003,
- // title:$stateParams.title
- // });
- // }
- // }
- // break;
- // case 7:
- // $scope.go('visitModularForm', {
- // companyid: companyid,
- // pageid: 2,
- // orgtype: 10105,
- // isedit: 0,// isedit:对应的是0新增/1编辑/2复制并新建
- // connid: 0,
- // node:$stateParams.recourcecomefrom,
- // pagecode:1000003,
- // title:$stateParams.title
- // });
- // break;
- // return;
- // }
- };
- // 复制并新建
- $scope.copyAndNewPage = function (pageid, connid, node, pagecode) {
- $scope.go('visitModularForm', {
- companyid: 0,
- pageid: pageid,
- orgtype: orgtype,
- isedit: 2,// isedit:对应的是0新增/1编辑/2复制并新建
- connid: connid,
- // node:$stateParams.recourcecomefrom,
- pagecode: pagecode,
- node: node,
- title: $stateParams.title,
- pageTitle: $scope.comfrom == 'typein' ? '复制并编辑录入' : '复制并编辑走访'
- });
- // switch (pageid) {
- // case 3:
- // $scope.go("unitOrPersonalBaseInfo", {pageid: pageid, connid: connid, isedit: 2});
- // break;
- // case 4:
- // $scope.go("recordDemandInfo", {pageid: pageid, connid: connid, isedit: 2});
- // break;
- // case 5:
- // $scope.go("recordAchievementsInfo", {pageid: pageid, connid: connid, isedit: 2});
- // break;
- // case 6:
- // $scope.go("recordProductInfo", {pageid: pageid, connid: connid, isedit: 2});
- // break;
- // case 7:
- // $scope.go("recordPatentInfo", {pageid: pageid, connid: connid, isedit: 2});
- // break;
- // case 8:
- // $scope.go("recordTalentInfo", {pageid: pageid, connid: connid, isedit: 2});
- // break;
- // default:
- // $scope.go('visitModularForm', {
- // companyid: 0,
- // pageid: pageid,
- // orgtype: 1,
- // isedit: 2,// isedit:对应的是0新增/1编辑/2复制并新建
- // connid: connid,
- // node:$stateParams.recourcecomefrom,
- // pagecode:1000003,
- // title:$stateParams.title
- // });
- // return;
- // }
- };
- // 点击头像或名字进入个人主页
- $scope.goPublisher = function (userid) {
- if (userid != 0) {
- $scope.go('publisher', { Id: userid });
- }
- };
- //走访记录的其他信息
- $scope.sourceInfo = [];
- //点击图片放大
- $scope.bigImage = false; //初始默认大图是隐藏的
- $scope.hideBigImage = function () {
- $timeout(function () {
- if ($scope.app) {
- $scope.setStatusBar(0);
- }
- $scope.bigImage = false;
- }, 400);
- };
- $scope.shouBigImage = function (outerIndex, innerIndex, index) { //传递一个参数(图片的URl)
- if ($scope.app) {
- $scope.setStatusBar(1);
- }
- $scope.imgUrlList = $scope.allData[outerIndex].unitlist[innerIndex].imageList;
- var str = $scope.imgUrlList[index].sourceName.split('.');
- if (str && str.length > 0 && str[1] != 'jpg' && str[1] != 'gif' && str[1] != 'bmp' && str[1] != 'png' && str[1] != 'jpeg') {
- if ($scope.imgUrlList[index]) {
- window.open(ConfigService.imgurl + $scope.imgUrlList[index].sourceName);
- return;
- }
- }
- $scope.bigImage = true; //显示大图
- $(function () {
- $('div.pinch-zoom').each(function () {
- new RTP.PinchZoom($(this), {});
- });
- });
- $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
- //图片总数量
- setTimeout(function () {
- // console.log(parseInt($ionicSlideBoxDelegate.slidesCount()));
- // console.log(parseInt($ionicSlideBoxDelegate.currentIndex()));
- $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, 0);
- //获取图片
- var imgObj = document.getElementsByClassName('bigimage');
- var n;
- for (n = 0; n < imgObj.length; n++) {
- // 获取图片的原始高度和宽度
- var oldWid = imgObj[n].naturalWidth;
- var oldHei = imgObj[n].naturalHeight;
- var screen = document.body.offsetWidth;
- var screenH = window.innerHeight;
- // console.log(oldWid/oldHei);
- // console.log(screen );
- var rate = oldWid / oldHei;
- if (oldWid >= screen && oldHei >= screenH) {
- var tw = screen;
- var th = tw / rate;
- if (th < screenH) {
- imgObj[n].style.width = tw + 'px';
- imgObj[n].style.height = th + 'px';
- imgObj[n].style.marginTop = (screenH - th) / 2 + 'px';
- } else {
- imgObj[n].style.width = screenH * rate + 'px';
- imgObj[n].style.height = screenH + 'px';
- imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
- }
- } else if (oldWid >= screen && oldHei <= screenH) {
- imgObj[n].style.width = screen + 'px';
- imgObj[n].style.height = screen / rate + 'px';
- imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px';
- } else if (oldWid <= screen && oldHei >= screenH) {
- // var hh=screenH;
- // var ww=screenH*rate;
- imgObj[n].style.width = screenH * rate + 'px';
- imgObj[n].style.height = screenH + 'px';
- imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
- } else {
- imgObj[n].style.width = oldWid + 'px';
- imgObj[n].style.height = oldHei + 'px';
- imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px';
- imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px';
- }
- }
- }, 500);
- };
- //去认领企业
- $scope.goClaim = function () {
- $scope.go('identifyForm', {
- pageTitle: "企业认证",
- code: 4803,
- type: 5100,
- id: 0,
- action: 'submit',
- pagesize: 15,
- pagenum: 1,
- companyName: $scope.resourceDetail.baseInfoModel.title
- });
- }
- $scope.goBackPage = function () {
- if ($stateParams.comfrom == "privateResource") {
- $scope.go('privateResource', {
- res: angular.toJson($stateParams.res),
- groupid: $stateParams.groupid,
- restype: $stateParams.restype,
- filterList: $stateParams.filterList,
- MoreData: $stateParams.MoreData,
- capacityparams: $stateParams.capacityparams,
- checkedsort: $stateParams.checkedsort
- })
- } else {
- $scope.goback();
- }
- }
- $scope.goToMonthReport = function () {
- //获取月报表数据中的年份数据(false)
- statisticsReportService.getTongLuReportYear($scope.resourceDetail.baseInfoModel.oid, false).then(function (res) {
- if (res.code == 3350) {
- if (res.data.length != 0) {
- $scope.go('tongluMonthReport', { resource: $scope.resourceDetail });
- } else {
- if ($scope.app) {
- UtilService.showMess('');
- } else {
- CommonService.showMessage('暂无月报数据', $scope)
- }
- }
- }
- })
- }
- $scope.goToYearReport = function () {
- $scope.go('tongluYearReport', {
- datalist: $scope.datalist,
- title: $stateParams.title,
- orgid: $scope.resourceDetail.baseInfoModel.oid
- });
- }
- }
- )
|