1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222 |
- /**
- * Created by pushkeji on 2018/10/11.
- */
- angular.module('push')
- .controller('taskDetailCtrl',
- ['$scope', 'taskModuleService', '$timeout', '$q', 'UserService', '$stateParams', 'ResourceLibraryService', '$ionicSlideBoxDelegate', 'CommentService', 'ConfigService', 'ScienceCircleService', 'CommonService', '$ionicScrollDelegate', 'ConstantService', '$ionicActionSheet', 'UtilService', 'ShareService', '$ionicHistory', 'UserService', '$ionicPopup', 'dataToolsService',
- function ($scope, taskModuleService, $timeout, $q, UserService, $stateParams, ResourceLibraryService, $ionicSlideBoxDelegate, CommentService, ConfigService, ScienceCircleService, CommonService, $ionicScrollDelegate, ConstantService, $ionicActionSheet, UtilService, ShareService, $ionicHistory, UserService, $ionicPopup, dataToolsService) {
- console.log($stateParams);
- // $scope.comfromMytask=$stateParams.comefrom=='myTask';
- // $scope.showDockingButton=false;
- var personPageNum = 1;
- var personPagesize = 15;
- $scope.abutLength = false;
- $scope.index = $stateParams.index;
- $scope.ispublic = $stateParams.ispublic;
- $scope.isPublisher = false;
- $scope.node = UserService.node;
- $scope.status = $stateParams.status;
- $scope.resid = $stateParams.resid;
- $scope.resourceDetail = {};
- $scope.totalParticipants = 0;
- $scope.showDemandRewardButton = false;
- $scope.hasApplyAward = false;
- $scope.docking = false;
- $scope.techingreward = 0;
- $scope.endDemand = true;
- $scope.showTechnicalContract = false;
- // $scope.showApplyButton=$stateParams.ifjoin=='true';
- $scope.hasCollect = false;
- $scope.showConsultBox = true;
- $scope.notReceived = Number($stateParams.taskstatus) == 5300;
- $scope.action = {
- // action0:false,//我要申请 5322
- // action1:false,//对接录入 5322
- // action2:false,//评价 5323
- // action3:false,//申请奖励 5324
- // action4:false,//任务完成 5325
- }
- $scope.pubulisherData = {};
- $scope.buttonNum = 0;
- if ($scope.status == 'technicalreward') {
- $scope.buttonNum++;
- if (!$scope.showDemandRewardButton) {
- $scope.showDemandRewardButton = true;
- $scope.buttonNum++;
- }
- if (!$scope.docking) {
- $scope.docking = true;
- $scope.buttonNum++;
- }
- }
- //该用户是否签订过技术合同
- var getTechnical = function () {
- ResourceLibraryService.getTechnical(UserService.id, $scope.resid).then(function (res) {
- if (res.code == 3350) {
- if (res.data.length > 0) {
- //签订过技术合同就不显示
- $scope.showTechnicalContract = false;
- $scope.techingreward = 1;
- $scope.buttonNum++;
- } else {
- //没签订过技术合同就显示
- $scope.showTechnicalContract = true;
- $scope.techingreward = 0;
- }
- }
- })
- }
- getTechnical();
- //桐庐对接记录申请奖励
- var getDemandReward = function () {
- if ($stateParams.node == "330122000") {
- ResourceLibraryService.getResourceByID($scope.resid).then(function (res) {
- console.log(res)
- console.log(UserService.id)
- if (res.code == 3350) {
- if (res.data.creator == UserService.id) {
- //显示申请技术需求奖励按钮
- if (!$scope.showDemandRewardButton) {
- $scope.showDemandRewardButton = true;
- $scope.buttonNum++;
- }
- }
- }
- })
- }
- }
- getDemandReward();
- //当前用户是否申请过奖励
- var getDemandRewardByUser = function () {
- if ($scope.endDemand) {
- $scope.buttonNum++;
- }
- if ($stateParams.node == "330122000") {
- ResourceLibraryService.getDemandRewardByUser($scope.resid, UserService.id).then(function (res) {
- if (res.code == 3350) {
- if (res.data) {
- $scope.hasApplyAward = true;
- } else {
- $scope.hasApplyAward = false;
- $scope.buttonNum++;
- }
- }
- })
- }
- }
- getDemandRewardByUser();
- $scope.seeTechnicalContract = function (resourceDetail) {
- ResourceLibraryService.getTechnical(UserService.id, resourceDetail.resid).then(function (res) {
- if (res.code == 3350) {
- if (res.data.length > 0) {
- $scope.go('signDemandContractDetail', { contract: res.data[0] });
- }
- }
- })
- }
- $scope.getDemandRewardDetail = function (resourceDetail) {
- if (UserService.id == resourceDetail.creator) {
- dataToolsService.judgeUserBroker(UserService.id).then(function (res) {
- if (res.code == 3350) {
- if (res.data) {
- //是技术经纪人
- $scope.go("demandRewardDetail", { resid: resourceDetail.id, comefrom: "taskDetail" });
- } else {
- //不是技术经纪人
- $ionicPopup.confirm({
- title: '认证',
- template: '需先认证为技术经纪人,方可申请技术需求类奖励',
- okText: '去认证',
- cancelText: '取消'
- }).then(function (result) {
- if (result) {
- if ($scope.node == "330122000") {
- $scope.go('identifyFormForTongLu', {
- pageTitle: '技术经纪人认证',
- code: 4801,
- action: 'check'
- });
- } else {
- $scope.go('identifyForm', {
- pageTitle: '技术经纪人认证',
- code: 4801,
- action: 'check'
- });
- }
- }
- })
- }
- }
- })
- } else {
- if ($scope.app) {
- UtilService.showMess("仅发布者可以申请需求奖励!");
- } else {
- CommonService.showMessage("仅发布者可以申请需求奖励!", $scope);
- }
- }
- }
- $scope.goBackPage = function () {
- $scope.go('tab.activityIndex');
- /*if ($ionicHistory.backView()) {
- $ionicHistory.backView().go();
- } else {
- $ionicHistory.goBack();
- }*/
- // if($stateParams.comefrom=='tab.activityIndex'){
- // $scope.go('tab.activityIndex');
- // }else{
- // $scope.go('taskHoll');
- // }
- /*if (UserService.isRewardFlag == 1 && UserService.isTaskHollFlag == 1) {
- $scope.go('taskHoll');
- UserService.isRewardFlag = 0;
- UserService.isTaskHollFlag = 0;
- } else {
- if (UserService.isMessage == 1) {
- $scope.go('mymessage');
- UserService.isMessage = 0;
- } else {
- if (UserService.isNotThisUserFlag == 1) {
- $scope.go('tab.activityIndex');
- UserService.isNotThisUserFlag = 0;
- } else {
- if ($stateParams.comefrom == "taskHoll" && UserService.isTaskHollFlag == 1) {
- $scope.go('taskHoll');
- UserService.isTaskHollFlag = 0;
- } else {
- if ($ionicHistory.backView()) {
- $ionicHistory.backView().go();
- } else {
- $ionicHistory.goBack();
- }
- }
- }
- }
- }*/
- }
- /*if ($stateParams.comefrom) {
- if ($stateParams.comefrom == "publisher") {
- $scope.go($stateParams.comefrom, {Id: UserService.id});
- } else {
- $scope.go($stateParams.comefrom);
- }
- } else {
- $scope.go('taskHoll');
- }*/
- var tempArr = $stateParams.actions ? $stateParams.actions.split(',') : [];
- console.log(tempArr);
- if (tempArr.length > 0) {
- for (var i = 0; i < tempArr.length; i++) {
- switch (tempArr[i]) {
- case '5321':
- //进行中的任务
- if ($stateParams.taskstatus == 5301) {
- taskModuleService.getTaskReceiver($stateParams.taskid).then(function (response) {
- for (var i = 0; i < response.data.length; i++) {
- if (UserService.id != response.data[i]) {
- $scope.action.action0 = true;
- $scope.buttonNum++;
- break;
- }
- }
- })
- }
- $scope.action.action0 = true;
- $scope.buttonNum++;
- break;
- case '5322':
- taskModuleService.getTaskReceiver($stateParams.taskid).then(function (response) {
- for (var i = 0; i < response.data.length; i++) {
- if (UserService.id == response.data[i]) {
- $scope.action.action1 = true;
- $scope.buttonNum++;
- break;
- }
- }
- })
- break;
- // case '5323':$scope.action.action2=true;$scope.buttonNum++;break;//评价功能添加的时候,取消注释
- case '5324':
- taskModuleService.getTaskReceiver($stateParams.taskid).then(function (response) {
- for (var i = 0; i < response.data.length; i++) {
- if (UserService.id == response.data[i]) {
- $scope.action.action3 = true;
- $scope.buttonNum++;
- break;
- }
- }
- })
- break;
- case '5325':
- $scope.action.action4 = true;
- $scope.buttonNum++;
- break;
- }
- }
- console.log($scope.action);
- }
- $scope.goToSignDemandContract = function (resourceDetail) {
- $scope.go('signDemandContract', {
- pageTitle: "签订技术合同",
- code: 4801,
- type: 5100,
- action: 'submit',
- resid: resourceDetail.id
- });
- }
- $scope.technicalreward = function (resourceDetail) {
- console.log(resourceDetail)
- taskModuleService.checkTaskDetailPermission(2, UserService.id).then(function (res) {
- if (res.code == 3350) {
- if (!res.data) {//true可见,false不可见
- $ionicPopup.confirm({
- title: '确认',
- template: '需先认证为技术经纪人,方可申请技术经纪人技术合作类奖励',
- okText: '去认证',
- cancelText: '取消'
- }).then(function (result) {
- if (result) {
- if (UserService.node == '330122000') {
- $scope.go('identifyFormForTongLu', {
- pageTitle: '技术经纪人认证',
- code: 4801,
- type: 5100,
- id: UserService.userid
- });
- } else {
- $scope.go('identifyForm', {
- pageTitle: '技术经纪人认证',
- code: 4801,
- type: 5100,
- id: UserService.userid
- });
- }
- }
- })
- } else {
- // resourceDetail.restype=4801
- $scope.go('technicalawardapplication', {
- pageTitle: "技术经纪人产学研奖励",
- code: 4801,
- type: 5100,
- action: 'submit',
- resid: resourceDetail.id,
- restype: 4801,
- list: resourceDetail
- });
- }
- }
- });
- }
- // 标签点击事件
- $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.goToTaskAction = function (list, action) {
- UserService.isTaskFlag = 1;
- console.log(list);
- console.log(action);
- if (!ConfigService.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;
- }
- return;
- }
- if (action == 5321) {
- senddata = {
- data: {
- resourceid: $stateParams.resid,
- action: 5321,
- creator: UserService.id
- },
- node: UserService.node
- }
- $scope.showLoadingToast();
- console.log(senddata);
- taskModuleService.saveOrupdatetaskAction(senddata).then(function (res) {
- console.log(res);
- if (res.code == 3350) {
- // $scope.go('taskHoll');
- // $scope.showDockingButton=true;
- // $scope.showApplyButton=false;
- if ($scope.app) {
- UtilService.showMess("任务申请成功!");
- } else {
- CommonService.showMessage("任务申请成功!", $scope);
- }
- // getTaskDetail();
- // getAllParticipant();
- // getTaskDetail().then(function(data){
- // getAllParticipant();
- // })
- $stateParams.actions = '5322,5324';
- $scope.go('taskDetail', $stateParams, { reload: true });
- }
- $scope.hideLoadingToast();
- })
- } else if (action == 5323) {
- $scope.go('taskEvaluate', {
- taskRes: JSON.stringify(list)
- })
- } else if (action == 5322) {
- // 对接录入
- $scope.go('dockingInput', {
- comfrom: 'dockingInput',
- taskTitle: list.title,
- taskid: $stateParams.taskid,
- tasktitle: list.title,
- companyName: list.affiliatedCompany ? list.affiliatedCompany.name : "",
- companyid: list.baseInfoModel ? list.baseInfoModel.oid : 0,
- })
- } else if (action == 5324) {
- $scope.go('visitModularForm', {
- companyid: list.baseInfoModel.oid,
- pageTitle: '新建录入',
- pagecode: 1000027,
- pageid: 15,
- restype: 0,
- node: $stateParams.node,
- title: list.affiliatedCompany.name,
- })
- } else if (action == 5325) {
- if ($scope.endDemand) {
- $scope.endDemand = false;
- $scope.buttonNum--;
- }
- //弹框
- $ionicPopup.confirm({
- title: '确认',
- template: '是否确认结束需求'
- }).then(function (result) {
- if (result) {
- senddata = {
- data: {
- resourceid: $stateParams.resid,
- action: 5325,
- creator: UserService.id
- },
- node: UserService.node
- }
- $scope.showLoadingToast();
- console.log(senddata);
- taskModuleService.saveOrupdatetaskAction(senddata).then(function (res) {
- console.log(res);
- $stateParams.actions = '5322,5324';
- $stateParams.ifjoin = false;
- $scope.go('taskDetail', $stateParams, { reload: true });
- $scope.hideLoadingToast();
- })
- } else {
- $scope.goback();
- }
- })
- }
- }
- var customActionParams = {
- clicktype: 0,
- moduleid: 0,
- targetid: 0,
- userid: UserService.id
- }
- console.log($scope.showApplyButton);
- // 获得任务详情
- var getTaskDetail = function () {
- var deferred = $q.defer();
- $scope.showLoadingToast();
- console.log($stateParams);
- ResourceLibraryService.getPrivateResourceDetail($stateParams.resid, $stateParams.restype, $stateParams.node).then(function (res) {
- console.log('这又是个什么东东', res);
- if (res.code == 3350) {
- if (res.data.creator == UserService.id) {
- if (!$scope.isPublisher) {
- $scope.isPublisher = true;
- $scope.buttonNum++;
- }
- if (!$scope.docking) {
- $scope.docking = true;
- $scope.buttonNum++;
- }
- } else {
- $scope.isPublisher = false;
- }
- if ($stateParams.taskstatus == 5302) {
- taskModuleService.getTaskReceiver($stateParams.taskid).then(function (response) {
- for (var i = 0; i < response.data.length; i++) {
- if (UserService.id == response.data[i]) {
- $scope.taskFinish = true;
- $scope.buttonNum++;
- break;
- }
- }
- })
- }
- $scope.hideLoadingToast();
- $scope.allLabel = res.otherObj;
- $scope.hasCollect = res.data.collect;
- $scope.hasFocus = res.data.focus;
- $scope.resourceDetail = res.data;
- $scope.resourceDetail.restype = $stateParams.restype
- $scope.resourceDetail.resid = res.data.id;
- $scope.resourceDetail.createid = res.data.creator;
- $scope.showConsultBox = $scope.resourceDetail.createid != UserService.id;
- $scope.resourceDetail.title = res.data.baseInfoModel.title;//任务名称
- $scope.pubulisherData.contactName = res.data.userModel.username;//联系人
- $scope.pubulisherData.contactPhone = res.data.userModel.mobile;//联系电话
- $scope.resourceDetail.publisherScore = res.data.userModel.scoretotal;//联系人评分
- $scope.pubulisherData.createtime = res.data.createtime;//发布时间
- $scope.pubulisherData.publisherLogo = res.data.userModel.photo;//发布者头像
- $scope.pubulisherData.userid = res.data.userModel.userid;//发布者id
- $scope.resourceDetail.affiliatedCompany = {};
- angular.forEach(res.data.infoSectionList[0].unitlist, function (val) {
- val.tcname == 'oid' ? ($scope.resourceDetail.affiliatedCompany.name = val.content, $scope.resourceDetail.affiliatedCompany.showCode = val.showCode) : //所属单位
- val.tcname == 'capitalScale' ? $scope.resourceDetail.capitalScale = val.content == '0.0' ? '面议' : val.content ://投入预算
- val.tcname == 'cooperationmodel' ? $scope.resourceDetail.cooperationmodel = val.content ://合作模式
- val.tcname == 'content' ? $scope.resourceDetail.content = val.content ://简介
- val.tcname == 'tasktype' ? $scope.resourceDetail.tasktype = val.content ://任务类型
- val.tcname == 'images' ? $scope.resourceDetail.images = JSON.parse(val.content) : '';//任务类型
- /*val.tcname == 'contactor' ? $scope.resourceDetail.contactor = val.content : '';//任务类型
- val.tcname == 'tel' ? $scope.resourceDetail.tel = val.content : '';//任务类型*/
- })
- console.log($scope.resourceDetail);
- document.title = res.data.baseInfoModel.title;
- document.getElementById('shareSourc').setAttribute('src', ConfigService.imgurl + res.data.baseInfoModel.logo);
- deferred.resolve("ok");
- }
- })
- return deferred.promise;
- }
- // $scope.resourceDetail={
- // affiliatedCompany:{
- // name: "",
- // showCode: 2603
- // },
- // capitalScale: "0.0",
- // contactName: "普适科技-吴晓婷",
- // contactPhone: "15295115835",
- // content: "科晶电子任务1520科晶电子任务1520科晶电子任务1520科晶电子任务1520介绍",
- // cooperationmodel: "技术咨询",
- // createtime: "2018-10-24 15:21:43",
- // publisherLogo: "group3/M00/0A/CA/wKjILFmNIS2ADzOvAABQ0oV3mpA301.jpg",
- // publisherScore: 3.55,
- // tasktype: "人才需求",
- // title: "科晶电子任务1520"
- // }
- // 获得参与用户列表
- var getAllParticipant = function () {
- taskModuleService.searchAllParticipants($stateParams.resid, personPageNum, personPagesize).then(function (res) {
- console.log(res);
- if (res.code == 3350) {
- $scope.totalParticipants = res.page.totalCount;//参与用户数量
- $scope.participantsList = Object.assign([], res.data);
- // for(var i=0;i<$scope.participantsList.length;i++){
- // if($scope.participantsList[i].userid==$scope.resourceDetail.userModel.userid){
- // $scope.participantsList.splice(i,1);
- // $scope.totalParticipants--;
- // break;
- // }
- // }
- taskModuleService.searchDockingRecord($stateParams.resid, UserService.id, UserService.id).then(function (response) {
- if (response.code == 3350) {
- if (response.data.length > 0 && !$scope.abutLength) {
- $scope.abutLength = true;
- $scope.buttonNum++;
- }
- }
- })
- angular.forEach($scope.participantsList, function (val) {
- val.dockingRecord = [];
- taskModuleService.searchDockingRecord($stateParams.resid, UserService.id, val.userid).then(function (response) {
- console.log(response);
- if (response.data == false) {
- val.hasAuth = false;
- } else {
- /*if (response.data.length > 0 && !$scope.abutLength) {
- $scope.abutLength = true;
- $scope.buttonNum++;
- }*/
- $scope.node = UserService.node;
- ResourceLibraryService.judgeManager(UserService.id, 10501).then(function (res) {
- //ture:机构领导人,可以看到(hasAuth:true, unfoldDropdown:false)
- if (res.data == true) {
- val.hasAuth = true;
- val.unfoldDropdown = false;
- } else {
- //当前用户是任务发布者,可以看到对接记录
- if ($scope.pubulisherData.userid == UserService.id) {
- val.hasAuth = true;
- val.unfoldDropdown = false;
- //当前用户是该条对接记录的发布者(创建者)
- } else if (val.userid == UserService.id) {
- val.hasAuth = true;
- val.unfoldDropdown = false;
- } else {
- val.hasAuth = false;
- }
- }
- val.dockingRecord = response.data;
- val.allImages = JSON.parse(val.images);
- angular.forEach(val.dockingRecord, function (vv) {
- vv.allImages = JSON.parse(vv.images);
- })
- })
- }
- })
- })
- // 发布者的对接记录
- $scope.pubulisherData.typecode = Number(res.message) > 0 ? res.message : 0;
- taskModuleService.searchDockingRecord($stateParams.resid, UserService.id, $scope.pubulisherData.userid).then(function (response) {
- console.log(response);
- if (response.data == false) {
- $scope.pubulisherData.hasAuth = false;
- } else {
- $scope.pubulisherData.hasAuth = true;
- $scope.pubulisherData.dockingRecord = response.data;
- $scope.pubulisherData.unfoldDropdown = false;
- console.log($scope.pubulisherData);
- angular.forEach($scope.pubulisherData.dockingRecord, function (val) {
- val.allImages = JSON.parse(val.images);
- })
- }
- })
- console.log($scope.participantsList);
- }
- })
- }
- getTaskDetail().then(function (data) {
- getAllParticipant();
- })
- // 展开对接列表
- $scope.showDkDropdown = function (index) {
- $scope.participantsList[index].unfoldDropdown = !$scope.participantsList[index].unfoldDropdown;
- }
- $scope.bigImage = false; //初始默认大图是隐藏的
- $scope.hideBigImage = function () {
- $timeout(function () {
- if ($scope.app) {
- $scope.setStatusBar(0);
- }
- $scope.bigImage = false;
- }, 400);
- };
- $scope.shouBigImage = function (imgList, index) {
- if ($scope.app) {
- $scope.setStatusBar(1);
- }
- console.log('aaa')
- $scope.imgUrlList = imgList;
- console.log($scope.imgUrlList[index]);
- // 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.applyForTask = function () {
- }
- // 对接录入
- // $scope.goToTaskAction=function(){
- // $scope.go('dockingInput',{
- // comfrom:'dockingInput',
- // taskTitle:$stateParams.title,
- // taskid:$stateParams.resid,
- // companyName:$scope.resourceDetail.affiliatedCompany.name,
- // companyid:0,
- // })
- // }
- // 结束任务
- $scope.stopTask = function () {
- }
- // 收藏
- $scope.customAction = function (clicktype, moduleid, targetid) {
- customActionParams = {
- clicktype: clicktype,
- moduleid: moduleid,
- targetid: targetid,
- userid: UserService.id
- }
- console.log(customActionParams);
- CommentService.postClickFavour(customActionParams).then(function (res) {
- if (res.code == 3350) {
- if (clicktype == 2619 || clicktype == 2620) {
- $scope.hasCollect = !$scope.hasCollect;
- }
- if (clicktype == 2617 || clicktype == 2618) {
- $scope.hasFocus = !$scope.hasFocus;
- }
- }
- })
- }
- //分享
- $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) {
- console.log($scope.resourceDetail);
- $scope.shareflg = false;
- var linkUrl = ConfigService.webserver + '#/taskDetail/' + $stateParams.resid + '/' + $stateParams.restype + '/' + $stateParams.node + '/' + $stateParams.title + '/' + $stateParams.comefrom + '/' + $stateParams.ifjoin + '/' + $stateParams.actions + '/' + $stateParams.taskstatus + '/' + $stateParams.taskid + '/' + $stateParams.opentowho;
- 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
- };
- console.log(linkUrl);
- 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 = '';
- console.log($scope.resourceDetail.baseInfoModel.title);
- 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.sendMessage = function (userid) {
- console.log(userid);
- // if(userid==UserService.id){
- // if($scope.app){
- // UtilService.showMess("不能咨询本人哦!");
- // }else{
- // CommonService.showMessage("不能咨询本人哦!",$scope);
- // }
- // return;
- // }
- ScienceCircleService.createConversation(6202, userid, 20001).then(function (response) {
- console.log(response);
- if (response.result > 0) {
- $scope.go('singleChatMode', {
- "topicid": response.topic.topicid,
- "topicname": response.topic.topicname,
- "username": $scope.pubulisherData.contactName,
- "reciverid": response.topic.reciverid,
- "isfocus": $scope.isfocus
- });
- } else {
- if ($scope.app) {
- UtilService.showMess("网络不给力,请重试");
- } else {
- CommonService.showMessage("网络不给力,请重试", $scope);
- }
- }
- }, function () {
- if ($scope.app) {
- UtilService.showMess("网络不给力,请重试");
- } else {
- CommonService.showMessage("网络不给力,请重试", $scope);
- }
- })
- };
- //跳转到评论发布者的主页
- $scope.goPublisher = function (id) {
- UserService.isNotThisUserFlag = 1;
- console.log(id);
- if (id != 0) {
- $scope.go('publisher', { Id: id });
- }
- };
- /****评论*****/
- $scope.comment = { content: "" };
- var recourceid = $stateParams.resid;
- var recourcetype = $stateParams.restype;
- // 评论/评论回复的传参
- $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 getInfoCommentList = function () {
- CommentService.getInfoCommentList($scope.paramsForInfoCommentList).then(function (response) {
- console.log(response);
- // 评论列表
- $scope.comments = response.data;
- }, function () {
- })
- };
- getInfoCommentList();
- //发布普通评论
- $scope.publishComment = function (type, comment) {
- var content = $scope.comment.content;
- if (content.length == 0) {
- if ($scope.app) {
- UtilService.showMess("请输入评论内容!");
- } else {
- CommonService.showMessage("请输入评论内容!", $scope);
- }
- return;
- }
- $scope.showComment = true;
- $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();
- console.log($scope.infoComment);
- $scope.infoComment.contenttype = '任务详情页';
- 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: recourcecomefrom
- })
- };
- //点击抢沙发
- $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: '任务详情页'
- })
- };
- // 滚动至底部
- 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,
- comfrom: 'task'
- });
- }, 350);
- };
- // 弹出简单评论框
- $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"
- };
- }
- };
- // 点赞、收藏、分享的传参
- $scope.clickRecord =
- {
- //TODO
- targetid: $stateParams.recourceid,
- // targetid: 124,
- moduleid: ConstantService.TABLE_CODE_30001,
- userid: UserService.id,
- // userid:1,
- clicktype: 1,
- content: '资源详情页'
- };
- // 控制重复点击
- var flag = 1;
- // 操作:点赞、关注、收藏
- $scope.praiseAction = function (clicktype, recourceid, moduleid, ind) {
- if (flag == 0) {
- return;
- }
- flag = 0;
- console.log(ind)
- console.log(moduleid)
- console.log($scope.resourceDetail.creator);
- // 点赞 or 收藏 资源
- // 取消点赞 or 取消收藏 资源
- if (clicktype == 2615 || clicktype == 2619
- || clicktype == 2616 || clicktype == 2620) {
- $scope.clickRecord.targetid = recourceid;
- $scope.clickRecord.moduleid = moduleid;
- } else if (clicktype == 2617 || clicktype == 2618) {
- // 关注 用户
- // 取消关注 用户
- $scope.clickRecord.targetid = $scope.resourceDetail.creator;
- $scope.clickRecord.moduleid = 30043;
- }
- $scope.clickRecord.clicktype = clicktype;
- $scope.clickRecord.content = '任务详情页';
- console.log($scope.clickRecord);
- CommentService.postClickFavour($scope.clickRecord).then(function (response) {
- console.log(response);
- if (response.code == 3350 && (clicktype == 2615 || clicktype == 2616)) {
- $scope.comments[ind].favour = !$scope.comments[ind].favour;
- clicktype == 2615 ? $scope.comments[ind].favourcount++ : $scope.comments[ind].favourcount--;
- }
- // 恢复可用
- flag = 1;
- }, function () {
- // 恢复可用
- flag = 1;
- })
- };
- /********任务评价**********/
- taskModuleService.searchTaskRateList($stateParams.resid, 1, 5).then(function (res) {
- console.log(res);
- })
- /********任务编辑**********/
- $scope.openActionSheet = function () {
- var buttonlist = [
- { text: '编辑' },
- { text: '删除' }
- ];
- $ionicActionSheet.show({
- buttons: buttonlist,
- cancelText: '取消',
- buttonClicked: function (index) {
- if (index == 0) {
- $scope.resourceDetail.opentowho = $scope.opentowho;
- $scope.go('taskRelease', { comfrom: 'taskRelease', data: $scope.resourceDetail })
- }
- if (index == 1) {
- var taskTitle = $scope.resourceDetail.title;
- var companyId = $scope.resourceDetail.baseInfoModel.oid;
- taskModuleService.deleteTask(taskTitle, companyId);
- $scope.go('taskHoll');
- }
- }
- })
- }
- /****************邀请人员******************/
- $scope.opentowho = $scope.opentowho ? JSON.parse($stateParams.opentowho) : '';
- console.log($scope.opentowho);
- }
- ])
- ;
|