resume.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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. gender: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. recruitsId:options.id,
  64. })
  65. },
  66. /**
  67. * 生命周期函数--监听页面初次渲染完成
  68. */
  69. onReady: function () {
  70. },
  71. /**
  72. * 生命周期函数--监听页面显示
  73. */
  74. onShow: async function () {
  75. const isAuth = await app.isAuth()
  76. if (!isAuth) {
  77. wx.redirectTo({
  78. url: '/pages/prompt/prompt?page=' + this.route+"?type="+this.data.type,
  79. })
  80. return
  81. }
  82. var openId = wx.getStorageSync("openId")
  83. this.setData({
  84. openId:openId
  85. })
  86. await this.getUserInfo(openId);
  87. },
  88. /**
  89. * 生命周期函数--监听页面隐藏
  90. */
  91. onHide: function () {
  92. },
  93. /**
  94. * 生命周期函数--监听页面卸载
  95. */
  96. onUnload: function () {
  97. },
  98. /**
  99. * 页面相关事件处理函数--监听用户下拉动作
  100. */
  101. onPullDownRefresh: function () {
  102. },
  103. /**
  104. * 页面上拉触底事件的处理函数
  105. */
  106. onReachBottom: function () {
  107. },
  108. /**
  109. * 用户点击右上角分享
  110. */
  111. onShareAppMessage: function () {
  112. },
  113. changeBirth: function (e) {
  114. this.setData({
  115. birthday: e.detail.value
  116. })
  117. },
  118. changeSex: function (e) {
  119. this.setData({
  120. gender: e.detail.value
  121. })
  122. },
  123. changeEducation: function (e) {
  124. this.setData({
  125. highestEducation: e.detail.value
  126. })
  127. },
  128. changeSchoolType: function (e) {
  129. this.setData({
  130. learningModality: e.detail.value
  131. })
  132. },
  133. changeStatus:function(e){
  134. this.setData({
  135. jobStatus: e.detail.value
  136. })
  137. },
  138. changeNowMoney:function(e){
  139. this.setData({
  140. nowSalary: e.detail.value
  141. })
  142. },
  143. changeExpectMoney:function(e){
  144. this.setData({
  145. hopeSalary: e.detail.value
  146. })
  147. },
  148. chooseEnclosure:function(){
  149. var self =this;
  150. wx.chooseMessageFile({
  151. count: 1,
  152. type: 'file',
  153. success (res) {
  154. // tempFilePath可以作为img标签的src属性显示图片
  155. console.log(res.tempFiles);
  156. var path = res.tempFiles[0].path
  157. self.setData({
  158. resumeFile:path,
  159. resumeFileName:res.tempFiles[0].name
  160. })
  161. }
  162. })
  163. },
  164. getUserInfo: async function(openId) {
  165. var params = {}
  166. params['openid'] = openId;
  167. var info = await recruitApi.infoUser(params);
  168. console.log(info);
  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. userId:info.userId,
  177. name:info.name,
  178. email:info.email,
  179. mobile:info.mobile,
  180. gender:info.gender,
  181. birthday:birthday,
  182. nowAddress:info.nowAddress,
  183. registeredAddress:info.registeredAddress,
  184. highestEducation:highestEducation,
  185. learningModality:learningModality,
  186. takeProfessionally:info.takeProfessionally,
  187. jobStatus:jobStatus,
  188. hopeProfessionally:info.hopeProfessionally,
  189. nowSalary:nowSalary,
  190. hopeSalary:hopeSalary,
  191. resumeFile:info.resumeFile,
  192. })
  193. },
  194. saveResume: async function(){
  195. if(!this.data.name){
  196. wx.showToast({
  197. title: '请输入姓名',
  198. icon: 'none',
  199. duration: 1000
  200. })
  201. return;
  202. }
  203. if(!this.data.email){
  204. wx.showToast({
  205. title: '请输入邮箱',
  206. icon: 'none',
  207. duration: 1000
  208. })
  209. return;
  210. }
  211. if(!this.data.resumeFile){
  212. wx.showToast({
  213. title: '请上传附件',
  214. icon: 'none',
  215. duration: 1000
  216. })
  217. return;
  218. }
  219. var params = {
  220. userId:this.data.userId,
  221. name:this.data.name,
  222. email:this.data.email,
  223. mobile:this.data.mobile,
  224. birthday:this.data.birthday,
  225. gender:this.data.gender,
  226. nowAddress:this.data.nowAddress,
  227. registeredAddress:this.data.registeredAddress,
  228. highestEducation:this.data.highestEducation,
  229. learningModality:this.data.learningModality,
  230. takeProfessionally:this.data.takeProfessionally,
  231. jobStatus:this.data.jobStatus,
  232. hopeProfessionally:this.data.hopeProfessionally,
  233. nowSalary:this.data.nowSalary,
  234. hopeSalary:this.data.hopeSalary,
  235. resumeFile:this.data.resumeFile,
  236. };
  237. await recruitApi.saveUser(params);
  238. if(this.data.type ==2){
  239. await recruitApi.deliveryRecruit(this.data.openId,this.data.recruitsId);
  240. wx.showToast({
  241. title: '投递成功',
  242. icon: 'success',
  243. success:function(){
  244. setTimeout(() => {
  245. wx.navigateBack({
  246. delta: 2
  247. })
  248. }, 1000);
  249. }
  250. })
  251. }else{
  252. wx.showToast({
  253. title: '保存成功',
  254. icon: 'success',
  255. success:function(){
  256. setTimeout(() => {
  257. wx.navigateBack({
  258. delta: 2
  259. })
  260. }, 1000);
  261. }
  262. })
  263. }
  264. }
  265. })