特易招,招聘小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

463 lines
10 KiB

1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
3 months ago
10 months ago
10 months ago
1 year ago
3 months ago
3 months ago
1 year ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
3 months ago
1 year ago
10 months ago
3 months ago
1 year ago
3 months ago
1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
10 months ago
1 year ago
10 months ago
3 months ago
1 year ago
10 months ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
10 months ago
3 months ago
1 year ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
1 year ago
10 months ago
10 months ago
3 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
3 months ago
3 months ago
10 months ago
10 months ago
10 months ago
3 months ago
3 months ago
3 months ago
3 months ago
10 months ago
1 year ago
3 months ago
1 year ago
3 months ago
1 year ago
10 months ago
10 months ago
10 months ago
1 year ago
  1. <template>
  2. <view class="page">
  3. <navbar title="在线简历"
  4. leftClick
  5. @leftClick="$utils.navigateBack"/>
  6. <view class="box">
  7. <view class="list">
  8. <view class="item"
  9. v-for="(item, index) in list"
  10. :key="index">
  11. <view class="title">
  12. {{ item.title }}
  13. </view>
  14. <view class="tagList" v-if="!item.useAddressPicker">
  15. <view :class="{act : i == item.index}"
  16. @click="clickTag(item, i)" v-for="(t, i) in item.tag"
  17. :key="t.id">
  18. {{ t.name || t.adress }}
  19. </view>
  20. </view>
  21. <!-- 地址选择器模式 -->
  22. <view class="address-selector" v-else @click="openAddressPicker">
  23. <view class="selected-address">
  24. {{ selectedAddress || form.expectAddress_dictText || '请选择工作地区' }}
  25. </view>
  26. <uv-icon name="arrow-right" size="30rpx"></uv-icon>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="form-sheet-cell">
  31. <view class="label">
  32. 求职岗位
  33. </view>
  34. <input placeholder="请输入求职岗位"
  35. v-model="form.title" />
  36. </view>
  37. <view class="form-sheet-cell">
  38. <view class="label">
  39. 您的年龄
  40. </view>
  41. <input placeholder="请输入年龄"
  42. type="number"
  43. v-model="form.age" />
  44. </view>
  45. <view class="form-sheet-cell">
  46. <view class="label">
  47. 您的性别
  48. </view>
  49. <uv-radio-group v-model="form.sex">
  50. <view style="display: flex;justify-content: center;">
  51. <uv-radio
  52. :customStyle="{margin: '8px'}"
  53. v-for="(item, index) in sexList"
  54. :key="index"
  55. iconSize="30rpx"
  56. size="40rpx"
  57. labelSize="26rpx"
  58. :label="item.name"
  59. :name="item.name">
  60. </uv-radio>
  61. </view>
  62. </uv-radio-group>
  63. </view>
  64. <view class="form-sheet-cell">
  65. <view class="label">
  66. 您的民族
  67. </view>
  68. <input placeholder="请输入民族"
  69. v-model="form.nation" />
  70. </view>
  71. <view class="form-sheet-cell">
  72. <view class="label">
  73. 期望薪资
  74. </view>
  75. <view class="price">
  76. <input placeholder="下限" v-model="form.salaryLow" />
  77. ~
  78. <input placeholder="上限" v-model="form.salaryUp" />
  79. </view>
  80. </view>
  81. <view class="form-sheet-cell"
  82. @click="openPicker('qualification')">
  83. <view class="label">
  84. 您的学历
  85. </view>
  86. <input placeholder="请选择学历"
  87. disabled
  88. v-model="form.qualification" />
  89. </view>
  90. <!-- <view class="form-sheet-cell">
  91. <view class="label">
  92. 您的学历
  93. </view>
  94. <input placeholder="请输入您的学历"
  95. v-model="form.qualification" />
  96. </view> -->
  97. <uv-textarea
  98. v-model="form.brief"
  99. count
  100. :maxlength="300"
  101. autoHeight
  102. placeholder="请输入个人介绍"></uv-textarea>
  103. <view class="uni-color-btn"
  104. @click="submit">
  105. 发布
  106. </view>
  107. </view>
  108. <uv-picker ref="picker"
  109. :columns="columns"
  110. @confirm="pickerConfirm"></uv-picker>
  111. <!-- 地址选择组件 -->
  112. <AddressPicker ref="addressPicker" :multiple="true" :showSelectWholeCity="true" :onlyCity="false" @confirm="onAddressConfirm" />
  113. </view>
  114. </template>
  115. <script>
  116. import { mapState } from 'vuex'
  117. import AddressPicker from '@/components/AddressPicker.vue'
  118. export default {
  119. components: {
  120. AddressPicker
  121. },
  122. data() {
  123. return {
  124. list: [
  125. {
  126. title: '您希望从事的工种',
  127. tag: [],
  128. index: 0,
  129. type : 'typeId',
  130. },
  131. {
  132. title: '您希望从事工作的地区',
  133. tag: [],
  134. index: 0,
  135. type : 'expectAddress',
  136. useAddressPicker: true, // 标记使用地址选择器
  137. },
  138. {
  139. title: '您希望从事工作的性质',
  140. tag: [],
  141. index: 0,
  142. type : 'natureId',
  143. },
  144. ],
  145. form : {
  146. sex : '男',
  147. qulification : '',
  148. title: '',
  149. typeId : '',
  150. expectAddress : '',
  151. natureId : '',
  152. age : '',
  153. nation : '',
  154. salaryLow : '',
  155. salaryUp : '',
  156. qualification : '',
  157. brief: '',
  158. },
  159. sexList : [
  160. {
  161. name : '男',
  162. },
  163. {
  164. name : '女',
  165. },
  166. ],
  167. picker : {
  168. qualification : [
  169. '初中',
  170. '高中',
  171. '专科',
  172. '本科',
  173. '研究生',
  174. '博士',
  175. ],
  176. },
  177. pickerKey : 'workAge',
  178. selectedAddress: '', // 选中的地址文本
  179. }
  180. },
  181. computed : {
  182. ...mapState(['natureList', 'jobTypeList', 'addressList']),
  183. columns(){
  184. return [this.picker[this.pickerKey]]
  185. },
  186. },
  187. onLoad() {
  188. this.list[0].tag = this.jobTypeList
  189. this.list[1].tag = this.addressList
  190. this.list[2].tag = this.natureList
  191. this.queryResumeByUserId()
  192. },
  193. methods: {
  194. clickTag(item, index){
  195. item.index = index
  196. },
  197. openPicker(key, picker){
  198. this.pickerKey = key
  199. if(picker){
  200. picker.open()
  201. }else{
  202. this.$refs.picker.open()
  203. }
  204. },
  205. pickerConfirm(e){
  206. console.log(e);
  207. let data = e.value[0]
  208. if(data && data.id){
  209. this.form[this.pickerKey] = data.id
  210. this.form[this.pickerKey + '_dictText'] = data.name || data.adress
  211. }else{
  212. this.form[this.pickerKey] = data
  213. }
  214. },
  215. // 提交
  216. submit(){
  217. // if(this.fileList.length == 0){
  218. // return uni.showToast({
  219. // title: '请上传图片',
  220. // icon : 'none'
  221. // })
  222. // }
  223. this.list.forEach(n => {
  224. // 如果使用地址选择器,跳过从tag获取值
  225. if(!n.useAddressPicker) {
  226. this.form[n.type] = n.tag[n.index].id
  227. }
  228. })
  229. if (this.$utils.verificationAll(this.form, {
  230. title: '请输入求职岗位',
  231. typeId : '请选择工种',
  232. expectAddress : '请选择工作的地区',
  233. natureId : '请选择工作的性质',
  234. age : '请输入您的年龄',
  235. sex : '请选择性别',
  236. nation : '请输入您的民族',
  237. salaryLow : '请输入期望薪资下限',
  238. salaryUp : '请输入期望薪资上限',
  239. qualification : '请选择您的学历',
  240. brief: '请输入个人介绍',
  241. })) {
  242. return
  243. }
  244. let data = {
  245. title: this.form.title,
  246. typeId : this.form.typeId,
  247. expectAddress : this.form.expectAddress,
  248. natureId : this.form.natureId,
  249. age : this.form.age,
  250. nation : this.form.nation,
  251. salaryLow : this.form.salaryLow,
  252. salaryUp : this.form.salaryUp,
  253. qualification : this.form.qualification,
  254. brief: this.form.brief,
  255. sex: this.form.sex,
  256. }
  257. if(this.form.id){
  258. data.id = this.form.id
  259. }
  260. this.$api('addResume', data, res => {
  261. if(res.code == 200){
  262. uni.showToast({
  263. title: '保存成功!',
  264. icon: 'none'
  265. })
  266. setTimeout(uni.navigateBack, 1000, -1)
  267. }
  268. })
  269. },
  270. queryResumeByUserId(){
  271. this.$api('queryResumeByUserId', res => {
  272. if(res.code == 200 && res.result && res.result.records[0]){
  273. this.form = res.result.records[0]
  274. this.list.forEach((n, i) => {
  275. // 如果是地址选择器,需要根据ID找到对应的地址文本
  276. if(n.useAddressPicker && this.form[n.type]) {
  277. // 回显地址:根据存储的ID找到对应的地址文本
  278. this.selectedAddress = this.getAddressTextById(this.form[n.type])
  279. } else {
  280. n.tag.forEach((e, index) => {
  281. if(this.form[n.type] == e.id){
  282. n.index = index
  283. }
  284. })
  285. }
  286. })
  287. }
  288. })
  289. },
  290. // 打开地址选择器
  291. openAddressPicker() {
  292. this.$refs.addressPicker.open()
  293. },
  294. // 根据ID获取地址文本(用于回显)
  295. getAddressTextById(idOrIds) {
  296. if (!idOrIds) return ''
  297. // 如果是多个ID(逗号分隔)
  298. if (typeof idOrIds === 'string' && idOrIds.includes(',')) {
  299. const ids = idOrIds.split(',')
  300. const addressTexts = []
  301. ids.forEach(id => {
  302. const address = this.findAddressById(id.trim())
  303. if (address) {
  304. addressTexts.push(address.adress)
  305. }
  306. })
  307. return addressTexts.join(',')
  308. } else {
  309. // 单个ID
  310. const address = this.findAddressById(idOrIds)
  311. return address ? address.adress : ''
  312. }
  313. },
  314. // 递归查找地址
  315. findAddressById(id) {
  316. // 在省级地址中查找
  317. for (let province of this.addressList) {
  318. if (province.id == id) {
  319. return province
  320. }
  321. }
  322. // 如果没找到,需要异步获取下级地址进行查找
  323. // 这里简化处理,实际项目中可能需要更复杂的缓存机制
  324. return null
  325. },
  326. // 地址选择确认回调
  327. onAddressConfirm(addressResult) {
  328. // 显示地址文本给用户看
  329. this.selectedAddress = addressResult.fullAddress
  330. // 传给后端的是ID或ID数组
  331. if (addressResult.selectedIds && addressResult.selectedIds.length > 0) {
  332. // 多选模式,传ID数组的字符串形式
  333. this.form.expectAddress = addressResult.selectedIds.join(',')
  334. } else {
  335. // 单选模式,传单个ID
  336. this.form.expectAddress = addressResult.selectedId
  337. }
  338. },
  339. },
  340. }
  341. </script>
  342. <style scoped lang="scss">
  343. .page{
  344. background-color: #fff;
  345. min-height: 100vh;
  346. .box{
  347. padding: 30rpx;
  348. .list {
  349. .item {
  350. margin-top: 20rpx;
  351. .title {
  352. font-weight: 900;
  353. font-size: 30rpx;
  354. }
  355. .tagList {
  356. display: flex;
  357. flex-wrap: wrap;
  358. padding: 10rpx 0;
  359. view {
  360. background: rgba($uni-color, 0.1);
  361. padding: 10rpx 20rpx;
  362. margin: 10rpx;
  363. border-radius: 10rpx;
  364. font-size: 26rpx;
  365. }
  366. .act {
  367. color: #fff;
  368. background: $uni-color;
  369. }
  370. }
  371. .address-selector {
  372. display: flex;
  373. justify-content: space-between;
  374. align-items: center;
  375. background: rgba($uni-color, 0.1);
  376. padding: 20rpx;
  377. margin: 10rpx;
  378. border-radius: 10rpx;
  379. font-size: 26rpx;
  380. .selected-address {
  381. flex: 1;
  382. color: #333;
  383. }
  384. }
  385. }
  386. }
  387. .form-sheet-cell{
  388. display: flex;
  389. background-color: #fff;
  390. padding: 20rpx;
  391. align-items: center;
  392. .label{
  393. width: 160rpx;
  394. font-weight: 900;
  395. }
  396. .price{
  397. display: flex;
  398. text-align: center;
  399. input{
  400. width: 150rpx;
  401. border: 1px solid $uni-color;
  402. margin: 0 10rpx;
  403. }
  404. }
  405. input{
  406. flex: 1;
  407. background-color: rgba($uni-color, 0.1);
  408. padding: 10rpx 20rpx;
  409. border-radius: 10rpx;
  410. }
  411. .right-icon{
  412. margin-left: auto;
  413. }
  414. }
  415. /deep/ .uv-textarea{
  416. background-color: rgba($uni-color, 0.1) !important;
  417. min-height: 400rpx;
  418. }
  419. }
  420. }
  421. </style>