123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <template>
- <view class="updat" :style="'padding-top:'+padtop+'px'">
- <!-- 头部 -->
- <navbar :back="false" title="修改密码" :bgcolor="backgroundColor" color="#fff" fixed zIndex="1010" :center="true"
- :custom='true' @getTop="getTop" back="true" />
- <view>
- <view class="updatb">
- <view class="updatba">新密码</view>
- <input placeholder="请输入新密码" v-model="newpassword" class="updatbi" />
- </view>
- <view class="updatb">
- <view class="updatba">再次确认密码</view>
- <input placeholder="请再次输入新密码" v-model="password" class="updatbi" />
- </view>
- </view>
- <view class="login_btn btn1" @click="getSureFn">确认修改</view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- padtop: this.$http._GET.customBarH||0,
- backgroundColor: 'linear-gradient(90deg, #A00517, #E93030)',
- newpassword: '',
- password: '',
- }
- },
- onLoad(e) {
- this.userName=e.userName
- },
- methods: {
- getTop(e) {
- this.padtop = e
- },
- getSureFn() {
- if(!this.newpassword||!this.password){
- uni.showToast({
- title:"请输入完整",
- icon:'none'
- })
- return
- }
- if(this.newpassword.length<6){
- uni.showToast({
- title: '请输入至少六位数密码',
- icon: 'none'
- })
- return
- }
- if (this.newpassword != this.password) {
- uni.showToast({
- title: '两次密码输入不同,请修改',
- icon: 'none'
- })
- return
- }
- var userId = uni.getStorageSync('userId')
- var params={
- userId:userId,
- password:this.password,
- userName:this.userName
- }
- this.$http.post('system/user/updatePwd',params).then(res=>{
- if(res.code == 200 ) {
- uni.showToast({
- title:"修改成功,请重新登录",
- duration: 1000,
- icon: 'none'
- })
- setTimeout(function(){
- uni.removeStorageSync("userId")
- uni.removeStorageSync("token")
- uni.reLaunch({
- url:"/pages/login/login"
- })
- },1000)
-
- }else{
- uni.showToast({
- title: res.msg,
- duration: 1000,
- icon: 'none'
- });
- }
- })
- }
- }
- }
- </script>
- <style scoped>
- .updat {
- padding: 0 32rpx;
- min-height: 100vh;
- box-sizing: border-box;
- background: #ffffff;
- }
- .updatb {
- min-height: 100rpx;
- display: flex;
- align-items: center;
- padding: 18rpx 0;
- border-bottom: 2rpx solid #f5f5f5;
- box-sizing: border-box;
- }
- .updatba {
- font-size: 28rpx;
- font-weight: bold;
- color: #000000;
- flex: 0 0 auto;
- }
- .updatbi {
- flex: 1;
- text-align: right;
- font-size: 28rpx;
- color: #000;
- }
- .login_btn {
- width: 100%;
- height: 90rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 30rpx;
- border-radius: 48rpx;
- background: linear-gradient(90deg, #A00517, #E93030);
- color: #ffffff;
- margin-top: 120rpx;
- }
- </style>
|