东风启辰小程序端
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.

159 lines
3.5KB

  1. // pages/scout/scout.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. imgUrl: app.globalData.urlStatic,//图片路径
  9. maskShow: true,
  10. tipShow:true,
  11. iconShow:true,//是否有头像
  12. titleContent:'尊敬的启辰车主您好',
  13. userData:{
  14. avatarUrl: null,
  15. nickName: null,
  16. userLevel: 0
  17. },
  18. isbtn:true,//防重复点击
  19. maskid:0,//现实的弹窗
  20. },
  21. /**
  22. * 关闭提示弹窗
  23. */
  24. hiddenTip(){
  25. this.setData({
  26. maskShow: false,
  27. tipShow: false
  28. })
  29. },
  30. getUserWxMsg:function(e){//通过微信获取用户信息
  31. if (e.detail.errMsg == "getUserInfo:ok") {
  32. if(this.data.isbtn){
  33. this.setData({isbtn: false})
  34. }else{
  35. return;
  36. }
  37. this.data.userData.avatarUrl = e.detail.userInfo.avatarUrl;
  38. this.data.userData.nickName = e.detail.userInfo.nickName;
  39. this.data.userData.userLevel = 0;
  40. this.setData({
  41. userData: this.data.userData
  42. })
  43. app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName);
  44. wx.navigateTo({
  45. url:'../poster/poster'
  46. })
  47. }
  48. },
  49. getUserInfo:function(e){//获取个人信息
  50. if(this.data.isbtn){
  51. this.setData({isbtn: false})
  52. }else{
  53. return;
  54. }
  55. app.wxRequest(app.globalData.urlRoot + 'userInfo/getUserInfo', {}, res => {
  56. if(res.code==200){
  57. // res.data.userLevel = 3;
  58. if (res.data) {
  59. this.data.userData.avatarUrl = res.data.avatarUrl;
  60. this.data.userData.nickName = res.data.nickName;
  61. this.data.userData.userLevel = res.data.userLevel;
  62. this.setData({
  63. userData: this.data.userData
  64. })
  65. wx.navigateTo({
  66. url:'../poster/poster'
  67. })
  68. }
  69. }else{
  70. this.setData({isbtn: true})
  71. }
  72. },this)
  73. },
  74. /**
  75. * 海报页
  76. */
  77. getPoster:function(){
  78. wx.navigateTo({
  79. url:'../poster/poster'
  80. })
  81. },
  82. /**
  83. * 生命周期函数--监听页面加载
  84. */
  85. onLoad: function (options) {
  86. app.globalData.nowPage = 2;
  87. },
  88. /**
  89. * 生命周期函数--监听页面初次渲染完成
  90. */
  91. onReady: function () {
  92. },
  93. /**
  94. * 生命周期函数--监听页面显示
  95. */
  96. onShow: function () {
  97. // app.globalData.certificationState=4;
  98. this.setData({maskid: app.globalData.certificationState})
  99. if(app.globalData.certificationState==1){
  100. this.setData({titleContent:'尊敬的启辰车主您好'})
  101. }else if(app.globalData.certificationState==2){
  102. this.setData({titleContent:'尊敬的合伙人您好'})
  103. }else if(app.globalData.certificationState==3){
  104. this.setData({titleContent:'尊敬的同事您好'})
  105. }else if(app.globalData.certificationState==4){
  106. this.setData({titleContent:'尊敬的星探顾问'})
  107. }
  108. if(app.globalData.userInfoData==null){
  109. this.setData({iconShow:true})
  110. }else{
  111. this.setData({iconShow:false})
  112. }
  113. this.setData({isbtn: true})
  114. // wx.navigateTo({
  115. // url: './share/share'
  116. // })
  117. },
  118. /**
  119. * 生命周期函数--监听页面隐藏
  120. */
  121. onHide: function () {
  122. },
  123. /**
  124. * 生命周期函数--监听页面卸载
  125. */
  126. onUnload: function () {
  127. },
  128. /**
  129. * 页面相关事件处理函数--监听用户下拉动作
  130. */
  131. onPullDownRefresh: function () {
  132. },
  133. /**
  134. * 页面上拉触底事件的处理函数
  135. */
  136. onReachBottom: function () {
  137. },
  138. /**
  139. * 用户点击右上角分享
  140. */
  141. onShareAppMessage: function () {
  142. return app.sharePack();
  143. }
  144. })