| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <template>
- <view>
- <scroll-view scroll-y class="page">
- <cu-custom bgColor="bg-luohu" :isBack="true">
- <block slot="backText">返回</block>
- <block slot="content">修改密码</block>
- </cu-custom>
- <view class="example-body " style="display: flex;justify-content: center; margin-top: 80rpx;">
- <u-avatar :src="photo" size="160">
- </u-avatar>
- </view>
- <uni-card>
- <view class="cu-list menu">
- <view class="cu-form-group">
- <view class="title">密码</view>
- <input placeholder="请输入六位以上密码" name="input" type="password" v-model="password"></input>
- </view>
- <view class="cu-form-group">
- <view class="title">确认</view>
- <input placeholder="请再输入一遍密码" name="input" type="password" v-model="again"></input>
- </view>
- </view>
- </uni-card>
- <view class="padding flex flex-direction" style="margin-bottom: 100rpx;">
- <button class="cu-btn bg-blue lg btn-back-color" @click="submit">确认修改</button>
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- import {
- ACCESS_TOKEN,
- USER_NAME,
- USER_INFO
- } from "@/common/util/constants"
- import api from '@/api/api.js'
- import http from '@/common/service/http.js'
- export default {
- data() {
- return {
- password: "",
- again: "",
- id: '',
- photo: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b7c7f970-517d-11eb-97b7-0dc4655d6e68.jpg'
- };
- },
- onLoad() {
- let user = uni.getStorageSync(USER_INFO).user;
- this.id = user.id
- this.loadinfo()
- },
- methods: {
- loadinfo() {
- let token = uni.getStorageSync(ACCESS_TOKEN)
- this.$http.get('ibps/platform/v3/employee/load', {
- params: {
- employeeId: this.id
- }
- }).then(res => {
- if (res.data.state == '200') {
- let result = res.data.data
- this.user = result
- if (result.photo != '') {
- this.photo = http.apiHosp + 'ibps/platform/v3' + this.user.photo +
- '&access_token=' +
- token + '&tenantId='
- }
- }
- }).catch(e => {})
- },
- submit() {
- if (!this.password || this.password.length < 6) {
- uni.showToast({
- title: '密码长度不小于6位',
- icon: 'none',
- duration: 2000
- })
- return false
- }
- if (this.password != this.again) {
- uni.showToast({
- title: '两次输入不一致 ',
- icon: 'none',
- duration: 2000
- })
- return false
- }
- let reg = new RegExp(/^(?![^a-zA-Z]+$)(?!\D+$)/)
- if (!reg.test(this.password)) {
- uni.showToast({
- title: '密码必须包含数字和字母',
- icon: 'none',
- duration: 2000
- })
- return false
- }
- let data = {
- "userIds": [
- this.id,
- ],
- "newPassword": this.password,
- "repeatPassword": this.again,
- "primitivePassword": "",
- "reset": 1
- };
- this.$methCommon.getShowLoading()
- let that = this;
- this.$http.post("/ibps/platform/v3/user/change/passwd", data).then(res => {
- if (res.data.state == 200) {
- that.$tip.toast("修改成功")
- uni.reLaunch({
- url: "/pages/index/index"
- })
- uni.hideLoading()
- } else {
- this.$methCommon.getPrompt('修改失败!', 'fail')
- uni.hideLoading()
- }
- })
- }
- }
- }
- </script>
- <style>
- .page {
- height: 100Vh;
- width: 100vw;
- }
- .page.show {
- overflow: hidden;
- }
- .switch-sex::after {
- content: "\e716";
- }
- .switch-sex::before {
- content: "\e7a9";
- }
- .switch-music::after {
- content: "\e66a";
- }
- .switch-music::before {
- content: "\e6db";
- }
- .example-body {
- padding: 10px;
- padding-top: 0;
- }
- .custom-image-box {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- }
- .text {
- font-size: 14px;
- color: #333;
- }
- </style>
|