storePage.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. *
  3. * @authors Eric Hsiao
  4. *
  5. */
  6. storePage = function (_couponData) {
  7. //private menbers
  8. const YOUTUBE__ID = 'mDD48KKCqYw';
  9. var couponData = [];
  10. //private methods
  11. function init() {
  12. console.log('storePage is init.');
  13. $('.video__close').click(function (e) {
  14. e.preventDefault();
  15. TweenMax.to('.video__popout', 0.3, { autoAlpha: 0 });
  16. player.stopVideo();
  17. });
  18. }
  19. function updateCoupon(_data) {
  20. couponData = _data;
  21. console.log('============== updateCoupon ==============');
  22. // console.log(userInfo.goodinfo);
  23. for (let index = 0; index < couponData.length; index++) {
  24. var _coupon;
  25. if (couponData[index].lp < 5) {
  26. _coupon = new couponItem(index, couponData[index]);
  27. } else {
  28. var _isLock;
  29. if ($.cookie('luckydraw.isVideoUnlock')) {
  30. _isLock = false;
  31. } else {
  32. _isLock = true;
  33. }
  34. console.log('luckydraw.isVideoUnlock = ' + $.cookie('luckydraw.isVideoUnlock'));
  35. //YOUTUBE LINK
  36. _coupon = new couponItem(index, $.extend(couponData[index], { lock: _isLock, video: YOUTUBE__ID }));
  37. }
  38. }
  39. }
  40. //////////////////////////////////////
  41. function intoPage() {
  42. }
  43. function leavePage() {
  44. }
  45. //constructor
  46. {
  47. $(document).ready(function () {
  48. init();
  49. });
  50. }
  51. //public
  52. return {
  53. intoPage: function () {
  54. intoPage();
  55. },
  56. leavePage: function () {
  57. leavePage();
  58. },
  59. updateCoupon: function (_data) {
  60. updateCoupon(_data);
  61. }
  62. };
  63. };
  64. var storePage = new storePage();