resume.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. import recruitApi from '../../api/recruit'
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. endDate:'',
  9. // birth:'1990-01-01',
  10. // date:'1990-01-01',
  11. // sex: 0,
  12. array: ["保密", "男", "女"],
  13. educationArray: ["小学", "初中", "高中","中技(中专、技校、职高)","大专","本科","硕士研究生","MBA","博士研究生","保密"],
  14. // highestEducation: 0,
  15. schoolTypeArray: ["","全国普通高等院校非全日制","全国普通高等院校全日制", "成人高等教育", "统招专升本","其他","自学考试","非统招专升本","海外留学生"],
  16. // learningModality: 0,
  17. statusArray: ["","正在主动找工作","可以考虑工作机会", "目前不想找工作"],
  18. // jobStatus: 0,
  19. moneyArray: ["","1000以下","1000-2000", "2001-4000", "4001-6000","6001-8000","8001-10000","10001-15000","15001-25000","25001-30000","30001-50000","50001以上","面议"],
  20. // nowMoneyIndex:0,
  21. // expectMoneyIndex:0,
  22. type:1,//1保存简历 2保存简历+投递简历)
  23. saveTitle:'保存',
  24. name:'',
  25. emali:'',
  26. mobile:'',
  27. birthday:'1990-01-01',
  28. sex:0,
  29. nowAddress:'',
  30. registeredAddress:'',
  31. highestEducation:0,
  32. learningModality:0,
  33. takeProfessionally:'',
  34. jobStatus:0,
  35. hopeProfessionally:'',
  36. nowSalary:0,
  37. hopeSalary:0,
  38. resumeFile:'',
  39. resumeFileName:'在微信聊天中选择附件',
  40. },
  41. /**
  42. * 生命周期函数--监听页面加载
  43. */
  44. onLoad: function (options) {
  45. console.log(options)
  46. if(options.type ==2){
  47. this.setData({
  48. saveTitle:'确认投递'
  49. })
  50. wx.setNavigationBarTitle({
  51. title: '投递简历'
  52. })
  53. }else{
  54. wx.setNavigationBarTitle({
  55. title: '我的简历'
  56. })
  57. }
  58. var d = new Date();
  59. var endDate = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()
  60. this.setData({
  61. endDate:endDate,
  62. type:options.type,
  63. })
  64. },
  65. /**
  66. * 生命周期函数--监听页面初次渲染完成
  67. */
  68. onReady: function () {
  69. },
  70. /**
  71. * 生命周期函数--监听页面显示
  72. */
  73. onShow: async function () {
  74. const isAuth = await app.isAuth()
  75. if (!isAuth) {
  76. wx.redirectTo({
  77. url: '/pages/prompt/prompt?page=' + this.route+"?type="+this.data.type,
  78. })
  79. return
  80. }
  81. var openId = wx.getStorageSync("openId")
  82. await this.getUserInfo(openId);
  83. },
  84. /**
  85. * 生命周期函数--监听页面隐藏
  86. */
  87. onHide: function () {
  88. },
  89. /**
  90. * 生命周期函数--监听页面卸载
  91. */
  92. onUnload: function () {
  93. },
  94. /**
  95. * 页面相关事件处理函数--监听用户下拉动作
  96. */
  97. onPullDownRefresh: function () {
  98. },
  99. /**
  100. * 页面上拉触底事件的处理函数
  101. */
  102. onReachBottom: function () {
  103. },
  104. /**
  105. * 用户点击右上角分享
  106. */
  107. onShareAppMessage: function () {
  108. },
  109. changeBirth: function (e) {
  110. this.setData({
  111. birthday: e.detail.value
  112. })
  113. },
  114. changeSex: function (e) {
  115. this.setData({
  116. sex: e.detail.value
  117. })
  118. },
  119. changeEducation: function (e) {
  120. this.setData({
  121. highestEducation: e.detail.value
  122. })
  123. },
  124. changeSchoolType: function (e) {
  125. this.setData({
  126. learningModality: e.detail.value
  127. })
  128. },
  129. changeStatus:function(e){
  130. this.setData({
  131. jobStatus: e.detail.value
  132. })
  133. },
  134. changeNowMoney:function(e){
  135. this.setData({
  136. nowSalary: e.detail.value
  137. })
  138. },
  139. changeExpectMoney:function(e){
  140. this.setData({
  141. hopeSalary: e.detail.value
  142. })
  143. },
  144. chooseEnclosure:function(){
  145. var self =this;
  146. wx.chooseMessageFile({
  147. count: 1,
  148. type: 'file',
  149. success (res) {
  150. // tempFilePath可以作为img标签的src属性显示图片
  151. console.log(res.tempFiles);
  152. self.setData({
  153. resumeFile:res.tempFiles[0].path,
  154. resumeFileName:res.tempFiles[0].name
  155. })
  156. }
  157. })
  158. },
  159. getUserInfo: async function(openId) {
  160. var params = {}
  161. params['openid'] = openId;
  162. var info = await recruitApi.infoUser(params);
  163. console.log(info);
  164. if(info.birthday){
  165. this.setData({
  166. birthday:info.birthday,
  167. })
  168. }
  169. var highestEducation = info.highestEducation?info.highestEducation:0;
  170. var jobStatus = info.jobStatus?info.jobStatus:0;
  171. var nowSalary = info.nowSalary?info.nowSalary:0;
  172. var hopeSalary = info.hopeSalary?info.hopeSalary:0;
  173. var learningModality = info.learningModality?info.learningModality:0;
  174. var birthday = info.birthday?info.birthday:'1990-01-01';
  175. this.setData({
  176. name:info.name,
  177. email:info.email,
  178. mobile:info.mobile,
  179. sex:info.sex,
  180. birthday:birthday,
  181. nowAddress:info.nowAddress,
  182. registeredAddress:info.registeredAddress,
  183. highestEducation:highestEducation,
  184. learningModality:learningModality,
  185. takeProfessionally:info.takeProfessionally,
  186. jobStatus:jobStatus,
  187. hopeProfessionally:info.hopeProfessionally,
  188. nowSalary:nowSalary,
  189. hopeSalary:hopeSalary,
  190. resumeFile:info.resumeFile,
  191. })
  192. },
  193. saveResume: function(){
  194. if(!this.data.name){
  195. wx.showToast({
  196. title: '请输入姓名',
  197. icon: 'none',
  198. duration: 1000
  199. })
  200. return;
  201. }
  202. if(!this.data.email){
  203. wx.showToast({
  204. title: '请输入邮箱',
  205. icon: 'none',
  206. duration: 1000
  207. })
  208. return;
  209. }
  210. if(!this.data.resumeFile){
  211. wx.showToast({
  212. title: '请上传附件',
  213. icon: 'none',
  214. duration: 1000
  215. })
  216. return;
  217. }
  218. var params = {
  219. name:this.data.name,
  220. email:this.data.email,
  221. mobile:this.data.mobile,
  222. birthday:this.data.birthday,
  223. sex:this.data.sex,
  224. nowAddress:this.data.nowAddress,
  225. registeredAddress:this.data.registeredAddress,
  226. highestEducation:this.data.highestEducation,
  227. learningModality:this.data.learningModality,
  228. takeProfessionally:this.data.takeProfessionally,
  229. jobStatus:this.data.jobStatus,
  230. hopeProfessionally:this.data.hopeProfessionally,
  231. nowSalary:this.data.nowSalary,
  232. hopeSalary:this.data.hopeSalary,
  233. resumeFile:this.data.resumeFile,
  234. };
  235. var res = recruitApi.saveUser(params);
  236. console.log(res);
  237. }
  238. })