coming.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. define(['$', 'template', 'product', 'order', 'cart', 'native', 'helper', 'user', 'api', 'config', 'address', 'IScroll'], function ($, template, product, order, cart ,native, helper, user, api, config, address, IScroll) {
  2. function back(event) {
  3. event.preventDefault();
  4. $(document).trigger('spa:navigate', {
  5. hash: '',
  6. pushData: {
  7. dontNeedReload: true
  8. }
  9. });
  10. }
  11. return {
  12. title: '壹管家上门服务',
  13. body: '',
  14. init: function (pageData, dtd) {
  15. var productType = pageData.pushData.productType;
  16. var $view = this;
  17. var $doc = $(document);
  18. //返回
  19. $.newTouch('.back-button', function (event) {
  20. back.call(this, event);
  21. }, $view);
  22. $view.on('tapBackButton', function (event) {
  23. back.call(this, event);
  24. });
  25. $view.on('swipeRight', function (event) {
  26. back.call(this, event);
  27. });
  28. dtd.resolve();
  29. },
  30. beforeopen: function (pageData, dtd) {
  31. var $view = this;
  32. var pushData = pageData.pushData;
  33. var $doc = $(document);
  34. pushData.needReset = false;
  35. var productType = pushData.productType;
  36. var tmpData = {
  37. showNavBar: !config.isWX && !config.isChubao,
  38. prodcutTitle: product.getProductTitle(productType)
  39. };
  40. var tpl = template('coming/index', tmpData);
  41. $view.find('.spa-page-body').html(tpl);
  42. dtd.resolve();
  43. if (config.isWX) {
  44. wx.ready(function(){
  45. wx.onMenuShareTimeline({
  46. title: '家政服务,首选壹管家',
  47. link: 'http://www.yiguanjia.me/o2o/web/index',
  48. imgUrl: 'http://wozhua-others.qiniudn.com/icon-o2o-home.jpg'
  49. });
  50. wx.onMenuShareAppMessage({
  51. title: '家政服务,首选壹管家',
  52. desc: '全程管家,精心每一个细节!',
  53. link: 'http://www.yiguanjia.me/o2o/web/index',
  54. imgUrl: 'http://wozhua-others.qiniudn.com/icon-o2o-home.jpg'
  55. });
  56. });
  57. }
  58. }
  59. }
  60. })