workExperience.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119
  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">工作经历</view>
  10. <view class="nav-right"></view>
  11. </view>
  12. </view>
  13. <!-- 主要内容 -->
  14. <view class="main-content">
  15. <!-- 公司信息 -->
  16. <view class="form-section">
  17. <!-- 公司名称 -->
  18. <view class="form-item">
  19. <view class="form-label">
  20. <text class="required-mark">*</text>
  21. <text class="label-text">公司名称</text>
  22. </view>
  23. <view class="form-input">
  24. <input v-model="formData.companyName" placeholder="请填写公司名称" maxlength="50" />
  25. <u-icon v-if="formData.companyName" name="close-circle-fill" color="#C9CDD4" size="28"
  26. @click="formData.companyName = ''" class="clear-icon"></u-icon>
  27. </view>
  28. </view>
  29. <!-- 公司业务类型 -->
  30. <view class="form-item">
  31. <view class="form-label" style="margin-bottom: 20rpx;">
  32. <text class="required-mark">*</text>
  33. <text class="label-text">公司业务类型</text>
  34. </view>
  35. <view class="checkbox-container">
  36. <u-checkbox-group @change="checkboxGroupChange" :wrap="false" shape="square"
  37. active-color="#007AFF">
  38. <u-checkbox v-for="(option, index) in businessTypeOptions" :key="index" :name="option.value"
  39. v-model="option.checked" class="checkbox-item">
  40. {{ option.label }}
  41. </u-checkbox>
  42. </u-checkbox-group>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 岗位履历 -->
  47. <view class="form-section" v-for="(resume, index) in formData.resumes" :key="index">
  48. <!-- <view class="section-title" v-if="hasCrossBorderExperience"><text>岗位履历 ({{ index + 1 }})</text> -->
  49. <view class="section-title"><text>岗位履历 ({{ index + 1 }})</text>
  50. <image src="@/static/images/index/delete.svg" style="width: 40rpx;height: 40rpx;"
  51. @click="deleteResume(index)" v-if="formData.resumes && formData.resumes.length > 1" />
  52. </view>
  53. <!-- 任职时间 -->
  54. <view class="form-item">
  55. <view class="form-label">
  56. <text class="required-mark">*</text>
  57. <text class="label-text">在职时间</text>
  58. </view>
  59. <view class="form-input time-range">
  60. <view class="time-input" @click="handleSelectDate(index, 'start', resume.employmentTime[0])">
  61. {{ resume.employmentTime[0] || '开始时间' }}
  62. <!-- <uni-datetime-picker v-model="resume.employmentTime[0]" type="date"
  63. :border="false" placeholder="开始时间" /> -->
  64. <!-- <image src="../../static/images/index/Iconly_Light_Calendar.svg"
  65. style="width: 48rpx; height: 48rpx;" mode="aspectFit"></image> -->
  66. </view>
  67. <view class="time-separator">至</view>
  68. <view class="time-input" @click="handleSelectDate(index, 'end', resume.employmentTime[1])">
  69. {{ resume.employmentTime[1] || '结束时间' }}
  70. <!-- <uni-datetime-picker v-model="resume.employmentTime[1]" type="date"
  71. :border="false" placeholder="结束时间" /> -->
  72. </view>
  73. <image src="../../static/images/index/Iconly_Light_Calendar.svg"
  74. style="width: 48rpx; height: 48rpx;" mode="aspectFit"></image>
  75. </view>
  76. </view>
  77. <!-- 所在部门 -->
  78. <!-- <view class="form-item">
  79. <view class="form-label">
  80. <text class="required-mark">*</text>
  81. <text class="label-text">所在部门</text>
  82. </view>
  83. <view class="form-input">
  84. <picker class="picker" :data-index="index" mode="selector" :range="departments"
  85. @change="selectDepartment">
  86. <text>{{ departments.length > 0 ? departments[resume.departmentIndex] : '请选择部门' }}</text>
  87. </picker>
  88. <u-icon name="arrow-down" color="#999" size="36"></u-icon>
  89. </view>
  90. </view> -->
  91. <!-- 岗位 -->
  92. <view class="form-item">
  93. <view class="form-label">
  94. <text class="required-mark">*</text>
  95. <text class="label-text">岗位</text>
  96. </view>
  97. <view class="form-input" @click="selectPosition(index)">
  98. <text v-if="resume.position">{{ resume.position }}</text>
  99. <text v-else class="placeholder">请选择岗位</text>
  100. <u-icon name="arrow-right" color="#999" size="36"></u-icon>
  101. </view>
  102. </view>
  103. <!-- 岗位职级 -->
  104. <!-- <view class="form-item">
  105. <view class="form-label">岗位职级</view>
  106. <view class="form-input">
  107. <picker class="picker" :data-index="index" mode="selector" :range="positionLevels"
  108. @change="selectPositionLevel">
  109. <text>{{ resume.positionLevel || '请选择' }}</text>
  110. </picker>
  111. <u-icon name="arrow-down" color="#999" size="36"></u-icon>
  112. </view>
  113. </view> -->
  114. <!-- 岗位职业技能 -->
  115. <view class="form-item">
  116. <view class="form-label">
  117. <text class="required-mark">*</text>
  118. <text class="label-text">跨境职业技能</text>
  119. </view>
  120. <view class="skills-input-container">
  121. <view class="skills-tags">
  122. <view v-for="(skill, skillIndex) in resume.skills" :key="skillIndex" class="skill-tag">
  123. <text>{{ skill }}</text>
  124. <u-icon name="close" color="#999" size="16"
  125. @click="removeSkill(index, skillIndex)"></u-icon>
  126. </view>
  127. </view>
  128. <view class="add-skill-btn" @click="addSkill(index)">
  129. <u-icon name="plus" color="rgba(102, 102, 102, 1)" size="28"></u-icon>
  130. </view>
  131. </view>
  132. </view>
  133. <!-- 工作内容 -->
  134. <view class="form-item">
  135. <view class="form-label">
  136. <text class="required-mark">*</text>
  137. <text class="label-text">工作内容</text>
  138. </view>
  139. <view class="form-input">
  140. <textarea v-model="resume.workContent" placeholder="请输入工作内容" auto-height
  141. @input="handleTextareaInput($event, 'workContent', index)" class="form-textarea"></textarea>
  142. <view class="textarea-clear" v-if="resume.workContent"
  143. @click="clearTextarea('workContent', index)">
  144. <u-icon name="close-circle-fill" color="#C9CDD4" size="28"></u-icon>
  145. </view>
  146. </view>
  147. </view>
  148. <!-- 工作业绩 -->
  149. <view class="form-item">
  150. <view class="form-label">工作业绩</view>
  151. <view class="form-input">
  152. <textarea v-model="resume.workPerformance" placeholder="请输入工作绩效" auto-height
  153. @input="handleTextareaInput($event, 'workPerformance', index)"
  154. class="form-textarea"></textarea>
  155. <view class="textarea-clear" v-if="resume.workPerformance"
  156. @click="clearTextarea('workPerformance', index)">
  157. <u-icon name="close-circle-fill" color="#C9CDD4" size="28"></u-icon>
  158. </view>
  159. </view>
  160. </view>
  161. <!-- 添加岗位履历按钮 -->
  162. <view class="add-resume-btn" @click="addResume"
  163. v-if="index === formData.resumes.length - 1">
  164. <text>添加岗位履历</text>
  165. </view>
  166. </view>
  167. <!-- 删除工作经历 -->
  168. <view class="delete-experience" v-if="isEdit" @click="handleDeleteExp">删除全部工作经验</view>
  169. <!-- 底部保存按钮 -->
  170. <view class="fixed-section">
  171. <u-button type="primary" class="submit-btn" @click="saveWorkExperience">保存</u-button>
  172. </view>
  173. </view>
  174. <!-- 添加技能弹窗 -->
  175. <u-popup v-model="showAddSkill" mode="center" border-radius="24" width="80%">
  176. <view class="add-skill-popup">
  177. <view class="popup-title">添加技能</view>
  178. <view class="popup-content">
  179. <input v-model="newSkillName" placeholder="请输入技能名称" class="skill-input" maxlength="10" />
  180. </view>
  181. <view class="popup-buttons">
  182. <view class="popup-btn cancel-btn" @click="cancelAddSkill">取消</view>
  183. <view class="popup-btn confirm-btn" @click="confirmAddSkill">确定</view>
  184. </view>
  185. </view>
  186. </u-popup>
  187. <!-- 清除确认弹窗 -->
  188. <u-modal v-model="showClearConfirm" :content="'确定要清除所有填写的内容吗?'" show-cancel-button confirm-text="确定清除"
  189. cancel-text="取消" @confirm="clearAllContent" confirm-color="#FF4444"></u-modal>
  190. <!-- 时间控件弹窗 -->
  191. <u-select v-model="showSelectDate" :default-value="defaultDate" :list="dateList" @confirm="handleConfirmDate"></u-select>
  192. </view>
  193. </template>
  194. <script>
  195. var id = '';
  196. export default {
  197. data() {
  198. return {
  199. statusBarHeight: 0, // 状态栏高度
  200. showAddSkill: false,
  201. newSkillName: '',
  202. currentResumeIndex: 0,
  203. showClearConfirm: false, // 清除确认弹窗
  204. businessTypeOptions: [{
  205. label: '跨境电商',
  206. value: '0',
  207. checked: false
  208. },
  209. {
  210. label: '国内电商',
  211. value: '1',
  212. checked: false
  213. },
  214. {
  215. label: '外贸',
  216. value: '2',
  217. checked: false
  218. },
  219. {
  220. label: '其他',
  221. value: '3',
  222. checked: false
  223. }
  224. ],
  225. formData: {
  226. companyName: '',
  227. businessTypes: [],
  228. resumes: [{
  229. workExpDetailId: "",
  230. workExpId: "",
  231. employmentTime: [],
  232. department: '',
  233. departmentId: 0,
  234. departmentIndex: 0,
  235. position: '',
  236. positionId: 0,
  237. positionLevel: '初级',
  238. skills: [],
  239. workContent: '',
  240. workPerformance: ''
  241. }]
  242. },
  243. departments: [],
  244. departmentsIds: [],
  245. positionLevels: ['初级', '中级','高级','资深','其它'],
  246. operateKey: 0,
  247. isWork: false,
  248. isEdit: false, // 是否是编辑
  249. showSelectDate: false,
  250. selectParams: {
  251. index: 0,
  252. type: 'start', // start、end
  253. },
  254. currentDate: '', // 当前时间,记录选中的时间,用于u-select控件回显
  255. dateList: []
  256. }
  257. },
  258. onLoad(options) {
  259. // 获取状态栏高度
  260. let systemInfo = uni.getSystemInfoSync();
  261. this.statusBarHeight = systemInfo.statusBarHeight || 0;
  262. // 接收从在线简历页面传递的业务类型参数
  263. if (options.businessTypes) {
  264. try {
  265. const businessTypes = JSON.parse(decodeURIComponent(options.businessTypes))
  266. this.formData.businessTypes = businessTypes
  267. console.log('接收到的业务类型:', businessTypes)
  268. // console.log('是否有跨境经验:', this.hasCrossBorderExperience)
  269. // if (this.hasCrossBorderExperience)
  270. // this.businessTypeOptions[0].checked = true
  271. } catch (e) {
  272. console.error('解析业务类型参数失败:', e)
  273. }
  274. }
  275. this.getDepartment()
  276. id = options && options.id ? options.id : ''
  277. if (options && options.id) {
  278. this.isEdit = true;
  279. }
  280. // 监听技能设置更新
  281. uni.$on('jobs', (data) => {
  282. console.log('岗位设置已更新:', data)
  283. // 这里可以更新对应的技能显示
  284. this.formData.resumes[this.operateKey].position = data.ruleClassifyName
  285. this.formData.resumes[this.operateKey].positionId = data.ruleClassifyId;
  286. // 更新以后给岗位职业技能设置默认值
  287. this.getDataInfo(this.formData.resumes[this.operateKey].positionId);
  288. })
  289. uni.$on('skillsUpdated', (data) => {
  290. console.log('技能设置已更新:', data)
  291. // 这里可以更新对应的技能显示
  292. this.formData.resumes[this.operateKey].skills = data.selectedTags
  293. })
  294. // 生成时间组件数据
  295. this.dateList = this.generateYearMonthArray()
  296. },
  297. beforeDestroy() {
  298. // 移除事件监听
  299. uni.$off('jobs')
  300. uni.$off('skillsUpdated')
  301. },
  302. computed: {
  303. hasCrossBorderExperience() {
  304. return this.formData.businessTypes.includes('0')
  305. },
  306. hasContentToClear() {
  307. // 检查是否有内容可以清除
  308. return this.formData.companyName ||
  309. this.formData.businessTypes.length > 0 ||
  310. this.formData.resumes.some(resume =>
  311. resume.position ||
  312. resume.workContent ||
  313. resume.workPerformance ||
  314. resume.skills.length > 0
  315. )
  316. },
  317. // 时间控件回显
  318. defaultDate() {
  319. let currentIndex = 0
  320. this.dateList.forEach((date, index) => {
  321. if (this.currentDate == date.value) {
  322. currentIndex = index
  323. }
  324. })
  325. return [currentIndex]
  326. }
  327. },
  328. methods: {
  329. // 生成时间控件列表数据
  330. generateYearMonthArray() {
  331. // 定义起始年份和月份
  332. const startYear = 1950;
  333. const startMonth = 1; // 1月
  334. // 获取当前日期
  335. const now = new Date();
  336. const endYear = now.getFullYear();
  337. const endMonth = now.getMonth() + 1; // 月份从0开始,所以要+1
  338. // 存储最终结果的数组
  339. const result = [];
  340. // 遍历年份,从起始年到当前年
  341. for (let year = startYear; year <= endYear; year++) {
  342. // 确定当前年份需要遍历的月份范围
  343. let currentEndMonth = 12; // 默认到12月
  344. // 如果是当前年份,只遍历到当前月份
  345. if (year === endYear) {
  346. currentEndMonth = endMonth;
  347. }
  348. // 遍历月份,从1月到当前年份的结束月份
  349. for (let month = startMonth; month <= currentEndMonth; month++) {
  350. // 格式化value:确保月份是两位数(如1月显示为01)
  351. const formattedMonth = month.toString().padStart(2, '0');
  352. const value = `${year}-${formattedMonth}`;
  353. // 格式化label:直接显示月份数字(如1月)
  354. const label = `${year}年 ${month}月`;
  355. // 添加到结果数组
  356. result.unshift({ value, label });
  357. }
  358. }
  359. // 添加“至今”选项
  360. result.unshift({
  361. value: '至今',
  362. label: '至今'
  363. })
  364. return result;
  365. },
  366. // 打开日期选择控件
  367. handleSelectDate(index, type, date) {
  368. this.selectParams.index = index;
  369. this.selectParams.type = type;
  370. this.currentDate = date;
  371. this.showSelectDate = true;
  372. },
  373. // 选择时间
  374. handleConfirmDate(data) {
  375. for (let i = 0; i < this.formData.resumes.length; i++) {
  376. if (i === this.selectParams.index) {
  377. if (this.selectParams.type == 'end') {
  378. this.formData.resumes[i].employmentTime[1] = data[0].value
  379. } else {
  380. this.formData.resumes[i].employmentTime[0] = data[0].value
  381. }
  382. break
  383. }
  384. }
  385. },
  386. getDataInfo(jobId) {
  387. let data = {
  388. ruleClassifyId: jobId
  389. }
  390. this.$Request.getT('/app/userFirst/getPostSkill', data).then(res => {
  391. if (res.code == 0) {
  392. if (res.data.length > 0 && res.data[0]?.childrenList[0]?.postSkillName)
  393. this.formData.resumes[this.operateKey].skills = []
  394. this.formData.resumes[this.operateKey].skills.push(res.data[0]?.childrenList[0]?.postSkillName)
  395. }
  396. })
  397. },
  398. goBack() {
  399. uni.navigateBack()
  400. },
  401. getDepartment() {
  402. var that = this
  403. this.$Request.postJson("/app/userFirst/getDepartment", {}).then((res) => {
  404. if (res.code == 0) {
  405. that.departments = that.$queue.array_column(res.data, 'departmentName')
  406. that.departmentsIds = that.$queue.array_column(res.data, 'departmentId')
  407. that.formData.resumes.forEach(function (item) {
  408. item.departmentId = that.departmentsIds[item.departmentIndex]
  409. item.department = that.departments[item.departmentIndex]
  410. })
  411. if (id != '' && id != 0)
  412. that.getData()
  413. } else {
  414. uni.showToast({
  415. title: res.msg,
  416. icon: "none",
  417. });
  418. }
  419. });
  420. },
  421. getData() {
  422. var that = this
  423. this.$Request.getT("/app/userFirst/getWorkExpDetailOne", {
  424. workExpId: id
  425. }).then((res) => {
  426. if (res.code == 0) {
  427. res = res.data
  428. that.formData.companyName = res.workExp.companyName
  429. that.formData.businessTypes = JSON.parse(res.workExp.type)
  430. // 设置公司业务类型回显
  431. if (this.formData.businessTypes?.length) {
  432. for (let i = 0; i < this.formData.businessTypes.length; i++) {
  433. for (let opt = 0; i < this.businessTypeOptions.length; opt++) {
  434. const option = this.businessTypeOptions[opt]
  435. if (this.formData.businessTypes[i] == option.value) {
  436. this.businessTypeOptions[opt].checked = true
  437. break
  438. }
  439. }
  440. }
  441. }
  442. console.log(that.formData.businessTypes)
  443. res.workExpDetails.forEach(function (item) {
  444. item.skills = JSON.parse(item.skills)
  445. item.employmentTime = item.startTime == '' ? [] : [item.startTime, item
  446. .endTime],
  447. item.departmentIndex = that.departmentsIds.indexOf(item.departmentId) < 0 ?
  448. 0 : that.departmentsIds.indexOf(item.departmentId)
  449. })
  450. that.formData.resumes = res.workExpDetails
  451. } else {
  452. uni.showToast({
  453. title: res.msg,
  454. icon: "none",
  455. });
  456. }
  457. });
  458. },
  459. // selectDepartment(e) {
  460. // var key = Number(e.currentTarget.dataset.index)
  461. // this.formData.resumes[key].departmentId = this.departmentsIds[e.detail.value]
  462. // this.formData.resumes[key].departmentIndex = e.detail.value
  463. // this.formData.resumes[key].department = this.departments[e.detail.value]
  464. // },
  465. formatter(type, value) {
  466. if (type === 'year') {
  467. return `${value}年`
  468. }
  469. if (type === 'month') {
  470. return `${value}月`
  471. }
  472. if (type === 'day') {
  473. return `${value}日`
  474. }
  475. return value
  476. },
  477. checkboxGroupChange(e) {
  478. console.log('选中的业务类型:', e)
  479. // 更新 formData.businessTypes 以保持数据同步
  480. this.formData.businessTypes = e
  481. },
  482. selectEmploymentTime(index) {
  483. // 选择任职时间
  484. uni.showToast({
  485. title: '选择任职时间',
  486. icon: 'none'
  487. })
  488. },
  489. selectPosition(index) {
  490. this.operateKey = index
  491. // 选择岗位
  492. uni.navigateTo({
  493. url: '/package/jobIntention/jobList'
  494. })
  495. },
  496. // selectPositionLevel(e) {
  497. // var key = Number(e.currentTarget.dataset.index)
  498. // this.formData.resumes[key].positionLevel = this.positionLevels[e.detail.value]
  499. // },
  500. addSkill(index) {
  501. this.operateKey = index
  502. //this.currentResumeIndex = index
  503. //this.showAddSkill = true
  504. //this.newSkillName = ''
  505. if (this.formData.resumes[index].positionId == '' || this.formData.resumes[index].positionId == 0)
  506. return this.$queue.showToast('请先选择岗位')
  507. uni.navigateTo({
  508. url: '/package/jobIntention/jobSkills?jobId=' + this.formData.resumes[index].positionId +
  509. '&jobTitle=' + this.formData.resumes[index].position + '&skill=' + encodeURIComponent(JSON
  510. .stringify(this.formData.resumes[index].skills))
  511. })
  512. },
  513. removeSkill(resumeIndex, skillIndex) {
  514. this.formData.resumes[resumeIndex].skills.splice(skillIndex, 1)
  515. },
  516. cancelAddSkill() {
  517. this.showAddSkill = false
  518. this.newSkillName = ''
  519. },
  520. confirmAddSkill() {
  521. if (this.newSkillName.trim()) {
  522. this.formData.resumes[this.currentResumeIndex].skills.push(this.newSkillName.trim())
  523. this.showAddSkill = false
  524. this.newSkillName = ''
  525. } else {
  526. uni.showToast({
  527. title: '请输入技能名称',
  528. icon: 'none'
  529. })
  530. }
  531. },
  532. selectWorkContent(index) {
  533. // 选择工作内容
  534. uni.showToast({
  535. title: '选择工作内容',
  536. icon: 'none'
  537. })
  538. },
  539. selectWorkPerformance(index) {
  540. // 选择工作业绩
  541. uni.showToast({
  542. title: '选择工作业绩',
  543. icon: 'none'
  544. })
  545. },
  546. addResume() {
  547. this.formData.resumes.push({
  548. workExpDetailId: "",
  549. workExpId: "",
  550. employmentTime: [],
  551. department: this.departments[0],
  552. departmentId: this.departmentsIds[0],
  553. departmentIndex: 0,
  554. position: '',
  555. positionId: 0,
  556. positionLevel: '初级',
  557. skills: [],
  558. workContent: '',
  559. workPerformance: ''
  560. })
  561. },
  562. deleteResume(index) {
  563. this.formData.resumes.splice(index, 1)
  564. },
  565. // 处理文本域输入
  566. handleTextareaInput(e, field, index) {
  567. const value = e.detail.value;
  568. // 如果超过1000字,截断
  569. if (value.length > 1000) {
  570. this.formData.resumes[index][field] = value.substring(0, 1000);
  571. }
  572. },
  573. // 清除单个文本域
  574. clearTextarea(field, index) {
  575. this.formData.resumes[index][field] = '';
  576. },
  577. // 显示清除确认弹窗
  578. showClearAllConfirm() {
  579. this.showClearConfirm = true;
  580. },
  581. // 清除所有内容
  582. clearAllContent() {
  583. // 清空公司名称
  584. this.formData.companyName = '';
  585. // 清空业务类型选择
  586. this.formData.businessTypes = [];
  587. this.businessTypeOptions.forEach(option => {
  588. option.checked = false;
  589. });
  590. // 清空所有履历
  591. this.formData.resumes = [{
  592. workExpDetailId: "",
  593. workExpId: "",
  594. employmentTime: [],
  595. department: this.departments.length > 0 ? this.departments[0] : '',
  596. departmentId: this.departmentsIds.length > 0 ? this.departmentsIds[0] : 0,
  597. departmentIndex: 0,
  598. position: '',
  599. positionId: 0,
  600. positionLevel: '初级',
  601. skills: [],
  602. workContent: '',
  603. workPerformance: ''
  604. }];
  605. this.showClearConfirm = false;
  606. uni.showToast({
  607. title: '已清除所有内容',
  608. icon: 'success'
  609. });
  610. },
  611. // 删除工作经历
  612. handleDeleteExp() {
  613. this.$queue.appConfirm('确定删除该工作经历吗?', (res) => {
  614. if (!res) {
  615. return;
  616. }
  617. this.$Request.postJson('/app/userFirst/deleteWorkExp', {
  618. workExpId: id
  619. }).then((res) => {
  620. if (res.code == 0) {
  621. uni.showToast({
  622. title: "操作成功",
  623. icon: "none"
  624. });
  625. // 实际开发中可以在这里添加跳转逻辑
  626. uni.$emit('updateResume')
  627. setTimeout(() => {
  628. uni.navigateBack()
  629. }, 1000);
  630. } else {
  631. uni.showToast({
  632. title: res.msg,
  633. icon: "none",
  634. });
  635. }
  636. });
  637. })
  638. },
  639. saveWorkExperience() {
  640. console.log(this.formData)
  641. if (!this.formData.companyName) {
  642. uni.showToast({
  643. title: "请输入公司名称",
  644. icon: "none"
  645. });
  646. return;
  647. }
  648. if (!this.formData?.businessTypes || this.formData?.businessTypes?.length <= 0) {
  649. uni.showToast({
  650. title: "请选择公司业务类型",
  651. icon: "none"
  652. });
  653. return;
  654. }
  655. if (this.formData.resumes.length <= 0) {
  656. uni.showToast({
  657. title: "请至少填写一份履历",
  658. icon: "none"
  659. });
  660. return;
  661. }
  662. for (let i = 0; i < this.formData.resumes.length; i++) {
  663. const item = this.formData.resumes[i];
  664. const timeArr = item.employmentTime.filter(time => {
  665. if (time) {
  666. return time
  667. }
  668. });
  669. if (timeArr.length <= 0) {
  670. this.$queue.showToast('任职时间不能为空')
  671. return false;
  672. }
  673. if (timeArr.length < 2) {
  674. this.$queue.showToast('请选择完整的任职时间')
  675. return false;
  676. }
  677. // 判断开始时间是否大于结束时间
  678. let startTime = ''
  679. let endTime = ''
  680. if (item.employmentTime.length == 2) {
  681. startTime = item.employmentTime[0].split(' ')[0]
  682. endTime = item.employmentTime[1].split(' ')[0]
  683. }
  684. if (startTime && endTime && startTime > endTime) {
  685. this.$queue.showToast('任职开始时间不能大于任职结束时间')
  686. return false;
  687. }
  688. if (item.position == '') {
  689. this.$queue.showToast('岗位不能为空')
  690. return false;
  691. }
  692. if (!item.skills || item.skills?.length <= 0) {
  693. this.$queue.showToast('岗位技能不能为空')
  694. return false;
  695. }
  696. if (!item.workContent) {
  697. this.$queue.showToast('请输入工作内容')
  698. return false;
  699. } else if (!item.workContent || item.workContent.length < 80) {
  700. this.$queue.showToast('工作内容至少输入80个字')
  701. return false;
  702. }
  703. }
  704. let postData = this.formData.resumes.map(({
  705. employmentTime,
  706. departmentIndex,
  707. ...rest
  708. }) => {
  709. return {
  710. ...rest,
  711. skills: JSON.stringify(rest.skills),
  712. startTime: employmentTime?.[0] || '',
  713. endTime: employmentTime?.[1] || ''
  714. }
  715. })
  716. // this.formData.resumes.forEach(function(item){
  717. // console.log(item.skills)
  718. // item.skills=JSON.stringify(item.skills);
  719. // console.log(item.skills)
  720. // item.startTime=item.employmentTime[0]?item.employmentTime[0]:'';
  721. // item.endTime=item.employmentTime[1]?item.employmentTime[1]:'';
  722. // delete item.employmentTime;
  723. // delete item.departmentIndex;
  724. // })
  725. let data = {
  726. workExp: {
  727. workExpId: id,
  728. companyName: this.formData.companyName,
  729. type: JSON.stringify(this.formData.businessTypes),
  730. },
  731. workExpDetails: postData
  732. }
  733. if (this.isWork)
  734. return
  735. this.isWork = true
  736. uni.showLoading({
  737. title: "提交中..."
  738. });
  739. this.$Request.postJson("/app/userFirst/addWorkExp", data).then((res) => {
  740. uni.hideLoading();
  741. this.isWork = false
  742. this.formData.companyName == ''
  743. if (res.code == 0) {
  744. uni.showToast({
  745. title: "保存成功",
  746. icon: "none"
  747. });
  748. // 实际开发中可以在这里添加跳转逻辑
  749. uni.$emit('updateResume')
  750. setTimeout(() => {
  751. uni.navigateBack()
  752. }, 1000);
  753. } else {
  754. uni.showToast({
  755. title: res.msg,
  756. icon: "none",
  757. });
  758. }
  759. });
  760. },
  761. }
  762. }
  763. </script>
  764. <style lang="scss" scoped>
  765. @import '@/common.scss';
  766. .work-experience {
  767. height: 100vh;
  768. padding-bottom: 172rpx;
  769. display: flex;
  770. flex-direction: column;
  771. }
  772. .custom-navbar {
  773. // position: fixed;
  774. // top: 0;
  775. // left: 0;
  776. // right: 0;
  777. background-color: #ffffff;
  778. // z-index: 9999;
  779. .navbar-content {
  780. display: flex;
  781. align-items: center;
  782. justify-content: space-between;
  783. height: 100%;
  784. padding: 0 40rpx;
  785. .nav-left,
  786. .nav-right {
  787. width: 60rpx;
  788. height: 60rpx;
  789. display: flex;
  790. align-items: center;
  791. justify-content: center;
  792. }
  793. .nav-title {
  794. color: rgba(51, 51, 51, 1);
  795. font-family: DM Sans;
  796. font-size: 36rpx;
  797. font-weight: 700;
  798. line-height: 26px;
  799. letter-spacing: 0px;
  800. text-align: center;
  801. }
  802. }
  803. }
  804. .main-content {
  805. margin-top: 68rpx;
  806. padding: 0 20rpx 40rpx 20rpx;
  807. flex: 1;
  808. overflow: auto;
  809. }
  810. .form-section {
  811. background: #fff;
  812. border-radius: 16rpx;
  813. padding: 0rpx 10rpx;
  814. .section-title {
  815. color: rgba(23, 23, 37, 1);
  816. font-family: Inter;
  817. font-size: 32rpx;
  818. font-weight: 600;
  819. line-height: 48rpx;
  820. letter-spacing: 0%;
  821. text-align: left;
  822. padding: 16rpx 0 32rpx 0;
  823. display: flex;
  824. justify-content: space-between;
  825. align-items: center;
  826. }
  827. }
  828. .form-item {
  829. margin-bottom: 32rpx;
  830. .form-label {
  831. color: rgba(31, 44, 55, 1);
  832. font-family: DM Sans;
  833. font-size: 32rpx;
  834. font-weight: 500;
  835. line-height: 22px;
  836. letter-spacing: 0%;
  837. text-align: left;
  838. margin-bottom: 20rpx;
  839. position: relative;
  840. .word-count {
  841. font-size: 24rpx;
  842. color: #aaa;
  843. position: absolute;
  844. bottom: 0;
  845. right: 0;
  846. }
  847. .required-mark {
  848. color: #FF3B30;
  849. font-size: 18px;
  850. font-weight: 500;
  851. margin-right: 4rpx;
  852. }
  853. .label-text {
  854. color: rgba(31, 44, 55, 1);
  855. font-family: DM Sans;
  856. font-size: 16px;
  857. font-weight: 500;
  858. line-height: 22px;
  859. letter-spacing: 0%;
  860. text-align: left;
  861. }
  862. }
  863. .form-input {
  864. width: 100%;
  865. min-height: 80rpx;
  866. padding: 0 40rpx;
  867. border: 1px solid rgba(227, 231, 236, 1);
  868. border-radius: 24px;
  869. background: rgba(255, 255, 255, 1);
  870. display: flex;
  871. align-items: center;
  872. justify-content: space-between;
  873. .placeholder {
  874. color: #999999;
  875. }
  876. picker {
  877. width: 100%;
  878. }
  879. textarea {
  880. width: 100%;
  881. padding: 20rpx 0;
  882. height: auto !important;
  883. // min-height: 40rpx;
  884. resize: none;
  885. line-height: 1.5;
  886. overflow-y: hidden;
  887. }
  888. .form-textarea {
  889. font-size: 28rpx;
  890. line-height: 32rpx;
  891. }
  892. }
  893. }
  894. .skills-input-container {
  895. width: 100%;
  896. min-height: 80rpx;
  897. padding: 0rpx 40rpx;
  898. border: 1px solid rgba(227, 231, 236, 1);
  899. border-radius: 32px;
  900. background: rgba(255, 255, 255, 1);
  901. display: flex;
  902. align-items: center;
  903. justify-content: space-between;
  904. .skills-tags {
  905. display: flex;
  906. flex-wrap: wrap;
  907. gap: 12rpx;
  908. flex: 1;
  909. padding: 16rpx 0;
  910. .skill-tag {
  911. padding: 8rpx 16rpx;
  912. background: #F5F5F5;
  913. border-radius: 8rpx;
  914. display: flex;
  915. align-items: center;
  916. gap: 8rpx;
  917. text {
  918. font-size: 24rpx;
  919. color: #666666;
  920. }
  921. }
  922. }
  923. .add-skill-btn {
  924. width: 40rpx;
  925. height: 40rpx;
  926. border: 1rpx solid rgba(102, 102, 102, 1);
  927. border-radius: 8rpx;
  928. display: flex;
  929. align-items: center;
  930. justify-content: center;
  931. background: #fff;
  932. flex-shrink: 0;
  933. }
  934. }
  935. .add-resume-btn {
  936. width: 100%;
  937. height: 80rpx;
  938. border-radius: 60rpx;
  939. display: flex;
  940. align-items: center;
  941. justify-content: center;
  942. margin-top: 20rpx;
  943. border-radius: 100px;
  944. background: rgba(1, 107, 246, 0.1);
  945. text {
  946. color: #016bf6;
  947. font-size: 32rpx;
  948. font-weight: 500;
  949. }
  950. }
  951. // 删除工作经历
  952. .delete-experience {
  953. font-size: 32rpx;
  954. text-align: center;
  955. line-height: 88rpx;
  956. color: rgba(153, 153, 153, 1);
  957. margin-top: 32rpx;
  958. }
  959. .add-skill-popup {
  960. background: #fff;
  961. border-radius: 24rpx;
  962. padding: 40rpx;
  963. .popup-title {
  964. color: rgba(34, 37, 42, 1);
  965. font-size: 36rpx;
  966. font-weight: 500;
  967. text-align: center;
  968. margin-bottom: 30rpx;
  969. }
  970. .popup-content {
  971. margin-bottom: 30rpx;
  972. .skill-input {
  973. width: 100%;
  974. height: 80rpx;
  975. padding: 0 20rpx;
  976. border: 1rpx solid #E5E5EA;
  977. border-radius: 12rpx;
  978. font-size: 28rpx;
  979. color: rgba(34, 37, 42, 1);
  980. background: #F7F8FA;
  981. }
  982. }
  983. .popup-buttons {
  984. display: flex;
  985. gap: 20rpx;
  986. .popup-btn {
  987. flex: 1;
  988. height: 80rpx;
  989. border-radius: 12rpx;
  990. display: flex;
  991. align-items: center;
  992. justify-content: center;
  993. font-size: 28rpx;
  994. font-weight: 500;
  995. }
  996. .cancel-btn {
  997. background: #F7F8FA;
  998. color: rgba(102, 102, 102, 1);
  999. }
  1000. .confirm-btn {
  1001. background: #007AFF;
  1002. color: #fff;
  1003. }
  1004. }
  1005. }
  1006. .checkbox-container {
  1007. display: flex;
  1008. flex-wrap: nowrap;
  1009. gap: 10rpx;
  1010. /deep/ .u-checkbox-group {
  1011. display: flex;
  1012. flex-wrap: nowrap;
  1013. width: 100%;
  1014. }
  1015. /deep/ .u-checkbox {
  1016. flex: 1;
  1017. min-width: 0;
  1018. margin-right: 0;
  1019. }
  1020. /deep/ .u-checkbox__label {
  1021. color: var(--Grayscale/Grayscale 100, rgba(23, 23, 37, 1));
  1022. font-family: DM Sans;
  1023. font-size: 24rpx;
  1024. font-weight: 400;
  1025. line-height: 48rpx;
  1026. letter-spacing: 0%;
  1027. text-align: left;
  1028. }
  1029. }
  1030. /* 时间选择器样式 */
  1031. .time-range {
  1032. display: flex;
  1033. align-items: center;
  1034. justify-content: space-between;
  1035. .time-input {
  1036. flex: 1;
  1037. text-align: center;
  1038. }
  1039. }
  1040. </style>