index.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. import {
  2. getResume
  3. } from '../../services/index.js'
  4. import {
  5. imgServerUrl
  6. } from '../../config/config.js'
  7. import {
  8. showToast
  9. } from '../../utils/tips.js'
  10. import {
  11. formatTime
  12. } from '../../utils/util.js'
  13. const app = getApp();
  14. Page({
  15. data: {
  16. imgServerUrl: imgServerUrl,
  17. hpUserResumeId: '', //是否有简历
  18. eduList: ["请选择", "小学", "中学", "高中", "大专", "本科", "研究生", "博士", "博士后"],
  19. eduName: '', //学历
  20. expYear: "", //工作几年
  21. hpUserResumeId: '', //用户简历表id
  22. expectationPosition: ["普工", "客服", "销售", "服务员", "物流仓储", "司机", "才艺技能", "文员助理", "快递配送", "促销导购", "展会演出", "家教培训", "模特", "贸易采购", "厨师", "编辑", "线上推广", "设计", "技工", "保洁", "其它"],
  23. salaryList: [{
  24. "expectationSalary": -1,
  25. "hightNum": '不限'
  26. },
  27. {
  28. "expectationSalary": 0,
  29. "hightNum": '1000~2000'
  30. },
  31. {
  32. "expectationSalary": 1,
  33. "hightNum": '2000~3000'
  34. },
  35. {
  36. "expectationSalary": 2,
  37. "hightNum": '3000~4000'
  38. },
  39. {
  40. "expectationSalary": 3,
  41. "hightNum": '4000~5000'
  42. },
  43. {
  44. "expectationSalary": 4,
  45. "hightNum": '5000~6000'
  46. },
  47. {
  48. "expectationSalary": 5,
  49. "hightNum": '6000~7000'
  50. },
  51. {
  52. "expectationSalary": 6,
  53. "hightNum": '7000~8000'
  54. },
  55. {
  56. "expectationSalary": 7,
  57. "hightNum": '8000~9000'
  58. },
  59. {
  60. "expectationSalary": 9,
  61. "hightNum": '10000以上'
  62. }
  63. ],
  64. },
  65. onLoad: function (options) {
  66. var hpUserResumeId = options.hpUserResumeId;
  67. this.setData({
  68. hpUserResumeId
  69. })
  70. if (!hpUserResumeId) {
  71. wx.navigateTo({
  72. url: '../user-info/index',
  73. })
  74. }
  75. },
  76. onShow: function (options) {
  77. this.fetchData();
  78. },
  79. //获取用户简历详情
  80. fetchData() {
  81. let paramsObj = {
  82. user_id: app.globalData.userId,
  83. user_token: app.globalData.userToken,
  84. member_id: app.globalData.memberId
  85. }
  86. Object.assign(paramsObj);
  87. getResume(paramsObj).then(data => {
  88. if (!data.data.userResume) {
  89. wx.navigateTo({
  90. url: '../user-info/index',
  91. })
  92. }
  93. let {
  94. userResume
  95. } = data.data
  96. var eduName = this.data.eduList[userResume.highestQualification];
  97. var hpUserResumeId = userResume.hpUserResumeId;
  98. var expList = userResume.hpResumeWorkExperienceList;
  99. wx.setStorageSync("expList", expList);
  100. if (!userResume.headImg) {
  101. userResume.headImg = `${imgServerUrl}/images/avatar/man.png`;
  102. }
  103. if (userResume.expectationSalary) {
  104. var salaryList = this.data.salaryList;
  105. for (var i = 0; i < salaryList.length; i++) {
  106. if (salaryList[i].expectationSalary == userResume.expectationSalary) {
  107. userResume.expectationSalary = salaryList[i].hightNum
  108. }
  109. }
  110. }
  111. var year = userResume.birthYear;
  112. if (year) {
  113. var date = new Date;
  114. var year1 = date.getFullYear();
  115. year = year1 - year + 1;
  116. }
  117. wx.setStorageSync('userResume', userResume)
  118. userResume.expectationAddress = userResume.expectationAddress ? userResume.expectationAddress.split('-').join(' ') : ''
  119. userResume.expectationSalary = userResume.expectationSalary ? userResume.expectationSalary.split('~').join('-') : ''
  120. this.setData({
  121. userResume,
  122. eduName: eduName,
  123. expList: expList,
  124. year: year
  125. })
  126. })
  127. },
  128. // 修改基本信息
  129. toUserInfo() {
  130. wx.navigateTo({
  131. url: '../user-info/user-info?hpUserResumeId=' + this.data.hpUserResumeId,
  132. })
  133. },
  134. // 修改求职意向
  135. toUserJob(e) {
  136. wx.navigateTo({
  137. url: '../user-job/index?hpUserResumeId=' + this.data.hpUserResumeId,
  138. })
  139. },
  140. // 修改工作经验
  141. toUserWorks(e) {
  142. let {
  143. type,
  144. index
  145. } = e.detail;
  146. if (type == "edit") {
  147. wx.navigateTo({
  148. url: '../user-works/index?hpUserResumeId=' + this.data.hpUserResumeId + "&index=" + index,
  149. })
  150. } else {
  151. wx.navigateTo({
  152. url: '../user-works/index?hpUserResumeId=' + this.data.hpUserResumeId
  153. })
  154. }
  155. },
  156. //修改教育背景
  157. toUserEdu(e) {
  158. let {
  159. type,
  160. index
  161. } = e.currentTarget.dataset
  162. if (type == "edit") {
  163. wx.navigateTo({
  164. url: '../user-education/index?hpUserResumeId=' + this.data.hpUserResumeId + "&index=" + index,
  165. })
  166. } else {
  167. wx.navigateTo({
  168. url: '../user-education/index?hpUserResumeId=' + this.data.hpUserResumeId,
  169. })
  170. }
  171. }
  172. })