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

198 line
4.8KB

  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: 1
  17. },
  18. isbtn:true,//防重复点击
  19. maskid:0,//现实的弹窗
  20. authenticationStatus:false,
  21. authenticationShow:false
  22. },
  23. /**
  24. * 关闭提示弹窗
  25. */
  26. hiddenTip(){
  27. this.setData({
  28. maskShow: false,
  29. tipShow: false
  30. })
  31. },
  32. getUserWxMsg:function(e){//通过微信获取用户信息
  33. if (e.detail.errMsg == "getUserInfo:ok") {
  34. if(this.data.isbtn){
  35. this.setData({isbtn: false})
  36. }else{
  37. return;
  38. }
  39. this.data.userData.avatarUrl = e.detail.userInfo.avatarUrl;
  40. this.data.userData.nickName = e.detail.userInfo.nickName;
  41. this.data.userData.userLevel = 1;
  42. this.setData({
  43. userData: this.data.userData,
  44. iconShow:false
  45. })
  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. wx.navigateTo({
  69. url:'../poster/poster'
  70. })
  71. }
  72. }else{
  73. this.setData({isbtn: true})
  74. }
  75. },this)
  76. },
  77. /**
  78. * 海报页
  79. */
  80. getPoster:function(){
  81. console.log(this.data.authenticationStatus);
  82. // return;
  83. if (this.data.authenticationStatus) {
  84. wx.navigateTo({
  85. url: '../poster/poster'
  86. })
  87. }else{
  88. this.setData({
  89. authenticationShow:true
  90. })
  91. }
  92. },
  93. // getCertificationInfo: function () {//查询认证状态
  94. // app.wxRequest(app.globalData.urlRoot + 'userInfo/getCertificationInfo', {}, res => {
  95. // if (res.code == 200 && res.data && res.data.agentDetail) {
  96. // this.data.authenticationStatus = true;
  97. // }
  98. // }, this)
  99. // },
  100. /**
  101. * 生命周期函数--监听页面加载
  102. */
  103. onLoad: function (options) {
  104. app.globalData.nowPage = 2;
  105. },
  106. /**
  107. * 生命周期函数--监听页面初次渲染完成
  108. */
  109. onReady: function () {
  110. },
  111. /**
  112. * 生命周期函数--监听页面显示
  113. */
  114. onShow: function () {
  115. // if (app.globalData.openid) {
  116. // this.getCertificationInfo();
  117. // } else {
  118. // app.globalData.openidSuccessFuc = this.getCertificationInfo;
  119. // }
  120. if (app.globalData.authenticationStatus && app.globalData.authenticationStatus.agentDetail){
  121. this.data.authenticationStatus = true;
  122. this.setData({
  123. authenticationShow:false
  124. })
  125. }
  126. // app.globalData.certificationState=4;
  127. this.setData({maskid: app.globalData.certificationState})
  128. if(app.globalData.certificationState==1){
  129. this.setData({titleContent:'尊敬的启辰车主您好'})
  130. }else if(app.globalData.certificationState==2){
  131. this.setData({titleContent:'尊敬的合伙人您好'})
  132. }else if(app.globalData.certificationState==3){
  133. this.setData({titleContent:'尊敬的同事您好'})
  134. }else if(app.globalData.certificationState==4){
  135. this.setData({titleContent:'尊敬的星探顾问'})
  136. }
  137. console.log(app.globalData.userInfoData);
  138. if(app.globalData.userInfoData && app.globalData.userInfoData.avatarUrl){
  139. this.setData({iconShow:false})
  140. }else{
  141. this.setData({iconShow:true})
  142. }
  143. this.setData({isbtn: true})
  144. // wx.navigateTo({
  145. // url: './share/share'
  146. // })
  147. },
  148. /**
  149. * 生命周期函数--监听页面隐藏
  150. */
  151. onHide: function () {
  152. },
  153. /**
  154. * 生命周期函数--监听页面卸载
  155. */
  156. onUnload: function () {
  157. },
  158. /**
  159. * 页面相关事件处理函数--监听用户下拉动作
  160. */
  161. onPullDownRefresh: function () {
  162. },
  163. /**
  164. * 页面上拉触底事件的处理函数
  165. */
  166. onReachBottom: function () {
  167. },
  168. /**
  169. * 用户点击右上角分享
  170. */
  171. onShareAppMessage: function () {
  172. return app.sharePack();
  173. },
  174. changeAuthenticationShow:function(){
  175. this.setData({
  176. authenticationShow: !this.data.authenticationShow
  177. })
  178. },
  179. enterMsg: function () {//去补充资料
  180. wx.navigateTo({
  181. url: '/pages/supplement/supplement',
  182. })
  183. }
  184. })