index.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. import {
  2. resumeIntent,
  3. getSalaryList
  4. } from '../../services/index.js'
  5. import {
  6. imgServerUrl
  7. } from '../../config/config.js'
  8. import {
  9. showToast
  10. } from '../../utils/tips.js'
  11. var app = getApp()
  12. Page({
  13. data: {
  14. imgServerUrl: imgServerUrl,
  15. salaryList: [{
  16. "expectationSalary": null,
  17. "hightNum": '请选择'
  18. },
  19. {
  20. "expectationSalary": -1,
  21. "hightNum": '不限'
  22. },
  23. {
  24. "expectationSalary": 0,
  25. "hightNum": '1000~2000'
  26. },
  27. {
  28. "expectationSalary": 1,
  29. "hightNum": '2001~3000'
  30. },
  31. {
  32. "expectationSalary": 2,
  33. "hightNum": '3001~4000'
  34. },
  35. {
  36. "expectationSalary": 3,
  37. "hightNum": '4001~5000'
  38. },
  39. {
  40. "expectationSalary": 4,
  41. "hightNum": '5001~6000'
  42. },
  43. {
  44. "expectationSalary": 5,
  45. "hightNum": '6001~7000'
  46. },
  47. {
  48. "expectationSalary": 6,
  49. "hightNum": '7001~8000'
  50. },
  51. {
  52. "expectationSalary": 7,
  53. "hightNum": '8001~9000'
  54. },
  55. {
  56. "expectationSalary": 8,
  57. "hightNum": '9001~10000'
  58. }, {
  59. "expectationSalary": 9,
  60. "hightNum": '10000以上'
  61. }
  62. ],
  63. expectationPosition: ["普工", "客服", "销售", "服务员", "物流仓储", "司机", "才艺技能", "文员助理", "快递配送", "促销导购", "展会演出", "家教培训", "模特", "贸易采购", "厨师", "编辑", "线上推广", "设计", "技工", "保洁", "其它"],
  64. region: {
  65. code: [],
  66. value: []
  67. }, //省市区
  68. name: '',
  69. expectationPositionIndex: 0,
  70. salaryIndex: 0,
  71. hpUserIntentionId: '',
  72. hpUserResumeId: ''
  73. },
  74. onLoad: function(options) {
  75. console.log(options)
  76. let {
  77. hpUserResumeId
  78. } = options
  79. this.setData({
  80. hpUserResumeId: hpUserResumeId
  81. })
  82. if (hpUserResumeId) {
  83. let userResume = wx.getStorageSync('userResume')
  84. this.data.region.code = this.data.region.code.concat(userResume.expectationProvinceId);
  85. this.data.region.code = this.data.region.code.concat(userResume.expectationCityId);
  86. this.data.region.code = this.data.region.code.concat(userResume.expectationCountryId);
  87. var arr = userResume.expectationAddress.split("-");
  88. for(var i=0;i<arr.length;i++){
  89. this.data.region.value = this.data.region.value.concat(arr[i]);
  90. }
  91. var expectationArray = userResume.expectationPosition;
  92. var lengthSalary = this.data.salaryList.length;
  93. var salaryIndex;
  94. for (var i = 0; i < lengthSalary; i++) {
  95. if (userResume.expectationSalary == this.data.salaryList[i].hightNum) {
  96. salaryIndex = i;
  97. }
  98. }
  99. console.log("ggg", this.data.region)
  100. if (userResume.id) {
  101. this.setData({
  102. hpUserResumeId: userResume.id,
  103. expectationPositionIndex: expectationArray,
  104. salaryIndex: salaryIndex,
  105. region: this.data.region
  106. })
  107. }
  108. }
  109. },
  110. //改变薪资水平
  111. bindSalaryChange(e) {
  112. console.log('picker改变薪资水平,携带值为', e.detail)
  113. this.setData({
  114. salaryIndex: e.detail.value
  115. })
  116. },
  117. //改变期望岗位
  118. changeName(e) {
  119. this.setData({
  120. expectationPositionIndex: e.detail.value
  121. })
  122. },
  123. //改变期望地点
  124. bindRegionChange(e) {
  125. console.log('picker发送选择改变,携带值为', e.detail)
  126. this.data.region.code = e.detail.code;
  127. this.data.region.value = e.detail.value;
  128. this.setData({
  129. region: this.data.region
  130. })
  131. },
  132. //提交
  133. submit() {
  134. let flag = this.check()
  135. if (!flag) {
  136. return
  137. }
  138. let {
  139. expectationPositionIndex,
  140. salaryIndex,
  141. region,
  142. hpUserResumeId,
  143. salaryList
  144. } = this.data
  145. let paramsObj = {
  146. expectationPosition: expectationPositionIndex,
  147. expectationSalary: salaryList[salaryIndex].expectationSalary,
  148. expectationProvinceId: region.code[0],
  149. expectationCityId: region.code[1],
  150. expectationCountryId: region.code[2],
  151. expectationAddress: region.value[0] +'-'+ region.value[1] +'-' +region.value[2],
  152. user_id: app.globalData.userId,
  153. user_token: app.globalData.userToken,
  154. member_id: app.globalData.memberId
  155. }
  156. Object.assign(paramsObj);
  157. resumeIntent(paramsObj).then(data => {
  158. console.log(data)
  159. showToast('保存成功', 'success')
  160. wx.navigateBack()
  161. })
  162. },
  163. //验证
  164. check() {
  165. let {
  166. region,
  167. salaryList,
  168. salaryIndex
  169. } = this.data
  170. if (salaryList[salaryIndex].expectationSalary == null) {
  171. showToast('请选择期望薪资');
  172. return false
  173. }
  174. if (region.value.length == 0) {
  175. showToast('请选择期望地点');
  176. return false
  177. }
  178. return true
  179. }
  180. })