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

202 lines
5.0KB

  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. app.globalData.userInfoData = {};
  43. app.globalData.userInfoData.avatarUrl = e.detail.userInfo.avatarUrl;
  44. app.globalData.userInfoData.nickName = e.detail.userInfo.nickName;
  45. this.setData({
  46. userData: this.data.userData,
  47. iconShow:false
  48. })
  49. app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName);
  50. this.getPoster();
  51. // wx.navigateTo({
  52. // url:'../poster/poster'
  53. // })
  54. }
  55. },
  56. getUserInfo:function(e){//获取个人信息
  57. if(this.data.isbtn){
  58. this.setData({isbtn: false})
  59. }else{
  60. return;
  61. }
  62. app.wxRequest(app.globalData.urlRoot + 'userInfo/getUserInfo', {}, res => {
  63. if(res.code==200){
  64. // res.data.userLevel = 3;
  65. if (res.data) {
  66. this.data.userData.avatarUrl = res.data.avatarUrl;
  67. this.data.userData.nickName = res.data.nickName;
  68. this.data.userData.userLevel = res.data.userLevel;
  69. this.setData({
  70. userData: this.data.userData
  71. })
  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. console.log(this.data.authenticationStatus);
  86. // return;
  87. if (this.data.authenticationStatus) {
  88. wx.navigateTo({
  89. url: '../poster/poster'
  90. })
  91. }else{
  92. this.setData({
  93. authenticationShow:true
  94. })
  95. }
  96. },
  97. // getCertificationInfo: function () {//查询认证状态
  98. // app.wxRequest(app.globalData.urlRoot + 'userInfo/getCertificationInfo', {}, res => {
  99. // if (res.code == 200 && res.data && res.data.agentDetail) {
  100. // this.data.authenticationStatus = true;
  101. // }
  102. // }, this)
  103. // },
  104. /**
  105. * 生命周期函数--监听页面加载
  106. */
  107. onLoad: function (options) {
  108. app.globalData.nowPage = 2;
  109. },
  110. /**
  111. * 生命周期函数--监听页面初次渲染完成
  112. */
  113. onReady: function () {
  114. },
  115. /**
  116. * 生命周期函数--监听页面显示
  117. */
  118. onShow: function () {
  119. // if (app.globalData.openid) {
  120. // this.getCertificationInfo();
  121. // } else {
  122. // app.globalData.openidSuccessFuc = this.getCertificationInfo;
  123. // }
  124. if (app.globalData.authenticationStatus && app.globalData.authenticationStatus.agentDetail){
  125. this.data.authenticationStatus = true;
  126. this.setData({
  127. authenticationShow:false
  128. })
  129. }
  130. // app.globalData.certificationState=4;
  131. this.setData({maskid: app.globalData.certificationState})
  132. if(app.globalData.certificationState==1){
  133. this.setData({titleContent:'尊敬的启辰车主您好'})
  134. }else if(app.globalData.certificationState==2){
  135. this.setData({titleContent:'尊敬的合伙人您好'})
  136. }else if(app.globalData.certificationState==3){
  137. this.setData({titleContent:'尊敬的同事您好'})
  138. }else if(app.globalData.certificationState==4){
  139. this.setData({titleContent:'尊敬的星探顾问'})
  140. }
  141. console.log(app.globalData.userInfoData);
  142. if(app.globalData.userInfoData && app.globalData.userInfoData.avatarUrl){
  143. this.setData({iconShow:false})
  144. }else{
  145. this.setData({iconShow:true})
  146. }
  147. this.setData({isbtn: true})
  148. // wx.navigateTo({
  149. // url: './share/share'
  150. // })
  151. },
  152. /**
  153. * 生命周期函数--监听页面隐藏
  154. */
  155. onHide: function () {
  156. },
  157. /**
  158. * 生命周期函数--监听页面卸载
  159. */
  160. onUnload: function () {
  161. },
  162. /**
  163. * 页面相关事件处理函数--监听用户下拉动作
  164. */
  165. onPullDownRefresh: function () {
  166. },
  167. /**
  168. * 页面上拉触底事件的处理函数
  169. */
  170. onReachBottom: function () {
  171. },
  172. /**
  173. * 用户点击右上角分享
  174. */
  175. onShareAppMessage: function () {
  176. return app.sharePack();
  177. },
  178. changeAuthenticationShow:function(){
  179. this.setData({
  180. authenticationShow: !this.data.authenticationShow
  181. })
  182. },
  183. enterMsg: function () {//去补充资料
  184. wx.navigateTo({
  185. url: '/pages/supplement/supplement',
  186. })
  187. }
  188. })