| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <template>
-
-
- <view class="page-box">
-
-
- <uni-forms :modelValue="postForm" ref="postForm" :rules="rules" :label-width="100">
-
-
- <uni-forms-item name="oldPassword" label="旧密码" required>
- <uni-easyinput type="text" v-model="postForm.oldPassword" placeholder="输入旧密码" />
- </uni-forms-item>
-
- <uni-forms-item name="password" label="新密码" required>
- <uni-easyinput type="text" v-model="postForm.password" placeholder="输入新密码" />
- </uni-forms-item>
-
- <uni-forms-item name="confirm" label="确认密码" required>
- <uni-easyinput type="text" v-model="postForm.confirm" placeholder="输入确认密码" />
- </uni-forms-item>
-
-
- </uni-forms>
-
-
- <view style="margin-top: 10px;">
- <button type="primary" @tap="handleUpdate">提交修改</button>
- </view>
-
-
- </view>
- </template>
- <script>
- import { updatePass } from '@/api/user.js'
-
-
- export default {
- components: {
-
- },
- data() {
- return {
- rules: {
- oldPassword: {
- rules: [{
- required: true,
- errorMessage: '旧密码不能为空!'
- }]
-
- },
- password: {
- rules: [{
- required: true,
- errorMessage: '新密码不能为空!'
- }]
-
- },
- confirm: {
- rules: [{
- required: true,
- errorMessage: '确认密码不能为空!'
- },
- {
- validateFunction:function(rule,value,data,callback){
-
- if (value != data.password) {
- callback('两次密码输入不一致!')
- }
- return true
- }
- }
- ]
- }
- },
- postForm: {
- oldPassword: '',
- password: '',
- confirm: ''
- }
- }
- },
-
- methods: {
-
-
- handleUpdate() {
-
- this.$refs.postForm.validate().then((res) => {
-
- uni.showLoading({
- title: '加载中...'
- });
- this.loginLoading = true
-
- // 快速注册后开始考试
- updatePass(this.postForm).then(data => {
- // 关闭加载
- uni.hideLoading()
-
- // 移除token
- uni.removeStorageSync('token')
-
- //打印请求返回的数据
- uni.switchTab({
- url: '/pages/index/index'
- });
- });
- }).catch(()=>{
-
- })
- }
- }
- }
- </script>
- <style>
- .content {
- padding: 32rpx;
- font-size: 16px;
- line-height: 80rpx;
- }
- .uni-btn-v {
- margin-top: 50rpx;
- width: 100%;
- }
- </style>
|