123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640 |
- angular.module('push')
- .controller('indexSearchReasultCtrl', function ($scope, $state, $timeout, $http, UtilService, ActivityService, $sce, ModelService, $ionicModal,
- UserService, $ionicActionSheet, ConfigService, ConnSearchService) {
- $scope.search = {key: ""};
- $scope.searchtype = 2;//0全部 1节点 2资源 3资源库 4记录 5文件夹 6活动 7用户
- var hiskey = "";
- $scope.showSearchWrapFloor=false;
- $scope.defaultLan = UserService.defaultLan;
- if ($scope.defaultLan == 'Chinese') {
- $scope.searchtypeTxt='资源';
- } else {
- $scope.searchtypeTxt='Resource';
- }
- // 数组 index:0 1 2 3 4 依次对应以上(资源开始)
- var index = 0;
- $scope.loadind = 0;//是否继续加载的索引
- $scope.alllist = [{curpage: 1, list: [], hasmore: false, hiskey: ""}, {
- curpage: 1,
- list: [],
- hasmore: false,
- hiskey: ""
- },
- {curpage: 1, list: [], hasmore: false, hiskey: ""}, {curpage: 1, list: [], hasmore: false, hiskey: ""},
- {curpage: 1, list: [], hasmore: false, hiskey: ""},
- {curpage: 1, list: [], hasmore: false, hiskey: ""}, {curpage: 1, list: [], hasmore: false, hiskey: ""},
- {curpage: 1, list: [], hasmore: false, hiskey: ""}];
- // 综合搜索各种类型信息
- $scope.searchAllInfo = function () {
- if (!UtilService.isDefined($scope.search.key)) {
- return;
- }
- if (index == 3) {
- searchCloudFolder();
- return;
- }
- $scope.alllist[index].hiskey = angular.copy($scope.search.key);
- $scope.showLoadingToast();
- $scope.alllist[index].curpage = 1;
- ActivityService.searchAllInfo($scope.search.key, $scope.searchtype, $scope.alllist[index].curpage).then(function (response) {
- if (angular.isDefined(response.data)) {
- $scope.alllist[index].list = response.data.result;
- } else {
- $scope.alllist[index].list = [];
- }
- if (angular.isDefined(response.data.page) && angular.isDefined(response.data.page.totalPage)) {
- if ($scope.alllist[index].curpage >= response.data.page.totalPage) {
- $scope.alllist[index].hasmore = false;
- } else {
- $scope.alllist[index].curpage++;
- $scope.alllist[index].hasmore = true;
- }
- } else {
- $scope.alllist[index].hasmore = false;
- }
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- })
- };
- // 加载更多
- $scope.loadMore = function () {
- $scope.showLoadingToast();
- $scope.alllist[index].hasmore = false;
- ActivityService.searchAllInfo($scope.search.key, $scope.searchtype, $scope.alllist[index].curpage).then(function (response) {
- if (response.data.result.length > 0) {
- $scope.alllist[index].list = $scope.alllist[index].list.concat(response.data.result);
- }
- $timeout(function () {
- if (angular.isDefined(response.data.page.totalPage)) {
- if ($scope.alllist[index].curpage >= response.data.page.totalPage) {
- $scope.alllist[index].hasmore = false;
- } else {
- $scope.alllist[index].curpage++;
- $scope.alllist[index].hasmore = true;
- }
- }
- }, 1500);
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- }).finally(function () {
- $scope.$broadcast('scroll.infiniteScrollComplete');
- });
- };
- $scope.selectSearchTag=function () {
- $scope.showSearchWrapFloor=!$scope.showSearchWrapFloor;
- };
- // 切换页签
- $scope.changeAct = function (type) {
- $scope.showSearchWrapFloor=false;
- $scope.searchtype = type;
- index = type - 2;
- $scope.loadind = type - 2;
- if (($scope.search.key.length > 0 && $scope.alllist[index].list.length <= 0) || hiskey != $scope.alllist[index].hiskey) {
- if (index == 3) {
- searchCloudFolder();
- } else {
- $scope.searchAllInfo();
- }
- }
- if ($scope.defaultLan == 'Chinese') {
- switch (type) {
- case 2:
- $scope.searchtypeTxt = '资源';
- break;
- /*case 3:
- $scope.searchtypeTxt='资源库';
- break;
- case 6:
- $scope.searchtypeTxt='活动';
- break;
- case 5:
- $scope.searchtypeTxt='文件夹';
- break;*/
- case 4:
- $scope.searchtypeTxt = '记录';
- break;
- case 7:
- $scope.searchtypeTxt = '用户';
- break;
- }
- } else {
- switch (type) {
- case 2:
- $scope.searchtypeTxt = 'Resource';
- break;
- case 4:
- $scope.searchtypeTxt = 'Record';
- break;
- case 7:
- $scope.searchtypeTxt = 'User';
- break;
- }
- }
- };
- var searchCloudFolder = function () {
- $scope.alllist[index].hiskey = angular.copy($scope.search.key);
- $scope.showLoadingToast();
- ConnSearchService.searchCloudFolder($scope.search.key, 0).then(function (response) {
- $scope.alllist[index].list = response.list;
- $scope.alllist[index].hasmore = false;
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- });
- };
- $scope.goActivityDetail = function (actid) {
- $scope.go("activityIntroduction", {activityid: actid});
- };
- //进入分类详情,记录列表
- $scope.queryFolder = function (folder) {
- ModelService.setCheckdeFolder(folder);
- if (UtilService.isDefined(folder.localid)) {
- //本地文件夹记录列表
- $scope.go('conninfolist', {folder: angular.toJson(folder)});
- } else {
- //云文件夹记录列表
- $scope.go('cloudFolderDetail', {folder: angular.toJson(folder)});
- }
- };
- //进入记录详情
- $scope.goDockingdetails = function (rec) {
- $scope.islogin = ConfigService.islogin;
- if(!$scope.islogin){
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $ionicPopup.alert({
- title: '提示',
- template: '请先关注微信公众号"' + title + '"!'
- });
- return;
- } else {
- if (localStorage.isUserBindWx == 0) {
- var wxFlag = JSON.parse(localStorage.params);
- if (wxFlag.weChatModel) {
- $scope.go('bindPhone', {
- params: localStorage.params,
- comfrom: 'maincontroller',
- url: window.location.href.split('#/')[1]
- });
- } else {
- $scope.go('login');
- return;
- }
- } else {
- $scope.go('login');
- return;
- }
- }
- } else {
- $scope.go('login');
- return;
- }
- }else{
- $scope.go('resourceCommonInfoDetailsPage', {resid: rec.id, isAllVisitor: 1,node:UserService.node});
- }
- };
- //进入资源库详情
- $scope.goResorceLibaryDetail = function (reclib) {
- reclib.id = reclib.unique;
- reclib.name = reclib.title;
- $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.go('resourceLibraryPrivate', {reclib: angular.toJson(reclib)});
- }
- };
- //进入资源详情
- $scope.goResourceDetail = function (resource) {
- $scope.islogin = ConfigService.islogin;
- if(!$scope.islogin){
- if (localStorage.wxFlag == "true") {
- if (localStorage.isUserFocusXW == 0) {
- var title = localStorage.appidStr;
- $ionicPopup.alert({
- title: '提示',
- template: '请先关注微信公众号"' + title + '"!'
- });
- return;
- } else {
- if (localStorage.isUserBindWx == 0) {
- var wxFlag = JSON.parse(localStorage.params);
- if (wxFlag.weChatModel) {
- $scope.go('bindPhone', {
- params: localStorage.params,
- comfrom: 'maincontroller',
- url: window.location.href.split('#/')[1]
- });
- } else {
- $scope.go('login');
- return;
- }
- } else {
- $scope.go('login');
- return;
- }
- }
- } else {
- $scope.go('login');
- return;
- }
- }else{
- if (resource.groupid == "0") {
- $scope.go('resourceDetails', {
- recourceid: resource.unique,
- recourcetype: resource.type,
- recourcecomefrom: resource.source
- });
- } else {
- $scope.go('resourceCommonDetailsPage', {
- recourceid: resource.unique,
- recourcetype: resource.type,
- recourcecomefrom: resource.source,
- creator: resource.clickthrough,
- title:resource.title
- });
- }
- }
- };
- // 搜索关键字标红
- $scope.badge = function (title) {
- var re = eval("/" + $scope.search.key + "/g");
- title = title.replace(re, '<span style="color:red">' + $scope.search.key + '</span>');
- return $sce.trustAsHtml(title)
- };
- $scope.gobackback = function () {
- if($scope.app){
- cordova.plugins.Keyboard.close();
- }
- $timeout(function () {
- $scope.goback();
- }, 350);
- $scope.closeKeyboard();
- };
- //清空搜索内容
- $scope.clearSearch = function () {
- $scope.search.key = "";
- };
- $scope.showFunc = function () {
- $scope.showbaidu = true;
- };
- //监测key变化,即时匹配词库
- $scope.fixKey = function () {
- if (angular.isDefined($scope.search.key) && $scope.search.key.length > 0) {
- $scope.searchKey($scope.search.key);
- }
- };
- $scope.data = [];
- //百度词库
- $scope.searchKey = function (searchName) {
- var search_history = angular.element(document.getElementById("his_search"));
- if (search_history.val().length != 0) {
- var baidu = angular.element(document.getElementById("baidu_search"));
- baidu.css("display", "block");
- }
- $http({
- method: 'JSONP',
- url: 'https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd=' + searchName + '&cb=JSON_CALLBACK'
- }).success(function (data) {
- $scope.data = data.s;
- });
- };
- $scope.searchInfoByKey = function (d) {
- $scope.search.key = d;
- searchAllInfo();
- };
- /*---------------------------------------------------------------------------*/
- var authstatus = 0;// 0 未认证 1 认证
- ActivityService.getUserAuth().then(function (response) {
- authstatus = response.result;
- }, function () {
- });
- // 活动页面快捷入口路由跳转
- $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:
- // 报名
- if (authstatus == 1 || authstatus == 2) {
- $scope.go("activitySignUpConfirm", {activityid: act.id});
- } else {
- UtilService.showMess("您还未认证!");
- $timeout(function () {
- $scope.go('personIdentify');
- }, 1000);
- }
- 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:
- // 参与企业
- if (authstatus == 1 || authstatus == 2) {
- $scope.go("activityCompanyList", {activityid: act.id});
- } else {
- UtilService.showMess("您还未认证!");
- $timeout(function () {
- $scope.go('personIdentify');
- }, 1000);
- }
- break;
- case 7:
- // 活动统计
- $scope.go("activityStatistics", {activityid: act.id});
- break;
- case 8:
- // 活动安排管理
- $scope.go("activityArrangeManger", {activityid: act.id});
- break;
- case 9:
- // 签到
- checkIntime(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;
- }
- };
- // 活动是否弹出签到弹窗(否临时人员:弹窗,已报名:直接签到)
- var activityid = 0;
- var checkIntime = function (actid) {
- activityid = actid;
- $scope.showLoadingToast();
- ActivityService.checkIntime(activityid).then(function (response) {
- if (response.result == 1) {
- $scope.userinfo = response.userinfo;
- $scope.categoryModal.show();
- $scope.hideLoadingToast();
- } else {
- checkIn();
- }
- }, function () {
- $scope.hideLoadingToast();
- })
- };
- // 签到
- var checkIn = function () {
- ActivityService.getCheckInStatus(activityid).then(function (response) {
- // 0未签到,1已签到
- if (response.result == 0) {
- ActivityService.checkIn(activityid, ConfigService.location.lat, ConfigService.location.lng).then(function (response) {
- if (response.result == 1) {
- UtilService.showMess("签到成功");
- } else {
- UtilService.showMess("网络不给力,请重试");
- }
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- UtilService.showMess("网络不给力,请重试");
- });
- } else {
- UtilService.showMess("您已成功签到");
- $scope.hideLoadingToast();
- }
- }, function () {
- UtilService.showMess("网络不给力,请重试");
- $scope.hideLoadingToast();
- });
- };
- // 临时人员签到
- $scope.tempCheckin = function () {
- if (!UtilService.isDefined($scope.userinfo.name)) {
- UtilService.showMess("姓名不能为空");
- return;
- }
- if (!UtilService.isDefined($scope.userinfo.university)) {
- UtilService.showMess("所属院校不能为空");
- return;
- }
- $scope.showLoadingToast();
- ActivityService.tempCheckIn(activityid, ConfigService.location.lat, ConfigService.location.lng, $scope.userinfo).then(function (response) {
- if (response.result == 1) {
- UtilService.showMess("签到成功");
- $timeout(function () {
- $scope.categoryModal.hide();
- }, 300);
- } else {
- UtilService.showMess("网络不给力,请重试");
- }
- $scope.hideLoadingToast();
- }, function () {
- UtilService.showMess("网络不给力,请重试");
- $scope.hideLoadingToast();
- });
- };
- //关闭报名入口
- $scope.closeCategoryModal = function () {
- $scope.categoryModal.hide();
- };
- $ionicModal.fromTemplateUrl("templates/modal.html", {
- scope: $scope,
- animation: 'slide-in-up'
- }).then(function (modal) {
- $scope.categoryModal = modal;
- });
- //获取研究领域标签
- var buttons = [];
- var getLabelList = function () {
- ActivityService.getCategory().then(function (response) {
- angular.forEach(response, function (value, index) {
- var temphtml = {
- text: '<a class="action-sheet-push">' + value.name + '</a>',
- category: value.name,
- id: value.id
- };
- buttons.push(temphtml);
- });
- }, function () {
- })
- };
- getLabelList();
- //选择研究领域
- $scope.showDockingStatus = function () {
- $ionicActionSheet.show({
- buttons: buttons,
- cancelText: '取消',
- buttonClicked: function (index) {
- $scope.userinfo.categoryid = buttons[index].id;
- $scope.userinfo.category = buttons[index].category;
- return true;
- }
- });
- };
- // 进入个人主页
- $scope.goPublisher = function (userid) {
- $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.go('publisher', {Id: userid});
- }
- };
- });
|