educationExperience.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. <template>
  2. <view class="work-experience">
  3. <!-- 自定义导航栏 -->
  4. <view class="custom-navbar" :style="{ paddingTop: (12 + statusBarHeight) + 'px' }">
  5. <view class="navbar-content">
  6. <view class="nav-left" @click="goBack">
  7. <u-icon name="arrow-leftward" color="#333" size="42"></u-icon>
  8. </view>
  9. <view class="nav-title">
  10. <view>教育经历</view>
  11. <view style="font-size: 20rpx;color:#666;font-weight: 400;">(请填写最高学历)</view>
  12. </view>
  13. <view class="nav-right"></view>
  14. </view>
  15. </view>
  16. <!-- 主要内容 -->
  17. <view class="main-content">
  18. <!-- 公司信息 -->
  19. <view class="form-section">
  20. <!-- 公司名称 -->
  21. <view class="form-item">
  22. <view class="form-label">学校名称</view>
  23. <input
  24. v-model="formData.companyName"
  25. placeholder="请填写学校名称"
  26. class="form-input"
  27. />
  28. </view>
  29. </view>
  30. <!-- 岗位履历 -->
  31. <view class="form-section">
  32. <!-- 在校时间 -->
  33. <view class="form-item">
  34. <view class="form-label">
  35. <text class="required-mark">*</text>
  36. <text class="label-text">在校时间</text>
  37. </view>
  38. <!-- <view class="form-input time-range">
  39. <view class="time-input">
  40. <uni-datetime-picker v-model="formData.employmentTime[0]" type="date"
  41. :border="false" placeholder="开始时间" />
  42. </view>
  43. <view class="time-separator">至</view>
  44. <view class="time-input">
  45. <uni-datetime-picker v-model="formData.employmentTime[1]" type="date"
  46. :border="false" placeholder="结束时间" />
  47. <image src="../../static/images/index/Iconly_Light_Calendar.svg"
  48. style="width: 48rpx; height: 48rpx;" mode="aspectFit"></image>
  49. </view>
  50. </view> -->
  51. <view class="form-input time-range">
  52. <!-- 开始年月 -->
  53. <view class="time-input">
  54. <picker
  55. mode="multiSelector"
  56. :range="yearMonthRange"
  57. :value="employmentTimeIndex[0]"
  58. @change="onStartChange"
  59. >
  60. <view class="picker-label">
  61. {{ formData.employmentTime[0] || '开始年月' }}
  62. </view>
  63. </picker>
  64. </view>
  65. <view class="time-separator">至</view>
  66. <!-- 结束年月 -->
  67. <view class="time-input" @click="onEndClick">
  68. <picker
  69. mode="multiSelector"
  70. :range="yearMonthRange"
  71. :value="employmentTimeIndex[1]"
  72. @change="onEndChange"
  73. :disabled="!formData.employmentTime[0]"
  74. >
  75. <view class="picker-label">
  76. {{ formData.employmentTime[1] || '结束年月' }}
  77. </view>
  78. </picker>
  79. <image
  80. src="../../static/images/index/Iconly_Light_Calendar.svg"
  81. style="width: 48rpx; height: 48rpx;"
  82. mode="aspectFit"
  83. />
  84. </view>
  85. </view>
  86. </view>
  87. <!-- 所在部门 -->
  88. <view class="form-item">
  89. <view class="form-label">
  90. <text class="required-mark">*</text>
  91. <text class="label-text">学历</text>
  92. </view>
  93. <view class="form-input">
  94. <picker class="picker" mode="selector" :range="departments" @change="selectDepartment">
  95. <text>{{departments.length>0?departments[formData.departmentIndex]:'请选择学历'}}</text>
  96. </picker>
  97. <u-icon name="arrow-down" color="#999" size="36"></u-icon>
  98. </view>
  99. </view>
  100. <!-- 工作业绩 -->
  101. <view class="form-item">
  102. <view class="form-label">专业</view>
  103. <view class="form-input">
  104. <textarea auto-height v-model="formData.workPerformance" placeholder="选填,请输入"></textarea>
  105. </view>
  106. </view>
  107. <!-- 工作内容 -->
  108. <view class="form-item">
  109. <view class="form-label">经历内容</view>
  110. <view class="form-input">
  111. <textarea auto-height v-model="formData.workContent" placeholder="选填,请输入"></textarea>
  112. </view>
  113. </view>
  114. </view>
  115. <!-- 底部保存按钮 -->
  116. <view class="bottom-btn-container">
  117. <view class="save-btn" @click="saveWorkExperience">
  118. <text>保存</text>
  119. </view>
  120. </view>
  121. </view>
  122. <!-- 添加技能弹窗 -->
  123. <u-popup v-model="showAddSkill" mode="center" border-radius="24" width="80%">
  124. <view class="add-skill-popup">
  125. <view class="popup-title">添加技能</view>
  126. <view class="popup-content">
  127. <input
  128. v-model="newSkillName"
  129. placeholder="请输入技能名称"
  130. class="skill-input"
  131. maxlength="10"
  132. />
  133. </view>
  134. <view class="popup-buttons">
  135. <view class="popup-btn cancel-btn" @click="cancelAddSkill">取消</view>
  136. <view class="popup-btn confirm-btn" @click="confirmAddSkill">确定</view>
  137. </view>
  138. </view>
  139. </u-popup>
  140. </view>
  141. </template>
  142. <script>
  143. var id=''
  144. export default {
  145. data() {
  146. return {
  147. statusBarHeight: 0, // 状态栏高度
  148. showAddSkill: false,
  149. newSkillName: '',
  150. currentResumeIndex: 0,
  151. formData: {
  152. companyName: '',
  153. employmentTime: ['', ''],
  154. departmentIndex: 0,
  155. workContent: '',
  156. workPerformance: ''
  157. },
  158. employmentTimeIndex: [[0, 0], [0, 0]],
  159. yearMonthRange: [],
  160. departments:[
  161. "初中",
  162. "高中",
  163. "中专",
  164. "大专",
  165. "本科",
  166. "硕士",
  167. "博士",
  168. "博士后"
  169. ],
  170. isWork:false
  171. }
  172. },
  173. onLoad(options) {
  174. // 获取状态栏高度
  175. let systemInfo = uni.getSystemInfoSync();
  176. this.statusBarHeight = systemInfo.statusBarHeight || 0;
  177. // 接收从在线简历页面传递的业务类型参数
  178. id=options&&options.id?options.id:''
  179. if(id!=''&&id!=0)
  180. this.getData()
  181. this.initYearMonth();
  182. // 监听技能设置更新
  183. },
  184. beforeDestroy() {
  185. },
  186. computed: {
  187. },
  188. methods: {
  189. // 初始化年份-月份列表
  190. initYearMonth() {
  191. const years = []
  192. const months = []
  193. const currentDate = new Date()
  194. const currentYear = currentDate.getFullYear()
  195. const currentMonth = currentDate.getMonth() + 1
  196. for (let y = currentYear - 50; y <= currentYear + 5; y++) {
  197. years.push(y)
  198. }
  199. for (let m = 1; m <= 12; m++) {
  200. months.push(m < 10 ? '0' + m : '' + m)
  201. }
  202. this.yearMonthRange = [years, months]
  203. // 计算当前年月对应的索引
  204. const yearIndex = years.indexOf(currentYear)
  205. const monthIndex = months.indexOf(currentMonth < 10 ? '0' + currentMonth : '' + currentMonth)
  206. // 设置默认滚轮位置
  207. this.employmentTimeIndex = [
  208. [yearIndex, monthIndex],
  209. [yearIndex, monthIndex]
  210. ]
  211. },
  212. onStartChange(e) {
  213. const [yIndex, mIndex] = e.detail.value
  214. this.employmentTimeIndex[0] = e.detail.value
  215. this.$set(this.formData.employmentTime, 0, `${this.yearMonthRange[0][yIndex]}-${this.yearMonthRange[1][mIndex]}`)
  216. // 如果结束年月已选择,检查是否小于开始年月
  217. if (this.formData.employmentTime[1]) {
  218. const [endYear, endMonth] = this.formData.employmentTime[1].split('-').map(Number)
  219. const startYear = this.yearMonthRange[0][yIndex]
  220. const startMonth = Number(this.yearMonthRange[1][mIndex])
  221. if (endYear < startYear || (endYear === startYear && endMonth < startMonth)) {
  222. // 如果结束年月小于开始年月,清空结束年月
  223. this.$set(this.formData.employmentTime, 1, '')
  224. this.employmentTimeIndex[1] = [yIndex, mIndex] // 重置 picker 滚轮到开始年月
  225. }
  226. }
  227. },
  228. onEndClick(){
  229. if (!this.formData.employmentTime[0]) {
  230. uni.showToast({ title: '请先选择开始年月', icon: 'none' })
  231. return
  232. }
  233. },
  234. onEndChange(e) {
  235. if (!this.formData.employmentTime[0]) {
  236. uni.showToast({ title: '请先选择开始年月', icon: 'none' })
  237. return
  238. }
  239. const [yIndex, mIndex] = e.detail.value
  240. const startDate = this.formData.employmentTime[0].split('-').map(Number)
  241. const startYear = startDate[0]
  242. const startMonth = startDate[1]
  243. const selectedYear = this.yearMonthRange[0][yIndex]
  244. const selectedMonth = Number(this.yearMonthRange[1][mIndex])
  245. // 校验结束年月是否小于开始年月
  246. if (selectedYear < startYear || (selectedYear === startYear && selectedMonth < startMonth)) {
  247. uni.showToast({ title: '结束年月不能小于开始年月', icon: 'none' })
  248. return
  249. }
  250. this.employmentTimeIndex[1] = e.detail.value
  251. this.$set(this.formData.employmentTime, 1, `${selectedYear}-${this.yearMonthRange[1][mIndex]}`)
  252. },
  253. goBack() {
  254. uni.navigateBack()
  255. },
  256. getData(){
  257. var that=this
  258. this.$Request.getT("/app/userFirst/selectEdu", {eduId:id}).then((res) => {
  259. if (res.code == 0) {
  260. res=res.data
  261. that.formData.companyName= res.school
  262. that.formData.employmentTime= [res.startTime ? res.startTime.slice(0, 7) : '',res.endTime ? res.endTime.slice(0, 7) : '']
  263. that.formData.departmentIndex= that.departments.indexOf(res.degree)<=0?0:that.departments.indexOf(res.degree)
  264. that.formData.workContent= res.detail
  265. that.formData.workPerformance= res.profession
  266. } else {
  267. uni.showToast({
  268. title: res.msg,
  269. icon: "none",
  270. });
  271. }
  272. });
  273. },
  274. selectDepartment(e){
  275. this.formData.departmentIndex=e.detail.value
  276. },
  277. formatter(type, value) {
  278. if (type === 'year') {
  279. return `${value}年`
  280. }
  281. if (type === 'month') {
  282. return `${value}月`
  283. }
  284. if (type === 'day') {
  285. return `${value}日`
  286. }
  287. return value
  288. },
  289. saveWorkExperience() {
  290. console.log(this.formData.resumes)
  291. if (!this.formData.companyName) {
  292. uni.showToast({ title: "请输入学校名称", icon: "none" });
  293. return;
  294. }
  295. if (this.formData.employmentTime.length<=0) {
  296. uni.showToast({ title: "请选择在校时间", icon: "none" });
  297. return;
  298. }
  299. let data={
  300. eduId:id,
  301. school:this.formData.companyName,
  302. profession:this.formData.workPerformance,
  303. startTime:this.formData.employmentTime.length<=0?'':this.formData.employmentTime[0] + '-' + '01',
  304. endTime:this.formData.employmentTime.length<=0?'':this.formData.employmentTime[1] + '-' + '01',
  305. degree:this.departments[this.formData.departmentIndex],
  306. detail:this.formData.workContent
  307. }
  308. if(this.isWork)
  309. return
  310. this.isWork=true
  311. uni.showLoading({ title: "提交中..." });
  312. this.$Request.postJson("/app/userFirst/addEdu", data).then((res) => {
  313. uni.hideLoading();
  314. this.isWork=false
  315. this.formData.companyName=''
  316. if (res.code == 0) {
  317. uni.showToast({ title: "保存成功", icon: "none" });
  318. // 实际开发中可以在这里添加跳转逻辑
  319. uni.$emit('updateResume')
  320. setTimeout(() => {
  321. uni.navigateBack()
  322. }, 1000);
  323. } else {
  324. uni.showToast({
  325. title: res.msg,
  326. icon: "none",
  327. });
  328. }
  329. });
  330. },
  331. }
  332. }
  333. </script>
  334. <style lang="scss" scoped>
  335. .work-experience {
  336. min-height: 100vh;
  337. padding-bottom: 120rpx;
  338. display: flex;
  339. flex-direction: column;
  340. }
  341. .custom-navbar {
  342. // position: fixed;
  343. // top: 0;
  344. // left: 0;
  345. // right: 0;
  346. // padding-top: 80rpx;
  347. background-color: #ffffff;
  348. // z-index: 9999;
  349. .navbar-content {
  350. display: flex;
  351. align-items: center;
  352. justify-content: space-between;
  353. height: 88rpx;
  354. padding-left: 40rpx;
  355. padding-right: 40rpx;
  356. box-sizing: border-box;
  357. .nav-left, .nav-right {
  358. width: 60rpx;
  359. height: 60rpx;
  360. display: flex;
  361. align-items: center;
  362. justify-content: center;
  363. }
  364. .nav-title {
  365. color: rgba(51, 51, 51, 1);
  366. font-family: DM Sans;
  367. font-size: 36rpx;
  368. font-weight: 700;
  369. // line-height: 26px;
  370. letter-spacing: 0px;
  371. text-align: center;
  372. }
  373. }
  374. }
  375. .main-content {
  376. margin-top: 68rpx;
  377. padding: 0 20rpx 40rpx 20rpx;
  378. overflow: auto;
  379. flex: 1;
  380. }
  381. .form-section {
  382. background: #fff;
  383. border-radius: 16rpx;
  384. padding: 0rpx 10rpx;
  385. .section-title {
  386. color: rgba(23, 23, 37, 1);
  387. font-family: Inter;
  388. font-size: 32rpx;
  389. font-weight: 600;
  390. line-height: 48rpx;
  391. letter-spacing: 0%;
  392. text-align: left;
  393. padding: 16rpx 0 32rpx 0;
  394. }
  395. }
  396. .form-item {
  397. margin-bottom: 30rpx;
  398. .form-label {
  399. color: rgba(31, 44, 55, 1);
  400. font-family: DM Sans;
  401. font-size: 16px;
  402. font-weight: 500;
  403. line-height: 22px;
  404. letter-spacing: 0%;
  405. text-align: left;
  406. margin-bottom: 20rpx;
  407. .required-mark {
  408. color: #FF3B30;
  409. font-size: 18px;
  410. font-weight: 500;
  411. margin-right: 4rpx;
  412. }
  413. .label-text {
  414. color: rgba(31, 44, 55, 1);
  415. font-family: DM Sans;
  416. font-size: 16px;
  417. font-weight: 500;
  418. line-height: 22px;
  419. letter-spacing: 0%;
  420. text-align: left;
  421. }
  422. }
  423. .form-input {
  424. width: 100%;
  425. min-height: 80rpx;
  426. padding: 0 40rpx;
  427. border: 1px solid rgba(227, 231, 236, 1);
  428. border-radius: 24px;
  429. background: rgba(255, 255, 255, 1);
  430. display: flex;
  431. align-items: center;
  432. justify-content: space-between;
  433. .placeholder {
  434. color: #999999;
  435. }
  436. picker{
  437. width: 100%;
  438. } textarea{
  439. width: 100%;
  440. padding: 20rpx 0;
  441. height: fit-content;
  442. min-height: 40rpx;
  443. }
  444. }
  445. }
  446. /* 时间选择器样式 */
  447. .time-range {
  448. display: flex;
  449. align-items: center;
  450. justify-content: space-between;
  451. }
  452. .time-input {
  453. flex: 1;
  454. display: flex;
  455. align-items: center;
  456. justify-content: space-between;
  457. // border-bottom: 1rpx solid #E5E5EA;
  458. // padding-bottom: 10rpx;
  459. text-align: center;
  460. }
  461. .time-input:first-child {
  462. margin-right: 20rpx;
  463. }
  464. .time-input:last-child {
  465. margin-left: 20rpx;
  466. }
  467. .time-separator {
  468. font-size: 28rpx;
  469. color: #666;
  470. }
  471. /* 调整日期选择器输入框样式 */
  472. .time-input /deep/ .uni-datetime-picker__input {
  473. width: 100%;
  474. font-size: 28rpx;
  475. color: #333;
  476. }
  477. .time-input /deep/ .uni-datetime-picker__placeholder {
  478. color: #999;
  479. font-size: 28rpx;
  480. }
  481. .skills-input-container {
  482. width: 100%;
  483. min-height: 80rpx;
  484. padding: 0rpx 40rpx;
  485. border: 1px solid rgba(227, 231, 236, 1);
  486. border-radius: 32px;
  487. background: rgba(255, 255, 255, 1);
  488. display: flex;
  489. align-items: center;
  490. justify-content: space-between;
  491. .skills-tags {
  492. display: flex;
  493. flex-wrap: wrap;
  494. gap: 12rpx;
  495. flex: 1;
  496. .skill-tag {
  497. padding: 8rpx 16rpx;
  498. background: #F5F5F5;
  499. border-radius: 8rpx;
  500. display: flex;
  501. align-items: center;
  502. gap: 8rpx;
  503. text {
  504. font-size: 24rpx;
  505. color: #666666;
  506. }
  507. }
  508. }
  509. .add-skill-btn {
  510. width: 40rpx;
  511. height: 40rpx;
  512. border: 1rpx solid rgba(102, 102, 102, 1);
  513. border-radius: 8rpx;
  514. display: flex;
  515. align-items: center;
  516. justify-content: center;
  517. background: #fff;
  518. flex-shrink: 0;
  519. }
  520. }
  521. .add-resume-btn {
  522. width: 100%;
  523. height: 80rpx;
  524. border: 1rpx solid #007AFF;
  525. border-radius: 60rpx;
  526. display: flex;
  527. align-items: center;
  528. justify-content: center;
  529. margin-top: 20rpx;
  530. text {
  531. color: #007AFF;
  532. font-size: 28rpx;
  533. font-weight: 500;
  534. }
  535. }
  536. .bottom-btn-container {
  537. position: fixed;
  538. bottom: 0;
  539. left: 0;
  540. right: 0;
  541. padding: 30rpx 20rpx;
  542. background: #fff;
  543. border-top: 1px solid #f0f0f0;
  544. z-index: 98;
  545. }
  546. .save-btn {
  547. width: 100%;
  548. height: 88rpx;
  549. background: linear-gradient(90deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
  550. border-radius: 44rpx;
  551. display: flex;
  552. align-items: center;
  553. justify-content: center;
  554. text {
  555. font-size: 32rpx;
  556. font-weight: 600;
  557. color: #fff;
  558. }
  559. }
  560. .add-skill-popup {
  561. background: #fff;
  562. border-radius: 24rpx;
  563. padding: 40rpx;
  564. .popup-title {
  565. color: rgba(34, 37, 42, 1);
  566. font-size: 36rpx;
  567. font-weight: 500;
  568. text-align: center;
  569. margin-bottom: 30rpx;
  570. }
  571. .popup-content {
  572. margin-bottom: 30rpx;
  573. .skill-input {
  574. width: 100%;
  575. height: 80rpx;
  576. padding: 0 20rpx;
  577. border: 1rpx solid #E5E5EA;
  578. border-radius: 12rpx;
  579. font-size: 28rpx;
  580. color: rgba(34, 37, 42, 1);
  581. background: #F7F8FA;
  582. }
  583. }
  584. .popup-buttons {
  585. display: flex;
  586. gap: 20rpx;
  587. .popup-btn {
  588. flex: 1;
  589. height: 80rpx;
  590. border-radius: 12rpx;
  591. display: flex;
  592. align-items: center;
  593. justify-content: center;
  594. font-size: 28rpx;
  595. font-weight: 500;
  596. }
  597. .cancel-btn {
  598. background: #F7F8FA;
  599. color: rgba(102, 102, 102, 1);
  600. }
  601. .confirm-btn {
  602. background: #007AFF;
  603. color: #fff;
  604. }
  605. }
  606. }
  607. .checkbox-container {
  608. display: flex;
  609. flex-wrap: nowrap;
  610. gap: 10rpx;
  611. /deep/ .u-checkbox-group {
  612. display: flex;
  613. flex-wrap: nowrap;
  614. width: 100%;
  615. }
  616. /deep/ .u-checkbox {
  617. flex: 1;
  618. min-width: 0;
  619. margin-right: 0;
  620. }
  621. /deep/ .u-checkbox__label {
  622. color: var(--Grayscale/Grayscale 100, rgba(23, 23, 37, 1));
  623. font-family: DM Sans;
  624. font-size: 24rpx;
  625. font-weight: 400;
  626. line-height: 48rpx;
  627. letter-spacing: 0%;
  628. text-align: left;
  629. }
  630. }
  631. </style>