123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <template>
- <view class="pwd-retrieve-container pwd">
- <uni-forms ref="form" :value="user" >
- <uni-forms-item name="oldPassword" label="旧密码">
- <uni-easyinput :inputBorder="false" type="password" v-model="user.oldPassword" placeholder="请输入旧密码" />
- </uni-forms-item>
- <uni-forms-item name="newPassword" label="新密码">
- <uni-easyinput :inputBorder="false" type="password" v-model="user.newPassword" placeholder="请输入新密码" />
- </uni-forms-item>
- <uni-forms-item name="confirmPassword" label="确认密码">
- <uni-easyinput :inputBorder="false" type="password" v-model="user.confirmPassword" placeholder="请确认新密码" />
- </uni-forms-item>
- <view class="rbtn" @click="submit">提交</view>
- </uni-forms>
- </view>
- </template>
- <script>
- import { updateUserPwd } from "@/api/system/user"
- export default {
- data() {
- return {
- user: {
- oldPassword: undefined,
- newPassword: undefined,
- confirmPassword: undefined
- },
- rules: {
- oldPassword: {
- rules: [{
- required: true,
- errorMessage: '旧密码不能为空'
- }]
- },
- newPassword: {
- rules: [{
- required: true,
- errorMessage: '新密码不能为空',
- },
- {
- minLength: 6,
- maxLength: 20,
- errorMessage: '长度在 6 到 20 个字符'
- }
- ]
- },
- confirmPassword: {
- rules: [{
- required: true,
- errorMessage: '确认密码不能为空'
- }, {
- validateFunction: (rule, value, data) => data.newPassword === value,
- errorMessage: '两次输入的密码不一致'
- }
- ]
- }
- }
- }
- },
- onReady() {
- this.$refs.form.setRules(this.rules)
- },
- methods: {
- submit() {
- var that = this;
- this.$refs.form.validate().then(res => {
- updateUserPwd(this.user.oldPassword, this.user.newPassword).then(response => {
- that.$toast("修改成功")
- setTimeout(function(){
- that.$tab.reLaunch('/pages/mine/index')
- },1500)
- })
- })
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- background-color: #f5f5f5;
- }
- .pwd-retrieve-container {
- padding: 10rpx 36rpx;
- }
- .pwd .rbtn{width: 100%;height: 98rpx;background: $com-cd3;border-radius: 49rpx;text-align: center;line-height: 98rpx;font-size: 32rpx;font-weight: bold;color: #FFFEFE;margin-top: 68rpx;}
- .pwd /deep/ .uni-forms-item{height: 126rpx;background: #FFFFFF;border-radius: 18rpx;margin-top: 30rpx;padding: 0 40rpx;box-sizing: border-box;display: flex;align-items: center;margin-bottom: 0;}
- .pwd /deep/ .uni-forms-item__label{font-size: 32rpx;font-weight: 500;
- color: #161616;flex: 0 0 auto;width: auto !important;}
- .pwd /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 32rpx;color: #161616;}
- .pwd /deep/ .uni-forms-item__content{display: flex;align-items: center;flex-direction: row;}
- .pwd /deep/ .uni-easyinput__placeholder-class{font-size: 30rpx;}
- .pwd /deep/ .uni-easyinput__content-input{font-size: 30rpx;}
- .pwd /deep/ .uni-forms-item__error{margin-top:20rpx;left: auto;right: 0;z-index: 1;}
-
- </style>
|