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

196 lines
4.7KB

  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=2;
  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. if(app.globalData.userInfoData==null){
  138. this.setData({iconShow:true})
  139. }else{
  140. this.setData({iconShow:false})
  141. }
  142. this.setData({isbtn: true})
  143. // wx.navigateTo({
  144. // url: './share/share'
  145. // })
  146. },
  147. /**
  148. * 生命周期函数--监听页面隐藏
  149. */
  150. onHide: function () {
  151. },
  152. /**
  153. * 生命周期函数--监听页面卸载
  154. */
  155. onUnload: function () {
  156. },
  157. /**
  158. * 页面相关事件处理函数--监听用户下拉动作
  159. */
  160. onPullDownRefresh: function () {
  161. },
  162. /**
  163. * 页面上拉触底事件的处理函数
  164. */
  165. onReachBottom: function () {
  166. },
  167. /**
  168. * 用户点击右上角分享
  169. */
  170. onShareAppMessage: function () {
  171. return app.sharePack();
  172. },
  173. changeAuthenticationShow:function(){
  174. this.setData({
  175. authenticationShow: !this.data.authenticationShow
  176. })
  177. },
  178. enterMsg: function () {//去补充资料
  179. wx.navigateTo({
  180. url: '/pages/supplement/supplement',
  181. })
  182. }
  183. })