123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <template>
- <view class="content">
- <u-navbar back-text="返回" title="修改密码" back-icon-color="#ffffff" :back-text-style="{color: '#ffffff'}" title-color="#ffffff"
- :background="{backgroundColor: mainColor}"></u-navbar>
- <u-form :model="form" ref="form" label-width="140">
- <u-form-item label="账号" prop="userAccount" required>
- <u-input v-model="form.userAccount" placeholder="请输入账号" type="text" />
- </u-form-item>
- <u-form-item label="旧密码" prop="pwd" required>
- <u-input v-model="form.pwd" placeholder="请输入旧密码" type="text" />
- </u-form-item>
- <u-form-item label="新密码" prop="newPwd" required>
- <u-input v-model="form.newPwd" placeholder="请输入新密码" type="text" />
- </u-form-item>
- </u-form>
- <view class="handle-fix-box">
- <u-button type="primary" :ripple="true" :custom-style="customStyle" @click="submitForm()">提交</u-button>
- </view>
- <u-top-tips ref="uTips" :navbar-height="statusBarHeight + navbarHeight"></u-top-tips>
- </view>
- </template>
- <script>
- import {
- mapGetters
- } from 'vuex'
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- computed: {
- ...mapGetters([
- 'mainColor',
- 'customStyle',
- ])
- },
- data() {
- return {
- statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
- navbarHeight: 44,
- form: {
- userAccount: '',
- pwd: '',
- newPwd: '',
- },
- rules: {
- userAccount: [{
- required: true,
- message: '请输入账号',
- trigger: 'change'
- }],
- pwd: [{
- required: true,
- message: '请输入旧密码',
- trigger: 'change'
- }],
- newPwd: [{
- required: true,
- message: '请输入新密码',
- trigger: 'change'
- }],
- },
- }
- },
- onLoad(options) {},
- onReady() {
- this.$refs.form.setRules(this.rules);
- },
- methods: {
- // 提交表单
- submitForm() {
- this.$refs.form.validate(valid => {
- if (valid) {
- NET.request(API.submitPasswordForm, {
- ...this.form
- }, 'POST').then(res => {
- this.$refs.uTips.show({
- title: '修改成功',
- type: 'success',
- })
- setTimeout(() => {
- uni.navigateBack()
- }, 1000)
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- }
- });
- },
- },
- }
- </script>
- <style>
- page {
- width: 100%;
- height: 100%;
- position: relative;
- }
- </style>
- <style lang="scss" scoped>
- @import "@/static/css/themes.scss";
- .content {
- width: 100%;
- float: left;
- padding: 0 15px 60px 15px;
- box-sizing: border-box;
- }
- </style>
|