educationExperience.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  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. const times = this.formData.employmentTime.filter(time => {
  296. if (time) {
  297. return time
  298. }
  299. })
  300. if (times.length <= 0) {
  301. uni.showToast({ title: "请选择在校时间", icon: "none" });
  302. return;
  303. }
  304. if (times.length < 2) {
  305. uni.showToast({ title: "请完善在校时间", icon: "none" });
  306. return
  307. }
  308. let data={
  309. eduId:id,
  310. school:this.formData.companyName,
  311. profession:this.formData.workPerformance,
  312. startTime:this.formData.employmentTime.length<=0?'':this.formData.employmentTime[0] + '-' + '01',
  313. endTime:this.formData.employmentTime.length<=0?'':this.formData.employmentTime[1] + '-' + '01',
  314. degree:this.departments[this.formData.departmentIndex],
  315. detail:this.formData.workContent
  316. }
  317. if(this.isWork)
  318. return
  319. this.isWork=true
  320. uni.showLoading({ title: "提交中..." });
  321. this.$Request.postJson("/app/userFirst/addEdu", data).then((res) => {
  322. uni.hideLoading();
  323. this.isWork=false
  324. this.formData.companyName=''
  325. if (res.code == 0) {
  326. uni.showToast({ title: "保存成功", icon: "none" });
  327. // 实际开发中可以在这里添加跳转逻辑
  328. uni.$emit('updateResume')
  329. setTimeout(() => {
  330. uni.navigateBack()
  331. }, 1000);
  332. } else {
  333. uni.showToast({
  334. title: res.msg,
  335. icon: "none",
  336. });
  337. }
  338. });
  339. },
  340. }
  341. }
  342. </script>
  343. <style lang="scss" scoped>
  344. .work-experience {
  345. min-height: 100vh;
  346. padding-bottom: 120rpx;
  347. display: flex;
  348. flex-direction: column;
  349. }
  350. .custom-navbar {
  351. // position: fixed;
  352. // top: 0;
  353. // left: 0;
  354. // right: 0;
  355. // padding-top: 80rpx;
  356. background-color: #ffffff;
  357. // z-index: 9999;
  358. .navbar-content {
  359. display: flex;
  360. align-items: center;
  361. justify-content: space-between;
  362. height: 88rpx;
  363. padding-left: 40rpx;
  364. padding-right: 40rpx;
  365. box-sizing: border-box;
  366. .nav-left, .nav-right {
  367. width: 60rpx;
  368. height: 60rpx;
  369. display: flex;
  370. align-items: center;
  371. justify-content: center;
  372. }
  373. .nav-title {
  374. color: rgba(51, 51, 51, 1);
  375. font-family: DM Sans;
  376. font-size: 36rpx;
  377. font-weight: 700;
  378. // line-height: 26px;
  379. letter-spacing: 0px;
  380. text-align: center;
  381. }
  382. }
  383. }
  384. .main-content {
  385. margin-top: 68rpx;
  386. padding: 0 20rpx 40rpx 20rpx;
  387. overflow: auto;
  388. flex: 1;
  389. }
  390. .form-section {
  391. background: #fff;
  392. border-radius: 16rpx;
  393. padding: 0rpx 10rpx;
  394. .section-title {
  395. color: rgba(23, 23, 37, 1);
  396. font-family: Inter;
  397. font-size: 32rpx;
  398. font-weight: 600;
  399. line-height: 48rpx;
  400. letter-spacing: 0%;
  401. text-align: left;
  402. padding: 16rpx 0 32rpx 0;
  403. }
  404. }
  405. .form-item {
  406. margin-bottom: 30rpx;
  407. .form-label {
  408. color: rgba(31, 44, 55, 1);
  409. font-family: DM Sans;
  410. font-size: 16px;
  411. font-weight: 500;
  412. line-height: 22px;
  413. letter-spacing: 0%;
  414. text-align: left;
  415. margin-bottom: 20rpx;
  416. .required-mark {
  417. color: #FF3B30;
  418. font-size: 18px;
  419. font-weight: 500;
  420. margin-right: 4rpx;
  421. }
  422. .label-text {
  423. color: rgba(31, 44, 55, 1);
  424. font-family: DM Sans;
  425. font-size: 16px;
  426. font-weight: 500;
  427. line-height: 22px;
  428. letter-spacing: 0%;
  429. text-align: left;
  430. }
  431. }
  432. .form-input {
  433. width: 100%;
  434. min-height: 80rpx;
  435. padding: 0 40rpx;
  436. border: 1px solid rgba(227, 231, 236, 1);
  437. border-radius: 24px;
  438. background: rgba(255, 255, 255, 1);
  439. display: flex;
  440. align-items: center;
  441. justify-content: space-between;
  442. .placeholder {
  443. color: #999999;
  444. }
  445. picker{
  446. width: 100%;
  447. } textarea{
  448. width: 100%;
  449. padding: 20rpx 0;
  450. height: fit-content;
  451. min-height: 40rpx;
  452. }
  453. }
  454. }
  455. /* 时间选择器样式 */
  456. .time-range {
  457. display: flex;
  458. align-items: center;
  459. justify-content: space-between;
  460. }
  461. .time-input {
  462. flex: 1;
  463. display: flex;
  464. align-items: center;
  465. justify-content: space-between;
  466. // border-bottom: 1rpx solid #E5E5EA;
  467. // padding-bottom: 10rpx;
  468. text-align: center;
  469. }
  470. .time-input:first-child {
  471. margin-right: 20rpx;
  472. }
  473. .time-input:last-child {
  474. margin-left: 20rpx;
  475. }
  476. .time-separator {
  477. font-size: 28rpx;
  478. color: #666;
  479. }
  480. /* 调整日期选择器输入框样式 */
  481. .time-input /deep/ .uni-datetime-picker__input {
  482. width: 100%;
  483. font-size: 28rpx;
  484. color: #333;
  485. }
  486. .time-input /deep/ .uni-datetime-picker__placeholder {
  487. color: #999;
  488. font-size: 28rpx;
  489. }
  490. .skills-input-container {
  491. width: 100%;
  492. min-height: 80rpx;
  493. padding: 0rpx 40rpx;
  494. border: 1px solid rgba(227, 231, 236, 1);
  495. border-radius: 32px;
  496. background: rgba(255, 255, 255, 1);
  497. display: flex;
  498. align-items: center;
  499. justify-content: space-between;
  500. .skills-tags {
  501. display: flex;
  502. flex-wrap: wrap;
  503. gap: 12rpx;
  504. flex: 1;
  505. .skill-tag {
  506. padding: 8rpx 16rpx;
  507. background: #F5F5F5;
  508. border-radius: 8rpx;
  509. display: flex;
  510. align-items: center;
  511. gap: 8rpx;
  512. text {
  513. font-size: 24rpx;
  514. color: #666666;
  515. }
  516. }
  517. }
  518. .add-skill-btn {
  519. width: 40rpx;
  520. height: 40rpx;
  521. border: 1rpx solid rgba(102, 102, 102, 1);
  522. border-radius: 8rpx;
  523. display: flex;
  524. align-items: center;
  525. justify-content: center;
  526. background: #fff;
  527. flex-shrink: 0;
  528. }
  529. }
  530. .add-resume-btn {
  531. width: 100%;
  532. height: 80rpx;
  533. border: 1rpx solid #007AFF;
  534. border-radius: 60rpx;
  535. display: flex;
  536. align-items: center;
  537. justify-content: center;
  538. margin-top: 20rpx;
  539. text {
  540. color: #007AFF;
  541. font-size: 28rpx;
  542. font-weight: 500;
  543. }
  544. }
  545. .bottom-btn-container {
  546. position: fixed;
  547. bottom: 0;
  548. left: 0;
  549. right: 0;
  550. padding: 30rpx 20rpx;
  551. background: #fff;
  552. border-top: 1px solid #f0f0f0;
  553. z-index: 98;
  554. }
  555. .save-btn {
  556. width: 100%;
  557. height: 88rpx;
  558. background: linear-gradient(90deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
  559. border-radius: 44rpx;
  560. display: flex;
  561. align-items: center;
  562. justify-content: center;
  563. text {
  564. font-size: 32rpx;
  565. font-weight: 600;
  566. color: #fff;
  567. }
  568. }
  569. .add-skill-popup {
  570. background: #fff;
  571. border-radius: 24rpx;
  572. padding: 40rpx;
  573. .popup-title {
  574. color: rgba(34, 37, 42, 1);
  575. font-size: 36rpx;
  576. font-weight: 500;
  577. text-align: center;
  578. margin-bottom: 30rpx;
  579. }
  580. .popup-content {
  581. margin-bottom: 30rpx;
  582. .skill-input {
  583. width: 100%;
  584. height: 80rpx;
  585. padding: 0 20rpx;
  586. border: 1rpx solid #E5E5EA;
  587. border-radius: 12rpx;
  588. font-size: 28rpx;
  589. color: rgba(34, 37, 42, 1);
  590. background: #F7F8FA;
  591. }
  592. }
  593. .popup-buttons {
  594. display: flex;
  595. gap: 20rpx;
  596. .popup-btn {
  597. flex: 1;
  598. height: 80rpx;
  599. border-radius: 12rpx;
  600. display: flex;
  601. align-items: center;
  602. justify-content: center;
  603. font-size: 28rpx;
  604. font-weight: 500;
  605. }
  606. .cancel-btn {
  607. background: #F7F8FA;
  608. color: rgba(102, 102, 102, 1);
  609. }
  610. .confirm-btn {
  611. background: #007AFF;
  612. color: #fff;
  613. }
  614. }
  615. }
  616. .checkbox-container {
  617. display: flex;
  618. flex-wrap: nowrap;
  619. gap: 10rpx;
  620. /deep/ .u-checkbox-group {
  621. display: flex;
  622. flex-wrap: nowrap;
  623. width: 100%;
  624. }
  625. /deep/ .u-checkbox {
  626. flex: 1;
  627. min-width: 0;
  628. margin-right: 0;
  629. }
  630. /deep/ .u-checkbox__label {
  631. color: var(--Grayscale/Grayscale 100, rgba(23, 23, 37, 1));
  632. font-family: DM Sans;
  633. font-size: 24rpx;
  634. font-weight: 400;
  635. line-height: 48rpx;
  636. letter-spacing: 0%;
  637. text-align: left;
  638. }
  639. }
  640. </style>