东风启辰小程序端
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

160 lines
3.6KB

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