chitchatCtrl.js 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. angular.module('push')
  2. .controller('chitchatCtrl', function ($scope,CommentService,$stateParams,UserService,$ionicPopup,AccountService) {
  3. $scope.rewardHollList = [
  4. {title: '接收信息', selected: true, type: 0},
  5. {title: '发送信息', selected: false, type: 1},
  6. ]
  7. $scope.changeSelected = function (index) {
  8. angular.forEach($scope.rewardHollList, function (val) {
  9. val.selected = false;
  10. })
  11. $scope.rewardHollList[index].selected = true;
  12. list( $scope.rewardHollList[index].type)
  13. }
  14. list(0)
  15. function list(type){
  16. CommentService.getchatlist({userId:UserService.id,isSend:type}).then((res)=>{
  17. console.log(res)
  18. if(res.code==3350){
  19. $scope.Listdata=res.data
  20. }else {
  21. $ionicPopup.alert({
  22. title: '提示',
  23. template: res.message
  24. });
  25. }
  26. }).catch(function () {
  27. $ionicPopup.alert({
  28. title: '提示',
  29. template: "服务器错误"
  30. });
  31. })
  32. }
  33. })