index.js 4.9 KB

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