basicInfo.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  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. this.getUserInfo()
  170. },
  171. methods: {
  172. goBack() {
  173. uni.navigateBack();
  174. },
  175. // 选择头像
  176. chooseAvatar() {
  177. var that=this
  178. uni.chooseImage({
  179. count: 1,
  180. sizeType: ["compressed"],
  181. sourceType: ["album", "camera"],
  182. success: (res) => {
  183. that.$queue.uploadFile(res.tempFilePaths[0],function(path){
  184. if(path)
  185. that.formData.avatar = path;
  186. })
  187. },
  188. });
  189. },
  190. // 日期选择确认
  191. onDateConfirm(e) {
  192. const { year, month, day } = e;
  193. this.birthDateText = `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
  194. this.showDatePicker = false;
  195. },
  196. // 显示求职状态选择器
  197. showJobStatusPicker() {
  198. this.showJobStatusModal = true;
  199. },
  200. // 选择求职状态
  201. selectJobStatus(item) {
  202. this.selectedJobStatus = item.value;
  203. this.showJobStatusModal = false;
  204. // 可以在这里添加保存状态的逻辑
  205. console.log('选择的求职状态:', item);
  206. },
  207. getUserInfo() {
  208. let userId = uni.getStorageSync('userId')
  209. this.$Request.get("/app/user/selectUserById").then(res => {
  210. if (res.code == 0) {
  211. this.weChatNum = res.data.weChatNum
  212. this.sex = res.data.sex
  213. this.age = res.data.age
  214. this.phone = res.data.phone;
  215. this.avatar = res.data.avatar;
  216. this.userName = res.data.userName;
  217. }
  218. uni.hideLoading();
  219. });
  220. },
  221. // 保存
  222. messagebtn() {
  223. if (!this.userName) {
  224. // this.$queue.showToast('用户名不能为空');
  225. uni.showToast({
  226. title: "用户名不能为空",
  227. icon: "none"
  228. })
  229. } else if (!this.phone) {
  230. // this.$queue.showToast('用户名不能为空');
  231. uni.showToast({
  232. title: "联系电话不能为空",
  233. icon: "none"
  234. })
  235. } else {
  236. let that = this
  237. uni.showModal({
  238. title: '温馨提示',
  239. content: '确定保存信息',
  240. success: e => {
  241. if (e.confirm) {
  242. that.$Request.postJson("/app/user/updateUser", {
  243. userName: that.userName,
  244. avatar: that.avatar,
  245. phone: that.phone,
  246. sex: that.sex,
  247. age: that.age,
  248. weChatNum:that.weChatNum
  249. }).then(res => {
  250. if (res.code === 0) {
  251. uni.showToast({
  252. title: '保存成功',
  253. icon: "none"
  254. })
  255. that.setResume()
  256. } else {
  257. uni.showToast({
  258. title: res.msg,
  259. icon: "none"
  260. })
  261. }
  262. })
  263. }
  264. }
  265. });
  266. }
  267. },
  268. setResume() {
  269. let data={
  270. resumesStatus:this.selectedJobStatus,
  271. birthday:this.birthDateText,
  272. ifExp:this.ifExp
  273. }
  274. this.$Request.postJson("/app/userFirst/regist", data).then((res) => {
  275. if (res.code == 0) {
  276. // 实际开发中可以在这里添加跳转逻辑
  277. uni.$emit('updateResume')
  278. setTimeout(function() {
  279. uni.navigateBack()
  280. }, 1000)
  281. } else {
  282. uni.showToast({
  283. title: res.msg,
  284. icon: "none",
  285. });
  286. }
  287. });
  288. }
  289. }
  290. }
  291. </script>
  292. <style lang="scss" scoped>
  293. .basic-info {
  294. background-color: #fff;
  295. min-height: 100vh;
  296. }
  297. // 顶部导航栏
  298. .navbar {
  299. background: #fff;
  300. padding: 80rpx 0 40rpx 40rpx;
  301. margin-bottom: 30rpx;
  302. .navbar-content {
  303. display: flex;
  304. align-items: center;
  305. justify-content: space-between;
  306. padding: 0 30rpx;
  307. height: 60rpx;
  308. .navbar-left {
  309. width: 60rpx;
  310. height: 60rpx;
  311. display: flex;
  312. align-items: center;
  313. justify-content: center;
  314. }
  315. .navbar-title {
  316. color: var(--Grayscale/Grayscale 100, rgba(23, 23, 37, 1));
  317. font-family: DM Sans;
  318. font-size: 18px;
  319. font-weight: 700;
  320. line-height: 26px;
  321. letter-spacing: 0.5%;
  322. text-align: center;
  323. }
  324. .navbar-right {
  325. width: 60rpx;
  326. height: 60rpx;
  327. }
  328. }
  329. }
  330. // 表单内容
  331. .form-content {
  332. padding: 0 30rpx;
  333. .form-item {
  334. margin-bottom: 30rpx;
  335. .form-label {
  336. color: var(--Neutral/100, rgba(31, 44, 55, 1));
  337. font-family: DM Sans;
  338. font-size: 16px;
  339. font-weight: 500;
  340. line-height: 22px;
  341. letter-spacing: 0.5%;
  342. text-align: left;
  343. display: flex;
  344. align-items: center;
  345. margin-bottom: 20rpx;
  346. .required-mark {
  347. color: #FF3B30;
  348. font-size: 18px;
  349. font-weight: 600;
  350. margin-right: 8rpx;
  351. }
  352. text {
  353. color: var(--Neutral/100, rgba(31, 44, 55, 1));
  354. font-family: DM Sans;
  355. font-size: 16px;
  356. font-weight: 500;
  357. line-height: 22px;
  358. letter-spacing: 0.5%;
  359. text-align: left;
  360. }
  361. }
  362. .form-input {
  363. width: 100%;
  364. height: 75rpx;
  365. font-size: 14px;
  366. border: 1px solid rgba(227, 231, 236, 1);
  367. border-radius: 24px;
  368. color: rgba(23, 23, 37, 1);
  369. padding: 12px 16px;
  370. }
  371. .form-display {
  372. color: rgba(23, 23, 37, 1);
  373. font-family: DM Sans;
  374. font-size: 16px;
  375. font-weight: 400;
  376. line-height: 22px;
  377. letter-spacing: 0%;
  378. text-align: left;
  379. padding: 15px 0px;
  380. }
  381. // 头像样式
  382. .avatar-container {
  383. position: relative;
  384. display: inline-block;
  385. .user-avatar {
  386. width: 80rpx;
  387. height: 80rpx;
  388. border-radius: 50%;
  389. }
  390. .edit-avatar-icon {
  391. position: absolute;
  392. bottom: 10rpx;
  393. right: 5rpx;
  394. width: 25rpx;
  395. height: 25rpx;
  396. border-radius: 50%;
  397. display: flex;
  398. align-items: center;
  399. justify-content: center;
  400. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.1);
  401. }
  402. }
  403. // 日期选择器样式
  404. .date-picker {
  405. display: flex;
  406. align-items: center;
  407. justify-content: space-between;
  408. height: 75rpx;
  409. font-size: 14px;
  410. border: 1px solid rgba(227, 231, 236, 1);
  411. border-radius: 24px;
  412. color: rgba(23, 23, 37, 1);
  413. padding: 12px 16px;
  414. .date-text {
  415. color: rgba(23, 23, 37, 1);
  416. font-family: DM Sans;
  417. font-size: 14px;
  418. font-weight: 400;
  419. line-height: 22px;
  420. letter-spacing: 0%;
  421. text-align: left;
  422. }
  423. }
  424. // 下拉选择器样式
  425. .select-picker {
  426. display: flex;
  427. align-items: center;
  428. justify-content: space-between;
  429. height: 75rpx;
  430. font-size: 14px;
  431. border: 1px solid rgba(227, 231, 236, 1);
  432. border-radius: 24px;
  433. color: rgba(23, 23, 37, 1);
  434. padding: 12px 16px;
  435. .select-text {
  436. color: rgba(23, 23, 37, 1);
  437. font-family: DM Sans;
  438. font-size: 14px;
  439. font-weight: 400;
  440. line-height: 22px;
  441. letter-spacing: 0%;
  442. text-align: left;
  443. }
  444. }
  445. }
  446. }
  447. // 保存按钮
  448. .save-button {
  449. position: fixed;
  450. bottom: 60rpx;
  451. left: 0;
  452. right: 0;
  453. height: 120rpx;
  454. margin: 0 60rpx;
  455. border-radius: 24px;
  456. background: #007AFF;
  457. display: flex;
  458. align-items: center;
  459. justify-content: center;
  460. .save-text {
  461. color: rgba(255, 255, 255, 1);
  462. font-family: DM Sans;
  463. font-size: 18px;
  464. font-weight: 400;
  465. line-height: 24px;
  466. letter-spacing: 0.5%;
  467. text-align: left;
  468. }
  469. }
  470. // 求职状态选择器样式
  471. .job-status-picker {
  472. background: #fff;
  473. border-radius: 42rpx 42rpx 0 0;
  474. .picker-header {
  475. padding: 40rpx 40rpx 20rpx 40rpx;
  476. text-align: center;
  477. border-bottom: 1px solid #f0f0f0;
  478. .picker-title {
  479. color: rgba(23, 23, 37, 1);
  480. font-family: DM Sans;
  481. font-size: 18px;
  482. font-weight: 600;
  483. line-height: 26px;
  484. letter-spacing: 0%;
  485. text-align: center;
  486. }
  487. }
  488. .picker-content {
  489. padding: 20rpx 40rpx 40rpx 40rpx;
  490. .status-option {
  491. padding: 30rpx 0;
  492. border-bottom: 1px solid #f0f0f0;
  493. &:last-child {
  494. border-bottom: none;
  495. }
  496. &.active {
  497. background-color: rgba(0, 122, 255, 0.05);
  498. }
  499. .option-left {
  500. display: flex;
  501. align-items: center;
  502. .radio-btn {
  503. width: 40rpx;
  504. height: 40rpx;
  505. border-radius: 50%;
  506. border: 2px solid #e0e0e0;
  507. display: flex;
  508. align-items: center;
  509. justify-content: center;
  510. margin-right: 20rpx;
  511. &.checked {
  512. background-color: #007AFF;
  513. border-color: #007AFF;
  514. }
  515. }
  516. .option-text {
  517. flex: 1;
  518. color: rgba(23, 23, 37, 1);
  519. font-family: DM Sans;
  520. font-size: 16px;
  521. font-weight: 400;
  522. line-height: 22px;
  523. letter-spacing: 0%;
  524. text-align: left;
  525. }
  526. .recommend-tag {
  527. background-color: #007AFF;
  528. border-radius: 8rpx;
  529. padding: 4rpx 12rpx;
  530. margin-left: 16rpx;
  531. text {
  532. color: #fff;
  533. font-family: DM Sans;
  534. font-size: 12px;
  535. font-weight: 500;
  536. line-height: 16px;
  537. letter-spacing: 0%;
  538. text-align: center;
  539. }
  540. }
  541. }
  542. }
  543. }
  544. }
  545. </style>