123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <template>
- <view class="body">
- <!-- 公共组件-每个页面必须引入 -->
- <public-module></public-module>
-
- <view class="form">
- <view class="password">
- <view class="icon iconfont icon-icon-mima"></view>
- <input placeholder="请设置新密码(6-15位数字与字母组合)" v-model="pwd" password=true placeholder-style="color: #C5C5C5;font-size:26upx"/>
- </view>
- <view class="password">
- <view class="icon iconfont icon-icon-mima"></view>
- <input placeholder="再次输入新密码" v-model="repwd" password=true placeholder-style="color: #C5C5C5;font-size:26upx"/>
- </view>
- <button class="user-set-btn d-flex a-center j-center main-bg-color" :loading="loading" :class="{'main-bf-hover-color':disabled}" :disabled="disabled" type="primary" @tap="submit">完成</button>
- </view>
- </view>
- </template>
- <script>
- import {mapState} from "vuex"
- export default {
- data() {
- return {
- pwd:"",
- repwd:"",
- loading:false,
- disabled:true,
- }
- },
- watch:{
- pwd(val){
- this.OnBtnChange();
- },
- repwd(val){
- this.OnBtnChange();
- },
-
- },
- computed:{
- ...mapState(['userInfo'])
- },
- methods: {
- // 改变按钮状态
- OnBtnChange(){
- if(this.pwd && this.repwd){
- this.disabled=false; return;
- }
- this.disabled=true;
- },
- async submit(){
- if (!this.$base.passwordRegular.test(this.pwd)) {
- return uni.showToast({title: '密码须6-15位数字与字母组合',icon: 'none'});
- }
- if(this.pwd != this.repwd){
- return uni.showToast({ title: '两次密码输入不一致', icon:"none" });
- }
-
- let res = await this.$http.post('/user/updatePwd?id='+this.userInfo.sysUser.id+'&password='+this.pwd);
- if (res.code == 200){
- this.pwd = "";
- this.repwd = "";
- return uni.showToast({ title: "修改密码成功", icon:"none" });
- }
-
- }
- }
- }
- </script>
- <style>
- .body{
- position: absolute;
- width: 100%;
- height:100vh;
- background-color: #F5F5F5;
- }
- .form{
- width: 90%;
- padding: 20upx 5%;
- font-size: 30upx;
- }
- .form .password{
- position: relative;
- width: calc(100% - 100upx);
- height: 90upx;
- display: flex;
- align-items: center;
- border-radius: 5upx;
- background-color: #FFFFFF;
- padding: 0 0 0 100upx;
- margin: 30upx 0upx 50upx;
- }
- .form .password input{
- width: 100%;
- height: 50upx;
- color: rgba($color: #ffffff, $alpha: 0.8);
- font-weight: 200;
- }
- .icon{
- color: #999;
- height: 70upx;
- font-size: 40upx;
- z-index: 10;
- position: absolute;
- top: 10upx;
- left: 10upx;
- padding: 0 15upx;
- border-right: 2px solid #F5F5F5;
- }
- </style>
|