chatSearchModelCtrl.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. angular.module('push')
  2. .controller('chatSearchModelCtrl', function ($scope, UtilService, ScienceCircleService) {
  3. if($scope.app){
  4. $scope.setStatusBar(0);
  5. }
  6. $scope.searchuser = {key: ""};
  7. // 搜索通讯录用户
  8. $scope.searchUser = function () {
  9. if (!UtilService.isDefined($scope.searchuser.key)) {
  10. return;
  11. }
  12. $scope.showLoadingToast();
  13. //0:全部搜索 1:我的关注 2:我的粉丝 3:陌生人
  14. ScienceCircleService.searchContactUser($scope.searchuser.key, 0, 1).then(function (response) {
  15. console.log(response);
  16. $scope.userList1 = response.data.user_1;
  17. $scope.userList2 = response.data.user_2;
  18. $scope.userList3 = response.data.user_3;
  19. $scope.hideLoadingToast();
  20. }, function () {
  21. $scope.hideLoadingToast();
  22. })
  23. };
  24. $scope.clearSearch = function () {
  25. $scope.searchuser.key = "";
  26. };
  27. // 查看个人主页
  28. $scope.goPublisher = function (userId) {
  29. $scope.go('publisher', {Id: userId});
  30. };
  31. });