educationExperience.vue 17 KB

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