setup.vue 14 KB

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