storeEnterCommunity.js 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. (function(vc){
  2. vc.extends({
  3. data:{
  4. storeEnterCommunityInfo:{
  5. communityInfo:[],
  6. errorInfo:'',
  7. searchCommunityName:'',
  8. }
  9. },
  10. _initMethod:function(){
  11. },
  12. _initEvent:function(){
  13. vc.on('storeEnterCommunity','openStoreEnterCommunity',function(_params){
  14. $('#storeEnterCommunityModel').modal('show');
  15. vc.component.storeEnterCommunityInfo.searchCommunityName = '';
  16. vc.component.listNoEnterCommunity();
  17. });
  18. },
  19. methods:{
  20. // _saveEnterCommunity:function(){
  21. // var param = {};
  22. // vc.component.storeEnterCommunityInfo.errorInfo = "";
  23. // vc.http.post(
  24. // 'storeEnterCommunity',
  25. // 'enterCommunity',
  26. // JSON.stringify(param),
  27. // {
  28. // emulateJSON:true
  29. // },
  30. // function(json,res){
  31. // //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
  32. // if(res.status == 200){
  33. // //关闭model
  34. // $('#storeEnterCommunityModel').modal('hide');
  35. // vc.emit('enterCommunity','listMyCommunity',{});
  36. // return ;
  37. // }
  38. // vc.component.storeEnterCommunityInfo.errorInfo = json;
  39. // },
  40. // function(errInfo,error){
  41. // console.log('请求失败处理');
  42. //
  43. // vc.component.storeEnterCommunityInfo.errorInfo = errInfo;
  44. // });
  45. // },
  46. listNoEnterCommunity:function(){
  47. vc.loading('open');
  48. var param = {
  49. params:{
  50. communityName:vc.component.storeEnterCommunityInfo.searchCommunityName
  51. }
  52. }
  53. //发送get请求
  54. vc.http.get('storeEnterCommunity',
  55. 'listNoEnterCommunity',
  56. param,
  57. function(json,res){
  58. vc.component.storeEnterCommunityInfo.communityInfo=JSON.parse(json);
  59. vc.loading('close');
  60. },function(errInfo,error){
  61. console.log('请求失败处理');
  62. vc.loading('close');
  63. }
  64. );
  65. },
  66. _saveEnterCommunity:function(_communityInfo){
  67. var _param = {
  68. communityId:_communityInfo.communityId
  69. };
  70. //发送get请求
  71. vc.http.post('storeEnterCommunity',
  72. '_saveEnterCommunity',
  73. JSON.stringify(_param),
  74. {
  75. emulateJSON:true
  76. },
  77. function(json,res){
  78. if(res.status == 200){
  79. vc.jumpToPage("/flow/login");
  80. return ;
  81. }
  82. vc.component.storeEnterCommunityInfo.errorInfo = json;
  83. },function(errInfo,error){
  84. console.log('请求失败处理');
  85. vc.component.storeEnterCommunityInfo.errorInfo = json;
  86. }
  87. );
  88. }
  89. }
  90. });
  91. })(window.vc);