binding.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /**
  2. 入驻小区
  3. **/
  4. (function(vc){
  5. vc.extends({
  6. data:{
  7. @@templateCode@@Info:{
  8. $step:{},
  9. index:0,
  10. infos:[]
  11. }
  12. },
  13. _initMethod:function(){
  14. vc.component._initStep();
  15. },
  16. _initEvent:function(){
  17. vc.on("@@templateCode@@", "notify", function(_info){
  18. vc.component.@@templateCode@@Info.infos[vc.component.@@templateCode@@Info.index] = _info;
  19. });
  20. },
  21. methods:{
  22. _initStep:function(){
  23. vc.component.@@templateCode@@Info.$step = $("#step");
  24. vc.component.@@templateCode@@Info.$step.step({
  25. index: 0,
  26. time: 500,
  27. title: @@stepTitle@@
  28. });
  29. vc.component.@@templateCode@@Info.index = vc.component.@@templateCode@@Info.$step.getIndex();
  30. },
  31. _prevStep:function(){
  32. vc.component.@@templateCode@@Info.$step.prevStep();
  33. vc.component.@@templateCode@@Info.index = vc.component.@@templateCode@@Info.$step.getIndex();
  34. @@notifyOnIndex@@
  35. },
  36. _nextStep:function(){
  37. var _currentData = vc.component.@@templateCode@@Info.infos[vc.component.@@templateCode@@Info.index];
  38. if( _currentData == null || _currentData == undefined){
  39. vc.message("请选择相关信息");
  40. return ;
  41. }
  42. vc.component.@@templateCode@@Info.$step.nextStep();
  43. vc.component.@@templateCode@@Info.index = vc.component.@@templateCode@@Info.$step.getIndex();
  44. @@notifyOnIndex@@
  45. },
  46. _finishStep:function(){
  47. var param = {
  48. data:vc.component.@@templateCode@@Info.infos
  49. }
  50. vc.http.post(
  51. '@@templateCode@@',
  52. 'binding',
  53. JSON.stringify(param),
  54. {
  55. emulateJSON:true
  56. },
  57. function(json,res){
  58. if(res.status == 200){
  59. vc.message('处理成功',true);
  60. //关闭model
  61. vc.jumpToPage("@@jumpUrl@@?" + vc.objToGetParam(JSON.parse(json)));
  62. return ;
  63. }
  64. vc.message(json);
  65. },
  66. function(errInfo,error){
  67. console.log('请求失败处理');
  68. vc.message(errInfo);
  69. });
  70. }
  71. }
  72. });
  73. })(window.vc);