index.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. import {
  2. imgServerUrl
  3. } from '../../config/config.js'
  4. import {
  5. getCenterInfo,
  6. getResume
  7. } from '../../services/index.js'
  8. import {
  9. updataStorageData
  10. } from '../../utils/storage.js'
  11. import {
  12. checkPhone
  13. } from '../../services/wx.js'
  14. var app = getApp()
  15. Page({
  16. data: {
  17. imgServerUrl: imgServerUrl,
  18. userInfo: {},
  19. noPhone:true,
  20. },
  21. onShow: function() {
  22. if (app.globalData.userInfo) {
  23. console.log('有info===', app.globalData)
  24. this.setData({
  25. userInfo: app.globalData.userInfo
  26. })
  27. } else if (this.data.canIUse) {
  28. // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
  29. // 所以此处加入 callback 以防止这种情况
  30. app.userInfoReadyCallback = res => {
  31. console.log('userInfoReadyCallback===', app.globalData)
  32. this.setData({
  33. userInfo: app.globalData.userInfo
  34. })
  35. }
  36. } else {
  37. // 在没有 open-type=getUserInfo 版本的兼容处理
  38. wx.getUserInfo({
  39. success: res => {
  40. app.globalData.userInfo = res.userInfo
  41. console.log('兼容处理===', app.globalData)
  42. this.setData({
  43. userInfo: useapp.globalData.userInforInfo
  44. })
  45. }
  46. })
  47. }
  48. this.fetchData();
  49. this.getUserResume();
  50. if (this.data.noPhone){
  51. //检查手机号
  52. checkPhone({
  53. user_id: app.globalData.userId,
  54. user_token: app.globalData.userToken
  55. }).then(data => {
  56. console.log("hh")
  57. })
  58. }
  59. },
  60. onLoad: function (options) {
  61. this.setData({
  62. phone: updataStorageData("phone")
  63. })
  64. },
  65. //获取用户简历详情
  66. getUserResume() {
  67. let paramsObj = {
  68. user_id: app.globalData.userId,
  69. user_token: app.globalData.userToken
  70. }
  71. Object.assign(paramsObj);
  72. getResume(paramsObj).then(data => {
  73. if (data.data.userResume) {
  74. this.setData({
  75. hpUserResumeId: data.data.userResume.id,
  76. userResume: data.data.userResume
  77. })
  78. }
  79. })
  80. },
  81. //获取用户认证状态
  82. fetchData() {
  83. let paramsObj = {
  84. user_id: app.globalData.userId,
  85. user_token: app.globalData.userToken
  86. }
  87. Object.assign(paramsObj);
  88. getCenterInfo(paramsObj).then(data => {
  89. let {
  90. approveStatus
  91. } = data.data
  92. this.setData({
  93. approveStatus, // 认证状态(0:未认证 1:等待认证 2:未通过 3:已认证) ,
  94. })
  95. })
  96. },
  97. // 简历
  98. tojianli() {
  99. if (this.data.hpUserResumeId) {
  100. wx.navigateTo({
  101. url: '../jianli/index?hpUserResumeId=' + this.data.hpUserResumeId,
  102. })
  103. } else {
  104. wx.navigateTo({
  105. url: '../user-info/user-info',
  106. })
  107. }
  108. },
  109. //去认证页面
  110. toAuth() {
  111. let approveState = this.data.approveStatus
  112. console.log(approveState)
  113. if (approveState == 0) {
  114. //身份认证
  115. wx.navigateTo({
  116. url: '../identification/index',
  117. })
  118. } else if (approveState == 3) {
  119. //个人信息页面
  120. wx.navigateTo({
  121. url: '../user-form/index',
  122. })
  123. } else if (approveState == 2) {
  124. //认证不通过
  125. wx.navigateTo({
  126. url: '../result/index?type=auth&status=0',
  127. })
  128. } else if (approveState == 1) {
  129. //待审核
  130. wx.navigateTo({
  131. url: '../result/index?type=auth&status=2',
  132. })
  133. }
  134. },
  135. apply(){
  136. //我的申请
  137. wx.navigateTo({
  138. url: '../apply-list/index',
  139. })
  140. },
  141. collection(){
  142. //我的收藏
  143. wx.navigateTo({
  144. url: '../collection-list/index',
  145. })
  146. },
  147. interview(){
  148. //面试邀请
  149. wx.navigateTo({
  150. url: '../interview/index',
  151. })
  152. },
  153. setup(){
  154. //设置
  155. wx.navigateTo({
  156. url: '../set/index',
  157. })
  158. }
  159. })