resume.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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. resumeFileNow:'',
  41. },
  42. /**
  43. * 生命周期函数--监听页面加载
  44. */
  45. onLoad: function (options) {
  46. console.log(options)
  47. if(options.type ==2){
  48. this.setData({
  49. saveTitle:'确认投递'
  50. })
  51. wx.setNavigationBarTitle({
  52. title: '投递简历'
  53. })
  54. }else{
  55. wx.setNavigationBarTitle({
  56. title: '我的简历'
  57. })
  58. }
  59. var d = new Date();
  60. var endDate = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()
  61. this.setData({
  62. endDate:endDate,
  63. type:options.type,
  64. recruitsId:options.id,
  65. })
  66. },
  67. /**
  68. * 生命周期函数--监听页面初次渲染完成
  69. */
  70. onReady: function () {
  71. },
  72. /**
  73. * 生命周期函数--监听页面显示
  74. */
  75. onShow: async function () {
  76. const isAuth = await app.isAuth()
  77. if (!isAuth) {
  78. wx.redirectTo({
  79. url: '/pages/prompt/prompt?page=' + this.route+"?type="+this.data.type,
  80. })
  81. return
  82. }
  83. var openId = wx.getStorageSync("openId")
  84. this.setData({
  85. openId:openId
  86. })
  87. await this.getUserInfo(openId);
  88. },
  89. /**
  90. * 生命周期函数--监听页面隐藏
  91. */
  92. onHide: function () {
  93. },
  94. /**
  95. * 生命周期函数--监听页面卸载
  96. */
  97. onUnload: function () {
  98. },
  99. /**
  100. * 页面相关事件处理函数--监听用户下拉动作
  101. */
  102. onPullDownRefresh: function () {
  103. },
  104. /**
  105. * 页面上拉触底事件的处理函数
  106. */
  107. onReachBottom: function () {
  108. },
  109. /**
  110. * 用户点击右上角分享
  111. */
  112. onShareAppMessage: function () {
  113. },
  114. changeBirth: function (e) {
  115. this.setData({
  116. birthday: e.detail.value
  117. })
  118. },
  119. changeSex: function (e) {
  120. this.setData({
  121. gender: e.detail.value
  122. })
  123. },
  124. changeEducation: function (e) {
  125. this.setData({
  126. highestEducation: e.detail.value
  127. })
  128. },
  129. changeSchoolType: function (e) {
  130. this.setData({
  131. learningModality: e.detail.value
  132. })
  133. },
  134. changeStatus:function(e){
  135. this.setData({
  136. jobStatus: e.detail.value
  137. })
  138. },
  139. changeNowMoney:function(e){
  140. this.setData({
  141. nowSalary: e.detail.value
  142. })
  143. },
  144. changeExpectMoney:function(e){
  145. this.setData({
  146. hopeSalary: e.detail.value
  147. })
  148. },
  149. chooseEnclosure:function(){
  150. var self =this;
  151. wx.chooseMessageFile({
  152. count: 1,
  153. type: 'file',
  154. success (res) {
  155. // tempFilePath可以作为img标签的src属性显示图片
  156. console.log(res.tempFiles[0].path);
  157. self.setData({
  158. resumeFileNow: res.tempFiles[0].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. // console.log(this.data.resumeFileNow);
  196. // wx.uploadFile({
  197. // url: "http://oapi.shpr.top:81/open/upload/upload-pic", //上传的路径
  198. // filePath:this.data.resumeFileNow, //刚刚在data保存的文件路径
  199. // name: 'file', //后台获取的凭据
  200. // formData: {
  201. // 'basePath': 'recruit'
  202. // },
  203. // success (res){
  204. // const data = res.data
  205. // console.log(data);
  206. // //do something
  207. // }
  208. // })
  209. return;
  210. if(!this.data.name){
  211. wx.showToast({
  212. title: '请输入姓名',
  213. icon: 'none',
  214. duration: 1000
  215. })
  216. return;
  217. }
  218. if(!this.data.email){
  219. wx.showToast({
  220. title: '请输入邮箱',
  221. icon: 'none',
  222. duration: 1000
  223. })
  224. return;
  225. }
  226. if(!this.data.resumeFile){
  227. wx.showToast({
  228. title: '请上传附件',
  229. icon: 'none',
  230. duration: 1000
  231. })
  232. return;
  233. }
  234. var params = {
  235. userId:this.data.userId,
  236. name:this.data.name,
  237. email:this.data.email,
  238. mobile:this.data.mobile,
  239. birthday:this.data.birthday,
  240. gender:this.data.gender,
  241. nowAddress:this.data.nowAddress,
  242. registeredAddress:this.data.registeredAddress,
  243. highestEducation:this.data.highestEducation,
  244. learningModality:this.data.learningModality,
  245. takeProfessionally:this.data.takeProfessionally,
  246. jobStatus:this.data.jobStatus,
  247. hopeProfessionally:this.data.hopeProfessionally,
  248. nowSalary:this.data.nowSalary,
  249. hopeSalary:this.data.hopeSalary,
  250. resumeFile:this.data.resumeFile,
  251. };
  252. await recruitApi.saveUser(params);
  253. if(this.data.type ==2){
  254. await recruitApi.deliveryRecruit(this.data.openId,this.data.recruitsId);
  255. wx.showToast({
  256. title: '投递成功',
  257. icon: 'success',
  258. success:function(){
  259. setTimeout(() => {
  260. wx.navigateBack({
  261. delta: 2
  262. })
  263. }, 1000);
  264. }
  265. })
  266. }else{
  267. wx.showToast({
  268. title: '保存成功',
  269. icon: 'success',
  270. success:function(){
  271. setTimeout(() => {
  272. wx.navigateBack({
  273. delta: 2
  274. })
  275. }, 1000);
  276. }
  277. })
  278. }
  279. }
  280. })