|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <template>
- <view class="page">
- <l-title>设置密码</l-title>
- <l-input v-model="oldPwd" title="旧密码" placeholder="请输入身份证后八位" password></l-input>
- <l-input v-model="newPwd" title="新密码" placeholder="请输入新密码" password></l-input>
- <l-input v-model="confirmPwd" title="确认输入" placeholder="请再次输入新密码" password></l-input>
- <view class="passwordDes">
- <text>新密码必须8-20位同时包含1.[大小写字母]、2.[数字]、3.[特殊符号!@#$%^&*]</text>
- </view>
- <view class="padding">
- <l-button @click="submit" size="lg" color="blue" class="block" block>确认修改</l-button>
- </view>
- </view>
- </template>
-
- <script>
- import moment from 'moment';
- import get from 'lodash/get';
- import set from 'lodash/set';
- export default {
- data() {
- return {
- userInfo: {},
- oldPwd: '',
- newPwd: '',
- confirmPwd: ''
- }
- },
- mounted(){
- var a = document.getElementsByClassName('uni-page-head-hd')[0]
- a.style.display = 'none';
- },
- methods: {
- init() {
- this.SET_GLOBAL('token', this.GET_STORAGE('token'));
- },
- // 提交修改
- submit() {
- // const {
- // auth,
- // oldPwd,
- // newPwd,
- // confirmPwd
- // } = this
- if (this.oldPwd.length < 6) {
- this.CONFIRM('操作失败', '旧密码输入不正确,请重新确认')
- return
- }
- // if (newPwd.length < 6 || newPwd.length > 16) {
- // this.CONFIRM('操作失败', '新密码不符合要求,请修改后重试')
- // return
- // }
- var reg = /^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*,\.])[0-9a-zA-Z!@#$%^&*,\.]{8,20}$/;
- if (!reg.test(this.newPwd)) {
- this.CONFIRM('操作失败', '新密码不符合要求,请修改后重试')
- return
- }
- if (this.newPwd !== this.confirmPwd) {
- this.CONFIRM('操作失败', '新密码和确认密码输入不一致,请修改')
- return
- }
- let obj={
- newpassword: this.MD5(this.newPwd),
- oldpassword: this.oldPwd
- }
- this.HTTP_POST('learun/adms/user/modifypwiden', obj, '未能成功修改密码').then(res => {
- this.HIDE_LOADING();
- if (res) {
- this.TOAST('密码修改成功')
- setTimeout(() => {
- this.CLEAR_GLOBAL()
- this.RELAUNCH_TO('/pages/login')
- }, 100)
- }
- });
- }
- },
- created() {
- this.userInfo = this.GET_GLOBAL('loginUser'); //获取登录信息
- this.init();
- }
- }
- </script>
- <style lang="scss">
- .passwordDes {
- color: #606266;
- font-size: 14px;
- padding: 8px;
- text-indent: 2em;
- }
- </style>
|