editpassword.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view>
  3. <scroll-view scroll-y class="page">
  4. <cu-custom bgColor="bg-luohu" :isBack="true">
  5. <block slot="backText">返回</block>
  6. <block slot="content">修改密码</block>
  7. </cu-custom>
  8. <view class="example-body " style="display: flex;justify-content: center; margin-top: 80rpx;">
  9. <u-avatar :src="photo" size="160">
  10. </u-avatar>
  11. </view>
  12. <uni-card>
  13. <view class="cu-list menu">
  14. <view class="cu-form-group">
  15. <view class="title">密码</view>
  16. <input placeholder="请输入六位以上密码" name="input" type="password" v-model="password"></input>
  17. </view>
  18. <view class="cu-form-group">
  19. <view class="title">确认</view>
  20. <input placeholder="请再输入一遍密码" name="input" type="password" v-model="again"></input>
  21. </view>
  22. </view>
  23. </uni-card>
  24. <view class="padding flex flex-direction" style="margin-bottom: 100rpx;">
  25. <button class="cu-btn bg-blue lg bg-mingjian" @click="submit">确认修改</button>
  26. </view>
  27. </scroll-view>
  28. </view>
  29. </template>
  30. <script>
  31. import {
  32. ACCESS_TOKEN,
  33. USER_NAME,
  34. USER_INFO
  35. } from "@/common/util/constants"
  36. import api from '@/api/api.js'
  37. import http from '@/common/service/http.js'
  38. export default {
  39. data() {
  40. return {
  41. password: "",
  42. again: "",
  43. id: '',
  44. photo: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b7c7f970-517d-11eb-97b7-0dc4655d6e68.jpg'
  45. };
  46. },
  47. onLoad() {
  48. let user = uni.getStorageSync(USER_INFO).employee;
  49. this.id = user.id
  50. this.loadinfo()
  51. },
  52. methods: {
  53. loadinfo() {
  54. let token = uni.getStorageSync(ACCESS_TOKEN)
  55. this.$http.get('ibps/platform/v3/employee/load', {
  56. params: {
  57. employeeId: this.id
  58. }
  59. }).then(res => {
  60. if (res.data.state == '200') {
  61. let result = res.data.data
  62. this.user = result
  63. if (result.photo != '') {
  64. this.photo = http.apiHosp + 'ibps/platform/v3' + this.user.photo +
  65. '&access_token=' +
  66. token + '&tenantId='
  67. }
  68. }
  69. }).catch(e => {})
  70. },
  71. submit() {
  72. if (!this.password || this.password.length < 6) {
  73. this.$tip.alert('正确输入密码');
  74. return false
  75. }
  76. if (this.password != this.again) {
  77. this.$tip.alert('两次输入不一致');
  78. return false
  79. }
  80. let data = {
  81. "userIds": [
  82. this.user.employee.id,
  83. ],
  84. "newPassword": this.password,
  85. "repeatPassword": this.again,
  86. "primitivePassword": "",
  87. "reset": 1
  88. };
  89. let that = this;
  90. this.$http.post("/ibps/platform/v3/user/change/passwd", data).then(res => {
  91. if (res.data.state == 200) {
  92. that.$tip.toast("修改成功")
  93. uni.navigateTo({
  94. url: "/pages/index/index"
  95. })
  96. } else {
  97. this.$tip.toast("发送异常");
  98. }
  99. });
  100. }
  101. }
  102. }
  103. </script>
  104. <style>
  105. .page {
  106. height: 100Vh;
  107. width: 100vw;
  108. }
  109. .page.show {
  110. overflow: hidden;
  111. }
  112. .switch-sex::after {
  113. content: "\e716";
  114. }
  115. .switch-sex::before {
  116. content: "\e7a9";
  117. }
  118. .switch-music::after {
  119. content: "\e66a";
  120. }
  121. .switch-music::before {
  122. content: "\e6db";
  123. }
  124. .example-body {
  125. padding: 10px;
  126. padding-top: 0;
  127. }
  128. .custom-image-box {
  129. /* #ifndef APP-NVUE */
  130. display: flex;
  131. /* #endif */
  132. flex-direction: row;
  133. justify-content: space-between;
  134. align-items: center;
  135. }
  136. .text {
  137. font-size: 14px;
  138. color: #333;
  139. }
  140. </style>