basicInfo.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. <template>
  2. <view class="basic-info">
  3. <!-- 顶部导航栏 -->
  4. <view class="navbar">
  5. <view class="navbar-content">
  6. <view class="navbar-left" @click="goBack">
  7. <u-icon name="arrow-leftward" size="42" color="#333"></u-icon>
  8. </view>
  9. <view class="navbar-title">基本信息</view>
  10. <view class="navbar-right"></view>
  11. </view>
  12. </view>
  13. <!-- 表单内容 -->
  14. <view class="form-content">
  15. <!-- 头像 -->
  16. <view class="form-item">
  17. <view class="form-label">头像</view>
  18. <view @click="chooseAvatar" class="avatar-container">
  19. <image :src="avatar?avatar:'../../static/logo.png'" class="user-avatar" mode="aspectFill"></image>
  20. <view class="edit-avatar-icon">
  21. <image src="../../static/images/index/Combined-Shape.svg" style="width: 32rpx;height: 32rpx;" mode=""></image>
  22. </view>
  23. </view>
  24. </view>
  25. <!-- 姓名 -->
  26. <view class="form-item">
  27. <view class="form-label">
  28. <text class="required-mark">*</text>
  29. <text>姓名</text>
  30. </view>
  31. <input class="form-input" type="text" placeholder="请输入姓名" v-model="userName" />
  32. </view>
  33. <!-- 性别 -->
  34. <view class="form-item">
  35. <view class="form-label">
  36. <text class="required-mark">*</text>
  37. <text>性别</text>
  38. </view>
  39. <u-radio-group v-model="sex" direction="row">
  40. <u-radio name="1" activeColor="#007AFF">男</u-radio>
  41. <u-radio name="2" activeColor="#007AFF">女</u-radio>
  42. </u-radio-group>
  43. </view>
  44. <!-- 联系方式 -->
  45. <view class="form-item">
  46. <view class="form-label">联系方式</view>
  47. <input class="form-input" type="text" placeholder="请输入手机号" v-model="phone" />
  48. </view>
  49. <!-- 微信号码 -->
  50. <view class="form-item">
  51. <view class="form-label">微信号码</view>
  52. <input class="form-input" type="text" placeholder="请输入微信号码,方便给求职者交换微信联系" v-model="weChatNum"/>
  53. </view>
  54. <!-- 出生年月 -->
  55. <view class="form-item">
  56. <view class="form-label">
  57. <text class="required-mark">*</text>
  58. <text>出生年月</text>
  59. </view>
  60. <view class="date-picker" @click="showDatePicker = true">
  61. <text class="date-text">{{ birthDateText }}</text>
  62. <u-icon name="arrow-down" color="#999" size="24"></u-icon>
  63. </view>
  64. <u-picker
  65. :default-time="birthDateText"
  66. v-model="showDatePicker"
  67. mode="time"
  68. :params="dateParams"
  69. @confirm="onDateConfirm"
  70. ></u-picker>
  71. </view>
  72. <!-- 求职状态 -->
  73. <view class="form-item">
  74. <view class="form-label">
  75. <text class="required-mark">*</text>
  76. <text>求职状态</text>
  77. </view>
  78. <view class="select-picker" @click="showJobStatusPicker">
  79. <text class="select-text">{{ jobStatusList[selectedJobStatus].text }}</text>
  80. <u-icon name="arrow-down" color="#999" size="24"></u-icon>
  81. </view>
  82. </view>
  83. </view>
  84. <!-- 保存按钮 -->
  85. <view @click="messagebtn" class="save-button">
  86. <text class="save-text">保存</text>
  87. </view>
  88. <!-- 求职状态选择器 -->
  89. <u-popup v-model="showJobStatusModal" mode="bottom" border-radius="42" height="auto" :safe-area-inset-bottom="true">
  90. <view class="job-status-picker">
  91. <view class="picker-header">
  92. <text class="picker-title">求职状态</text>
  93. </view>
  94. <view class="picker-content">
  95. <view
  96. class="status-option"
  97. :class="{ active: selectedJobStatus == item.value }"
  98. v-for="item in jobStatusList"
  99. :key="item.value"
  100. @click="selectJobStatus(item)"
  101. >
  102. <view class="option-left">
  103. <view class="radio-btn" :class="{ checked: selectedJobStatus == item.value }">
  104. <u-icon v-if="selectedJobStatus == item.value" name="checkmark" color="#ffffff" size="28"></u-icon>
  105. </view>
  106. <text class="option-text">{{ item.text }}</text>
  107. <view v-if="item.recommended" class="recommend-tag">
  108. <text>推荐</text>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </u-popup>
  115. </view>
  116. </template>
  117. <script>
  118. export default {
  119. data() {
  120. return {
  121. weChatNum :'' ,
  122. sex : '',
  123. age :'',
  124. phone :'',
  125. avatar :'',
  126. ifExp:0,
  127. userName :'',
  128. birthDateText: '1991-11-29', // 显示的日期文本
  129. showDatePicker: false, // 控制日期选择器显示
  130. dateParams: {
  131. year: true,
  132. month: true,
  133. day: true
  134. },
  135. // 求职状态相关
  136. showJobStatusModal: false,
  137. selectedJobStatus: 0,
  138. jobStatusList: [
  139. {
  140. value: '0',
  141. text: '离职-随时到岗',
  142. recommended: true
  143. },
  144. {
  145. value: '1',
  146. text: '在职-月内到岗',
  147. recommended: true
  148. },
  149. {
  150. value: '2',
  151. text: '在职-考虑机会',
  152. recommended: false
  153. },
  154. {
  155. value: '3',
  156. text: '在职-暂不考虑',
  157. recommended: false
  158. }
  159. ]
  160. }
  161. },
  162. onLoad(options){
  163. if(options&&options.resumesStatus)
  164. this.selectedJobStatus=options.resumesStatus
  165. if(options&&options.birthday)
  166. this.birthDateText=options.birthday
  167. if(options&&options.ifExp)
  168. this.ifExp=options.ifExp
  169. if(options&&options.resumesPhone)
  170. this.phone = options.resumesPhone
  171. this.getUserInfo()
  172. },
  173. methods: {
  174. goBack() {
  175. uni.navigateBack();
  176. },
  177. // 选择头像
  178. chooseAvatar() {
  179. var that=this
  180. uni.chooseImage({
  181. count: 1,
  182. sizeType: ["compressed"],
  183. sourceType: ["album", "camera"],
  184. success: (res) => {
  185. console.log(res.tempFilePaths[0])
  186. that.$queue.uploadFile(res.tempFilePaths[0],function(path){
  187. if(path)
  188. that.avatar = path;
  189. })
  190. },
  191. });
  192. },
  193. // 日期选择确认
  194. onDateConfirm(e) {
  195. const { year, month, day } = e;
  196. this.birthDateText = `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
  197. this.showDatePicker = false;
  198. },
  199. // 显示求职状态选择器
  200. showJobStatusPicker() {
  201. this.showJobStatusModal = true;
  202. },
  203. // 选择求职状态
  204. selectJobStatus(item) {
  205. this.selectedJobStatus = item.value;
  206. this.showJobStatusModal = false;
  207. // 可以在这里添加保存状态的逻辑
  208. console.log('选择的求职状态:', item);
  209. },
  210. getUserInfo() {
  211. let userId = uni.getStorageSync('userId')
  212. this.$Request.get("/app/user/selectUserById").then(res => {
  213. if (res.code == 0) {
  214. this.weChatNum = res.data.weChatNum
  215. this.sex = res.data.sex
  216. this.age = res.data.age
  217. this.avatar = res.data.avatar;
  218. this.userName = res.data.userName;
  219. }
  220. uni.hideLoading();
  221. });
  222. },
  223. // 保存
  224. messagebtn() {
  225. if (!this.userName) {
  226. // this.$queue.showToast('用户名不能为空');
  227. uni.showToast({
  228. title: "用户名不能为空",
  229. icon: "none"
  230. })
  231. } else if (!this.phone) {
  232. // this.$queue.showToast('用户名不能为空');
  233. uni.showToast({
  234. title: "联系电话不能为空",
  235. icon: "none"
  236. })
  237. } else {
  238. let that = this
  239. uni.showModal({
  240. title: '温馨提示',
  241. content: '确定保存信息',
  242. success: e => {
  243. if (e.confirm) {
  244. that.$Request.postJson("/app/user/updateUser", {
  245. userName: that.userName,
  246. avatar: that.avatar,
  247. sex: that.sex,
  248. age: that.age,
  249. weChatNum:that.weChatNum
  250. }).then(res => {
  251. if (res.code === 0) {
  252. uni.showToast({
  253. title: '保存成功',
  254. icon: "none"
  255. })
  256. that.setResume()
  257. } else {
  258. uni.showToast({
  259. title: res.msg,
  260. icon: "none"
  261. })
  262. }
  263. })
  264. }
  265. }
  266. });
  267. }
  268. },
  269. setResume() {
  270. let data={
  271. resumesStatus:this.selectedJobStatus,
  272. resumesPhone: that.phone,
  273. birthday:this.birthDateText,
  274. ifExp:this.ifExp
  275. }
  276. this.$Request.postJson("/app/userFirst/regist", data).then((res) => {
  277. if (res.code == 0) {
  278. // 实际开发中可以在这里添加跳转逻辑
  279. uni.$emit('updateResume')
  280. setTimeout(function() {
  281. uni.navigateBack()
  282. }, 1000)
  283. } else {
  284. uni.showToast({
  285. title: res.msg,
  286. icon: "none",
  287. });
  288. }
  289. });
  290. }
  291. }
  292. }
  293. </script>
  294. <style lang="scss" scoped>
  295. .basic-info {
  296. background-color: #fff;
  297. min-height: 100vh;
  298. }
  299. // 顶部导航栏
  300. .navbar {
  301. background: #fff;
  302. padding: 80rpx 0 40rpx 40rpx;
  303. margin-bottom: 30rpx;
  304. .navbar-content {
  305. display: flex;
  306. align-items: center;
  307. justify-content: space-between;
  308. padding: 0 30rpx;
  309. height: 60rpx;
  310. .navbar-left {
  311. width: 60rpx;
  312. height: 60rpx;
  313. display: flex;
  314. align-items: center;
  315. justify-content: center;
  316. }
  317. .navbar-title {
  318. color: var(--Grayscale/Grayscale 100, rgba(23, 23, 37, 1));
  319. font-family: DM Sans;
  320. font-size: 18px;
  321. font-weight: 700;
  322. line-height: 26px;
  323. letter-spacing: 0.5%;
  324. text-align: center;
  325. }
  326. .navbar-right {
  327. width: 60rpx;
  328. height: 60rpx;
  329. }
  330. }
  331. }
  332. // 表单内容
  333. .form-content {
  334. padding: 0 30rpx;
  335. .form-item {
  336. margin-bottom: 30rpx;
  337. .form-label {
  338. color: var(--Neutral/100, rgba(31, 44, 55, 1));
  339. font-family: DM Sans;
  340. font-size: 16px;
  341. font-weight: 500;
  342. line-height: 22px;
  343. letter-spacing: 0.5%;
  344. text-align: left;
  345. display: flex;
  346. align-items: center;
  347. margin-bottom: 20rpx;
  348. .required-mark {
  349. color: #FF3B30;
  350. font-size: 18px;
  351. font-weight: 600;
  352. margin-right: 8rpx;
  353. }
  354. text {
  355. color: var(--Neutral/100, rgba(31, 44, 55, 1));
  356. font-family: DM Sans;
  357. font-size: 16px;
  358. font-weight: 500;
  359. line-height: 22px;
  360. letter-spacing: 0.5%;
  361. text-align: left;
  362. }
  363. }
  364. .form-input {
  365. width: 100%;
  366. height: 75rpx;
  367. font-size: 14px;
  368. border: 1px solid rgba(227, 231, 236, 1);
  369. border-radius: 24px;
  370. color: rgba(23, 23, 37, 1);
  371. padding: 12px 16px;
  372. }
  373. .form-display {
  374. color: rgba(23, 23, 37, 1);
  375. font-family: DM Sans;
  376. font-size: 16px;
  377. font-weight: 400;
  378. line-height: 22px;
  379. letter-spacing: 0%;
  380. text-align: left;
  381. padding: 15px 0px;
  382. }
  383. // 头像样式
  384. .avatar-container {
  385. position: relative;
  386. display: inline-block;
  387. .user-avatar {
  388. width: 80rpx;
  389. height: 80rpx;
  390. border-radius: 50%;
  391. }
  392. .edit-avatar-icon {
  393. position: absolute;
  394. bottom: 10rpx;
  395. right: 5rpx;
  396. width: 25rpx;
  397. height: 25rpx;
  398. border-radius: 50%;
  399. display: flex;
  400. align-items: center;
  401. justify-content: center;
  402. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.1);
  403. }
  404. }
  405. // 日期选择器样式
  406. .date-picker {
  407. display: flex;
  408. align-items: center;
  409. justify-content: space-between;
  410. height: 75rpx;
  411. font-size: 14px;
  412. border: 1px solid rgba(227, 231, 236, 1);
  413. border-radius: 24px;
  414. color: rgba(23, 23, 37, 1);
  415. padding: 12px 16px;
  416. .date-text {
  417. color: rgba(23, 23, 37, 1);
  418. font-family: DM Sans;
  419. font-size: 14px;
  420. font-weight: 400;
  421. line-height: 22px;
  422. letter-spacing: 0%;
  423. text-align: left;
  424. }
  425. }
  426. // 下拉选择器样式
  427. .select-picker {
  428. display: flex;
  429. align-items: center;
  430. justify-content: space-between;
  431. height: 75rpx;
  432. font-size: 14px;
  433. border: 1px solid rgba(227, 231, 236, 1);
  434. border-radius: 24px;
  435. color: rgba(23, 23, 37, 1);
  436. padding: 12px 16px;
  437. .select-text {
  438. color: rgba(23, 23, 37, 1);
  439. font-family: DM Sans;
  440. font-size: 14px;
  441. font-weight: 400;
  442. line-height: 22px;
  443. letter-spacing: 0%;
  444. text-align: left;
  445. }
  446. }
  447. }
  448. }
  449. // 保存按钮
  450. .save-button {
  451. position: fixed;
  452. bottom: 60rpx;
  453. left: 0;
  454. right: 0;
  455. height: 120rpx;
  456. margin: 0 60rpx;
  457. border-radius: 24px;
  458. background: #007AFF;
  459. display: flex;
  460. align-items: center;
  461. justify-content: center;
  462. .save-text {
  463. color: rgba(255, 255, 255, 1);
  464. font-family: DM Sans;
  465. font-size: 18px;
  466. font-weight: 400;
  467. line-height: 24px;
  468. letter-spacing: 0.5%;
  469. text-align: left;
  470. }
  471. }
  472. // 求职状态选择器样式
  473. .job-status-picker {
  474. background: #fff;
  475. border-radius: 42rpx 42rpx 0 0;
  476. .picker-header {
  477. padding: 40rpx 40rpx 20rpx 40rpx;
  478. text-align: center;
  479. border-bottom: 1px solid #f0f0f0;
  480. .picker-title {
  481. color: rgba(23, 23, 37, 1);
  482. font-family: DM Sans;
  483. font-size: 18px;
  484. font-weight: 600;
  485. line-height: 26px;
  486. letter-spacing: 0%;
  487. text-align: center;
  488. }
  489. }
  490. .picker-content {
  491. padding: 20rpx 40rpx 40rpx 40rpx;
  492. .status-option {
  493. padding: 30rpx 0;
  494. border-bottom: 1px solid #f0f0f0;
  495. &:last-child {
  496. border-bottom: none;
  497. }
  498. &.active {
  499. background-color: rgba(0, 122, 255, 0.05);
  500. }
  501. .option-left {
  502. display: flex;
  503. align-items: center;
  504. .radio-btn {
  505. width: 40rpx;
  506. height: 40rpx;
  507. border-radius: 50%;
  508. border: 2px solid #e0e0e0;
  509. display: flex;
  510. align-items: center;
  511. justify-content: center;
  512. margin-right: 20rpx;
  513. &.checked {
  514. background-color: #007AFF;
  515. border-color: #007AFF;
  516. }
  517. }
  518. .option-text {
  519. flex: 1;
  520. color: rgba(23, 23, 37, 1);
  521. font-family: DM Sans;
  522. font-size: 16px;
  523. font-weight: 400;
  524. line-height: 22px;
  525. letter-spacing: 0%;
  526. text-align: left;
  527. }
  528. .recommend-tag {
  529. background-color: #007AFF;
  530. border-radius: 8rpx;
  531. padding: 4rpx 12rpx;
  532. margin-left: 16rpx;
  533. text {
  534. color: #fff;
  535. font-family: DM Sans;
  536. font-size: 12px;
  537. font-weight: 500;
  538. line-height: 16px;
  539. letter-spacing: 0%;
  540. text-align: center;
  541. }
  542. }
  543. }
  544. }
  545. }
  546. }
  547. </style>