basicInfo.vue 14 KB

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