educationExperience.vue 17 KB

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