addChatFriendsCtrl.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. angular.module('push')
  2. .controller('addChatFriendsCtrl', function ($scope, UtilService, ScienceCircleService) {
  3. if($scope.app){
  4. $scope.setStatusBar(0);
  5. }
  6. $scope.searchuser = {key: ""};
  7. $scope.shownone = false;
  8. // 搜索用户
  9. $scope.searchUser = function () {
  10. if (!UtilService.isDefined($scope.searchuser.key)) {
  11. return;
  12. }
  13. $scope.showLoadingToast();
  14. ScienceCircleService.searchUser($scope.searchuser.key, 1).then(function (response) {
  15. console.log(response);
  16. $scope.userList = response.data.user;
  17. if ($scope.userList.length < 1) {
  18. $scope.shownone = true;
  19. } else {
  20. $scope.shownone = false;
  21. }
  22. $scope.hideLoadingToast();
  23. }, function () {
  24. $scope.hideLoadingToast();
  25. })
  26. };
  27. $scope.clearSearch = function () {
  28. $scope.searchuser.key = "";
  29. };
  30. // 进入个人主页
  31. $scope.goChatPublisher = function (userId) {
  32. $scope.go('publisher', {Id: userId});
  33. };
  34. });