|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+<template>
|
|
|
2
|
+ <!-- <page-meta :root-font-size="getRootFontSize(1)"></page-meta> -->
|
|
|
3
|
+ <view id="wrap">
|
|
|
4
|
+ <view class="changeFont">
|
|
|
5
|
+ <view class="changeFont_left"><text style="color: #ff0000; ">*</text>原密码:</view>
|
|
|
6
|
+ <u--input v-model="oldpass" placeholder="原密码" type="password"/>
|
|
|
7
|
+ </view>
|
|
|
8
|
+ <view class="changeFont">
|
|
|
9
|
+ <view class="changeFont_left"><text style="color: #ff0000; ">*</text>新密码:</view>
|
|
|
10
|
+ <u--input v-model="newpass" placeholder="新密码" type="password"/>
|
|
|
11
|
+ </view>
|
|
|
12
|
+ <view class="changeFont">
|
|
|
13
|
+ <view class="changeFont_left"><text style="color: #ff0000; ">*</text>确认密码:</view>
|
|
|
14
|
+ <u--input v-model="confirmpass" placeholder="确认密码" type="password"/>
|
|
|
15
|
+ </view>
|
|
|
16
|
+ <view class="btnClass">
|
|
|
17
|
+ <wButton class="wbutton" text="保存" :rotate="isRotate" @click="saveFont"></wButton>
|
|
|
18
|
+ </view>
|
|
|
19
|
+
|
|
|
20
|
+ </view>
|
|
|
21
|
+</template>
|
|
|
22
|
+
|
|
|
23
|
+<script>
|
|
|
24
|
+ import wButton from '@/components/watch-login/watch-button.vue' //button
|
|
|
25
|
+ export default {
|
|
|
26
|
+ data() {
|
|
|
27
|
+ return {
|
|
|
28
|
+ isRotate: false, //是否加载旋转
|
|
|
29
|
+ oldpass:'',
|
|
|
30
|
+ newpass:'',
|
|
|
31
|
+ confirmpass:''
|
|
|
32
|
+ };
|
|
|
33
|
+ },
|
|
|
34
|
+ components: {
|
|
|
35
|
+ wButton,
|
|
|
36
|
+ },
|
|
|
37
|
+ onLoad() {},
|
|
|
38
|
+ methods: {
|
|
|
39
|
+ change(e) {
|
|
|
40
|
+ console.log("e:", e);
|
|
|
41
|
+ },
|
|
|
42
|
+ saveFont() {
|
|
|
43
|
+ // const reg = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,20}$/;
|
|
|
44
|
+ const reg = /\S{6,}/;
|
|
|
45
|
+ if(!this.oldpass){
|
|
|
46
|
+ this.$mHelper.toast("原密码不能为空");
|
|
|
47
|
+ return
|
|
|
48
|
+ }
|
|
|
49
|
+ if(!this.newpass){
|
|
|
50
|
+ this.$mHelper.toast("新密码不能为空");
|
|
|
51
|
+ return
|
|
|
52
|
+ }
|
|
|
53
|
+ if(this.newpass == this.oldpass){
|
|
|
54
|
+ this.$mHelper.toast("新密码不能和原密码相同!");
|
|
|
55
|
+ return
|
|
|
56
|
+ }
|
|
|
57
|
+ if(!this.confirmpass){
|
|
|
58
|
+ this.$mHelper.toast("确认密码不能为空");
|
|
|
59
|
+ return
|
|
|
60
|
+ }
|
|
|
61
|
+ if(this.confirmpass != this.newpass){
|
|
|
62
|
+ this.$mHelper.toast("两次密码不一致,请重新输入");
|
|
|
63
|
+ return
|
|
|
64
|
+ }
|
|
|
65
|
+ if(!reg.test(this.newpass) || !reg.test(this.confirmpass)){
|
|
|
66
|
+ this.$mHelper.toast("密码不符合规范,小于六位");
|
|
|
67
|
+ return
|
|
|
68
|
+ }
|
|
|
69
|
+ // /system/user/UpdatePwd?oldPwd=123456&Pwd=123456
|
|
|
70
|
+ const params={
|
|
|
71
|
+ oldPwd: this.oldpass,
|
|
|
72
|
+ Pwd: this.confirmpass,
|
|
|
73
|
+ }
|
|
|
74
|
+ this.$http.put("/system/user/UpdatePwd?oldPwd="+this.oldpass+'&Pwd='+this.confirmpass).then((response) => {
|
|
|
75
|
+ if (response.state == "success") {
|
|
|
76
|
+ uni.showModal({
|
|
|
77
|
+ title: '重置密码成功!',
|
|
|
78
|
+ content: '退出到登录页面',
|
|
|
79
|
+ showCancel:false,
|
|
|
80
|
+ success: (res) => {
|
|
|
81
|
+ if (res.confirm) {
|
|
|
82
|
+ uni.setStorageSync('Username', '');
|
|
|
83
|
+ uni.setStorageSync('Password', '');
|
|
|
84
|
+ uni.setStorageSync('token', '');
|
|
|
85
|
+ uni.setStorageSync('user', '');
|
|
|
86
|
+ uni.reLaunch({
|
|
|
87
|
+ url: '/pages/login/login'
|
|
|
88
|
+ });
|
|
|
89
|
+ } else if (res.cancel) {
|
|
|
90
|
+ console.log('用户点击取消');
|
|
|
91
|
+ }
|
|
|
92
|
+ }
|
|
|
93
|
+ });
|
|
|
94
|
+ }else{
|
|
|
95
|
+ this.$mHelper.toast(response.message);
|
|
|
96
|
+ }
|
|
|
97
|
+ })
|
|
|
98
|
+ },
|
|
|
99
|
+ }
|
|
|
100
|
+ }
|
|
|
101
|
+</script>
|
|
|
102
|
+
|
|
|
103
|
+<style scoped>
|
|
|
104
|
+ #wrap {
|
|
|
105
|
+ background: #fff;
|
|
|
106
|
+ padding: 15px;
|
|
|
107
|
+ }
|
|
|
108
|
+
|
|
|
109
|
+ .btnClass {
|
|
|
110
|
+ margin-top: 30px;
|
|
|
111
|
+ }
|
|
|
112
|
+
|
|
|
113
|
+ .fontContent {
|
|
|
114
|
+ margin-top: 30px;
|
|
|
115
|
+ }
|
|
|
116
|
+
|
|
|
117
|
+ .changeFont_left {
|
|
|
118
|
+ width: 25%;
|
|
|
119
|
+ }
|
|
|
120
|
+
|
|
|
121
|
+ .changeFont {
|
|
|
122
|
+ margin-top: 30px;
|
|
|
123
|
+ display: flex;
|
|
|
124
|
+ background: #fff;
|
|
|
125
|
+ line-height: 36px;
|
|
|
126
|
+
|
|
|
127
|
+ }
|
|
|
128
|
+</style>
|