blob: 7828d2b3040c33d7af46d6d2ed540786c9fe1bf3 [file] [log] [blame]
guangchao.xu070005a2020-12-07 09:56:40 +08001<template>
2 <view class="changeLoginPwd">
3 <view class="changeLoginPwd-list">
4 <u-field v-model="oldpwd" label="原登陆密码" :field-style="fieldStyle" placeholder="请输入登陆密码"
5 label-width="160" maxlength="12" :password="true" clear-size="40"></u-field>
6 <u-field v-model="newpwd" label="新登陆密码" :field-style="fieldStyle" placeholder="请设置6-12位密码"
7 label-width="160" maxlength="12" :password="true" clear-size="40"></u-field>
8 <u-field v-model="renewpwd" label="确认密码" :field-style="fieldStyle" placeholder="请确认新密码"
9 label-width="160" maxlength="12" :password="true" clear-size="40"></u-field>
10 </view>
11 <u-button @click="changeLoginPwd" :custom-style="changeLoginPwdBtn">确认修改</u-button>
12 </view>
13</template>
14
15<script>
16 export default {
17 data() {
18 return {
19 oldpwd: "",
20 newpwd: "",
21 renewpwd: "",
22 fieldStyle:{'font-size':'30rpx','color':'#999999'},
23 changeLoginPwdBtn:{
24 width: '600rpx',
25 backgroundColor: '#2FA8E1',
26 color: '#FFFFFF',
27 fontFamily: "PingFang-SC-Medium",
28 fontSize: '30rpx',
29 marginTop: '100rpx',
30 padding: '50rpx 0'
31 }
32 }
33 },
34 methods: {
35 changeLoginPwd() {
36 let that = this
37 let {
38 newpwd,
39 renewpwd,
40 oldpwd
41 } = that
42 if (oldpwd == "") {
43 uni.showToast({
44 title: "请输入原登录密码",
45 icon: "none",
46 duration: 800
47 })
48 return false
49 }
50 if (newpwd.length < 6) {
51 uni.showToast({
52 title: "新密码必须6位以上字符",
53 icon: "none",
54 duration: 800
55 })
56 return false
57 }
58 if (newpwd != renewpwd) {
59 uni.showToast({
60 title: "两次密码不一致,请确认后重新输入",
61 icon: "none",
62 duration: 800
63 })
64 return false
65 }
66 let param = {
67 "newpwd": newpwd,
68 "renewpwd": renewpwd,
69 "oldpwd": oldpwd
70 }
71 that.$u.post("/v1/pwdset", param).then((res) => {
72 uni.showToast({
73 title: "密码修改成功",
74 icon: "none",
75 duration: 800,
76 complete(res) {
77 setTimeout(() => {
78 uni.switchTab({
79 url: "/pages/sub_tabbar/index"
80 })
81 }, 1500)
82 }
83 })
84 })
85 }
86
87 }
88 }
89</script>
90
91<style lang="scss" scoped>
92 .changeLoginPwd {
93 width: 100vw;
94 // height: 100vh;
95 background-color: #F3F3F3;
96 overflow: hidden;
97 padding-bottom: 30rpx;
98
99 &-list {
100 background-color: #FFFFFF;
101 margin-top: 30rpx;
102 }
103
104 &-btn {
105 width: 600rpx;
106 background-color: #2FA8E1;
107 color: #FFFFFF;
108 font-family: "PingFang-SC-Medium";
109 font-size: 30rpx;
110 margin-top: 100rpx;
111 padding: 50rpx 0;
112 }
113 }
114</style>