angular.module('push') .controller('activityIndexCtrl', function ($scope, $state, $compile, $rootScope, $timeout, HomeService, ActivityService, $ionicScrollDelegate, $ionicSlideBoxDelegate, UtilService, HandleService, homepageOfNodeService, UserService, ConfigService, resourceLibraryTempData, roleService, $ionicModal, dataToolsService, taskModuleService, CommonService, $ionicPopup, ResourceLibraryService, $stateParams, AccountService) { $scope.node = UserService.node; //加载等待页 $scope.isloadingPageFloor = true; if ($scope.app) { if (localStorage.getItem("firstInitApp") == 0) { $scope.guidePageCom.show(); } } var scrollFunc = function () { if (ionic.scroll.lastTop > 440) { $scope.addtransparent = true } else { $scope.addtransparent = false } } console.log("----------", $scope.ddd) //给页面绑定滑轮滚动事件 if (document.addEventListener) { //firefox document.addEventListener('DOMMouseScroll', scrollFunc, false); } //滚动滑轮触发scrollFunc方法 //ie 谷歌 var move = 'ontouchmove' in document ? 'touchmove' : 'onmousewheel' if ('ontouchmove' in document) { window.ontouchmove = document.ontouchmove = scrollFunc; } else { window.onmousewheel = document.onmousewheel = scrollFunc; } //跳转引导页(如果用户第一次登陆app就显示), // if ($scope.app) { // $rootScope.db.transaction(function (tx) { // tx.executeSql('SELECT count(*) AS mycount FROM guidepage', [], function (tx, rs) { // if (rs.rows.item(0).mycount == 0) { // //如果为0的话就意味着是第一次登陆 // $scope.guidePageCom.show(); // } // }, function (tx, error) { // console.log('SELECT error: ' + error.message); // }); // }); // } $scope.platformname = UserService.nodename; $scope.defaultLan = UserService.defaultLan; // 获取溧阳token var arr1 = window.location.href.split('token='); if (arr1[1]) { var arr2 = arr1[1].split('#/'); var token = arr2[0]; ActivityService.liyangLogin(token).then(function (res) { // console.log(res); if (res.code == 3350) { ConfigService.islogin = true; $scope.islogin = true; localStorage.setItem("mobile", res.data.mobile); //存储密码用作自动登录 localStorage.setItem("password", res.data.password); UserService.id = res.data.userid; AccountService.getUserInfo().then(function (response) { UserService.user = response.data; UserService.role = response.data.userRoleList; }) } }) } // console.log($stateParams); document.title = UserService.nodename; $scope.showtask = UserService.node != '320481000'; if ($scope.isLiyangApp) { // $(".tab_hide").hide(); localStorage.showNoticeMask = true; } //TODO if ($scope.app) { $scope.setStatusBar(1); } $scope.$on("$ionicView.beforeEnter", function () { //TODO if ($scope.app) { $scope.setStatusBar(1); } }); var sysUsersInfo = {}; $scope.islogin = ConfigService.islogin; // if (device.platform != "Android") { // if (flg == 0) { // StatusBar.styleDefault();//黑色 // } else { // StatusBar.styleLightContent();//白色 // } // } // 保存节点信息 if (localStorage.node) { UserService.node = localStorage.node; UserService.nodename = localStorage.nodename; } else { if (!$scope.isLiyangApp && !$scope.isWujingApp) { $scope.go('chooseNodeIndex'); } } // 轮播 var hasSwipe = true; var mySwiper; var startSwipe = function () { mySwiper = new Swiper('.swiper-container', { slidesPerView: 'auto', grabCursor: true, centeredSlides: true, loop: true, autoplay: { delay: 10000, disableOnInteraction: false, }, on: { tap: function (e) { if (this.clickedIndex % 4 == 0 || this.clickedIndex == 0) { if (UserService.node == "320412000") { $scope.go("academician"); } if (UserService.node == "320481000") { $scope.go("suzheng"); } } else if ((this.clickedIndex % 5 == 0 || this.clickedIndex == 1) && (localStorage.node == '320412000')) { 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 (sysUsersInfo.authenstatus == 5100) { $scope.go('identifyForm', { pageTitle: '技术经纪人', code: 4801, type: sysUsersInfo.authenstatus, id: sysUsersInfo.id, action: 'submit', comfrom: 'tab.activityIndex' }); } else { $scope.go('identifyStatus', { pageTitle: '技术经纪人', code: 4801, type: sysUsersInfo.authenstatus, id: sysUsersInfo.id, action: 'submit', comfrom: 'tab.activityIndex' }); } } else { $scope.go('bannerContent') } } } }) // mySwiper.updateProgress(); } // $scope.showLoadingToast(); $scope.comfromWeb = sessionStorage.comfrom == 'web'; $scope.updataversion = "none";//有版本更新时显示; $('.tab_hide').css("display", "none");//背景遮层 $scope.showloadBar = false;//进度条 // $scope.hideupdate = true; $scope.hideupdate = false; $rootScope.homeBadge = 10; $scope.showtoast = false;//签到弹窗 $scope.reclib = { id: 0,// 资源库文件夹id-武进库 reclibid: 0,// 资源库细分文件夹id-需求库 name: "", moduleid: 0 }; $scope.getNodeInfo = function () { $scope.node = UserService.node;//节点号 $scope.nodename = UserService.nodename;//节点号名称 }; $scope.getNodeInfo(); setInterval(function () { $scope.$watch(UserService.node, function () { $scope.nodename = UserService.nodename; }); }, 100); /*检测更新*/ var checkUpdate = function () { var devicetype = device.platform == "Android" ? 0 : 1; HomeService.checkUpdate(devicetype).then(function (response) { // HomeService.checkUpdate(1).then(function (response) { $scope.checkUpdateInfo = response.data; if ($scope.checkUpdateInfo.status != 0) { $scope.updatestatus = $scope.checkUpdateInfo.status; $scope.version = $scope.checkUpdateInfo.version; $rootScope.verno = $scope.checkUpdateInfo.version; $scope.isexitapp = $scope.checkUpdateInfo.isexitapp; } //APK更新 if ($scope.checkUpdateInfo.status == 1) { if ((devicetype == 0 && $scope.checkUpdateInfo.andriodstatus == 0) || (devicetype == 1 && $scope.checkUpdateInfo.iosstatus == 0)) { $scope.updataversion = "block"; $scope.hideupdate = true; $scope.showloadBar = false; $('.tab_hide').css("display", "block"); } } //www更新 // if ( $scope.checkUpdateInfo.status == 2) { // $scope.updataversion = "block"; // $scope.hideupdate = true; // $('.tab_hide').css("display", "block"); // } }, function () { }); }; //TODO --注释放开 if ($scope.app) { checkUpdate(); } //android更新 $scope.updateversion = function () { if ($scope.updatestatus == 1) { if (device.platform == "Android") { if ($scope.isLiyangApp) { cordova.InAppBrowser.open("http://sj.qq.com/myapp/detail.htm?apkName=com.liyang.liyangapp", '_system', 'location=yes'); } else { //app在线下载(自动更新) $scope.updateAuto(); //app打开应用宝开始下载 //cordova.InAppBrowser.open("http://sj.qq.com/myapp/detail.htm?apkName=com.push.pushapp", '_system', 'location=yes'); } } else { cordova.InAppBrowser.open("https://itunes.apple.com/us/app/push科技/id1218178687?mt=8", '_system', 'location=yes'); } } if ($scope.updatestatus == 2) { $scope.showloadBar = true; $scope.checkForUpdates(); } $scope.updataversion = "none"; $scope.hideupdate = false; $('.tab_hide').css("display", "none"); }; //取消更新版本 $scope.cancleupdateversion = function () { $scope.hideupdate = false; if ($scope.isexitapp == 1) { //直接关闭app ionic.Platform.exitApp(); } $scope.updataversion = "none"; $('.tab_hide').css("display", "none"); }; $scope.doUpdate = function () { $ionicDeploy.update().then(function (res) { // console.log(res); }, function () { }, function (prog) { var loadPercent = parseInt(prog) + "%"; $("#loadpercent").html(loadPercent); $('.progress-bar').css({ 'width': loadPercent }); }); }; // 当前版本号 $rootScope.verno = angular.copy(ConfigService.versionno); //web端检测更新 var checkUpdatesForWeb = function () { ActivityService.checkUpdatesForWeb($rootScope.verno).then(function (res) { if (res.code == 3350 && res.data == true) { //$scope.clearNavigatorCokkier(); } }) } //代码有Bug,该功能暂时不使用 //checkUpdatesForWeb(); //检测更新 $scope.checkForUpdates = function () { $ionicDeploy.check($rootScope.verno).then(function (hasUpdate) { $scope.hasUpdate = hasUpdate; if (hasUpdate) { $scope.doUpdate(); } }, function (err) { }) }; //版本更新,清除浏览器记录 $scope.clearNavigatorCokkier = function () { var keys = document.cookie.match(/[^ =;]+(?==)/g) if (keys) { for (var i = keys.length; i--;) { document.cookie = keys[i] + '=0;path=/;expires=' + new Date(0).toUTCString() // 清除当前域名下的,例如:m.ratingdog.cn document.cookie = keys[i] + '=0;path=/;domain=' + document.domain + ';expires=' + new Date(0).toUTCString() // 清除当前域名下的,例如 .m.ratingdog.cn document.cookie = keys[i] + '=0;path=/;domain=ratingdog.cn;expires=' + new Date(0).toUTCString() // 清除一级域名下的或指定的,例如 .ratingdog.cn } } } //app在线下载(自动更新) $scope.updateAuto = function () { //var textStr = "测试代码";测试服务器svn时间 var source = 'http://pic.ubittc.com/group3/M00/0B/14/wKgBd10etCiAH7eRAAB6AIZYBWw073.apk'; var target = "/Download/pushkeji.apk"; var trustAllHosts = true; var options = {}; var fileTransfer = new FileTransfer(); function successCallback(entry) { cordova.plugins.fileOpener2.open( target, 'application/vnd.android.package-archive' ); $ionicLoading.hide(); } function errorCallback(error) { $ionicLoading.show({ template: "下载失败" }); $timeout(function () { $ionicLoading.hide() }, 2000); } fileTransfer.download(source, target, successCallback, errorCallback, trustAllHosts, options); fileTransfer.onprogress = function (progressEvent) { if (progressEvent.lengthComputable) { $ionicLoading.show({ template: "已经下载:" + Math.floor((progressEvent.loaded / progressEvent.total) * 100) + "%" }); } } }; $scope.ButtonShow = ['走访记录', '企业库', '数据看板', '培育库'] homepageOfNodeService.getNodeAuth(UserService.node).then(function (res) { $scope.isUserManager = res.data; }) // 获取活动首页所有信息(宣传图、我的消息、最近的活动、最近的需求反馈) var getActivityInfo = function () { // $scope.showLoadingToast(); var clienttype = 0; if ($scope.app) { clienttype = 1; } else { clienttype = 2; } ActivityService.getActivityInfo(clienttype, 0).then(function (response) { console.log('index/all', response) //关闭启动动画 //TODO if ($scope.app) { $timeout(function () { navigator.splashscreen.hide(); }, 1000); } // $scope.hideLoadingToast(); $scope.menulist = response.data && response.data.menulist ? response.data.menulist : []; // $scope.menulist.push({ // title:'技术经纪人', // url:'identifyForm', // icon:'./img/2018/technical_broker.png' // }); // $scope.menulist.push({ // title:'任务', // url:'taskHoll', // icon:'./img/2018/task-org.png' // }); // $scope.menulist.push({ // title:'活动', // url:'activitiesHoll', // icon:'./img/2018/activities.png' // }); angular.forEach($scope.menulist, function (val) { // val.icon=val.title=='走访'?'./img/2018/interview-org.png':val.title=='我的录入'?'./img/2018/typein-org.png':val.title=='报表统计'?'./img/2018/statistic_report.png':val.icon; // val.noticeContent=val.title=='技术经纪人'?'快速认证经纪经纪人,领取普适币':val.title=='任务'?'快速进入任务大厅,赚取普适币':''; val.hasNotice = (val.noticeContent != null && val.noticeContent != '' && val.noticeContent != ""); if (val.title == "报表管理") { val.hasNotice = false; } var title = val.title; val.wholePicUrl = ConfigService.imgurl + val.icon; val.picflag = (title == "技术经纪人" || title == "活动" || title == "需求") ? "1" : "2"; }) if (!localStorage.showNoticeMask) { $scope.showNoticeMask = true; $(".notice-mask").show(); $(".tab_hide").show(); $scope.changeNotice(); } // // if(mySwiper){ // mySwiper.slideTo (0); // mySwiper.destroy(true) // } startSwipe(); $scope.bannerlist = response.data && response.data.adlist ? response.data.adlist : [];//首页宣传图 console.log("response.data:", response.data); sysUsersInfo = response.data && response.data.sysUsersInfo ? response.data.sysUsersInfo : { authenstatus: 5100, id: 0 }; $scope.myMessageList = response.data && response.data.messagelist ? response.data.messagelist : []; angular.forEach($scope.myMessageList, function (val) { // if(val.msgTypeModel){ // switch (val.msgTypeModel.mtype){ // case 2647 :val.title='有人对 '+val.infoname+' 录入了信息';break; // case 2645 :val.title=val.applytypename+" "+val.authenstatusname;val.params=val.params?JSON.parse(val.postscript):{};break; // case 2614 :val.params=val.postscript?JSON.parse(val.postscript):{};val.title='有人评论了 '+val.params.title;break; // case 2646 :val.title='有人走访了 '+val.infoname;break; // case 2615 :val.params=val.postscript?JSON.parse(val.postscript):{};val.title='有人点赞了 '+val.params.title;break; // case 2640 :val.title='有人申请权限,请审核!';break; // case 2641 :val.title='您申请的权限已被处理,请查看!';break; // case 2617 :val.params=val.postscript?JSON.parse(val.postscript):{};val.title=val.msgTypeModel.content;break; // case 2662 :val.params=val.postscript?JSON.parse(val.postscript):{};val.params.comefrom='tab.activityIndex';val.params.opentowho=JSON.stringify(val.params.opentowho);val.title=val.resultmark;break; // default:val.params=val.postscript?JSON.parse(val.postscript):{};val.title=val.resultmark; // } // } val.params == val.postscript ? JSON.parse(val.postscript) : {}; }) angular.forEach($scope.myMessageList, function (val) { // console.log("resultmark=" + val.resultmark + "===标志===:" + val.by2); }) $scope.myMessageList != '' && $scope.myMessageList != [] ? $scope.myMessageList.push($scope.myMessageList.slice(0, 1)[0]) : ''; // $scope.myMessageList =[ // {msgTypeModel:{content:'第一條消息'},createtime:'2018-10-10'}, // {msgTypeModel:{content:'第二條消息'},createtime:'2018-10-10'}, // {msgTypeModel:{content:'第三條消息'},createtime:'2018-10-10'}, // {msgTypeModel:{content:'第四條消息'},createtime:'2018-10-10'}, // {msgTypeModel:{content:'第五條消息'},createtime:'2018-10-10'}, // {msgTypeModel:{content:'第六條消息'},createtime:'2018-10-10'}, // ] /*5.0版本未调整此部分功能,暂时未取值,注释*/ /*$scope.myMessageList = response.message;//最新6条消息 if (angular.isDefined(response.activity)) { $scope.newactivity = response.activity[0];//我的最近活动 } if (response.followup.list.length > 0) { $scope.folupcount = response.followup.count; $scope.actfolup = response.followup.list[0];//我的需求反馈 }*/ // 宣传图渲染 // $timeout(function () { // $ionicSlideBoxDelegate.$getByHandle("adBanner").update(); // }, 50); // console.log(mySwiper); // // if(mySwiper) { // console.log(mySwiper); // //销毁swiper // mySwiper.removeAllSlides(); // } $scope.isloadingPageFloor = false; }, function () { }) }; getActivityInfo(); // 首页搜索入口 $scope.goIndexSearch = function () { $scope.go("indexSearchReasult"); }; // 各模块快捷入口页面跳转 $scope.jumpPage = function (pageindex) { $scope.islogin = ConfigService.islogin; switch (pageindex) { case 0: // 对接宝 $scope.go("abutmentHome"); break; case 1: // 活动中心 //$scope.go("activityCenter"); UtilService.showMess("功能正在完善中,敬请期待!"); break; case 2: // 普适币 $scope.go("psMoneyHome"); break; case 3: // 我的群组 break; case 4: //关注用户 $scope.go("fancenter", { act: 'activity' }); break; case 5: break; case 6: //技术经纪人 $scope.go("technicalBrokerButtonSummary"); break; case 7: //走企业 $scope.go("technicalBrokerEnterCompanyInfo"); break; case 8: //录入 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.go("recordInfoAccount"); } break; case 9: //录入 $scope.go("reportTypeList"); break; default: break; } }; // 活动页面快捷入口路由跳转 $scope.goNextPage = function (index, act) { switch (index) { case 1: // 通知 $scope.go("activityNotice", { activityid: act.id, title: act.title }); break; case 2: // 通知管理 $scope.go("activityNoticeManger", { activityid: act.id, title: act.title, status: act.status, days: act.activityLeaveDays }); break; case 3: // 报名 $scope.go("activitySignUpConfirm", { activityid: act.id }); break; case 4: // 高校报名管理 $scope.go("activitySchoolSignUpManger", { activityid: act.id, title: act.title, visittime: act.visitclosingdate }); break; case 5: // 企业报名管理 $scope.go("activityCompanySignUpManger", { activityid: act.id, title: act.title, visittime: act.visitclosingdate }); break; case 6: // 参与企业 $scope.go("activityCompanyList", { activityid: act.id }); break; case 7: // 活动统计 $scope.go("activityStatistics", { activityid: act.id }); break; case 8: // 活动安排管理 $scope.go("activityArrangeManger", { activityid: act.id }); break; case 9: // 签到 checkIn(act.id); break; case 10: // 反馈(1、非企业用户:1.1 未填写过进入填写页面,1.2 已填写过进入列表 2、企业用户:填写本企业的走访反馈列表) if (UserService.role[0] <= 8 && UserService.role[0] != 1) { ActivityService.checkFollowupInfo(act.id).then(function (response) { if (response.result == 0) { $scope.go("activityFeedBack", { activityid: act.id, title: act.title }); } else { $scope.go("activityFeedBackList", { activityid: act.id, title: act.title }); } }, function () { }); } else { $scope.go("activityCompanyViewFeedList", { activityid: act.id }); } break; case 11: // 活动安排 if (UserService.role[0] <= 8 && UserService.role[0] != 1) { $scope.go("activityArrange", { activityid: act.id }); } else { $scope.go("activityCompanyArrange", { activityid: act.id }); } break; case 12: // 反馈管理 $scope.go("activityBackManger", { activityid: act.id }); break; case 13: // 签到管理 $scope.go("activitySignManger", { activityid: act.id }); break; case 14: // 备案 $scope.go("activityRecord"); break; case 15: // 备案管理 $scope.go("activityReacordManger"); break; case 16: // 选择企业 $scope.go("activityChooseCompany", { activityid: act.id }); break; case 17: // 报名信息 $scope.go("activitySignUpInfo", { activityid: act.id }); break; case 18: // 选择专家 $scope.go("activityChooseTeacher", { activityid: act.id }); break; default: break; } }; // 获取模版列表的传参 $scope.roleModel = { //TODO funid: 2,//所属功能:1走访、2录入等 roleidList: []// 角色数组 }; //根据角色获取所有模版 $scope.rolePageList = []; $scope.roleModel.roleidList.push(0);// 角色默认一笔0,否则后台 in查询会报错 var getRolePageList = function () { if (UtilService.isDefined(UserService.role)) { angular.forEach(UserService.role, function (value, index) { $scope.roleModel.roleidList.push(value.roleid); }); } $scope.roleModel.node = UserService.node; //==============根据角色获取所有模版================ console.log('角色传参', $scope.roleModel, UserService); roleService.getRolePageList($scope.roleModel).then(function (response) { console.log('来自于大家觉得', response); // 模版列表 $scope.rolePageList = response.data; angular.forEach($scope.rolePageList, function (val) { val.logo = val.pagename == '基本信息' ? 'iconfont-basic-info' : val.pagename == '需求信息' ? 'iconfont-demand' : val.pagename == '成果信息' ? 'iconfont-achievement' : val.pagename == '产品信息' ? 'iconfont-product' : val.pagename == '专利信息' ? 'iconfont-patents' : val.pagename == '人才信息' ? 'iconfont-talents' : val.pagename == '月报表' ? 'iconfont-report-form' : val.pagename == '项目转化' ? 'iconfont-transform' : val.pagename == '对接录入' ? 'iconfont-butt-joint' : 'ion-compose'; }) // console.log($scope.rolePageList); }, function () { }) }; /* app5.0开发,功能未调整,不展示,注释 // 活动是否弹出签到弹窗(否临时人员:弹窗,已报名:直接签到) var activityid = 0; var checkIntime = function (actid) { activityid = actid; $scope.showLoadingToast(); ActivityService.checkIntime(activityid).then(function (response) { // console.log(response); if (response.result == 1) { $scope.userinfo = response.userinfo; $scope.showtoast = true; $scope.hideLoadingToast(); } else { } }, function () { $scope.hideLoadingToast(); }) }; // 签到 var checkIn = function (actid) { ActivityService.getCheckInStatus(actid).then(function (response) { // 0未签到,1已签到 if (response.result == 0) { ActivityService.checkIn(actid, ConfigService.location.lat, ConfigService.location.lng).then(function (response) { // console.log(response); if (response.result == 1) { UtilService.showMess("签到成功"); getActivityInfo(); } else { UtilService.showMess("网络不给力,请重试"); } $scope.hideLoadingToast(); }, function () { $scope.hideLoadingToast(); UtilService.showMess("网络不给力,请重试"); }); } else { UtilService.showMess("您已成功签到"); $scope.hideLoadingToast(); } }, function () { UtilService.showMess("网络不给力,请重试"); $scope.hideLoadingToast(); }); }; // 临时人员签到 $scope.tempCheckin = function () { $scope.showLoadingToast(); ActivityService.tempCheckIn(activityid, ConfigService.location.lat, ConfigService.location.lng, $scope.userinfo).then(function (response) { // console.log(response); if (response.result == 1) { UtilService.showMess("签到成功"); getActivityInfo(); $timeout(function () { $scope.showtoast = false; }, 300); } else { UtilService.showMess("网络不给力,请重试"); } $scope.hideLoadingToast(); }, function () { UtilService.showMess("网络不给力,请重试"); $scope.hideLoadingToast(); }); }; // 检查活动当天是否有弹框 $scope.ifshowResourceWrapFloor = false; var checkIspopup = function (moduletype) { $scope.showLoadingToast(); ActivityService.checkIspopup(moduletype).then(function (response) { if (response.result == 1) { // 获取弹框内容 getPopupDetail(moduletype); $scope.ifshowResourceWrapFloor = true; $scope.showResourceWrapFloor = true; $("ion-nav-view[name='tab-activityIndex']").css("z-index","8"); $scope.hideLoadingToast(); } else { $scope.ifshowResourceWrapFloor = false; } }, function () { $scope.hideLoadingToast(); }) }; checkIspopup(0); // 获取弹框详情 var getPopupDetail = function (moduletype) { $scope.showLoadingToast(); ActivityService.getPopupDetail(moduletype).then(function (response) { $scope.popupinfo = response; $scope.hideLoadingToast(); }, function () { $scope.hideLoadingToast(); }) }; getPopupDetail(0); // 查询用户是否输入正确过口令 $scope.keywordid = 0; $scope.ifpostuserkeyword = 0; var checkUserKeyword = function (keywordid) { ActivityService.checkUserKeyword(keywordid).then(function (response) { // 口令id $scope.ifpostuserkeyword = response.result; }, function () { }) }; // 判断用户是否有文件夹权限 $scope.ifhasvisitauth = 2; var checkUserAuthority = function () { ActivityService.getAuthority().then(function (response) { // 有权限1,没有权限2 $scope.ifhasvisitauth = response.result; }, function () { }) }; // 查询口令的id var getkeywordid = function (moduletype) { ActivityService.getkeywordid(moduletype).then(function (response) { // 口令id $scope.keywordid = response.keywordid; console.log($scope.keywordid); checkUserKeyword($scope.keywordid); checkUserAuthority(); }, function () { }) }; getkeywordid(0); // 输入口令正确,用户获取文件夹权限 var setAuthority = function (claid) { ActivityService.setAuthority(claid).then(function (response) { // console.log("设置文件夹权限成功" + response.result); }, function () { }) }; //进入资源库文件夹列表方法 var goResourceLib = function (id, reclibid, name, linktype) { $scope.reclib.id = id;// 资源库文件夹id-武进库 $scope.reclib.reclibid = reclibid;// 资源库细分文件夹id-需求库 $scope.reclib.name = name; $scope.reclib.moduleid = linktype;// 模块对应的moduleid:6,7,8 console.log($scope.reclib); $scope.go('resourceLibraryPrivate', {reclib: angular.toJson($scope.reclib)}); }; // 查询用户输入口令是否正确 $scope.submitActPas = function (actPassword) { ActivityService.postKeyword($scope.keywordid, actPassword).then(function (response) { // console.log("aa1:"+response); if (response.result == 1) { // 输入正确,继续 $("#consoleHtm").html("口令输入正确"); // 设置为0,则后台取配置信息 setAuthority(0); $scope.ifpostuserkeyword = 1; $scope.ifhasvisitauth = 1; // 口令正确,自动进入资源库 // console.log($scope.popupinfo.popupdetaillist.length); // console.log("aa:"+$scope.popupinfo.popupdetaillist[0].detailtitle); if ($scope.popupinfo.popupdetaillist.length > 0) { goResourceLib($scope.popupinfo.popupdetaillist[0].url, $scope.popupinfo.popupdetaillist[0].claid, $scope.popupinfo.popupdetaillist[0].detailtitle, $scope.popupinfo.popupdetaillist[0].linktype); } } else if (response.result == 2) { // 输入错误 $("#consoleHtm").html("口令输入错误"); } }, function () { }) }; //进入资源库文件夹列表 $scope.goSomeWhere = function (id, reclibid, name, linktype) { console.log(name); goResourceLib(id, reclibid, name, linktype); }; // 关闭签到弹窗 $scope.btnHide = function () { $timeout(function () { $scope.showtoast = false; }, 300); };*/ // 进入需求反馈详情页 $scope.goFolUpDetail = function () { $scope.go("activityFeedBackListContent", { folupid: $scope.actfolup.id }); }; // 进入需求反馈列表 $scope.goFeedBackList = function () { $scope.go("activityFeedBackList", { activityid: $scope.actfolup.aid, title: $scope.actfolup.activityname }); }; //关闭启动动画 if ($scope.app) { $timeout(function () { //TODO navigator.splashscreen.hide(); }, 1000); } if ($scope.app && device.platform != "Android") { $scope.isIosPlatform = true; } $scope.hastask = true;//控制标题栏内容是否显示 $scope.isScrollEnough = false; $scope.showInBody = true; // var scrollheight=document.getElementById('click-button').offsetTop; var scrollheight; /*$timeout(function () { scrollheight = document.getElementById('click-position').offsetTop; }, 1000)*/ $scope.getScrollPosition = function () { var position = $ionicScrollDelegate.getScrollPosition().top;//取这个ion-content滑动TOP值 // console.log(position); if (position > scrollheight) { //当滚动距离大于250px时执行下面的东西 $scope.showInBody = false; $timeout(function () { var scrollWidth = document.querySelector('#click-button-top>li.resource-active').offsetLeft; var width = document.querySelector('#click-button-top>li.resource-active').offsetWidth; if (scrollWidth > window.innerWidth / 2) { // $ionicScrollDelegate.$getByHandle('clickButton').scrollTo(scrollWidth-window.innerWidth/2+allLis[index].offsetWidth/2,0); $ionicScrollDelegate.$getByHandle('clickButtonTop').scrollTo(scrollWidth - window.innerWidth / 2 + width / 2, 0); } else { // $ionicScrollDelegate.$getByHandle('clickButton').scrollTo(0,0); $ionicScrollDelegate.$getByHandle('clickButtonTop').scrollTo(0, 0); } }, 0); } else {//当滚动距离小于250的时候执行下面的内容,也就是让导航栏恢复原状 $scope.showInBody = true; $timeout(function () { /*var scrollWidth = document.querySelector('#click-button>li.resource-active').offsetLeft; var width = document.querySelector('#click-button>li.resource-active').offsetWidth; if (scrollWidth > window.innerWidth / 2) { $ionicScrollDelegate.$getByHandle('clickButton').scrollTo(scrollWidth - window.innerWidth / 2 + width / 2, 0); // $ionicScrollDelegate.$getByHandle('clickButtonTop').scrollTo(scrollWidth-window.innerWidth/2+allLis[index].offsetWidth/2,0); } else { $ionicScrollDelegate.$getByHandle('clickButton').scrollTo(0, 0); // $ionicScrollDelegate.$getByHandle('clickButtonTop').scrollTo(0,0); }*/ }, 0); } $scope.$apply();//触发用以更新view }; //弹出各类按钮 $scope.showAnthorBtnWrap = false; $scope.showAnthorBtn = function () { $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.showAnthorBtnWrap = true; getRolePageList(); $("ion-nav-view[name='tab-activityIndex']").css("z-index", "8"); } }; var hideAnthorBtnf = function () { $scope.showAnthorBtnWrap = false; $("ion-nav-view[name='tab-activityIndex']").css("z-index", "1"); }; $scope.hideAnthorBtnWrap = function () { $scope.showAnthorBtnWrap = false; $("ion-nav-view[name='tab-activityIndex']").css("z-index", "1"); }; $scope.goTaskReceive = function () { //$scope.go("technicalBrokerSelfReceiveTask"); UtilService.showMess("功能正在完善中,敬请期待!"); }; $scope.jumpQuick = function (orgtype, pagecode, pagename, id, isedit) { if (id == 10) { $scope.go('reportEditModal', { pageTitle: '报表录入', pageid: id }) } if (id == 16) { $scope.go('dockingInput', { comfrom: "dockingInput", companyName: "", companyid: 0, taskId: "", taskTitle: "" }) } else { if (UserService.node == '330122000' && id == 4) { console.log(9999) $scope.go('visitModularFormDemand', { companyid: 0, pageid: id, orgtype: orgtype, pagecode: pagecode, isedit: isedit, node: UserService.node, pageTitle: '新建录入', techtype: 5350 }); } else { $scope.go('visitModularForm', { companyid: 0, pageid: id, orgtype: orgtype, pagecode: pagecode, isedit: isedit, node: UserService.node, pageTitle: '新建录入' }); } // if(UserService.node=='320117005'||UserService.node=='320117003'||UserService.node=='320117002'||UserService.node=='320117001'||UserService.node=='320117004'){ // // $scope.go('typeinAllModal', {companyid: 0, pageid: id, orgtype: orgtype,pagecode:pagecode, isedit: isedit,node:UserService.node}); // $scope.go('visitModularForm', {companyid: 0, pageid: id, orgtype: orgtype,pagecode:pagecode, isedit: isedit,node:UserService.node,pageTitle:'新建录入'}); // }else{ // $scope.go('typeinInformation',{orgtype:orgtype,pagecode:pagecode,pagename:pagename,id:id,isedit:isedit}) // } } hideAnthorBtnf(); }; //资源库跳转弹窗 $scope.showResourceWrapFloor = true; $scope.showResourceBtn = function () { $("ion-nav-view[name='tab-activityIndex']").css("z-index", "8"); $scope.showResourceWrapFloor = true; }; $scope.resourceBtnHide = function () { $("ion-nav-view[name='tab-activityIndex']").css("z-index", "1"); $scope.showResourceWrapFloor = false; }; //跳转轮播详情页 $scope.goBannerContent = function () { $scope.go('bannerContent') }; // 跳转到选择节点 $scope.goSelectNode = function () { $scope.go('chooseNodeIndex'); }; $scope.jumpToPage = function (url, title) { $scope.islogin = ConfigService.islogin; if (url == 'reward') { $scope.go(url); } else { if (!$scope.islogin) { if (url == "technicalBrokerEnterCompanyInfo" || url == "taskHoll" || url == "activitiesHoll" || url == "notification" || url == "linkus") { $scope.go(url); return; } else { 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; } } } if (/技术经纪/g.test(title) || "Technical Broker" == title) { console.log(sysUsersInfo.authenstatus, url) // return; var jumpUrl = ''; if (sysUsersInfo.authenstatus == 5100) { jumpUrl = url; } else { jumpUrl = 'identifyStatus'; } $scope.go(jumpUrl, { pageTitle: title, code: 4801, type: sysUsersInfo.authenstatus, id: sysUsersInfo.id, action: 'submit', comfrom: 'tab.activityIndex' }); } else { if (url == "orgInspect") { //判断当前用户是不是节点下的管理机构的管理员 taskModuleService.judgeUserInOrgForTL().then(function (res) { console.log(res) if (res.code == 3350) { $scope.isAdmin = res.data; if ($scope.isAdmin) { $scope.go('orgInspectList', { isuserlist: false }); } else { taskModuleService.getInspectList(0, '0', '', true).then(function (res) { if (res.code == 3350) { if (res.data.length > 0) { $scope.go('orgInspectList', { isuserlist: true }); } else { $scope.go('orgInspect'); } } }) } } }) } else if (title == "企业库") { $scope.go('privateResource', { res: angular.toJson(url), privateName: url.name, groupid: url.parentid, restype: url.moduleid, privateContent: url.content, authority: url.by5 }); } else if (url == 'Selfcheckentrance') { $scope.go(url, { id: title }); }else if(title=='科技工具'){ window.open( 'https://cae365.yuansuan.com/') } else { $scope.go(url); } } } } $scope.changeNotice = function () { angular.forEach($scope.menulist, function (value) { value.showNotice = false; }) var i = 0; for (; i < $scope.menulist.length; i++) { if ($scope.menulist[i].hasNotice) { $scope.menulist[i].hasNotice = false; $scope.menulist[i].showNotice = true; $scope.noticeContent = $scope.menulist[i].noticeContent; return; } } if (i == $scope.menulist.length) { $scope.showNoticeMask = false; $(".tab_hide").hide(); localStorage.showNoticeMask = true; } } $scope.allTaskData = [] var taskSwiper; var taskSwiperFn = function () { var num = $scope.isapp ? 2 : 5; taskSwiper = new Swiper('.swiper-container-newest-task', { // loop: true, // 循环模式选项 slidesPerView: num, spaceBetween: 10, initialSlide: 0, // hashNavigation: true, // 如果需要分页器 pagination: { el: '.swiper-pagination', }, // 如果需要前进后退按钮 navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, on: { tap: function (e) { e.stopPropagation(); if (e.target.className == 'swiper-button-next') { this.slideNext(); } else if (e.target.className == 'swiper-button-prev') { this.slidePrev(); } else if (this.clickedIndex || this.clickedIndex == 0) { 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; } } else { var list = $scope.allTaskData[this.clickedIndex]; if (list.noSuthority) { var alertPopup = $ionicPopup.alert({ title: '提示', template: '自任务发布起一周内仅被邀请用户方可接单,一周后无人接单才会公开接单权限。' }); return; } /*$scope.go('taskDetail', { resid: list.unique, node: list.source, title: list.title, restype: list.type, comefrom: 'tab.activityIndex', ifjoin: list.otherObj.ifjoin, actions: list.otherObj.actions, taskstatus: list.otherObj.taskstatus, taskid: list.otherObj.id, opentowho: list.otherObj.opentowho, });*/ } } } }, // 如果需要滚动条 // scrollbar: { // el: '.swiper-scrollbar', // }, }) } // $scope.showLoadingToast(); // 获取任务分类标签 // dataToolsService.getTypeEntryListByTypeName('usertask_type').then(function(res){ taskModuleService.getAllTaskLable(UserService.node).then(function (res) { $scope.labelList = [{ itemvalue: 0, itemkey: '全部', isSelected: true }]; if (res.code == 3350) { angular.forEach(res.data, function (val) { val.isSelected = false; }) $scope.labelList = $scope.labelList.concat(res.data); } }); // 获取任务列表 $scope.getTaskList = function (tasktype, index) { if ($scope.labelList) { angular.forEach($scope.labelList, function (val) { val.isSelected = false; }) $scope.labelList[index].isSelected = true; } $scope.allTaskData = []; $scope.showNoData = false; $scope.showLoading = true; taskModuleService.getAllTaskList(UserService.node, 0, tasktype, '', 1, 10).then(function (res) { $scope.showLoading = false; if (res.code == 3350) { $scope.allTaskData = res.data; angular.forEach($scope.allTaskData, function (val) { val.noSuthority = false; if (val.otherObj && val.otherObj.creator != UserService.id && val.otherObj.taskstatus == 5300 && !val.otherObj.actions) { val.noSuthority = true; } }) $scope.showNoData = (res.data && res.data.length == 0); //溧阳节点隐藏掉 $timeout(function () { if (taskSwiper && $scope.showtask) { taskSwiper.slideTo(0); taskSwiper.destroy(true) } taskSwiperFn(); }, 200) } }) } $scope.goTongLuCheckDetail = function (list) { if (list.source == '330122000') { 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; } } else { var permissionvalue = list.by6; var splitArr = []; if (permissionvalue == 1 || permissionvalue == 2 || permissionvalue == 3 || permissionvalue == 4 || permissionvalue == 5) { splitArr.push(permissionvalue); } else if (permissionvalue != null) { splitArr = permissionvalue.split(','); } else { splitArr.push(1); } for (var i = 0; i < splitArr.length; i++) { if (splitArr[i] == 2) { taskModuleService.checkTaskDetailPermission(2, UserService.id).then(function (res) { if (res.code == 3350) { $scope.isVisiableFlag = res.data; if (!$scope.isVisiableFlag) { taskModuleService.getUserPermissionCheck(list.unique, list.creator, UserService.id).then(function (res) { if (res.code == 3350) { $scope.isVisiableFlag = res.data; if (!$scope.isVisiableFlag) {//true可见,false不可见 $ionicPopup.confirm({ title: '确认', template: '仅技术经纪人可见,请先认证技术经纪人', okText: '去认证', cancelText: '取消' }).then(function (result) { if (result) { if ($scope.node == '330122000') { $scope.go('identifyFormForTongLu', { pageTitle: '技术经纪人认证', code: 4801, type: 5100, id: UserService.userid }); } if ($scope.node == '320412000') { $scope.go('identifyForm', { pageTitle: '技术经纪人认证', code: 4801, type: 5100, id: UserService.userid }); } } else { $scope.go('tab.activityIndex'); } }) } else { 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; } } else { if (list.noSuthority) { var alertPopup = $ionicPopup.alert({ title: '提示', template: '自需求发布起一周内仅被邀请用户方可接单,一周后无人接单才会公开接单权限。' }); return; } // console.log(list); if (list.otherObj.taskstatus == 5302) { taskModuleService.getTaskReceiver(list.otherObj.id).then(function (res) { for (var i = 0; i < res.data.length; i++) { if (res.data[i] == UserService.id) { list.otherObj.actions = list.otherObj.actions + "," + 5324; break; } } }) } $scope.go('taskDetail', { resid: list.unique, node: list.source, title: list.title, restype: list.type, comefrom: 'taskHoll', ifjoin: list.otherObj.ifjoin, actions: list.otherObj.actions, taskstatus: list.otherObj.taskstatus, taskid: list.otherObj.id, opentowho: list.otherObj.opentowho }); } } } }); } else { 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; } } else { if (list.noSuthority) { var alertPopup = $ionicPopup.alert({ title: '提示', template: '自需求发布起一周内仅被邀请用户方可接单,一周后无人接单才会公开接单权限。' }); return; } // console.log(list); if (list.otherObj.taskstatus == 5302) { taskModuleService.getTaskReceiver(list.otherObj.id).then(function (res) { for (var i = 0; i < res.data.length; i++) { if (res.data[i] == UserService.id) { list.otherObj.actions = list.otherObj.actions + "," + 5324; break; } } }) } $scope.go('taskDetail', { resid: list.unique, node: list.source, title: list.title, restype: list.type, comefrom: 'taskHoll', ifjoin: list.otherObj.ifjoin, actions: list.otherObj.actions, taskstatus: list.otherObj.taskstatus, taskid: list.otherObj.id, opentowho: list.otherObj.opentowho }); } } } }); } else if (splitArr[i] == 3) { taskModuleService.checkTaskDetailPermission(3, UserService.id).then(function (res) { if (res.code == 3350) { $scope.isVisiableFlag = res.data; if (!$scope.isVisiableFlag) { taskModuleService.getUserPermissionCheck(list.unique, list.creator, UserService.id).then(function (res) { if (res.code == 3350) { $scope.isVisiableFlag = res.data; if (!$scope.isVisiableFlag) {//true可见,false不可见 $ionicPopup.confirm({ title: '确认', template: '仅高校院所专家可见,请先认证高校院所专家', okText: '去认证', cancelText: '取消' }).then(function (result) { if (result) { $scope.go('identifyForm', { pageTitle: '高校认证', code: 4804, action: 'submit' }); } else { $scope.go('tab.activityIndex'); } }) } else { 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; } } else { if (list.noSuthority) { var alertPopup = $ionicPopup.alert({ title: '提示', template: '自需求发布起一周内仅被邀请用户方可接单,一周后无人接单才会公开接单权限。' }); return; } // console.log(list); if (list.otherObj.taskstatus == 5302) { taskModuleService.getTaskReceiver(list.otherObj.id).then(function (res) { for (var i = 0; i < res.data.length; i++) { if (res.data[i] == UserService.id) { list.otherObj.actions = list.otherObj.actions + "," + 5324; break; } } }) } $scope.go('taskDetail', { resid: list.unique, node: list.source, title: list.title, restype: list.type, comefrom: 'taskHoll', ifjoin: list.otherObj.ifjoin, actions: list.otherObj.actions, taskstatus: list.otherObj.taskstatus, taskid: list.otherObj.id, opentowho: list.otherObj.opentowho }); } } } }); } else { 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; } } else { if (list.noSuthority) { var alertPopup = $ionicPopup.alert({ title: '提示', template: '自需求发布起一周内仅被邀请用户方可接单,一周后无人接单才会公开接单权限。' }); return; } // console.log(list); if (list.otherObj.taskstatus == 5302) { taskModuleService.getTaskReceiver(list.otherObj.id).then(function (res) { for (var i = 0; i < res.data.length; i++) { if (res.data[i] == UserService.id) { list.otherObj.actions = list.otherObj.actions + "," + 5324; break; } } }) } $scope.go('taskDetail', { resid: list.unique, node: list.source, title: list.title, restype: list.type, comefrom: 'taskHoll', ifjoin: list.otherObj.ifjoin, actions: list.otherObj.actions, taskstatus: list.otherObj.taskstatus, taskid: list.otherObj.id, opentowho: list.otherObj.opentowho }); } } } }); } else if (splitArr[i] == 4) { taskModuleService.getUserPermissionCheck(list.unique, list.creator, UserService.id).then(function (res) { if (res.code == 3350) { $scope.isVisiableFlag = res.data; if (list.creator != UserService.id && !$scope.isVisiableFlag) { $ionicPopup.confirm({ title: '提示', template: '此需求已设置权限,若需了解需求详情,去向发布者申请权限', okText: '去申请权限', cancelText: '取消' }).then(function (result) { if (result) { $scope.go("tongluPermissionApply", { resource: list }); } else { $scope.go('tab.activityIndex'); } }) } else { 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; } } else { if (list.noSuthority) { var alertPopup = $ionicPopup.alert({ title: '提示', template: '自需求发布起一周内仅被邀请用户方可接单,一周后无人接单才会公开接单权限。' }); return; } // console.log(list); if (list.otherObj.taskstatus == 5302) { taskModuleService.getTaskReceiver(list.otherObj.id).then(function (res) { for (var i = 0; i < res.data.length; i++) { if (res.data[i] == UserService.id) { list.otherObj.actions = list.otherObj.actions + "," + 5324; break; } } }) } $scope.go('taskDetail', { resid: list.unique, node: list.source, title: list.title, restype: list.type, comefrom: 'taskHoll', ifjoin: list.otherObj.ifjoin, actions: list.otherObj.actions, taskstatus: list.otherObj.taskstatus, taskid: list.otherObj.id, opentowho: list.otherObj.opentowho }); } } } }); } else { 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; } } else { if (list.noSuthority) { var alertPopup = $ionicPopup.alert({ title: '提示', template: '自需求发布起一周内仅被邀请用户方可接单,一周后无人接单才会公开接单权限。' }); return; } // console.log(list); if (list.otherObj.taskstatus == 5302) { taskModuleService.getTaskReceiver(list.otherObj.id).then(function (res) { for (var i = 0; i < res.data.length; i++) { if (res.data[i] == UserService.id) { list.otherObj.actions = list.otherObj.actions + "," + 5324; break; } } }) } $scope.go('taskDetail', { resid: list.unique, node: list.source, title: list.title, restype: list.type, comefrom: 'taskHoll', ifjoin: list.otherObj.ifjoin, actions: list.otherObj.actions, taskstatus: list.otherObj.taskstatus, taskid: list.otherObj.id, opentowho: list.otherObj.opentowho }); } } } } $scope.getTaskList(0); // 标签点击事件 $scope.goToTaskDetail = function (list) { // console.log(list); if (list.noSuthority) { if ($scope.app) { UtilService.showMess('未开放查看权限!'); } else { CommonService.showMessage('未开放查看权限!', $scope); } return; } 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; } } else { // console.log(list); $scope.go('taskDetail', { resid: list.unique, node: list.source, title: list.title, restype: list.type, comefrom: 'tab.activityIndex', ifjoin: list.otherObj.ifjoin, actions: list.otherObj.actions, taskstatus: list.otherObj.taskstatus }); } } } } //点击图片,跳转到武进专家页面 $scope.jumpToWujingTalents = function (banner) { if (banner.title == "wjtest.gif") { if (UserService.node == "320412000") { $scope.go("academician"); } } } // 刷新页面 $scope.doRefresh = function () { getActivityInfo(); $scope.getTaskList(0, 0); // $scope.go('tab.activityIndex'); $scope.lishuiNode = false; // console.log(UserService.node); if (UserService.node == '320117005' || UserService.node == '320117003' || UserService.node == '320117002' || UserService.node == '320117001' || UserService.node == '320117004') { $scope.lishuiNode = true; } $scope.$broadcast('scroll.refreshComplete'); }; $scope.doRefresh() // 进入消息详情 $scope.goMessageDetail = function (index) { var message = $scope.myMessageList[index]; switch ($scope.myMessageList[index].msgTypeModel.mtype) { case 2647: break; case 2645: var myMessage = $scope.myMessageList[index]; if (myMessage.params == null || myMessage.params == undefined) { var postscript = myMessage.postscript ? JSON.parse(myMessage.postscript) : {}; var code = postscript.code; myMessage.params = {}; myMessage.params.code = code; } $scope.go('identifyStatus', { code: $scope.myMessageList[index].params.code, id: $scope.myMessageList[index].targetid, pageTitle: $scope.myMessageList[index].applytypename, type: $scope.myMessageList[index].result, }); break; case 2614: $scope.go($scope.myMessageList[index].msgTypeModel.url, { comfrom: $scope.myMessageList[index].params.comfrom, node: $scope.myMessageList[index].params.node, orgtype: $scope.myMessageList[index].params.orgtype, pagecode: $scope.myMessageList[index].params.pagecode, // resid: $scope.myMessageList[index].params.recourceid, templettype: $scope.myMessageList[index].params.templettype, recourcecomefrom: $scope.myMessageList[index].params.node, recourcetype: $scope.myMessageList[index].params.recourcetype, title: $scope.myMessageList[index].params.title, recourceid: $scope.myMessageList[index].params.recourceid, actions: $scope.myMessageList[index].params.actions, comefrom: 'tab.activityIndex', label: $scope.myMessageList[index].params.label, // node: $scope.myMessageList[index].params.node, opentype: $scope.myMessageList[index].params.opentype, resid: $scope.myMessageList[index].params.resid, restype: $scope.myMessageList[index].params.restype, taskid: $scope.myMessageList[index].params.taskid, taskstatus: $scope.myMessageList[index].params.taskstatus, activityid: $scope.myMessageList[index].params.activityid }); // if($scope.myMessageList[index].msgTypeModel.url=='taskDetail'){ // $scope.go('taskDetail',{ // // }) // } break; case 2615: $scope.go($scope.myMessageList[index].msgTypeModel.url, { comfrom: $scope.myMessageList[index].params.comfrom, node: $scope.myMessageList[index].params.node, orgtype: $scope.myMessageList[index].params.orgtype, pagecode: $scope.myMessageList[index].params.pagecode, resid: $scope.myMessageList[index].params.recourceid, templettype: $scope.myMessageList[index].params.templettype, recourcecomefrom: $scope.myMessageList[index].params.node, recourcetype: $scope.myMessageList[index].params.recourcetype, title: $scope.myMessageList[index].params.title, recourceid: $scope.myMessageList[index].params.recourceid, actions: $scope.myMessageList[index].params.actions, comefrom: 'tab.activityIndex', label: $scope.myMessageList[index].params.label, // node: $scope.myMessageList[index].params.node, opentype: $scope.myMessageList[index].params.opentype, // resid: $scope.myMessageList[index].params.resid, restype: $scope.myMessageList[index].params.restype, taskid: $scope.myMessageList[index].params.taskid, taskstatus: $scope.myMessageList[index].params.taskstatus, activityid: $scope.myMessageList[index].params.activityid }); break; case 2640: $scope.go('authorityApply', { content: $scope.myMessageList[index].applyinfo, messageId: $scope.myMessageList[index].id, type: $scope.myMessageList[index].type }); break; case 2641: $scope.go('authorityApply', { content: $scope.myMessageList[index].applyinfo, messageId: $scope.myMessageList[index].id, type: $scope.myMessageList[index].type }); break; case 2662: UserService.isMessage = 1; var messageParams = message.postscript ? JSON.parse(message.postscript) : {}; $scope.go('taskDetail', { resid: messageParams.resid, node: messageParams.node, title: messageParams.title, restype: messageParams.restype, comefrom: 'tab.activityIndex', //ifjoin: params.otherObj.ifjoin, actions: messageParams.actions, taskstatus: messageParams.taskstatus, taskid: messageParams.taskid, //opentowho: params.otherObj.opentowho, }); break; case 2617: $scope.go($scope.myMessageList[index].msgTypeModel.url, { Id: $scope.myMessageList[index].creator }); break; case 5900: $scope.go($scope.myMessageList[index].msgTypeModel.url, { activityid: $scope.myMessageList[index].targetid }); break; case 2681: break; case 2682: break; case 2683: break; case 2684: break; case 2685: break; case 2686: break; default: $scope.go($scope.myMessageList[index].msgTypeModel.url, $scope.myMessageList[index].params); } } $scope.subBannerList = [ { src: './img/2018/subSliderImg1.jpeg' }, { src: './img/2018/subSliderImg2.jpeg' }, ] // 获取资源列表 var length = 10; ResourceLibraryService.getResourceLibrary('', UserService.node).then(function (res) { // console.log(res); if (res.code == 3350) { $scope.resourceTitle = res.data; angular.forEach($scope.resourceTitle, function (val, index) { getAllResList(index, val); val.active = false; val.itemList = []; val.isload = true; val.pagenum = 0; switch (val.content.length) { case 1: length += 62; break; case 2: length += 62; break; case 3: length += 78; break; case 4: length += 95; break; case 5: length += 110; break; case 6: length += 126; break; case 7: length += 142; break; case 8: length += 158; break; case 9: length += 174; break; case 10: length += 190; break; default: length += 100; } }) //document.getElementById('click-button').style.width = length + 'px'; $('#click-button-top').css("width", length + 'px'); // document.getElementById('click-button-top').style.width = length + 'px'; $scope.changeActiveTitle(0); } }) $scope.activeIndex = 0; $scope.noData = false; var clickFirst = false; $scope.allResList = []; $scope.changeActiveTitle = function (index) { $scope.noData = false; if (clickFirst) { $ionicScrollDelegate.$getByHandle('calenderContent').scrollTo(top, scrollheight); } clickFirst = true; $scope.activeIndex = index; $scope.resourceItemList = []; angular.forEach($scope.resourceTitle, function (val) { val.active = false; }) $scope.resourceTitle[index].active = true; if ($scope.resourceTitle[index].itemList.length == 0) { ResourceLibraryService.getDefaultSort($scope.resourceTitle[index].moduleid).then(function (getDefaultSortRes) { var sort = getDefaultSortRes.data; ResourceLibraryService.getFirstResourceList($scope.resourceTitle[index].moduleid, $scope.resourceTitle[index].parentid, $scope.resourceTitle[index].pagenum, '', sort, 0, 0, '').then(function (res) { // console.log(res); $scope.resourceItemList = res.data || []; $scope.resourceTitle[index].itemList = Object.assign([], res.data); $scope.resourceTitle[index].pagenum++; if (res.page && $scope.resourceTitle[index].pagenum >= res.page.totalPage) { $scope.resourceTitle[index].isload = false; // $scope.showNoData=true; } $scope.noData = $scope.resourceItemList.length == 0; }) }) } else { $scope.resourceItemList = $scope.resourceTitle[index].itemList; $scope.noData = $scope.resourceItemList.length == 0; } // 滚动标题栏 var allLis = document.querySelectorAll(".click-button-item"); if (allLis.length > 0) { var scrollWidth = allLis[index].offsetLeft; // console.log(scrollWidth); // console.log(window.innerWidth); // console.log(allLis[index].offsetWidth); if (scrollWidth > window.innerWidth / 2) { $ionicScrollDelegate.$getByHandle('clickButton').scrollTo(scrollWidth - window.innerWidth / 2 + allLis[index].offsetWidth / 2, 0); // $ionicScrollDelegate.$getByHandle('clickButtonTop').scrollTo(scrollWidth-window.innerWidth/2+allLis[index].offsetWidth/2,0); } else { $ionicScrollDelegate.$getByHandle('clickButton').scrollTo(0, 0); // $ionicScrollDelegate.$getByHandle('clickButtonTop').scrollTo(0,0); } } } $scope.loadMoreData = function () { ResourceLibraryService.getDefaultSort($scope.resourceTitle[$scope.activeIndex].moduleid).then(function (getDefaultSortRes) { var sort = getDefaultSortRes.data; ResourceLibraryService.getFirstResourceList($scope.resourceTitle[$scope.activeIndex].moduleid, $scope.resourceTitle[$scope.activeIndex].parentid, $scope.resourceTitle[$scope.activeIndex].pagenum, '', sort, 0, 0, '').then(function (res) { // console.log(res); $scope.resourceTitle[$scope.activeIndex].pagenum++; $scope.resourceTitle[$scope.activeIndex].itemList = $scope.resourceTitle[$scope.activeIndex].itemList.concat(res.data); $scope.resourceItemList = $scope.resourceTitle[$scope.activeIndex].itemList; if ($scope.resourceTitle[$scope.activeIndex].pagenum >= res.page.totalPage) { $scope.resourceTitle[$scope.activeIndex].isload = false; // $scope.showNoData=true; } $scope.noData = $scope.resourceItemList.length == 0; }).finally(function () { $scope.$broadcast('scroll.infiniteScrollComplete'); }); }) } // web端布局 var getAllResList = function (index, val) { // console.log($scope.resourceTitle[index]); ResourceLibraryService.getDefaultSort($scope.resourceTitle[index].moduleid).then(function (getDefaultSortRes) { var sort = getDefaultSortRes.data; ResourceLibraryService.getFirstResourceList($scope.resourceTitle[index].moduleid, $scope.resourceTitle[index].parentid, 0, '', sort, 0, 0, '').then(function (res) { // console.log(res); $scope.allResList[index] = { name: $scope.resourceTitle[index].name, list: res.data, val: val }; // console.log($scope.allResList); }) }) } // 进入资源详情 $scope.goResourceDetail = function (resource, ind) { // console.log(resource); // console.log($stateParams.libtype); 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.go('resourceCommonDetailsPage', { recourceid: resource.unique, recourcetype: resource.type, recourcecomefrom: resource.source, creator: resource.clickthrough, title: resource.title, orgtype: 0, // comfrom:$scope.comfrom, pagecode: 0, label: JSON.stringify(resource.otherObj) }); } }; $scope.goToResList = function (rec) { // console.log(rec); var reclibc = rec || $scope.resourceTitle[$scope.activeIndex]; $scope.go('privateResource', { reclib: angular.toJson(reclibc), privateName: reclibc.name, restype: reclibc.moduleid, groupid: reclibc.parentid, privateContent: reclibc.content, authority: reclibc.by5 }) } $scope.goToTaskList = function () { $scope.go('taskHoll'); } //首页显示资源库数据专用 //初始化资源库列表 $scope.rescontactflg = 0;//0:本地/云资源库开始查询 2:查询结束 var tempLocalResourceLibrarylist = []; var tempCloudResourceLibrarylist = []; var initResourceLibraryList = function () { ResourceLibraryService.getResourceLibrary("", UserService.node).then(function (response) { console.log('初始化资源', response); if (UtilService.isDefined(response.data)) { // console.log(response.data); // 配置图片 tempCloudResourceLibrarylist = response.data; angular.forEach(tempCloudResourceLibrarylist, function (val) { val.logo = []; val.logo = val.name == '企业库' ? ['./img/2018/company1.png', './img/2018/company2.jpeg', './img/2018/company3.png'] : val.name == '高校库' ? ['./img/2018/university1.png', './img/2018/university2.png', './img/2018/university3.png'] : val.name == '人才库' || val.name == '技术经纪人库' ? ['./img/2018/person1.png', './img/2018/person2.png', './img/2018/person3.png'] : val.name == '需求库' ? ['./img/2018/demand1.jpg', './img/2018/demand2.jpg'] : val.name == '成果库' ? ['./img/2018/product1.jpg', './img/2018/product2.jpg', './img/2018/product3.jpg'] : ['./img/2018/other1-1.jpg', './img/2018/other1-2.jpg', './img/2018/other1-3.jpg']; if ($scope.isLiyangApp && val.name == '企业库') { val.logo = ['./img/2018/liyang1.jpg', './img/2018/liyang2.jpg', './img/2018/liyang3.jpg']; } }) } else { tempCloudResourceLibrarylist = []; } $scope.rescontactflg++; $scope.rescontactflg++; }, function () { tempCloudResourceLibrarylist = []; $scope.rescontactflg++; $scope.rescontactflg++; }) }; initResourceLibraryList(); //节点背景图切换 var initResourceLibraryNodeBg = function () { // $scope.showLoadingToast(); var clienttype = 0; if ($scope.app) { clienttype = 1; } else { clienttype = 2; } ResourceLibraryService.getResourceLibraryNodeBg(clienttype).then(function (response) { $scope.urlBackGImage = response.data; if (($scope.urlBackGImage && $scope.urlBackGImage.adlist.length > 0 && $scope.urlBackGImage.adlist[0].sourceName != undefined) || ($scope.urlBackGImage.adlist.length > 0 && $scope.urlBackGImage.adlist[0].sourceName.length > 0)) { $scope.sourceBgName = $scope.urlBackGImage.adlist[0].sourceName } else { $scope.sourceBgName = 'group3/M00/0B/01/wKjILFuI0w2AcHjkAAAaToWtucA883.jpg'; } }, function () { }) }; + initResourceLibraryNodeBg(); //拼接本地与云文件夹(按sort、updatetime排序) var connectLocalAndCloud = function () { HandleService.connectLocalAndCloud(tempLocalResourceLibrarylist, tempCloudResourceLibrarylist).then(function (response) { $scope.resourcelibrarylist = response; // console.log(response); if ($scope.resourcelibrarylist.length == 0) { $scope.shownone = true; } else { $scope.shownone = false; $scope.resinfocount = 0;//资源总数 // 节点资源总数 angular.forEach($scope.resourcelibrarylist, function (value) { $scope.resinfocount += value.infocount;//资源总数 if (value.moduleid == ConstantService.CATEGORY_MODULE_8) { $scope.resexpertcount = value.infocount;//专家总数 } if (value.moduleid == ConstantService.CATEGORY_MODULE_6) { $scope.resorgcount = value.infocount;//企业总数 } if (value.moduleid == ConstantService.CATEGORY_MODULE_2) { $scope.resresearchfindingcount = value.infocount;//成果总数 } if (value.moduleid == ConstantService.CATEGORY_MODULE_1) { $scope.techrequirementcount = value.infocount;//需求总数 } }); } resourceLibraryTempData.setResourceLibraryList($scope.resourcelibrarylist); $scope.hideLoadingToast(); console.log('resourcelibrarylist', $scope.resourcelibrarylist) }, function () { $scope.hideLoadingToast(); }) }; connectLocalAndCloud(); //--监听本地与云文件夹查询是否结束 $scope.$watch("rescontactflg", function (newValue) { if (newValue == 2) { //本地与云均无,显示缺省页 if (tempCloudResourceLibrarylist.length == 0 && tempLocalResourceLibrarylist.length == 0) { $scope.shownone = true; $scope.resourcelibrarylist = []; $scope.hideLoadingToast(); } else { //无云文件夹显示本地 if (tempCloudResourceLibrarylist.length < 1) { $scope.resourcelibrarylist = tempLocalResourceLibrarylist; // console.log('来自于父亲的爱', $scope.resourcelibrarylist); $scope.hideLoadingToast(); } //无本地文件夹显示云 if (tempLocalResourceLibrarylist.length < 1) { $scope.resourcelibrarylist = tempCloudResourceLibrarylist; $scope.hideLoadingToast(); } //本地与云均有去拼接 if (tempCloudResourceLibrarylist.length > 0 && tempLocalResourceLibrarylist.length > 0) { connectLocalAndCloud(); } $scope.shownone = false; } console.log('最终处理', $scope.resourcelibrarylist) $scope.rescontactflg = 0; resourceLibraryTempData.setResourceLibraryList($scope.resourcelibrarylist); // console.log($scope.resourcelibrarylist); } }); //网络异常时点击屏幕重新加载 $scope.repeatLoad = function () { ConfigService.ressynchroflg = true; initResourceLibraryList(); initResourceLibraryNodeBg(); }; // //第一次进入才显示溧阳信 // if ($scope.isLiyangApp && localStorage.goLetterNum == 0 && !$scope.app) { // localStorage.goLetterNum++; // $scope.go('liyangLetter'); // } //进入资源库首页 $scope.goResorceLibaryDetail = function (res) { console.log('res', res); resourceLibraryTempData.setCategoryIndex(0); resourceLibraryTempData.resetChecked(); if (res.moduleid == false && UserService.node == '330122000') { window.open("http://app.zjumap.com:7736/#/index", "_blank"); } else if (res.moduleid == 44) { $scope.go('wujingTeacher'); } else if (res.moduleid == 43) { $scope.go('wujingTechnical'); } else if (res.moduleid == 33) { $scope.go("notification"); } else { //进入公共资源库列表 if (res.fixtype == 1) { $scope.go('publicResource', { libtype: res.moduleid, name: res.name, reclibid: $scope.res.id, modlibid: res.id }); } else if (res.fixtype == 2) { //进入私人资源库列表 $scope.go('privateResource', { res: angular.toJson(res), privateName: res.name, groupid: res.parentid, restype: res.moduleid, privateContent: res.content, authority: res.by5 }); } } }; } )