common.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. (function (angular) {
  2. var app = angular.module('app.mobile', [
  3. 'ngResource',
  4. 'base.param',
  5. 'eccrm.angular'
  6. ]);
  7. app.service('CommunityImportService', function (CommonUtils, $resource) {
  8. return $resource(CommonUtils.contextPathURL('/wx/house/:method'), {}, {
  9. // 查询区域价格
  10. queryAreaPrice: {method: 'POST', params: {method: 'price-area'}, isArray: false},
  11. // 查询价格
  12. queryHousePrices: {method: 'POST', params: {method: 'price-house'}, isArray: false}
  13. })
  14. });
  15. app.service('AlertService', function () {
  16. return {
  17. /**
  18. * 弹出层提示
  19. * @param content
  20. */
  21. alert: function (content) {
  22. layer.closeAll();
  23. layer.open({
  24. content: content,
  25. btn: '确认'
  26. });
  27. },
  28. /**
  29. * 简单的信息提示
  30. * @param content 提示内容
  31. * @param closeTime 多少秒过后关闭
  32. */
  33. info: function (content, closeTime) {
  34. closeTime = closeTime || 2;
  35. layer.open({
  36. content: content
  37. , skin: 'msg'
  38. , time: closeTime
  39. });
  40. },
  41. loading: function () {
  42. layer.closeAll();
  43. return layer.open({
  44. type: 2
  45. });
  46. },
  47. /**
  48. * 确认执行某个操作
  49. * @param title 标题
  50. * @param btnName 按钮名称
  51. * @param okFn 点击按钮要执行的事件
  52. */
  53. confirm: function (title, btnName, okFn) {
  54. layer.open({
  55. content: title
  56. , btn: [btnName, '取消']
  57. , skin: 'footer'
  58. , yes: function (index) {
  59. okFn();
  60. }
  61. });
  62. },
  63. close: function (index) {
  64. layer.close(index);
  65. },
  66. closeAll: function () {
  67. layer.closeAll();
  68. }
  69. }
  70. });
  71. })(angular);