| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <template>
- <view class="page">
- <view class="info">
- <u--form labelPosition="left" :model="info" ref="ownerForm" labelWidth="80" errorType="message"
- :labelStyle="{fontWeight:'bold',color:'#333'}">
- <u-form-item label="旧密码" borderBottom>
- <u--input v-model="info.oldPassWord" border="none" clearable placeholder="请输入旧密码"
- placeholderStyle="color:#999"></u--input>
- </u-form-item>
- <u-form-item label="新密码" borderBottom>
- <u--input v-model="info.newPassWord" border="none" clearable placeholder="请输入8-20位的字母,数字的组合"
- placeholderStyle="color:#999" :password="isHidePassword">
- </u--input>
- </u-form-item>
- <u-form-item label="确认密码" borderBottom>
- <u--input v-model="newPassWord" border="none" clearable placeholder="请确认密码"
- placeholderStyle="color:#999" :password="isHidePassword">
- </u--input>
- </u-form-item>
- </u--form>
- </view>
- <view class="btn dis a-c j-c " @click="save">
- 确定
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from "vuex"
- export default {
- data() {
- return {
- isHidePassword: true, //是否隐藏密码
- info: {
- oldPassWord: "", //旧密码
- newPassWord: "", //新密码
- },
- newPassWord: "",
- }
- },
- onShow() {
- },
- onLoad() {
- },
- computed: {},
- methods: {
- ...mapMutations(['emptyUserInfo']),
- async save() {
- if (!this.info.oldPassWord) {
- uni.showToast({
- title: '旧密码为空',
- icon: 'none'
- });
- return;
- }
- if (!this.info.newPassWord) {
- uni.showToast({
- title: '新密码为空',
- icon: 'none'
- });
- return;
- }
- if (!this.newPassWord) {
- uni.showToast({
- title: '确认密码为空',
- icon: 'none'
- });
- return;
- }
- if (this.info.newPassWord !== this.newPassWord) {
- uni.showToast({
- title: '新密码要与确认密码一致',
- icon: 'none'
- });
- return;
- }
- let res = await this.$http.post('/auth/modifyPass', this.info);
- if (res.code == 200) {
- uni.showToast({
- title: '密码修改成功,请重新登录',
- icon: 'none'
- });
- this.emptyUserInfo();
- setTimeout(() => {
- uni.reLaunch({
- url: "/pages/login/login"
- })
- }, 1500);
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- }
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- background-color: #fff;
- padding: 30rpx 60rpx;
- box-sizing: border-box;
- }
- .info {}
- .btn {
- padding: 20rpx;
- box-sizing: border-box;
- background: #FDE935;
- border-radius: 45rpx 45rpx 45rpx 45rpx;
- margin-top: 100rpx;
- font-size: 36rpx;
- color: #1F1F1F;
- font-weight: bold;
- }
- ::v-deep {
- .u-form-item__body {
- padding: 34rpx 0;
- }
- }
- </style>
|