newuser.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. },
  14. onLoad: function (options) {
  15. var that = this;
  16. backgroundAudioManager = wx.getBackgroundAudioManager();
  17. that.setData({
  18. Containnerheight: main.getWindowHeight(),
  19. });
  20. that.init(options.index);
  21. },
  22. init: function (index) {
  23. var that = this;
  24. if (!index)
  25. index=0;
  26. main.getData("GetMiaoguoNewUserImageList", function (data) {
  27. that.setData({
  28. List: data[index].Images,
  29. PageIndex:index,
  30. });
  31. wx.setNavigationBarTitle({
  32. title: data[index].Name
  33. });
  34. wx.setNavigationBarColor({
  35. frontColor: "#000000",
  36. backgroundColor: data[index].BarColor,
  37. backgroundColorTop: data[index].BarColor,
  38. });
  39. if (app.globalData.IsIPhoneX) {
  40. that.setData({
  41. IsIPad: "_IPhoneX",
  42. });
  43. }
  44. });
  45. },
  46. goto: function (e) {
  47. var url = e.currentTarget.dataset.url;
  48. wx.navigateTo({
  49. url: url,
  50. });
  51. },
  52. showMore:function(){
  53. this.setData({
  54. IsShowMore:true,
  55. })
  56. },
  57. scroll:function(e){
  58. var that=this;
  59. if (that.data.PanelShow==0 && that.data.PageIndex==0){
  60. var query = wx.createSelectorQuery().in(that)
  61. query.select('#Image4').boundingClientRect(function(res){
  62. console.log(res.top);
  63. if (res && res.top && res.top<0 && !that.data.IsShowBtn){
  64. that.setData({
  65. IsShowBtn:true,
  66. });
  67. }
  68. else if (res && res.top && res.top>0 && that.data.IsShowBtn){
  69. that.setData({
  70. IsShowBtn:false,
  71. });
  72. }
  73. }).exec();
  74. }
  75. },
  76. showPay:function(){
  77. var that = this;
  78. main.getData("GetClassList?Flag=0", function (data) {
  79. if (data && data.length>0) {
  80. that.setData({
  81. IsShowPay:true,
  82. StartDate: common.formatDateCHS(data[0].StartDate),
  83. })
  84. }
  85. });
  86. },
  87. hidePay:function(){
  88. this.setData({
  89. IsShowPay:false,
  90. });
  91. },
  92. payMoney: function () {
  93. var that = this;
  94. var money = 1;
  95. var detail = {};
  96. detail.UserID = app.globalData.userInfo.UserID;
  97. detail.Introducer = app.globalData.userInfo.Introducer;
  98. detail.PayType=9;
  99. detail = JSON.stringify(detail);
  100. //console.log(detail);
  101. //console.log(money);
  102. var remark = null;
  103. main.payMoney(9, remark, money, detail, function () {
  104. that.setData({
  105. PanelShow:1,
  106. });
  107. wx.setNavigationBarColor({
  108. frontColor: "#000000",
  109. backgroundColorTop: "#ffffff",
  110. backgroundColor: "#ffffff",
  111. });
  112. if (app.globalData.userInfo.NickName=="陌生用户" && app.globalData.userInfo.IsShow == 1){
  113. wx.navigateTo({
  114. url: '../index/accredit',
  115. });
  116. }
  117. });
  118. },
  119. copyManager: function () {
  120. wx.setClipboardData({
  121. data: "秒过学习法",
  122. success(res) {
  123. wx.showModal({
  124. title: '已复制',
  125. showCancel: false,
  126. content: "请在微信添加公众号中长按粘贴。",
  127. confirmText: "知道了",
  128. });
  129. }
  130. });
  131. },
  132. gotoIndex: function () {
  133. wx.reLaunch({
  134. url: '../index/index',
  135. })
  136. },
  137. play:function(){
  138. var that=this;
  139. var isPlay=!that.data.IsPlay;
  140. if (isPlay){
  141. that.data.List[11].Image="bm_sy_12b";
  142. backgroundAudioManager.title = "暖暖爸致辞";
  143. backgroundAudioManager.src = app.globalData.uploadImageUrl+"web/_lesson/nuannuanbazhici.m4a";
  144. }
  145. else{
  146. that.data.List[11].Image="bm_sy_12a";
  147. backgroundAudioManager.pause();
  148. }
  149. that.setData({
  150. List:that.data.List,
  151. IsPlay:isPlay,
  152. });
  153. },
  154. onShareAppMessage: function () {
  155. return {
  156. title: app.globalData.ShareTitle,
  157. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  158. imageUrl: app.globalData.ShareImage,
  159. }
  160. },
  161. })