123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698 |
- 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) {
- const lName = labelName === '其他'? '6709' : labelName;
- ResourceLibraryService.getResourceBySameLabel(lName).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 = '初中';
- }
- if (val.title === '学位' && val.content === '6709'){
- 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
- });
- }
- }
- )
|