editpassword.vue 3.6 KB

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