addResume.js 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. //import * as WxJsApi from '@/utils/wxJsApi.js'
  2. import * as API from '@/apis/job/job.js'
  3. import * as API_common from '@/apis/common.js'
  4. import * as WxJsApi from '@/utils/wxJsApi.js'
  5. export default {
  6. data() {
  7. return {
  8. isReady:false,
  9. isReady2:false,
  10. action:process.car.BASE_URL+"/mobile/jobUserApi/upload",
  11. header:{
  12. 'Authorization':this.carhelp.getToken()
  13. },
  14. fileList:[
  15. ],
  16. isObj:false,//是否是修改
  17. picList:[],
  18. form: {
  19. name: '',
  20. sex: '2',
  21. value:'',
  22. resumeUrls:"",
  23. expJson:"",
  24. },
  25. formData:{},
  26. endyear:2020,
  27. nowyear:2020,
  28. pickerShow:false,
  29. pickerShowS:false,
  30. pickerShowE:false,
  31. pickerObj:{},
  32. expJsonMap:{},
  33. leftStyle:{
  34. color: '#2979ff',
  35. fontSize:'32rpx',
  36. },
  37. selectShowIndex:0,
  38. selectShowTree:false,
  39. popupList:[],
  40. selectIndexList:[[],[],[],[]],
  41. workExp:[],
  42. educationExp:[],
  43. actionSheetList: [
  44. {
  45. id:1,
  46. text: '男'
  47. },
  48. {
  49. id:0,
  50. text: '女'
  51. },
  52. {
  53. id:2,
  54. text: '保密'
  55. }
  56. ],
  57. actionSheetShow: false,
  58. dataList:[
  59. "0c3194dc-884d-4ea9-9966-dfb94f537f5c",//性别
  60. "b5e4a52a-9f89-4e3b-976f-79207a40587d",//月薪
  61. "7724a25f-a781-46f4-b048-d9812108ff02" , //工作经验
  62. "c1887d9d-e945-4875-be3f-905195cd8a8e",//学历
  63. "e03f43d0-46f8-4696-a6f2-331d353dccd8",//工作状态
  64. "b974b7a8-3609-4717-aee7-67cd32461c22",//期望工作地
  65. ],
  66. dataParam:[
  67. "sex",//性别
  68. "dreamMoney",//月薪
  69. "workExp" , //工作经验
  70. "education",//学历
  71. "jobStatus",//工作状态
  72. "dreamAdd",//期望工作地
  73. ],
  74. dataMap:{},
  75. pickerShowEList:[],
  76. pickerShowSList:[]
  77. }
  78. },
  79. methods: {
  80. uploadPic(){
  81. if(!this.isReady2){
  82. return
  83. }
  84. WxJsApi.chooseImage().then(res=>{
  85. var formData = {
  86. 'photoName': '1.jpg',
  87. 'photoFile': res.localData
  88. }
  89. uni.showLoading({
  90. title:"加载中",mask:true,
  91. })
  92. API_common.uploadBase64(formData).then(response => {
  93. this.fileList.push(response.data)
  94. uni.showToast({
  95. title:"上传成功",
  96. icon:"none"
  97. })
  98. this.$forceUpdate()
  99. }).catch(error => {
  100. uni.showToast({
  101. title:error,
  102. icon:"none"
  103. })
  104. })
  105. })
  106. },
  107. setObj(info,work,exp){
  108. this.isObj=true;
  109. this.form=info;
  110. this.form.categoryName=info.positionCategoryName
  111. this.form.categoryId=info.positionCategoryId;
  112. if(info.resumeUrls){
  113. this.pirList=info.resumeUrls.split(',');
  114. this.fileList=this.pirList.map((item)=>{
  115. return {
  116. url:item
  117. }
  118. });
  119. }
  120. this.workExp=work.map((item)=>{
  121. item.timeS=item.startTime;
  122. item.timeE=item.endTime;
  123. item.name=item.companyName;
  124. item.remark=item.job;
  125. return item;
  126. })
  127. this.educationExp=exp.map((item)=>{
  128. item.timeS=item.startTime;
  129. item.timeE=item.endTime;
  130. item.name=item.schoolName;
  131. item.remark=item.education;
  132. item.content=item.major
  133. return item;
  134. })
  135. if(!this.isReady){
  136. this.init();
  137. this.isReady=true;
  138. }
  139. document.body.scrollTop = 0;
  140. document.documentElement.scrollTop = 0;
  141. },
  142. submit(){
  143. var form=this.form;
  144. var error=""
  145. if(!form.categoryId){
  146. error="请选择应聘职位"
  147. }else if(!form.dreamMoney){
  148. error="请选择期望工资"
  149. }else if(!form.workExp){
  150. error="请选择工作经验"
  151. }else if(!form.jobStatus){
  152. error="请选择工作状态"
  153. }else if(!form.birthday){
  154. error="请选择出生年月"
  155. }else if(!form.dreamAdd){
  156. error="请填写期望工作地"
  157. }else if(!form.introduction){
  158. error="请输入个人介绍"
  159. }
  160. if(error){
  161. uni.showToast({
  162. title:error
  163. })
  164. return false;
  165. }
  166. var b=false;
  167. this.workExp.find((item)=>{
  168. if(!item.timeS||!item.timeE){
  169. uni.showToast({
  170. title:"请完善工作经历中的工作时间"
  171. })
  172. b=true
  173. return true;
  174. }else if(!item.name||!item.remark||!item.content){
  175. uni.showToast({
  176. title:"请完善工作经历中的详细信息"
  177. })
  178. b=true
  179. return true;
  180. }else{
  181. return false;
  182. }
  183. })
  184. if(b){
  185. return false;
  186. }
  187. this.educationExp.find((item)=>{
  188. if(!item.timeS||!item.timeE){
  189. uni.showToast({
  190. title:"请完善教育经历中的在校时间"
  191. })
  192. b=true
  193. return true;
  194. }else if(!item.name||!item.remark||!item.content){
  195. uni.showToast({
  196. title:"请完善教育经历中的详细信息"
  197. })
  198. b=true
  199. return true;
  200. }else{
  201. return false;
  202. }
  203. })
  204. if(b){
  205. return false;
  206. }
  207. uni.showLoading({
  208. title:"提交中"
  209. })
  210. var expJson={
  211. workExp:this.workExp,
  212. educationExp:this.educationExp,
  213. }
  214. this.form.expJson=JSON.stringify(expJson);
  215. this.form.resumeUrls=this.picList.filter(item=>{
  216. if(item){
  217. return true;
  218. }else{
  219. return false;
  220. }
  221. }).join();
  222. API.submitResume(this.form).then((response) => {
  223. uni.showToast({
  224. title:response.data
  225. })
  226. this.$emit("submit")
  227. }).catch(error => {
  228. uni.showToast({
  229. title:error
  230. })
  231. })
  232. },
  233. radioChange(e){
  234. console.log(this.form.sex);
  235. },
  236. back(){
  237. this.$emit("back")
  238. },
  239. getScreenList(){
  240. API_common.getScreenList().then((response) => {
  241. var list=response.data;
  242. var tree=[];
  243. var map=new Map();
  244. var max=0;
  245. var all={
  246. extra:0,
  247. name:"请选择岗位"
  248. }
  249. tree.push(all);
  250. list.forEach((item)=>{
  251. if(item.level>max){
  252. max=item.level;
  253. }
  254. if(item.parentId){
  255. }else{
  256. item.extra=tree.length,
  257. tree.push(item);
  258. }
  259. map.set(item.id,item);
  260. this.setChildren(item,max,item);
  261. })
  262. this.setChildren(all,max,all);
  263. list.forEach((item)=>{
  264. if(item.parentId){
  265. var obj=map.get(item.parentId);
  266. item.extra=obj.children.length
  267. obj.children.push(item)
  268. }
  269. })
  270. this.popupList=tree;
  271. uni.hideLoading()
  272. // .map((item)=>{
  273. // return item.name;
  274. // })
  275. }).catch(error => {
  276. uni.showToast({
  277. title:error
  278. })
  279. })
  280. },
  281. confirmSelectTree(obj){
  282. console.log(obj)
  283. var list=[];
  284. for(var i in obj){
  285. if(i==0){
  286. this.form.categoryId="";
  287. this.form.categoryName="";
  288. }
  289. if(obj[i].extra){
  290. list.push(obj[i].extra);
  291. }else{
  292. list.push(0);
  293. }
  294. if(obj[i].value){
  295. this.form.categoryId=obj[i].value;
  296. this.form.categoryName=obj[i].label;
  297. }
  298. }
  299. this.selectIndexList[3]=list;
  300. },
  301. setChildren(item,i,it){
  302. if(i>1){
  303. var i2=i-1;
  304. var myit={extra:0}
  305. it.children=[myit]
  306. return this.setChildren(item,i2,myit);
  307. }else{
  308. return item
  309. }
  310. },
  311. selectpicker(item){
  312. this.form.birthday=item.year+"-"+item.month+"-"+item.day;
  313. },
  314. selectpickerS(item){
  315. this.pickerObj.timeS=item[0].label+item[1].label;
  316. },
  317. selectpickerE(item){
  318. this.pickerObj.timeE=item[0].label+(item[1].label?item[1].label:'');
  319. },
  320. getDataMap(){
  321. uni.showLoading({
  322. title: '加载中'
  323. });
  324. API_common.getData(this.dataList.join()).then((res) => {
  325. this.dataMap=res.data;
  326. for(var key in this.dataMap){
  327. this.dataMap[key].forEach((item,index)=>{
  328. item.extra=(index+1);
  329. })
  330. }
  331. this.getScreenList();
  332. }).catch(error => {
  333. uni.showToast({
  334. title:error
  335. })
  336. })
  337. },
  338. // 点击actionSheet回调
  339. actionSheetCallback(index) {
  340. var obj=this.getShowDataList[index]
  341. uni.hideKeyboard();
  342. this.form[this.dataParam[this.selectShowIndex]] =obj.id
  343. this.form[this.dataParam[this.selectShowIndex]+"Name"] =obj.text
  344. },
  345. init(){
  346. // WxJsApi.getWxConfig(['chooseImage']).then(()=>{
  347. // this.isReady2=true
  348. // });
  349. var list=["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]
  350. list=list.map((item)=>{
  351. return {
  352. value:item,
  353. label:item,
  354. }
  355. })
  356. var year=new Date().getYear()+1900;
  357. this.endyear=year-5;
  358. console.log(this.endyear)
  359. var list2=[];
  360. for(var i=0;i< 40;i++){
  361. list2.push({
  362. value:year-i+"年",
  363. label:year-i+"年",
  364. children:list
  365. })
  366. }
  367. this.pickerShowSList.push(list2)
  368. this.pickerShowSList.push(list)
  369. this.pickerShowEList=[
  370. {
  371. value:'至今',
  372. label:'至今',
  373. children:[{}]
  374. },
  375. ...list2
  376. ]
  377. this.getDataMap();
  378. },
  379. beforeUpload(index, list){
  380. console.log(list);
  381. },
  382. onErrorUpload(){
  383. this.picList.push("")
  384. },
  385. successUpload(data, index, lists, name){
  386. console.log(this.picList);
  387. this.picList.push(data.data)
  388. },
  389. removeUpload(data, index, lists, name){
  390. this.picList.splice(data,1)
  391. }
  392. },
  393. mounted(){
  394. this.init();
  395. this.isReady=true;
  396. },
  397. onReady(){
  398. this.init();
  399. this.isReady=true;
  400. },computed:{
  401. getShowDataList(){
  402. var list=this.dataMap[this.dataList[this.selectShowIndex]];
  403. if(list){
  404. var ls=list.map((it)=>{
  405. it.text=it.name
  406. return it
  407. })
  408. return ls;
  409. }else{
  410. return [];
  411. }
  412. },
  413. }
  414. }