evaluationIntention.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. <!-- 自我评价和求职意向 -->
  2. <template>
  3. <view class="evaluate-intention">
  4. <!-- 导航栏 -->
  5. <u-navbar
  6. class="evaluate-intention-bar"
  7. back-text=""
  8. title=""
  9. :background="{ backgroundColor: '#3D5D4C' }"
  10. title-color="#fff"
  11. back-icon-color="#fff"
  12. >
  13. </u-navbar>
  14. <view class="evaluate-intention-explain">
  15. <view>继续完善加分项</view>
  16. <view>据平台数据显示,完善后,被HR查看几率更高</view>
  17. </view>
  18. <!-- tab页 -->
  19. <view class="evaluate-intention-tabs">
  20. <view
  21. class="evaluate-intention-tabs-item"
  22. v-for="(item, index) in list"
  23. :key="index"
  24. :class="{ 'evaluate-intention-tabs-active': tabCur === index }"
  25. @click="tabCur = index"
  26. >
  27. {{ item.name }}
  28. </view>
  29. </view>
  30. <!-- 工作意向 -->
  31. <view class="evaluate-intention-intention" v-if="tabCur === 0">
  32. <u-form :model="intentionForm" ref="intentionForm" label-position="top">
  33. <u-form-item label="工作城市" prop="cityName" required>
  34. <u-input v-model="intentionForm.workCity" type="select" @click="workCityClick" placeholder="请选择工作城市" />
  35. <!-- <u-select v-model="cityShow" :list="cityList" @confirm="cityConfirm"></u-select> -->
  36. <city-select-unlimited v-if="cityShow" v-model="cityShow" :default-region="defaultRegion" @city-change="cityConfirm" />
  37. </u-form-item>
  38. <!-- <u-form-item label="期望职位" prop="position" required>
  39. <u-input v-model="intentionForm.position" type="select" @click="positionShow = true" placeholder="请选择期望职位"/>
  40. <u-select v-model="positionShow" :list="positionList" @confirm="positionConfirm"></u-select>
  41. </u-form-item>
  42. <u-form-item label="期望行业" prop="industry" required>
  43. <u-input v-model="intentionForm.industry" type="select" @click="industryShow = true" placeholder="请选择期望行业"/>
  44. <u-select v-model="industryShow" :list="industryList" @confirm="industryConfirm"></u-select>
  45. </u-form-item> -->
  46. <u-form-item label="最低薪资要求(k)" prop="expectedLowestSalary" required>
  47. <u-input v-model="intentionForm.expectedLowestSalary" type="select" @click="lowestsalaryShow = true" placeholder="请选择薪资要求" />
  48. <u-select
  49. v-model="lowestsalaryShow"
  50. :list="salaryList"
  51. @confirm="salaryLowestConfirm"
  52. :default-value="[Number(intentionForm.expectedLowestSalary) - 1]"
  53. ></u-select>
  54. </u-form-item>
  55. <u-form-item label="最高薪资要求(k)" prop="expectedHighestSalary" required>
  56. <u-input v-model="intentionForm.expectedHighestSalary" type="select" @click="highestSalaryShow = true" placeholder="请选择薪资要求" />
  57. <u-select
  58. v-model="highestSalaryShow"
  59. :list="salaryList"
  60. @confirm="salaryHighestConfirm"
  61. :default-value="[Number(intentionForm.expectedHighestSalary) - 1]"
  62. ></u-select>
  63. </u-form-item>
  64. </u-form>
  65. <view class="evaluate-intention-intention-submit">
  66. <u-button type="primary" class="btn" @click="submitIntention">开始找工作</u-button>
  67. </view>
  68. <view class="evaluate-intention-intention-explain">去完善项目经历,让更多HR看到你</view>
  69. </view>
  70. <!-- 自我评价 -->
  71. <view class="evaluate-intention-evaluate" v-else-if="tabCur === 1">
  72. <u-form :model="evaluateForm" ref="evaluateForm" label-position="top">
  73. <u-form-item label="自我评价">
  74. <u-input v-model="evaluateForm.content" type="textarea" :border="true" :height="150" :auto-height="true" />
  75. </u-form-item>
  76. </u-form>
  77. <view class="evaluate-intention-evaluate-submit">
  78. <u-button type="primary" class="btn" @click="submitEvaluation">提交</u-button>
  79. </view>
  80. </view>
  81. <u-toast ref="uToast" />
  82. </view>
  83. </template>
  84. <script>
  85. import { industry } from './industry.js';
  86. import citySelectUnlimited from '../../uview-ui/components/u-city-select-unlimited/u-city-select-unlimited.vue';
  87. export default {
  88. components: {
  89. citySelectUnlimited
  90. },
  91. data() {
  92. return {
  93. list: [
  94. {
  95. name: '期望薪资'
  96. },
  97. {
  98. name: '自我评价'
  99. }
  100. ],
  101. tabCur: 0,
  102. intentionForm: {
  103. provinceName: '',
  104. provinceId: '',
  105. cityName: '',
  106. cityId: '',
  107. areaName: '',
  108. areaId: '',
  109. // position: '',
  110. // positionId: '',
  111. // industry: '',
  112. // industryId: '',
  113. expectedLowestSalary: '',
  114. expectedHighestSalary: '',
  115. workCity: ''
  116. },
  117. defaultRegion: [],
  118. intentionRules: {
  119. cityName: [
  120. {
  121. required: true,
  122. message: '请选择您的工作城市',
  123. trigger: ['change', 'blur']
  124. }
  125. ],
  126. // position: [
  127. // {
  128. // required: true,
  129. // message: '请选择您的期望职位',
  130. // trigger: ['change', 'blur']
  131. // }
  132. // ],
  133. // industry: [
  134. // {
  135. // required: true,
  136. // message: '请选择您的期望行业',
  137. // trigger: ['change', 'blur']
  138. // }
  139. // ],
  140. expectedLowestSalary: [
  141. {
  142. required: true,
  143. message: '请选择您的最低薪资要求',
  144. trigger: ['change', 'blur']
  145. }
  146. ],
  147. expectedHighestSalary: [
  148. {
  149. required: true,
  150. message: '请选择您的最高薪资要求',
  151. trigger: ['change', 'blur']
  152. },
  153. {
  154. validator: (rule, value, callback) => {
  155. return Number(value) >= Number(this.intentionForm.expectedLowestSalary);
  156. },
  157. message: '最高薪资要求不能小于最低薪资要求',
  158. trigger: ['change', 'blur']
  159. }
  160. ]
  161. },
  162. // 城市下拉显示
  163. cityShow: false,
  164. // 职位下拉显示
  165. positionShow: false,
  166. // 职位列表
  167. positionList: [
  168. {
  169. value: 1,
  170. label: '保安'
  171. },
  172. {
  173. value: 2,
  174. label: '服务员'
  175. },
  176. {
  177. value: 3,
  178. label: '消防员'
  179. }
  180. ],
  181. // 行业下拉显示
  182. industryShow: false,
  183. // 行业列表
  184. industryList: industry,
  185. // 薪资下拉显示
  186. highestSalaryShow: false,
  187. lowestsalaryShow: false,
  188. // 薪资列表
  189. salaryList: [],
  190. // 自我评价
  191. evaluateForm: {
  192. content: ''
  193. }
  194. };
  195. },
  196. onLoad(page) {
  197. this.getMemberinfo();
  198. if (page.tabCur) {
  199. this.tabCur = Number(page.tabCur);
  200. }
  201. // 设置薪资范围
  202. let numList = [];
  203. for (let i = 1; i < 51; i++) {
  204. const obj = {
  205. value: String(i),
  206. label: String(i)
  207. };
  208. numList.push(obj);
  209. }
  210. this.salaryList = numList;
  211. },
  212. // 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
  213. onReady() {
  214. if (this.tabCur === 0) {
  215. this.$refs.intentionForm.setRules(this.intentionRules);
  216. }
  217. },
  218. methods: {
  219. /**
  220. * 获取用户基本信息
  221. */
  222. getMemberinfo() {
  223. this.$u.api
  224. .getmemberinfo()
  225. .then((res) => {
  226. if (res.code === 200) {
  227. const data = res.data;
  228. this.evaluateForm.content = data.selfAssessment;
  229. // this.intentionForm.position = res.data.expectedPost
  230. // this.intentionForm.industry = res.data.expectedIndustry
  231. this.intentionForm.expectedLowestSalary = data.expectedLowestSalary ? String(data.expectedLowestSalary) : '';
  232. this.intentionForm.expectedHighestSalary = data.expectedHighestSalary ? String(data.expectedHighestSalary) : '';
  233. if (data.provinceName) {
  234. this.intentionForm.workCity = data.provinceName + '-' + data.cityName + '-' + data.areaName;
  235. }
  236. this.intentionForm.provinceId = data.provinceId;
  237. this.intentionForm.provinceName = data.provinceName;
  238. this.intentionForm.cityId = data.cityId;
  239. this.intentionForm.cityName = data.cityName;
  240. this.intentionForm.areaId = data.areaId;
  241. this.intentionForm.areaName = data.areaName;
  242. } else {
  243. this.$refs.uToast.show({
  244. title: res.msg,
  245. type: 'error'
  246. });
  247. }
  248. })
  249. .catch((err) => {
  250. this.$refs.uToast.show({
  251. title: err.msg,
  252. type: 'error'
  253. });
  254. });
  255. },
  256. /**
  257. * 城市下拉
  258. * @param { Object } item
  259. */
  260. cityConfirm(item) {
  261. this.intentionForm.provinceName = item.province.label;
  262. this.intentionForm.provinceId = item.province.value;
  263. this.intentionForm.cityName = item.city.label;
  264. this.intentionForm.cityId = item.city.value;
  265. this.intentionForm.areaName = item.area.label;
  266. this.intentionForm.areaId = item.area.value;
  267. this.intentionForm.workCity = item.province.label + '-' + item.city.label + '-' + item.area.label;
  268. },
  269. /**
  270. * 职位下拉
  271. * @param {Object} item
  272. */
  273. positionConfirm(item) {
  274. this.intentionForm.position = item[0].label;
  275. this.intentionForm.positionId = item[0].value;
  276. },
  277. /**
  278. * 行业下拉
  279. * @param {Object} item
  280. */
  281. industryConfirm(item) {
  282. this.intentionForm.industry = item[0].label;
  283. this.intentionForm.industryId = item[0].value;
  284. },
  285. /**
  286. * 最低薪资下拉
  287. * @param {Object} item
  288. */
  289. salaryLowestConfirm(item) {
  290. this.intentionForm.expectedLowestSalary = item[0].label;
  291. },
  292. /**
  293. * 最高薪资下拉
  294. * @param {Object} item
  295. */
  296. salaryHighestConfirm(item) {
  297. this.intentionForm.expectedHighestSalary = item[0].label;
  298. },
  299. /**
  300. * 跳转到指定页面
  301. */
  302. jumpPage(url, type) {
  303. if (type === 'redirectTo') {
  304. uni.redirectTo({
  305. url
  306. });
  307. } else {
  308. this.$u.route(url);
  309. }
  310. },
  311. /**
  312. * 提交求职意向
  313. */
  314. submitIntention() {
  315. this.$refs.intentionForm.validate((valid) => {
  316. if (valid) {
  317. const form = {
  318. ...this.intentionForm
  319. };
  320. uni.showLoading({
  321. title: '数据提交中,请等待'
  322. });
  323. this.$u.api.resume
  324. .submitJobIntention({
  325. provinceName: form.provinceName,
  326. provinceId: form.provinceId,
  327. cityName: form.cityName,
  328. cityId: form.cityId,
  329. areaName: form.areaName,
  330. areaId: form.areaId,
  331. expectedLowestSalary: form.expectedLowestSalary,
  332. expectedHighestSalary: form.expectedHighestSalary
  333. })
  334. .then((res) => {
  335. if (res.code === 200) {
  336. this.$refs.uToast.show({
  337. title: '更新成功',
  338. type: 'success'
  339. });
  340. setTimeout(() => {
  341. uni.hideLoading();
  342. this.jumpPage('/pages/myResume/myResume', 'redirectTo');
  343. }, 300);
  344. } else {
  345. uni.hideLoading();
  346. this.$refs.uToast.show({
  347. title: res.msg,
  348. type: 'error'
  349. });
  350. }
  351. })
  352. .catch(() => {
  353. uni.hideLoading();
  354. this.$refs.uToast.show({
  355. title: '系统异常',
  356. type: 'error'
  357. });
  358. });
  359. }
  360. });
  361. },
  362. /**
  363. * 提交自我评价
  364. */
  365. submitEvaluation() {
  366. if (this.evaluateForm.content) {
  367. uni.showLoading({
  368. title: '数据提交中,请等待'
  369. });
  370. this.$u.api.resume
  371. .submitSelfAssessment({
  372. selfAssessment: this.evaluateForm.content
  373. })
  374. .then((res) => {
  375. if (res.code === 200) {
  376. this.$refs.uToast.show({
  377. title: '更新成功',
  378. type: 'success'
  379. });
  380. setTimeout(() => {
  381. uni.hideLoading();
  382. this.jumpPage('/pages/myResume/myResume', 'redirectTo');
  383. }, 300);
  384. } else {
  385. uni.hideLoading();
  386. this.$refs.uToast.show({
  387. title: res.msg,
  388. type: 'error'
  389. });
  390. }
  391. })
  392. .catch(() => {
  393. uni.hideLoading();
  394. this.$refs.uToast.show({
  395. title: '系统异常',
  396. type: 'error'
  397. });
  398. });
  399. } else {
  400. uni.hideLoading();
  401. this.$refs.uToast.show({
  402. title: '请输入自我评价',
  403. type: 'warning'
  404. });
  405. }
  406. },
  407. /**
  408. * 城市下拉
  409. */
  410. workCityClick() {
  411. this.defaultRegion = [this.intentionForm.provinceName, this.intentionForm.cityName, this.intentionForm.areaName];
  412. this.cityShow = true;
  413. }
  414. }
  415. };
  416. </script>
  417. <style lang="scss" scoped>
  418. @import './evaluationIntention.scss';
  419. </style>