| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- <template>
- <view class="container">
- <!-- <u-navbar :is-fixed="false" :border-bottom="false" :is-back="true" back-icon-name="arrow-leftward" title="修改密码"
- back-icon-size="35" :background="{ background: '#fff' }" title-color="#000">
- </u-navbar> -->
- <uNavBar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
- :title="title" @clickLeft="toBack">
- </uNavBar>
- <view class="content">
- <view class="form">
- <view class="cell">
- <view class="name"><text style="color: #FF0000; font-weight: bold;font-size: 20px;">*</text>旧密码
- </view>
- <input type="text" password="true" placeholder="输入旧密码" v-model="oldPassword" class="ipt" placeholder-class="hold" />
- </view>
- <view class="cell">
- <view class="name"><text style="color: #FF0000; font-weight: bold;font-size: 20px;">*</text>新密码
- </view>
- <input type="text" password="true" placeholder="输入新密码" v-model="newPassword" class="ipt" placeholder-class="hold" />
- </view>
- <view class="cell">
- <view class="name"><text style="color: #FF0000; font-weight: bold;font-size: 20px;">*</text>确认新密码
- </view>
- <input type="text" password="true" placeholder="再次输入新密码" v-model="newPassword1" class="ipt"
- placeholder-class="hold" />
- </view>
- <u-gap height="50"></u-gap>
- <view class="cell">
- <view style="width: 100%;">
- <button type="warn" @click="formSubmit()">提交</button>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import http from '@/http/api.js'
- import md5 from '@/utils/md5.js'
- import pickRegions from '@/components/pick-regions/pick-regions.vue';
- import uNavBar from '@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue'
- export default {
- components: {
- pickRegions,
- uNavBar
- },
- data() {
- return {
- title:'修改密码',
- oldPassword: '',
- newPassword: '',
- newPassword1: ''
- };
- },
- onLoad() {
- },
- methods: {
- toBack() {
- uni.navigateBack({
- delta: 1
- })
- },
- formSubmit: function() {
- const that = this;
- if (this.oldPassword.length > 0 && this.newPassword.length > 0 && this.newPassword1.length > 0) {
- uni.showModal({
- content: '确定修改密码?',
- showCancel: true,
- success(res) {
- if (res.confirm) {
- let oldPassword = md5(that.oldPassword);
- let newPassword = md5(that.newPassword);
- let newPassword1 = md5(that.newPassword1);
- http.request({
- url: '/galaxy-user/update-password',
- method: 'POST',
- params: {
- oldPassword,
- newPassword,
- newPassword1
- }
- }).then(res => {
- console.log(JSON.stringify(res.data))
- if (res.success) {
- uni.showModal({
- content: '修改已成功',
- showCancel: false,
- success(res) {
- if (res.confirm) {
- that.$u.func.logout();
- }
- }
- });
- }
- }).catch(err => {
- console.log(err)
- })
- }
- }
- });
- } else {
- uni.showModal({
- content: '请确认必填项',
- showCancel: false
- });
- }
- }
- }
- };
- </script>
- <style lang="scss">
- .container {
- background-color: #f7f7f7;
- min-height: 100vh;
- padding: 0 0 200rpx;
- overflow: hidden;
- }
- .complie {
- vertical-align: middle;
- padding: 10rpx 20rpx;
- font-size: 32rpx;
- font-family: Source Han Sans CN;
- font-weight: 400;
- color: #14b9c8;
- }
- .content {
- background-color: #ffffff;
- overflow: hidden;
- }
- .avatar {
- margin-top: 30rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- flex-direction: column;
- font-size: 30rpx;
- font-family: Source Han Sans CN;
- font-weight: 400;
- color: #14b9c8;
- .avatar-image {
- width: 162rpx;
- height: 162rpx;
- background: #ffffff;
- border-radius: 50%;
- background-color: #82848a;
- margin-bottom: 15rpx;
- }
- }
- .form {
- padding: 0 36rpx;
- .cell {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 40rpx 0;
- font-size: 30rpx;
- font-family: Source Han Sans CN;
- font-weight: bold;
- color: #666666;
- &:not(:last-of-type) {
- border-bottom: 2rpx solid #efefef;
- }
- .ipt {
- flex: 1;
- margin-left: 40rpx;
- text-align: right;
- font-size: 23rpx;
- font-family: Source Han Sans CN;
- font-weight: bold;
- color: #333333;
- }
- .hold {
- font-size: 27rpx;
- font-family: Source Han Sans CN;
- font-weight: bold;
- color: #c8c8ce;
- }
- }
- }
- .back {
- margin-top: 40rpx;
- text-align: center;
- height: 109rpx;
- background: #ffffff;
- font-size: 34rpx;
- font-family: Source Han Sans CN;
- font-weight: bold;
- color: #141414;
- line-height: 109rpx;
- }
- </style>
|