东风启辰小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

guessSecondPrize.js 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. // pages/guessSecondPrize/guessSecondPrize.js
  2. const app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. imgUrl: app.globalData.urlStatic,//图片路径
  9. ruleShow:false,//是否显示竞猜规则
  10. inputValue:"",//输入的价格
  11. stringValue:"",//输入的竞猜价格
  12. focusState:false,//输入框聚焦状态
  13. tipImgShow:true,//是否显示输入框提示
  14. isGuess:true,//是否竞猜过价格
  15. guessPriceArr:[1,2,3,4,5,6],
  16. slideDay:['0','0'],//距离上市时间
  17. randomNum:44,//随机数
  18. cartogramShow:false,//是否显示统计图
  19. },
  20. /**
  21. * 生命周期函数--监听页面加载
  22. */
  23. onLoad: function (options) {
  24. app.globalData.nowPage = 3;
  25. this.distanceDay();
  26. if (app.globalData.openid) {
  27. this.loadFun();
  28. } else {
  29. app.globalData.openidSuccessFuc = this.loadFun;
  30. }
  31. },
  32. loadFun:function(){
  33. },
  34. /**
  35. * 生命周期函数--监听页面初次渲染完成
  36. */
  37. onReady: function () {
  38. },
  39. /**
  40. * 生命周期函数--监听页面显示
  41. */
  42. onShow: function () {
  43. },
  44. /**
  45. * 生命周期函数--监听页面隐藏
  46. */
  47. onHide: function () {
  48. },
  49. /**
  50. * 生命周期函数--监听页面卸载
  51. */
  52. onUnload: function () {
  53. },
  54. /**
  55. * 页面相关事件处理函数--监听用户下拉动作
  56. */
  57. onPullDownRefresh: function () {
  58. },
  59. /**
  60. * 页面上拉触底事件的处理函数
  61. */
  62. onReachBottom: function () {
  63. },
  64. /**
  65. * 用户点击右上角分享
  66. */
  67. onShareAppMessage: function () {
  68. return {
  69. title: '召唤预言帝!快来和我一起猜启辰星售价,赢升舱大奖!',
  70. imageUrl: this.data.imgUrl + "/versions/guessShareImg.jpg",
  71. path: "/pages/guess/guess"
  72. }
  73. },
  74. enterLucky:function(){//每日抽奖
  75. wx.navigateTo({
  76. url: '/pages/luckyStar/luckyStar'
  77. })
  78. },
  79. ruleControl:function(){//规则显示控制
  80. this.setData({
  81. ruleShow:!this.data.ruleShow
  82. })
  83. },
  84. focusControl:function(){
  85. this.setData({
  86. focusState:true
  87. })
  88. },
  89. focusControl2:function(){
  90. this.setData({
  91. focusState:false
  92. })
  93. },
  94. getValue:function(e){
  95. this.data.inputValue = e.detail.value;
  96. if(e.detail.value){
  97. this.setData({
  98. tipImgShow:false
  99. })
  100. }else{
  101. this.setData({
  102. tipImgShow:true
  103. })
  104. }
  105. this.setData({
  106. stringValue:e.detail.value
  107. })
  108. },
  109. submitPrice2:function(){
  110. if(this.data.inputValue>150000 || this.data.inputValue<110000){
  111. this.tipWindowControl();
  112. }else{
  113. this.data.guessPrice = this.data.inputValue;
  114. this.data.guessPriceArr = this.data.guessPrice.toString().split("");
  115. for(let i=0;i<this.data.guessPriceArr.length;i++){
  116. this.data.guessPriceArr[i] = parseInt(this.data.guessPriceArr[i]);
  117. }
  118. this.setData({
  119. guessPriceArr:this.data.guessPriceArr
  120. })
  121. console.log(this.data.guessPrice);
  122. console.log(this.data.guessPriceArr);
  123. this.tipWindowControl2();
  124. }
  125. // this.submitFirstGuessInfo();
  126. },
  127. tipWindowControl:function(){
  128. this.setData({
  129. tipWindow:!this.data.tipWindow
  130. })
  131. if(!this.data.tipWindow){
  132. this.setData({
  133. stringValue:"",
  134. tipImgShow:true
  135. })
  136. }
  137. },
  138. tipWindowControl2:function(){
  139. this.setData({
  140. tipWindow2:!this.data.tipWindow2
  141. })
  142. },
  143. tipWindowControl3:function(){
  144. this.setData({
  145. stringValue:"",
  146. tipImgShow:true
  147. })
  148. this.setData({
  149. tipWindow2:!this.data.tipWindow2
  150. })
  151. },
  152. distanceDay:function(){//距离4月23日上市还有XX天
  153. var timestamp = Date.parse(new Date()); //今天的时间戳
  154. var timestamp2 = Date.parse(new Date('2020-04-23')); //上市时间时间戳
  155. if(timestamp2>timestamp){
  156. var slideNum = Math.ceil((timestamp2-timestamp)/60/60/24/1000).toString().split("");
  157. this.setData({
  158. slideDay:slideNum//距离上市时间
  159. })
  160. }
  161. },
  162. cartogramControl:function(){
  163. var randomNum = Math.floor(Math.random()*4+44);
  164. this.setData({
  165. randomNum:randomNum,
  166. cartogramShow:!this.data.cartogramShow
  167. })
  168. }
  169. })