hookehuyr

新增密码重置页面

...@@ -11,7 +11,6 @@ declare module 'vue' { ...@@ -11,7 +11,6 @@ declare module 'vue' {
11 ElBreadcrumbItem: typeof import('element-ui/lib/breadcrumb-item')['default'] 11 ElBreadcrumbItem: typeof import('element-ui/lib/breadcrumb-item')['default']
12 ElCarousel: typeof import('element-ui/lib/carousel')['default'] 12 ElCarousel: typeof import('element-ui/lib/carousel')['default']
13 ElCarouselItem: typeof import('element-ui/lib/carousel-item')['default'] 13 ElCarouselItem: typeof import('element-ui/lib/carousel-item')['default']
14 - ElCheckbox: typeof import('element-ui/lib/checkbox')['default']
15 ElCol: typeof import('element-ui/lib/col')['default'] 14 ElCol: typeof import('element-ui/lib/col')['default']
16 ElCollapse: typeof import('element-ui/lib/collapse')['default'] 15 ElCollapse: typeof import('element-ui/lib/collapse')['default']
17 ElCollapseItem: typeof import('element-ui/lib/collapse-item')['default'] 16 ElCollapseItem: typeof import('element-ui/lib/collapse-item')['default']
......
1 <!-- 1 <!--
2 * @Date: 2024-10-20 09:59:52 2 * @Date: 2024-10-20 09:59:52
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-21 09:35:58 4 + * @LastEditTime: 2024-10-21 10:36:22
5 * @FilePath: /hager/src/components/common/hagerInput.vue 5 * @FilePath: /hager/src/components/common/hagerInput.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -9,13 +9,15 @@ ...@@ -9,13 +9,15 @@
9 <div :class="['hager-input-page', required ? 'required': 'normal']"> 9 <div :class="['hager-input-page', required ? 'required': 'normal']">
10 <div :class="['input-box', disable ? 'disable': '']"> 10 <div :class="['input-box', disable ? 'disable': '']">
11 <div class="typeIcon" :style="{backgroundImage: 'url('+typeIcon+')'}"></div> 11 <div class="typeIcon" :style="{backgroundImage: 'url('+typeIcon+')'}"></div>
12 - <input :value="value" @input="onInput" :disabled="disable" :placeholder="placeholder" /> 12 + <input class="input" :value="value" @input="onInput" :disabled="disable" :placeholder="placeholder" />
13 + <div v-if="reset" class="send" @click="resetPwd">发送验证码</div>
13 </div> 14 </div>
14 </div> 15 </div>
15 </template> 16 </template>
16 17
17 <script> 18 <script>
18 import mixin from 'common/mixin'; 19 import mixin from 'common/mixin';
20 +import { Message } from 'element-ui';
19 21
20 export default { 22 export default {
21 mixins: [mixin.init], 23 mixins: [mixin.init],
...@@ -39,11 +41,16 @@ export default { ...@@ -39,11 +41,16 @@ export default {
39 disable: { 41 disable: {
40 type: Boolean, 42 type: Boolean,
41 default: false 43 default: false
44 + },
45 + reset: {
46 + type: Boolean,
47 + default: false
42 } 48 }
43 }, 49 },
44 data () { 50 data () {
45 return { 51 return {
46 - 52 + email: '',
53 + pwd: '',
47 } 54 }
48 }, 55 },
49 computed: { 56 computed: {
...@@ -72,6 +79,17 @@ export default { ...@@ -72,6 +79,17 @@ export default {
72 onInput(event) { 79 onInput(event) {
73 // 使用 $emit 触发 input 事件,传递新的输入值 80 // 使用 $emit 触发 input 事件,传递新的输入值
74 this.$emit('input', event.target.value); 81 this.$emit('input', event.target.value);
82 + },
83 + resetPwd () {
84 + if (!this.email) {
85 + Message({
86 + showClose: true,
87 + message: '邮箱地址不能为空',
88 + type: 'warning'
89 + });
90 + } else {
91 +
92 + }
75 } 93 }
76 } 94 }
77 } 95 }
...@@ -91,16 +109,16 @@ export default { ...@@ -91,16 +109,16 @@ export default {
91 } 109 }
92 110
93 .input-box { 111 .input-box {
112 + display: flex;
113 + align-items: center;
114 + justify-content: space-between;
115 + box-sizing: border-box; /* 确保内边距和边框不会增加总宽度 */
94 background: #FFFFFF; 116 background: #FFFFFF;
95 border-radius: 5px; 117 border-radius: 5px;
96 border: 1px solid #DADADA; 118 border: 1px solid #DADADA;
97 padding: 0.5rem 0.75rem; 119 padding: 0.5rem 0.75rem;
98 width: 100%; 120 width: 100%;
99 margin: 0.5rem 0; 121 margin: 0.5rem 0;
100 - display: flex;
101 - align-items: center;
102 - justify-content: space-between;
103 - box-sizing: border-box; /* 确保内边距和边框不会增加总宽度 */
104 &.disable { 122 &.disable {
105 background-color:#F9F9F9; 123 background-color:#F9F9F9;
106 border: 1px solid #F9F9F9; 124 border: 1px solid #F9F9F9;
...@@ -117,9 +135,16 @@ export default { ...@@ -117,9 +135,16 @@ export default {
117 background-position: center; 135 background-position: center;
118 margin-right: 0.5rem; 136 margin-right: 0.5rem;
119 } 137 }
120 - input { 138 + .input {
121 border: 0; 139 border: 0;
122 - width: calc(100% - 2rem); /* 调整输入框的宽度 */ 140 + flex: 1;
141 + }
142 + .send {
143 + color: @secondary-color;
144 + font-size: 0.8rem;
145 + &:hover {
146 + cursor: pointer;
147 + }
123 } 148 }
124 } 149 }
125 } 150 }
......
1 /* 1 /*
2 * @Date: 2024-08-26 10:42:15 2 * @Date: 2024-08-26 10:42:15
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-20 20:57:49 4 + * @LastEditTime: 2024-10-21 09:59:04
5 * @FilePath: /hager/src/route.js 5 * @FilePath: /hager/src/route.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -194,6 +194,15 @@ export default [{ ...@@ -194,6 +194,15 @@ export default [{
194 tag: 'info' 194 tag: 'info'
195 }, 195 },
196 }, 196 },
197 + {
198 + path: 'reset',
199 + name: '密码重置',
200 + component: () => import('@/views/user/reset'),
201 + meta: {
202 + title: '海格电器',
203 + tag: 'reset'
204 + },
205 + },
197 ] 206 ]
198 }, { 207 }, {
199 path: '/search', 208 path: '/search',
......
1 <!-- 1 <!--
2 * @Date: 2024-10-18 18:00:47 2 * @Date: 2024-10-18 18:00:47
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-21 09:41:08 4 + * @LastEditTime: 2024-10-21 09:59:33
5 * @FilePath: /hager/src/views/user/login.vue 5 * @FilePath: /hager/src/views/user/login.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
13 <hagerInput type="pwd" required v-model="pwd" placeholder="请输入登录密码" /> 13 <hagerInput type="pwd" required v-model="pwd" placeholder="请输入登录密码" />
14 <!-- TODO: 记住密码和忘记密码业务显示的问题? --> 14 <!-- TODO: 记住密码和忘记密码业务显示的问题? -->
15 <div class="pwd-box"> 15 <div class="pwd-box">
16 - <div><el-checkbox v-model="checked">记住密码</el-checkbox></div> 16 + <!-- <div><el-checkbox v-model="checked">记住密码</el-checkbox></div> -->
17 - <div><span>忘记密码?</span></div> 17 + <div><span @click="goToReset">忘记密码?</span></div>
18 </div> 18 </div>
19 </div> 19 </div>
20 <div class="login-footer"> 20 <div class="login-footer">
...@@ -48,6 +48,9 @@ export default { ...@@ -48,6 +48,9 @@ export default {
48 }, 48 },
49 goToRegister () { 49 goToRegister () {
50 this.$router.push('/user/register'); 50 this.$router.push('/user/register');
51 + },
52 + goToReset () {
53 + this.$router.push('/user/reset');
51 } 54 }
52 } 55 }
53 } 56 }
...@@ -64,7 +67,7 @@ export default { ...@@ -64,7 +67,7 @@ export default {
64 } 67 }
65 .pwd-box { 68 .pwd-box {
66 display: flex; 69 display: flex;
67 - justify-content: space-between; 70 + justify-content: flex-end;
68 align-items: center; 71 align-items: center;
69 margin-top: 1rem; 72 margin-top: 1rem;
70 font-size: 0.85rem; 73 font-size: 0.85rem;
......
1 +<!--
2 + * @Date: 2024-10-18 18:00:47
3 + * @LastEditors: hookehuyr hookehuyr@gmail.com
4 + * @LastEditTime: 2024-10-21 10:53:15
5 + * @FilePath: /hager/src/views/user/reset.vue
6 + * @Description: 文件描述
7 +-->
8 +<template>
9 + <div class="hager-reset-page">
10 + <div class="input-title">密码重置</div>
11 + <div style="padding: 1rem 1.5rem 1rem 1rem;">
12 + <hagerInput type="email" required reset v-model="email" placeholder="请输入邮箱地址" />
13 + <hagerInput type="pwd" required v-model="sms" placeholder="请输入验证码" />
14 + <hagerInput type="pwd" required v-model="pwd" placeholder="请输入登录密码" />
15 + </div>
16 + <div class="reset-footer">
17 + <div class="edit-box">
18 + <div class="cancel btn" @click="goBack">取消</div>
19 + <div class="confirm btn" @click="onSubmit">重置</div>
20 + </div>
21 + </div>
22 + </div>
23 +</template>
24 +
25 +<script>
26 +import mixin from 'common/mixin';
27 +import hagerInput from '@/components/common/hagerInput.vue';
28 +import { Message } from 'element-ui';
29 +
30 +export default {
31 + mixins: [mixin.init],
32 + data () {
33 + return {
34 + email: '',
35 + pwd: '',
36 + sms: '',
37 + checked: false
38 + }
39 + },
40 + mounted () {
41 +
42 + },
43 + methods: {
44 + onSubmit () {
45 + Message({
46 + showClose: true,
47 + message: '重置成功',
48 + type: 'success'
49 + });
50 + },
51 + goBack () {
52 + this.$router.go(-1);
53 + }
54 + }
55 +}
56 +</script>
57 +
58 +<style lang="less" scoped>
59 + .hager-reset-page {
60 + padding: 2rem 0.5rem 0;
61 + .input-title {
62 + color: @secondary-color;
63 + font-weight: bold;
64 + font-size: 1.25rem;
65 + text-align: center;
66 + }
67 + .pwd-box {
68 + display: flex;
69 + justify-content: flex-end;
70 + align-items: center;
71 + margin-top: 1rem;
72 + font-size: 0.85rem;
73 + padding-left: 1rem;
74 + span {
75 + color: @primary-color;
76 + font-weight: bold;
77 + &:hover {
78 + cursor: pointer;
79 + }
80 + }
81 + }
82 + .submit-btn {
83 + background-color: @secondary-color;
84 + color: #FFF;
85 + padding: 0.5rem 1rem;
86 + text-align: center;
87 + border-radius: 5px;
88 + &:hover {
89 + cursor: pointer;
90 + }
91 + }
92 + .reset-footer {
93 + padding: 0 1rem 1rem 2rem;
94 + .edit-box {
95 + display: flex;
96 + justify-content: space-between;
97 + .cancel {
98 + color: @secondary-color;
99 + }
100 + .confirm {
101 + background-color: @secondary-color;
102 + color: #FFF;
103 + }
104 + .btn {
105 + flex: 1;
106 + text-align: center;
107 + padding: 0.5rem 1rem;
108 + border-radius: 5px;
109 + border: 1px solid @secondary-color;
110 + margin: 0 0.5rem; /* 添加左右间隔 */
111 + &:hover {
112 + cursor: pointer;
113 + }
114 + }
115 + .btn:first-child {
116 + margin-left: 0; /* 第一个按钮左边不加间隔 */
117 + }
118 + .btn:last-child {
119 + margin-right: 0; /* 最后一个按钮右边不加间隔 */
120 + }
121 + }
122 + }
123 + }
124 +
125 + :deep(.el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner) {
126 + background-color: #009FE5;
127 + border-color: #009FE5;
128 + }
129 +
130 + :deep(.el-checkbox__input.is-checked+.el-checkbox__label) {
131 + color: #009FE5;
132 + }
133 +</style>