userinfo.vue 15 KB

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