resume.js 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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. self.setData({
  213. resumeFileNow:result.data.destPath,
  214. fileColor:"#000",
  215. })
  216. }
  217. })
  218. },
  219. // downloadFile:function(e){
  220. // var url = e.currentTarget.dataset.url;
  221. // wx.downloadFile({
  222. // url: url, //仅为示例,并非真实的资源
  223. // success (res) {
  224. // // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  225. // if (res.statusCode === 200) {
  226. // }
  227. // }
  228. // })
  229. // },
  230. getUserInfo: async function(openId) {
  231. var params = {}
  232. params['openid'] = openId;
  233. var info = await recruitApi.infoUser(params);
  234. console.log(info);
  235. var highestEducation = info.highestEducation?info.highestEducation:0;
  236. var jobStatus = info.jobStatus?info.jobStatus:0;
  237. var nowSalary = info.nowSalary?info.nowSalary:0;
  238. var hopeSalary = info.hopeSalary?info.hopeSalary:0;
  239. var learningModality = info.learningModality?info.learningModality:0;
  240. var birthday = info.birthday?info.birthday:'1990-01-01';
  241. var fileColor = info.resumeFileName?'#000':'#c2c6da';
  242. var resumeFileName = info.resumeFileName?info.resumeFileName:'';
  243. this.setData({
  244. userId:info.userId,
  245. name:info.name,
  246. email:info.email,
  247. mobile:info.mobile,
  248. gender:info.gender,
  249. birthday:birthday,
  250. nowAddress:info.nowAddress,
  251. registeredAddress:info.registeredAddress,
  252. highestEducation:highestEducation,
  253. learningModality:learningModality,
  254. takeProfessionally:info.takeProfessionally,
  255. jobStatus:jobStatus,
  256. hopeProfessionally:info.hopeProfessionally,
  257. nowSalary:nowSalary,
  258. hopeSalary:hopeSalary,
  259. resumeFile:info.resumeFile,
  260. resumeFileNow:info.resumeFile,
  261. resumeFileName:resumeFileName,
  262. fileColor:fileColor,
  263. })
  264. },
  265. saveResume: async function(){
  266. if(!this.data.name){
  267. wx.showToast({
  268. title: '请输入姓名',
  269. icon: 'none',
  270. duration: 1000
  271. })
  272. return;
  273. }
  274. if(!this.data.email){
  275. wx.showToast({
  276. title: '请输入邮箱',
  277. icon: 'none',
  278. duration: 1000
  279. })
  280. return;
  281. }
  282. if(!this.data.mobile){
  283. wx.showToast({
  284. title: '请输入手机号',
  285. icon: 'none',
  286. duration: 1000
  287. })
  288. return;
  289. }
  290. if(!this.data.resumeFileNow){
  291. wx.showToast({
  292. title: '请上传附件',
  293. icon: 'none',
  294. duration: 1000
  295. })
  296. return;
  297. }
  298. var params = {
  299. userId:this.data.userId,
  300. name:this.data.name,
  301. email:this.data.email,
  302. mobile:this.data.mobile,
  303. birthday:this.data.birthday,
  304. gender:this.data.gender,
  305. nowAddress:this.data.nowAddress,
  306. registeredAddress:this.data.registeredAddress,
  307. highestEducation:this.data.highestEducation,
  308. learningModality:this.data.learningModality,
  309. takeProfessionally:this.data.takeProfessionally,
  310. jobStatus:this.data.jobStatus,
  311. hopeProfessionally:this.data.hopeProfessionally,
  312. nowSalary:this.data.nowSalary,
  313. hopeSalary:this.data.hopeSalary,
  314. resumeFile:this.data.resumeFileNow,
  315. resumeFileName:this.data.resumeFileName,
  316. };
  317. await recruitApi.saveUser(params);
  318. if(this.data.type ==2){
  319. await recruitApi.deliveryRecruit(this.data.openId,this.data.recruitsId);
  320. wx.showToast({
  321. title: '投递成功',
  322. icon: 'success',
  323. success:function(){
  324. setTimeout(() => {
  325. wx.navigateBack({
  326. delta: 2
  327. })
  328. }, 1000);
  329. }
  330. })
  331. }else{
  332. wx.showToast({
  333. title: '保存成功',
  334. icon: 'success',
  335. success:function(){
  336. setTimeout(() => {
  337. wx.navigateBack({
  338. delta: 2
  339. })
  340. }, 1000);
  341. }
  342. })
  343. }
  344. }
  345. })