东风启辰小程序端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

scout.js 3.3KB

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