东风启辰小程序端
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

165 lines
3.9KB

  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. isLogin: true
  43. })
  44. app.globalData.userInfoData = {};
  45. app.globalData.userInfoData.avatarUrl = e.detail.userInfo.avatarUrl;
  46. app.globalData.userInfoData.nickName = e.detail.userInfo.nickName;
  47. app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName);
  48. wx.navigateTo({
  49. url:'../poster/poster'
  50. })
  51. }
  52. },
  53. getUserInfo:function(e){//获取个人信息
  54. if(this.data.isbtn){
  55. this.setData({isbtn: false})
  56. }else{
  57. return;
  58. }
  59. app.wxRequest(app.globalData.urlRoot + 'userInfo/getUserInfo', {}, res => {
  60. if(res.code==200){
  61. // res.data.userLevel = 3;
  62. if (res.data) {
  63. this.data.userData.avatarUrl = res.data.avatarUrl;
  64. this.data.userData.nickName = res.data.nickName;
  65. this.data.userData.userLevel = res.data.userLevel;
  66. this.setData({
  67. userData: this.data.userData
  68. })
  69. app.globalData.userInfoData = {};
  70. app.globalData.userInfoData.avatarUrl = res.data.avatarUrl;
  71. app.globalData.userInfoData.nickName = res.data.nickName;
  72. wx.navigateTo({
  73. url:'../poster/poster'
  74. })
  75. }
  76. }else{
  77. this.setData({isbtn: true})
  78. }
  79. },this)
  80. },
  81. /**
  82. * 海报页
  83. */
  84. getPoster:function(){
  85. wx.navigateTo({
  86. url:'../poster/poster'
  87. })
  88. },
  89. /**
  90. * 生命周期函数--监听页面加载
  91. */
  92. onLoad: function (options) {
  93. },
  94. /**
  95. * 生命周期函数--监听页面初次渲染完成
  96. */
  97. onReady: function () {
  98. },
  99. /**
  100. * 生命周期函数--监听页面显示
  101. */
  102. onShow: function () {
  103. // app.globalData.certificationState=4;
  104. this.setData({maskid: app.globalData.certificationState})
  105. if(app.globalData.certificationState==1){
  106. this.setData({titleContent:'尊敬的启辰车主您好'})
  107. }else if(app.globalData.certificationState==2){
  108. this.setData({titleContent:'尊敬的合伙人您好'})
  109. }else if(app.globalData.certificationState==3){
  110. this.setData({titleContent:'尊敬的同事您好'})
  111. }else if(app.globalData.certificationState==4){
  112. this.setData({titleContent:'尊敬的星探顾问'})
  113. }
  114. if(app.globalData.userInfoData==null){
  115. this.setData({iconShow:true})
  116. }else{
  117. this.setData({iconShow:false})
  118. }
  119. this.setData({isbtn: true})
  120. // wx.navigateTo({
  121. // url: './share/share'
  122. // })
  123. },
  124. /**
  125. * 生命周期函数--监听页面隐藏
  126. */
  127. onHide: function () {
  128. },
  129. /**
  130. * 生命周期函数--监听页面卸载
  131. */
  132. onUnload: function () {
  133. },
  134. /**
  135. * 页面相关事件处理函数--监听用户下拉动作
  136. */
  137. onPullDownRefresh: function () {
  138. },
  139. /**
  140. * 页面上拉触底事件的处理函数
  141. */
  142. onReachBottom: function () {
  143. },
  144. /**
  145. * 用户点击右上角分享
  146. */
  147. onShareAppMessage: function () {
  148. return app.sharePack();
  149. }
  150. })