123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- angular.module('push')
- .controller('chatMailListCtrl', function ($scope, $timeout, $rootScope, $ionicLoading, $http, $ionicScrollDelegate, ScienceCircleService) {
- if($scope.app){
- $scope.setStatusBar(0);
- }
- $scope.showMiddle = false; //是否在屏幕中央显示选中的字母索引
- // 获取通讯录列表
- var getContacts = function () {
- $scope.showLoadingToast();
- ScienceCircleService.getContacts(0).then(function (response) {
- console.log(response);
- $scope.mailDatas = response;
- //联系人首字母字母数组
- $scope.letters = [];
- angular.forEach($scope.mailDatas, function (value, index) {
- $scope.letters.push(value.userUpper);
- });
- $scope.heightAccount=20*($scope.letters.length)+"px";
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- });
- };
- getContacts();
- // 触摸字母定位至对应联系人
- $scope.mTouch = function (event) {
- var c = $(this).attr("c");
- $scope.hint = c;
- $scope.showMiddle = true;
- $timeout(function () {
- $scope.showMiddle = false;
- }, 300);
- var scroll = document.getElementById($scope.hint).offsetTop - $ionicScrollDelegate.getScrollPosition().top;
- $ionicScrollDelegate.scrollBy(0, scroll, true);
- var ele = document.getElementsByTagName("ion-content");
- ele[0].style.overflow = "auto"; //解决滑动右边的导航字母后,左边不能再滚动的bug,可以试着注释这两句来测试这个问题
- };
- // 手指从屏幕上离开 隐藏中间显示的字母
- $scope.mRelease = function () {
- $timeout(function () {
- $scope.showMiddle = false;
- }, 300);
- };
- // 通讯录搜索
- $scope.goSearchChatMail = function () {
- $scope.go('chatSearchModel');
- };
- // 添加好友
- $scope.addChatFriends = function () {
- $scope.go('addChatFriends');
- };
- // 进入陌生人页面
- $scope.goStrangerList = function () {
- $scope.go("strangerList");
- };
- // 查看个人主页
- $scope.goPublisher = function (userId) {
- $scope.go('publisher', {Id: userId});
- };
- // 我的粉丝
- $scope.goMyFans = function () {
- $scope.go('chatMailListFans');
- };
- });
- /* .directive('rjPositionMiddle', ['$window', function ($window) {
- return {
- replace: false,
- link: function (scope, iElm, iAttrs, controller) {
- var height = $window.innerHeight - 44 - 49 - iElm[0].offsetHeight;
- if (height >= 0) {
- iElm[0].style.top = (height / 2 + 44) + 'px';
- } else {
- iElm[0].style.top = 44 + 'px';
- }
- }
- }
- }]);*/
|