newuser.js 4.2 KB

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