resume.js 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. import recruitApi from '../../api/recruit'
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. endDate:'',
  9. fileColor:"",
  10. array: ["保密", "男", "女"],
  11. educationArray: ["小学", "初中", "高中","中技(中专、技校、职高)","大专","本科","硕士研究生","MBA","博士研究生","保密"],
  12. schoolTypeArray: ["","全国普通高等院校非全日制","全国普通高等院校全日制", "成人高等教育", "统招专升本","其他","自学考试","非统招专升本","海外留学生"],
  13. statusArray: ["","正在主动找工作","可以考虑工作机会", "目前不想找工作"],
  14. moneyArray: ["","1000以下","1000-2000", "2001-4000", "4001-6000","6001-8000","8001-10000","10001-15000","15001-25000","25001-30000","30001-50000","50001以上","面议"],
  15. nowMoneyArray: ["","1000以下","1000-2000", "2001-4000", "4001-6000","6001-8000","8001-10000","10001-15000","15001-25000","25001-30000","30001-50000","50001以上"],
  16. type:1,//1保存简历 2保存简历+投递简历)
  17. saveTitle:'保存',
  18. name:'',
  19. emali:'',
  20. mobile:'',
  21. birthday:'1990-01-01',
  22. gender:0,
  23. nowAddress:'',
  24. registeredAddress:'',
  25. highestEducation:0,
  26. learningModality:0,
  27. takeProfessionally:'',
  28. jobStatus:0,
  29. hopeProfessionally:'',
  30. nowSalary:0,
  31. hopeSalary:0,
  32. resumeFile:'',
  33. resumeFileName:'在微信聊天中选择附件',
  34. resumeFileNow:'',
  35. isChooseFile:false,
  36. },
  37. /**
  38. * 生命周期函数--监听页面加载
  39. */
  40. onLoad: function (options) {
  41. if(options.type ==2){
  42. this.setData({
  43. saveTitle:'确认投递'
  44. })
  45. wx.setNavigationBarTitle({
  46. title: '投递简历'
  47. })
  48. }else{
  49. wx.setNavigationBarTitle({
  50. title: '我的简历'
  51. })
  52. }
  53. var d = new Date();
  54. var endDate = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()
  55. this.setData({
  56. endDate:endDate,
  57. type:options.type,
  58. recruitsId:options.id,
  59. })
  60. },
  61. /**
  62. * 生命周期函数--监听页面初次渲染完成
  63. */
  64. onReady: function () {
  65. },
  66. /**
  67. * 生命周期函数--监听页面显示
  68. */
  69. onShow: async function () {
  70. const isAuth = await app.isAuth()
  71. if (!isAuth) {
  72. wx.redirectTo({
  73. url: '/pages/prompt/prompt?page=' + this.route+"?type="+this.data.type,
  74. })
  75. return
  76. }
  77. var openId = wx.getStorageSync("openId")
  78. this.setData({
  79. openId:openId
  80. })
  81. if(!this.data.isChooseFile){
  82. await this.getUserInfo(openId);
  83. }else{
  84. this.setData({
  85. isChooseFile:false
  86. })
  87. }
  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. bindInputName: function (e) {
  115. this.setData({
  116. name: e.detail.value
  117. })
  118. },
  119. bindInputEmail: function (e) {
  120. this.setData({
  121. email: e.detail.value
  122. })
  123. },
  124. bindInputMobile: function (e) {
  125. this.setData({
  126. mobile: e.detail.value
  127. })
  128. },
  129. bindInputNowAddress: function (e) {
  130. this.setData({
  131. nowAddress: e.detail.value
  132. })
  133. },
  134. bindInputRegisteredAddress: function (e) {
  135. this.setData({
  136. registeredAddress: e.detail.value
  137. })
  138. },
  139. changeBirth: function (e) {
  140. this.setData({
  141. birthday: e.detail.value
  142. })
  143. },
  144. changeSex: function (e) {
  145. this.setData({
  146. gender: e.detail.value
  147. })
  148. },
  149. changeEducation: function (e) {
  150. this.setData({
  151. highestEducation: e.detail.value
  152. })
  153. },
  154. changeSchoolType: function (e) {
  155. this.setData({
  156. learningModality: e.detail.value
  157. })
  158. },
  159. changeStatus:function(e){
  160. this.setData({
  161. jobStatus: e.detail.value
  162. })
  163. },
  164. bindInputTakeProfessionally:function(e){
  165. this.setData({
  166. takeProfessionally: e.detail.value
  167. })
  168. },
  169. bindInputHopeProfessionally:function(e){
  170. this.setData({
  171. hopeProfessionally: e.detail.value
  172. })
  173. },
  174. changeNowMoney:function(e){
  175. this.setData({
  176. nowSalary: e.detail.value
  177. })
  178. },
  179. changeExpectMoney:function(e){
  180. this.setData({
  181. hopeSalary: e.detail.value
  182. })
  183. },
  184. chooseEnclosure:function(){
  185. this.setData({
  186. isChooseFile:true
  187. })
  188. var self =this;
  189. wx.chooseMessageFile({
  190. count: 1,
  191. type: 'file',
  192. success (res) {
  193. // tempFilePath可以作为img标签的src属性显示图片
  194. self.uploadFile(res.tempFiles[0].path)
  195. self.setData({
  196. resumeFileName:res.tempFiles[0].name
  197. })
  198. }
  199. })
  200. },
  201. uploadFile: function(temFile){
  202. var self = this;
  203. wx.uploadFile({
  204. url: "https://oapi.shpr.top/open/upload/upload-pic", //上传的路径
  205. filePath:temFile, //刚刚在data保存的文件路径
  206. name: 'file', //后台获取的凭据
  207. formData: {
  208. 'basePath': 'recruit'
  209. },
  210. success (res){
  211. const result = JSON.parse(res.data)
  212. console.log(result)
  213. console.log(result.data.destPath)
  214. self.setData({
  215. resumeFileNow:result.data.destPath,
  216. fileColor:"#000",
  217. })
  218. }
  219. })
  220. },
  221. // downloadFile:function(e){
  222. // var url = e.currentTarget.dataset.url;
  223. // wx.downloadFile({
  224. // url: url, //仅为示例,并非真实的资源
  225. // success (res) {
  226. // // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  227. // if (res.statusCode === 200) {
  228. // }
  229. // }
  230. // })
  231. // },
  232. getUserInfo: async function(openId) {
  233. var params = {}
  234. params['openid'] = openId;
  235. var info = await recruitApi.infoUser(params);
  236. console.log(info);
  237. var highestEducation = info.highestEducation?info.highestEducation:0;
  238. var jobStatus = info.jobStatus?info.jobStatus:0;
  239. var nowSalary = info.nowSalary?info.nowSalary:0;
  240. var hopeSalary = info.hopeSalary?info.hopeSalary:0;
  241. var learningModality = info.learningModality?info.learningModality:0;
  242. var birthday = info.birthday?info.birthday:'1990-01-01';
  243. var fileColor = info.resumeFileName?'#000':'#c2c6da';
  244. var resumeFileName = info.resumeFileName?info.resumeFileName:'在微信聊天中选择附件';
  245. this.setData({
  246. userId:info.userId,
  247. name:info.name,
  248. email:info.email,
  249. mobile:info.mobile,
  250. gender:info.gender,
  251. birthday:birthday,
  252. nowAddress:info.nowAddress,
  253. registeredAddress:info.registeredAddress,
  254. highestEducation:highestEducation,
  255. learningModality:learningModality,
  256. takeProfessionally:info.takeProfessionally,
  257. jobStatus:jobStatus,
  258. hopeProfessionally:info.hopeProfessionally,
  259. nowSalary:nowSalary,
  260. hopeSalary:hopeSalary,
  261. resumeFile:info.resumeFile,
  262. resumeFileNow:info.resumeFile,
  263. resumeFileName:resumeFileName,
  264. fileColor:fileColor,
  265. })
  266. },
  267. saveResume: async function(){
  268. if(!this.data.name){
  269. wx.showToast({
  270. title: '请输入姓名',
  271. icon: 'none',
  272. duration: 1000
  273. })
  274. return;
  275. }
  276. if(!this.data.email){
  277. wx.showToast({
  278. title: '请输入邮箱',
  279. icon: 'none',
  280. duration: 1000
  281. })
  282. return;
  283. }
  284. if(!this.data.mobile){
  285. wx.showToast({
  286. title: '请输入手机号',
  287. icon: 'none',
  288. duration: 1000
  289. })
  290. return;
  291. }
  292. // if(!this.data.resumeFileNow){
  293. // wx.showToast({
  294. // title: '请上传附件',
  295. // icon: 'none',
  296. // duration: 1000
  297. // })
  298. // return;
  299. // }
  300. var resumeFileName = this.data.resumeFileNow?this.data.resumeFileName:''
  301. var params = {
  302. userId:this.data.userId,
  303. name:this.data.name,
  304. email:this.data.email,
  305. mobile:this.data.mobile,
  306. birthday:this.data.birthday,
  307. gender:this.data.gender,
  308. nowAddress:this.data.nowAddress,
  309. registeredAddress:this.data.registeredAddress,
  310. highestEducation:this.data.highestEducation,
  311. learningModality:this.data.learningModality,
  312. takeProfessionally:this.data.takeProfessionally,
  313. jobStatus:this.data.jobStatus,
  314. hopeProfessionally:this.data.hopeProfessionally,
  315. nowSalary:this.data.nowSalary,
  316. hopeSalary:this.data.hopeSalary,
  317. resumeFile:this.data.resumeFileNow,
  318. resumeFileName:resumeFileName,
  319. };
  320. await recruitApi.saveUser(params);
  321. if(this.data.type ==2){
  322. await recruitApi.deliveryRecruit(this.data.openId,this.data.recruitsId);
  323. wx.showToast({
  324. title: '投递成功',
  325. icon: 'success',
  326. success:function(){
  327. setTimeout(() => {
  328. wx.navigateBack({
  329. delta: 2
  330. })
  331. }, 1000);
  332. }
  333. })
  334. }else{
  335. wx.showToast({
  336. title: '保存成功',
  337. icon: 'success',
  338. success:function(){
  339. setTimeout(() => {
  340. wx.navigateBack({
  341. delta: 2
  342. })
  343. }, 1000);
  344. }
  345. })
  346. }
  347. }
  348. })