newuser.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. var app = getApp();
  4. var backgroundAudioManager;
  5. Page({
  6. data: {
  7. PanelShow: 0,
  8. IsShowPay:false,
  9. IsShowBtn:false,
  10. IsShowMore:false,
  11. IsPlay:false,
  12. ImagePath: app.globalData.uploadImageUrl,
  13. officialAccounts:app.globalData.officialAccounts,
  14. },
  15. onLoad: function (options) {
  16. var that = this;
  17. backgroundAudioManager = wx.getBackgroundAudioManager();
  18. that.setData({
  19. Containnerheight: main.getWindowHeight(),
  20. });
  21. that.init(options.index);
  22. },
  23. init: function (index) {
  24. var that = this;
  25. if (!index)
  26. index=0;
  27. main.getData("GetMiaoguoNewUserImageList", function (data) {
  28. that.setData({
  29. List: data[index].Images,
  30. PageIndex:index,
  31. });
  32. wx.setNavigationBarTitle({
  33. title: data[index].Name
  34. });
  35. wx.setNavigationBarColor({
  36. frontColor: "#000000",
  37. backgroundColor: data[index].BarColor,
  38. backgroundColorTop: data[index].BarColor,
  39. });
  40. if (app.globalData.IsIPhoneX) {
  41. that.setData({
  42. IsIPad: "_IPhoneX",
  43. });
  44. }
  45. });
  46. },
  47. goto: function (e) {
  48. var url = e.currentTarget.dataset.url;
  49. wx.navigateTo({
  50. url: url,
  51. });
  52. },
  53. showMore:function(){
  54. this.setData({
  55. IsShowMore:true,
  56. })
  57. },
  58. scroll:function(e){
  59. var that=this;
  60. if (that.data.PanelShow==0 && that.data.PageIndex==0){
  61. var query = wx.createSelectorQuery().in(that)
  62. query.select('#Image4').boundingClientRect(function(res){
  63. console.log(res.top);
  64. if (res && res.top && res.top<0 && !that.data.IsShowBtn){
  65. that.setData({
  66. IsShowBtn:true,
  67. });
  68. }
  69. else if (res && res.top && res.top>0 && that.data.IsShowBtn){
  70. that.setData({
  71. IsShowBtn:false,
  72. });
  73. }
  74. }).exec();
  75. }
  76. },
  77. showPay:function(){
  78. var that = this;
  79. main.getData("GetClassList?Flag=0", function (data) {
  80. if (data && data.length>0) {
  81. that.setData({
  82. IsShowPay:true,
  83. StartDate: common.formatDateCHS(data[0].StartDate),
  84. })
  85. }
  86. });
  87. },
  88. hidePay:function(){
  89. this.setData({
  90. IsShowPay:false,
  91. });
  92. },
  93. payMoney: function () {
  94. var that = this;
  95. var money = 1;
  96. var detail = {};
  97. detail.UserID = app.globalData.userInfo.UserID;
  98. detail.Introducer = app.globalData.userInfo.Introducer;
  99. detail.PayType=9;
  100. detail = JSON.stringify(detail);
  101. //console.log(detail);
  102. //console.log(money);
  103. var remark = null;
  104. main.payMoney(9, remark, money, detail, function () {
  105. that.setData({
  106. PanelShow:1,
  107. });
  108. wx.setNavigationBarColor({
  109. frontColor: "#000000",
  110. backgroundColorTop: "#ffffff",
  111. backgroundColor: "#ffffff",
  112. });
  113. if (app.globalData.userInfo.NickName=="陌生用户" && app.globalData.userInfo.IsShow == 1){
  114. wx.navigateTo({
  115. url: '../index/accredit?Type=1',
  116. });
  117. }
  118. });
  119. },
  120. gotoIndex: function () {
  121. wx.reLaunch({
  122. url: '../index/index',
  123. })
  124. },
  125. play:function(){
  126. var that=this;
  127. var isPlay=!that.data.IsPlay;
  128. if (isPlay){
  129. that.data.List[11].Image="bm_sy_12b";
  130. backgroundAudioManager.title = "暖暖爸致辞";
  131. backgroundAudioManager.src = app.globalData.uploadImageUrl+"web/_lesson/nuannuanbazhici.m4a";
  132. }
  133. else{
  134. that.data.List[11].Image="bm_sy_12a";
  135. backgroundAudioManager.pause();
  136. }
  137. that.setData({
  138. List:that.data.List,
  139. IsPlay:isPlay,
  140. });
  141. },
  142. onShareAppMessage: function () {
  143. return {
  144. title: app.globalData.ShareTitle,
  145. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  146. imageUrl: app.globalData.ShareImage,
  147. }
  148. },
  149. })