userinfo.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. <template>
  2. <view>
  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="36" color="#333"></u-icon>
  8. </view>
  9. <view class="navbar-title">基本信息</view>
  10. <view class="navbar-right"></view>
  11. </view>
  12. </view>
  13. <!-- <nav-bar title="基本信息"></nav-bar> -->
  14. <view class="usermain">
  15. <view class="usermain-item ">
  16. <view class="usermain-item-title">头像</view>
  17. <view class="avatar-wrapper">
  18. <!-- #ifdef MP-WEIXIN -->
  19. <button open-type="chooseAvatar" class="avatar-button" @chooseavatar="onChooseAvatar">
  20. <image style="width: 78rpx;height: 78rpx;border-radius: 50%"
  21. :src="avatar?avatar:'../../static/logo.png'"></image>
  22. </button>
  23. <!-- #endif -->
  24. <!-- #ifndef MP-WEIXIN -->
  25. <view @click="uploadImg()">
  26. <image src="../../static/logo.png" v-if="avatar==null" mode=""
  27. style="width: 78rpx;height: 78rpx;border-radius: 50%;"></image>
  28. <image v-else :src="avatar" mode="" style="width: 78rpx;height: 78rpx;border-radius: 50%;">
  29. </image>
  30. </view>
  31. <!-- #endif -->
  32. <view class="edit-avatar-icon">
  33. <image src="/static/images/index/Combined-Shape.svg" style="width: 32rpx;height: 32rpx;" mode="scaleToFill"></image>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="usermain-item item-padding ">
  38. <view class="form-label">
  39. <text class="required-mark">*</text>
  40. <text class="usermain-item-title">姓名</text>
  41. </view>
  42. <view class="cu-form-group">
  43. <input type="nickname" v-model="userName" placeholder="请输入用户名" />
  44. </view>
  45. </view>
  46. <view class="usermain-item item-padding ">
  47. <view class="form-label">
  48. <text class="required-mark">*</text>
  49. <view class="usermain-item-title">性别</view>
  50. </view>
  51. <view>
  52. <view class="cu-form-group">
  53. <u-radio-group v-model="sex">
  54. <u-radio shape="circle" :name="1">男</u-radio>
  55. <u-radio shape="circle" active-color="red" :name="2">女</u-radio>
  56. </u-radio-group>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="usermain-item item-padding ">
  61. <view class="usermain-item-title">年龄</view>
  62. <view>
  63. <view class="cu-form-group">
  64. <input v-model="age" />
  65. </view>
  66. </view>
  67. </view>
  68. <view class="usermain-item item-padding contact-structure">
  69. <view class="usermain-item-title">联系方式</view>
  70. <view class="contact-wrapper">
  71. <text class="phone-display">{{phoneWithMask}}</text>
  72. <text class="modify-link" @click="modifyPhone">修改手机号</text>
  73. </view>
  74. </view>
  75. <!-- <view class="usermain-item item-padding">
  76. <view >姓名</view>
  77. <view class="cu-form-group">
  78. <input v-model="realName" placeholder="请填写您的真实姓名" />
  79. </view>
  80. </view> -->
  81. <view class="usermain-item item-padding ">
  82. <view class="usermain-item-title">微信号码</view>
  83. <view>
  84. <view class="cu-form-group">
  85. <input v-model="weChatNum" placeholder="请输入微信号码,方便给求职者交换微信联系" />
  86. </view>
  87. </view>
  88. </view>
  89. <!-- 接收简历邮箱 -->
  90. <view class="usermain-item item-padding">
  91. <view class="usermain-item-title">接收简历邮箱</view>
  92. <view>
  93. <view class="cu-form-group">
  94. <input v-model="email" placeholder="建议录入企业邮箱" />
  95. </view>
  96. </view>
  97. </view>
  98. <!-- 我的公司 -->
  99. <view class="usermain-item item-padding">
  100. <view class="usermain-item-title">我的公司</view>
  101. <view>
  102. <view class="form-input-selector" @click="selectCompany">
  103. <text v-if="selectedCompany">{{ selectedCompany }}</text>
  104. <text v-else class="placeholder">请选择公司</text>
  105. <u-icon name="arrow-down" color="#999" size="36"></u-icon>
  106. </view>
  107. </view>
  108. </view>
  109. <!-- 我的职务 -->
  110. <view class="usermain-item item-padding">
  111. <view class="usermain-item-title">我的职务</view>
  112. <view>
  113. <view class="form-input-selector" @click="selectPosition">
  114. <text v-if="selectedPosition">{{ selectedPosition }}</text>
  115. <text v-else class="placeholder">请选择职务</text>
  116. <u-icon name="arrow-down" color="#999" size="36"></u-icon>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <view class="footer-btn">
  122. <view class="usermain-btn" @click="messagebtn()">保存</view>
  123. </view>
  124. </view>
  125. </template>
  126. <script>
  127. import configdata from '../../common/config.js';
  128. import navBar from "@/components/nav-bar/index.vue";
  129. export default {
  130. components: {
  131. navBar
  132. },
  133. data() {
  134. return {
  135. statusBarHeight: 0, // 状态栏高度
  136. phone: '',
  137. weChatNum:'',//微信号
  138. email: '',//接收简历邮箱
  139. selectedCompany: '深圳市汉瑞国际猎头服务有限公司', // 我的公司
  140. selectedPosition: '人事总监', // 我的职务
  141. avatar: '../../static/logo.png',
  142. userName: '',
  143. nickName: '',
  144. userId: '',
  145. realName: '',
  146. weChatId: "",
  147. password: '',
  148. platform: '',
  149. createTime: '',
  150. money: '',
  151. jiFen: '',
  152. status: '',
  153. zhiFuBao: '',
  154. zhiFuBaoName: '',
  155. sex: 1,
  156. age: 0
  157. };
  158. },
  159. computed: {
  160. phoneWithMask() {
  161. if (this.phone && this.phone.length >= 11) {
  162. return this.phone.substring(0, 3) + '******' + this.phone.substring(9);
  163. }
  164. return this.phone || '请设置手机号';
  165. }
  166. },
  167. onLoad(e) {
  168. // 获取状态栏高度
  169. let systemInfo = uni.getSystemInfoSync();
  170. this.statusBarHeight = systemInfo.statusBarHeight || 0;
  171. this.getUserInfo()
  172. // this.avatar = uni.getStorageSync('avatar')
  173. },
  174. methods: {
  175. // 返回上一页
  176. goBack() {
  177. uni.navigateBack();
  178. },
  179. // 修改手机号
  180. modifyPhone() {
  181. console.log('点击修改手机号,当前手机号:', this.phone);
  182. const url = `/pages/my/userphone?currentPhone=${this.phone}`;
  183. console.log('跳转路径:', url);
  184. uni.navigateTo({
  185. url: url,
  186. });
  187. },
  188. // 选择公司
  189. selectCompany() {
  190. uni.navigateTo({
  191. url: '/pages/my/myCompany'
  192. });
  193. },
  194. // 选择职务
  195. selectPosition() {
  196. // 这里可以跳转到职务选择页面或显示职务选择弹窗
  197. console.log('选择职务');
  198. },
  199. onChooseAvatar(e) {
  200. let that = this;
  201. let token = uni.getStorageSync('token');
  202. uni.uploadFile({
  203. url: that.config("APIHOST1") +
  204. '/alioss/upload', //真实的接口地址
  205. filePath: e.detail.avatarUrl,
  206. header: {
  207. token: token
  208. },
  209. name: 'file',
  210. success: uploadFileRes => {
  211. let url = JSON.parse(uploadFileRes.data);
  212. that.avatar = url.data
  213. uni.hideLoading();
  214. }
  215. });
  216. },
  217. goMyAddress() {
  218. uni.navigateTo({
  219. url: '../jifen/myaddress'
  220. });
  221. },
  222. uploadImg() {
  223. let token = uni.getStorageSync('token')
  224. if (!token) {
  225. this.goLoginInfo();
  226. return;
  227. }
  228. let that = this;
  229. var url = null;
  230. uni.showActionSheet({
  231. // itemList按钮的文字接受的是数组
  232. itemList: ["查看头像", "从相册选择图片"],
  233. success(e) {
  234. var index = e.tapIndex
  235. if (index === 0) {
  236. // 用户点击了预览当前图片
  237. // 可以自己实现当前头像链接的读取
  238. let url = that.avatar;
  239. let arr = []
  240. arr.push(url)
  241. uni.previewImage({
  242. // 预览功能图片也必须是数组的
  243. urls: arr
  244. })
  245. } else if (index === 1) {
  246. uni.chooseImage({
  247. count: 1, //默认9
  248. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  249. sourceType: ['album'], //从相册选择
  250. success: function(res) {
  251. uni.showLoading({
  252. title: '上传中...'
  253. });
  254. let token = uni.getStorageSync('token');
  255. let userId = uni.getStorageSync('userId');
  256. uni.uploadFile({
  257. url: that.config("APIHOST1") +
  258. '/alioss/upload', //真实的接口地址
  259. filePath: res.tempFilePaths[0],
  260. header: {
  261. token: token
  262. },
  263. name: 'file',
  264. success: uploadFileRes => {
  265. url = JSON.parse(uploadFileRes.data);
  266. that.avatar = url.data
  267. uni.hideLoading();
  268. }
  269. });
  270. }
  271. });
  272. }
  273. }
  274. })
  275. },
  276. config: function(name) {
  277. var info = null;
  278. if (name) {
  279. var name2 = name.split("."); //字符分割
  280. if (name2.length > 1) {
  281. info = configdata[name2[0]][name2[1]] || null;
  282. } else {
  283. info = configdata[name] || null;
  284. }
  285. if (info == null) {
  286. let web_config = cache.get("web_config");
  287. if (web_config) {
  288. if (name2.length > 1) {
  289. info = web_config[name2[0]][name2[1]] || null;
  290. } else {
  291. info = web_config[name] || null;
  292. }
  293. }
  294. }
  295. }
  296. return info;
  297. },
  298. getUserInfo() {
  299. let userId = uni.getStorageSync('userId')
  300. this.$Request.get("/app/user/selectUserById").then(res => {
  301. if (res.code == 0) {
  302. this.$queue.setData('avatar', res.data.avatar);
  303. this.$queue.setData('userId', res.data.userId);
  304. this.$queue.setData('userName', res.data.userName);
  305. this.$queue.setData('phone', res.data.phone);
  306. this.$queue.setData('age', res.data.age);
  307. this.$queue.setData('weChatNum',res.data.weChatNum)
  308. this.weChatNum = res.data.weChatNum
  309. this.sex = res.data.sex
  310. this.age = res.data.age
  311. this.phone = res.data.phone;
  312. this.avatar = res.data.avatar;
  313. this.userName = res.data.userName;
  314. if (this.userName == null) {
  315. this.userName = res.data.nickName;
  316. } else {
  317. this.userName = res.data.userName;
  318. }
  319. }
  320. uni.hideLoading();
  321. });
  322. },
  323. // 保存
  324. messagebtn() {
  325. if (!this.userName) {
  326. // this.$queue.showToast('用户名不能为空');
  327. uni.showToast({
  328. title: "用户名不能为空",
  329. icon: "none"
  330. })
  331. } else if (!this.phone) {
  332. // this.$queue.showToast('用户名不能为空');
  333. uni.showToast({
  334. title: "联系电话不能为空",
  335. icon: "none"
  336. })
  337. } else {
  338. let that = this
  339. uni.showModal({
  340. title: '温馨提示',
  341. content: '确定保存信息',
  342. success: e => {
  343. if (e.confirm) {
  344. that.$Request.postJson("/app/user/updateUser", {
  345. userName: that.userName,
  346. avatar: that.avatar,
  347. phone: that.phone,
  348. sex: that.sex,
  349. age: that.age,
  350. weChatNum:that.weChatNum
  351. }).then(res => {
  352. if (res.code === 0) {
  353. uni.showToast({
  354. title: '保存成功',
  355. icon: "none"
  356. })
  357. that.getUserInfo()
  358. setTimeout(function() {
  359. uni.navigateBack()
  360. }, 1000)
  361. } else {
  362. uni.showToast({
  363. title: res.msg,
  364. icon: "none"
  365. })
  366. }
  367. })
  368. }
  369. }
  370. });
  371. }
  372. }
  373. },
  374. // userphone(){
  375. // uni.navigateTo({
  376. // url:'/pages/my/userphone'
  377. // })
  378. // }
  379. };
  380. </script>
  381. <style lang="scss" scoped>
  382. page {
  383. /* background: #1c1b20; */
  384. }
  385. .navbar {
  386. position: fixed;
  387. top: 0;
  388. left: 0;
  389. right: 0;
  390. z-index: 999;
  391. background: #fff;
  392. padding: 0 0 40rpx 20rpx;
  393. .navbar-content {
  394. display: flex;
  395. align-items: center;
  396. justify-content: space-between;
  397. padding: 0 30rpx;
  398. height: 60rpx;
  399. .navbar-left {
  400. width: 60rpx;
  401. height: 60rpx;
  402. display: flex;
  403. align-items: center;
  404. justify-content: center;
  405. }
  406. .navbar-title {
  407. color: rgba(23, 23, 37, 1);
  408. font-family: DM Sans;
  409. font-size: 36rpx;
  410. font-weight: 700;
  411. line-height: 52rpx;
  412. letter-spacing: 0%;
  413. text-align: center;
  414. }
  415. .navbar-right {
  416. width: 60rpx;
  417. height: 60rpx;
  418. }
  419. }
  420. }
  421. button::after {
  422. border: none;
  423. background-color: none;
  424. }
  425. button {
  426. position: relative;
  427. display: block;
  428. margin-left: auto;
  429. margin-right: auto;
  430. padding-left: 0px;
  431. padding-right: 0px;
  432. box-sizing: border-box;
  433. text-decoration: none;
  434. line-height: 1.35;
  435. overflow: hidden;
  436. color: #666666;
  437. /* background-color: #fff; */
  438. background-color: rgba(255, 255, 255, 0) !important;
  439. width: 100%;
  440. height: 100%;
  441. }
  442. .usermain {
  443. background: #ffffff;
  444. /* color: #fff; */
  445. margin-top: 120rpx; /* 为固定导航栏留出空间 */
  446. }
  447. .usermain-item {
  448. display: flex;
  449. flex-direction: column;
  450. margin: 0 40rpx;
  451. padding: 20rpx 0;
  452. // border-bottom: 1rpx solid rgba(229, 229, 229, 0.3);
  453. gap: 16rpx;
  454. }
  455. .usermain-item-title {
  456. color: rgba(31, 44, 55, 1);
  457. font-family: DM Sans;
  458. font-size: 28rpx;
  459. font-weight: 500;
  460. line-height: 44rpx;
  461. text-align: left;
  462. }
  463. .usermain-item.item-padding {
  464. /* padding: 0; */
  465. }
  466. .cu-form-group {
  467. padding: 0;
  468. background: #ffffff;
  469. text-align: right;
  470. }
  471. .cu-form-group input {
  472. background: #ffffff;
  473. font-size: 28rpx;
  474. /* color: #fff; */
  475. }
  476. /* 姓名字段样式 - 参考basicInfo.vue */
  477. .usermain-item .form-label {
  478. color: rgba(31, 44, 55, 1);
  479. font-family: DM Sans;
  480. font-size: 32rpx;
  481. font-weight: 500;
  482. line-height: 44rpx;
  483. letter-spacing: 0.5%;
  484. text-align: left;
  485. display: flex;
  486. align-items: center;
  487. margin-bottom: 16rpx;
  488. }
  489. .usermain-item .required-mark {
  490. color: #FF3B30;
  491. font-size: 36rpx;
  492. font-weight: 600;
  493. margin-right: 8rpx;
  494. }
  495. .usermain-item .cu-form-group {
  496. background: transparent;
  497. text-align: left;
  498. padding: 0;
  499. }
  500. .usermain-item .cu-form-group input {
  501. width: 100%;
  502. height: 68rpx;
  503. font-size: 28rpx;
  504. border: 1rpx solid rgba(227, 231, 236, 1);
  505. border-radius: 44rpx;
  506. color: rgba(23, 23, 37, 1);
  507. padding: 0 32rpx;
  508. background: #ffffff;
  509. font-family: DM Sans;
  510. font-weight: 400;
  511. }
  512. .usermain-item .cu-form-group input::placeholder {
  513. color: rgba(155, 155, 155, 1);
  514. font-size: 28rpx;
  515. }
  516. /* 联系方式样式 */
  517. .contact-structure {
  518. border-bottom: none !important;
  519. }
  520. .contact-wrapper {
  521. display: flex;
  522. align-items: center;
  523. justify-content: space-between;
  524. padding: 0;
  525. margin-top: 8rpx;
  526. }
  527. .phone-display {
  528. color: rgba(23, 23, 37, 1);
  529. font-family: DM Sans;
  530. font-size: 28rpx;
  531. font-weight: 400;
  532. line-height: 40rpx;
  533. letter-spacing: 0.5%;
  534. }
  535. .modify-link {
  536. color: rgba(24, 144, 255, 1);
  537. font-family: DM Sans;
  538. font-size: 28rpx;
  539. font-weight: 400;
  540. line-height: 40rpx;
  541. letter-spacing: 0.5%;
  542. cursor: pointer;
  543. text-decoration: none;
  544. }
  545. .modify-link:active {
  546. opacity: 0.7;
  547. }
  548. /* 头像编辑图标样式 */
  549. .avatar-wrapper {
  550. position: relative;
  551. display: inline-block;
  552. }
  553. .edit-avatar-icon {
  554. position: absolute;
  555. bottom: 10rpx;
  556. right: 2rpx;
  557. width: 24rpx;
  558. height: 24rpx;
  559. // background: #fff;
  560. border-radius: 50%;
  561. display: flex;
  562. align-items: center;
  563. justify-content: center;
  564. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  565. }
  566. .avatar-button {
  567. position: relative;
  568. padding: 0;
  569. margin: 0;
  570. background: transparent;
  571. border: none;
  572. }
  573. .footer-btn {
  574. margin-top: 40rpx;
  575. padding-bottom: 40rpx;
  576. }
  577. .footer-btn .usermain-btn {
  578. color: rgba(255, 255, 255, 1);
  579. background: rgba(1, 107, 246, 1);
  580. text-align: center;
  581. width: 90%;
  582. height: 80rpx;
  583. font-size: 32rpx;
  584. line-height: 80rpx;
  585. margin: 20rpx auto;
  586. border-radius: 40rpx;
  587. }
  588. /* 选择器样式 - 参考workExperience页面 */
  589. .form-input-selector {
  590. width: 100%;
  591. height: 68rpx;
  592. padding: 0 40rpx;
  593. border: 1px solid rgba(227, 231, 236, 1);
  594. border-radius: 24px;
  595. background: rgba(255, 255, 255, 1);
  596. display: flex;
  597. align-items: center;
  598. justify-content: space-between;
  599. cursor: pointer;
  600. transition: all 0.2s ease;
  601. .placeholder {
  602. color: #999999;
  603. font-family: DM Sans;
  604. font-size: 28rpx;
  605. font-weight: 400;
  606. line-height: 40rpx;
  607. }
  608. text {
  609. color: rgba(23, 23, 37, 1);
  610. font-family: DM Sans;
  611. font-size: 28rpx;
  612. font-weight: 400;
  613. line-height: 40rpx;
  614. }
  615. }
  616. .arrow-down {
  617. color: rgba(96, 98, 102, 1);
  618. font-size: 24rpx;
  619. font-weight: 400;
  620. transform: scale(1.5);
  621. }
  622. .selector-group:active {
  623. background: #f5f7fa !important;
  624. transform: scale(0.99);
  625. }
  626. </style>