李志伟 3 年前
父节点
当前提交
ab3cd0d9e9

+ 9
- 0
src/api/user.js 查看文件

@@ -66,3 +66,12 @@ export const enableUser = (id) => request({
66 66
 export const disableUser = (id) => request({
67 67
   url: `/admin/user/${id}/off`, method: 'put'
68 68
 })
69
+
70
+/**
71
+ * 找回密码
72
+ * @param {*} data
73
+ * @returns
74
+ */
75
+export const findPassword = (data) => request({
76
+  url: '/admin/find-password', method: 'put', data
77
+})

+ 1
- 0
src/icons/svg/captcha.svg 查看文件

@@ -0,0 +1 @@
1
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1644474272743" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6773" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M919.561369 245.727541c-0.899486-28.28623-24.311709-55.009871-52.010561-59.8409 0 0-107.385752-16.977673-167.643138-38.420031-75.231425-26.770713-149.681044-85.617983-149.681044-85.617983-23.220864-16.58063-58.83806-15.552208-80.374562 2.372024 0 0-52.704362 53.179177-151.044088 84.22117-90.852194 36.510542-163.464979 40.248679-163.464979 40.248679-27.402093 3.571339-50.991348 28.867468-51.522444 57.147558 0 0-3.690042 145.387251 0.966001 272.985348 1.759063 228.268914 271.994788 453.937606 408.55193 453.937606 134.416386 0 366.709963-157.224858 403.249157-450.619024C925.617295 347.953783 919.561369 245.727541 919.561369 245.727541zM709.887976 445.981401 477.54835 681.152515c-9.899464 10.018168-26.696012 11.174504-38.07927 2.124384l-121.329323-96.414887c-22.289656-17.711384-24.614607-48.538483-4.89038-69.169359 19.587104-20.48966 53.223179-23.199375 75.962066-5.403057l56.322773 44.083008 193.563484-182.358281c20.162202-18.995633 52.216245-18.458397 71.897493 0.325411-0.281409-0.293689-0.35918-0.693802-0.649799-0.984421l1.64036 1.64343c-0.290619-0.290619-0.696872-0.3776-0.99056-0.659009C729.922265 394.23076 729.659275 425.969625 709.887976 445.981401z" p-id="6774"></path></svg>

+ 1
- 0
src/icons/svg/phone.svg 查看文件

@@ -0,0 +1 @@
1
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1644474191232" class="icon" viewBox="0 0 1046 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3853" xmlns:xlink="http://www.w3.org/1999/xlink" width="204.296875" height="200"><defs><style type="text/css"></style></defs><path d="M759.763478 616.136348c-53.826783 0-94.47513 48.37287-143.248695 48.372869-48.417391 0-260.85287-209.274435-260.85287-260.786087 0-51.46713 48.39513-76.822261 48.39513-130.226087C404.057043 235.074783 260.763826 0 202.039652 0 143.226435 0 0 104.893217 0 202.039652c0 281.177043 518.500174 820.157217 843.063652 820.157218 89.577739 0 202.150957-94.497391 202.150957-202.128696 0.75687-40.292174-232.114087-203.909565-285.473392-203.909565" p-id="3854"></path></svg>

+ 6
- 1
src/layout/components/Sidebar/index.vue 查看文件

@@ -23,6 +23,7 @@ import { mapGetters } from 'vuex'
23 23
 import Logo from './Logo'
24 24
 import SidebarItem from './SidebarItem'
25 25
 import variables from '@/styles/variables.scss'
26
+import { getUserId } from '@/utils/auth'
26 27
 
27 28
 export default {
28 29
   components: { SidebarItem, Logo },
@@ -31,7 +32,11 @@ export default {
31 32
       'sidebar'
32 33
     ]),
33 34
     routes() {
34
-      return this.$router.options.routes
35
+      var newData = this.$router.options.routes
36
+      if (getUserId() !== '1') {
37
+        newData.splice(6, 1)
38
+      }
39
+      return newData
35 40
     },
36 41
     activeMenu() {
37 42
       const route = this.$route

+ 20
- 9
src/views/login/forgotPassword.vue 查看文件

@@ -51,20 +51,30 @@
51 51
           placeholder="密码"
52 52
           name="password"
53 53
           tabindex="3"
54
-          @keyup.enter.native="handleLogin"
54
+          @keyup.enter.native="retrievePassword"
55 55
         />
56 56
       </el-form-item>
57 57
       <el-button
58 58
         :loading="loading"
59 59
         type="primary"
60 60
         style="width: 100%; margin-bottom: 30px"
61
-        @click.native.prevent="handleLogin"
61
+        @click.native.prevent="retrievePassword"
62 62
       >找回密码</el-button>
63
+      <el-link :underline="false" style="margin:0" type="primary">
64
+        <router-link
65
+          :to="{path: '/login'}"
66
+        >登录系统</router-link>
67
+      </el-link>
68
+      <el-link :underline="false" style="float:right" type="primary">
69
+        <router-link
70
+          :to="{name: 'register'}"
71
+        >注册账号</router-link>
72
+      </el-link>
63 73
     </el-form>
64 74
   </div>
65 75
 </template>
66 76
 <script>
67
-import { getCaptcha, signUp } from '@/api/user'
77
+import { getCaptcha, findPassword } from '@/api/user'
68 78
 import md5 from 'js-md5'
69 79
 export default {
70 80
   name: 'Login',
@@ -132,14 +142,15 @@ export default {
132 142
         }
133 143
       })
134 144
     },
135
-    handleLogin() {
145
+    retrievePassword() {
136 146
       this.$refs.regisiterForm.validate((valid) => {
137 147
         if (valid) {
138
-          this.regisiterForm.password = md5(this.regisiterForm.password)
139
-          // signUp(this.regisiterForm).then((res) => {
140
-          this.$message('修改密码成功')
141
-          this.$router.push({ path: '/login' })
142
-          // })
148
+          var newData = { ...this.regisiterForm }
149
+          newData.password = md5(newData.password)
150
+          findPassword(newData).then((res) => {
151
+            this.$message('修改密码成功')
152
+            this.$router.push({ path: '/login' })
153
+          })
143 154
         } else {
144 155
           return false
145 156
         }

+ 4
- 4
src/views/login/register.vue 查看文件

@@ -32,7 +32,7 @@
32 32
         <el-input
33 33
           ref="password"
34 34
           v-model="regisiterForm.password"
35
-          type="text"
35
+          type="password"
36 36
           placeholder="请输入密码"
37 37
           name="password"
38 38
           tabindex="2"
@@ -45,7 +45,7 @@
45 45
         <el-input
46 46
           ref="password2"
47 47
           v-model="regisiterForm.password2"
48
-          type="text"
48
+          type="password"
49 49
           placeholder="确认密码"
50 50
           name="password2"
51 51
           tabindex="3"
@@ -53,7 +53,7 @@
53 53
       </el-form-item>
54 54
       <el-form-item prop="phone">
55 55
         <span class="svg-container">
56
-          <svg-icon icon-class="password" />
56
+          <svg-icon icon-class="phone" />
57 57
         </span>
58 58
         <el-input
59 59
           ref="phone"
@@ -67,7 +67,7 @@
67 67
 
68 68
       <el-form-item prop="captcha" style="width:65%">
69 69
         <span class="svg-container">
70
-          <svg-icon icon-class="password" />
70
+          <svg-icon icon-class="captcha" />
71 71
         </span>
72 72
         <el-input
73 73
           ref="captcha"

+ 6
- 3
src/views/userManage/index.vue 查看文件

@@ -94,11 +94,14 @@ export default {
94 94
     toogleUser(val) {
95 95
       if (val.status === 1) {
96 96
         disableUser(val.userId).then(() => {
97
-
97
+          this.$message('禁用成功' + val.userName + '不能登录了')
98
+          this.onSearch()
98 99
         })
99
-        // console.log('启用')
100 100
       } else {
101
-        console.log('禁用')
101
+        enableUser(val.userId).then(() => {
102
+          this.$message('启用成功' + val.userName + '恢复登录')
103
+          this.onSearch()
104
+        })
102 105
       }
103 106
     }
104 107
   }