许成详 vor 6 Jahren
Ursprung
Commit
9cebb06194
5 geänderte Dateien mit 118 neuen und 6 gelöschten Zeilen
  1. 1
    1
      src/pages/login/index.vue
  2. 64
    3
      src/pages/system/index.vue
  3. 43
    0
      src/pages/system/page.scss
  4. 1
    1
      src/store/app.js
  5. 9
    1
      src/util/api.js

+ 1
- 1
src/pages/login/index.vue Datei anzeigen

@@ -71,7 +71,7 @@ export default {
71 71
           duration: 1000
72 72
         })
73 73
         setTimeout(() => {
74
-          this.$router.push({ name: 'system' })
74
+          this.$router.push({ name: 'userManager' })
75 75
         }, 1000)
76 76
       }).catch(msg => {
77 77
 

+ 64
- 3
src/pages/system/index.vue Datei anzeigen

@@ -3,10 +3,18 @@
3 3
     <div class="system-header flex-h">
4 4
       <i class="iconfont icon-yinchenglogo"></i>
5 5
       <span>银城-城的空间</span>
6
-      <div class="flex-item flex-h">
6
+      <div class="flex-item flex-h" style="overflow: visible;">
7 7
         <div class="flex-item"></div>
8
-        <span class="characterMark">用户角色</span>
9
-        <a class="userIcon"></a>
8
+        <span class="characterMark">{{user.UserName}}</span>
9
+        <div class="userIconBox">
10
+          <a class="userIcon">
11
+            <img :src="user.Headimgurl" class="centerLabel cover" alt="">
12
+          </a>
13
+          <ul class="userSet">
14
+            <li @click="signout">登出</li>
15
+            <li @click="editPassword">修改密码</li>
16
+          </ul>
17
+        </div>
10 18
       </div>
11 19
     </div>
12 20
     <div class="flex-item flex-h">
@@ -24,6 +32,22 @@
24 32
         </div>
25 33
       </div>
26 34
     </div>
35
+    <el-dialog title="修改密码" :visible.sync="dialogFormVisible">
36
+      <el-input
37
+        placeholder="请输入旧密码"
38
+        v-model="postData.oriPasswd"
39
+        clearable>
40
+      </el-input>
41
+      <el-input style="margin-top:20px;"
42
+        placeholder="请输入新密码"
43
+        v-model="postData.newPasswd"
44
+        clearable>
45
+      </el-input>
46
+      <div slot="footer" class="dialog-footer">
47
+        <el-button @click="dialogFormVisible = false">取 消</el-button>
48
+        <el-button type="primary" @click="submitPasswd">确 定</el-button>
49
+      </div>
50
+    </el-dialog>
27 51
   </div>
28 52
 </template>
29 53
 
@@ -36,12 +60,18 @@ export default {
36 60
   name: '',
37 61
   data () {
38 62
     return {
63
+      dialogFormVisible: false,
64
+      postData: {
65
+        oriPasswd: '', // 旧密码
66
+        newPasswd: '', // 新密码
67
+      },
39 68
     }
40 69
   },
41 70
   computed: {
42 71
     ...mapState({
43 72
       breadCrumb: x => x.app.breadcrumb,
44 73
       pageMenu: x => x.app.menus,
74
+      user: x => x.app.user,
45 75
     })
46 76
   },
47 77
   components: {
@@ -53,6 +83,37 @@ export default {
53 83
     this.updateBread({ routerData, Url: this.$route.name })
54 84
   },
55 85
   methods: {
86
+    submitPasswd () { // 修改密码
87
+      var aData = {
88
+        oriPasswd: this.md5(this.postData.oriPasswd),
89
+        newPasswd: this.md5(this.postData.newPasswd)
90
+      }
91
+      this.$ajax(this.$api.system.editPassword.url, {
92
+        method: this.$api.system.editPassword.method,
93
+        urlData: { id: this.user.UserId },
94
+        data: aData
95
+      }).then(res => {
96
+        this.$message({
97
+          type: 'success',
98
+          message: '操作成功!'
99
+        })
100
+        this.$router.push({ name: 'login' })
101
+      })
102
+    },
103
+    editPassword () { // 修改密码
104
+      this.dialogFormVisible = true
105
+    },
106
+    signout () { // 登出
107
+      this.$ajax(this.$api.system.signout.url, {
108
+        method: this.$api.system.signout.method,
109
+      }).then(res => {
110
+        this.$message({
111
+          type: 'success',
112
+          message: '操作成功!'
113
+        })
114
+        this.$router.push({ name: 'login' })
115
+      })
116
+    },
56 117
     ...mapMutations([
57 118
       'updateBread'
58 119
     ]),

+ 43
- 0
src/pages/system/page.scss Datei anzeigen

@@ -58,6 +58,49 @@
58 58
     border-radius: 100%;
59 59
     background: #eee;
60 60
     margin: 0 20px 0 10px;
61
+    display: block;
62
+  }
63
+
64
+  .userIconBox{
65
+    position: relative;
66
+    overflow: visible;
67
+    .userSet{
68
+      display: none;
69
+      position: absolute;
70
+      right: 30px;
71
+      top: 40px;
72
+      background: #fff;
73
+      padding: 5px 0;
74
+      box-shadow: 0 0 20px 2px rgba(0, 0, 0, .1);
75
+      li{
76
+        display: block;
77
+        line-height: 30px;
78
+        white-space: nowrap;
79
+        color: #666;
80
+        font-size: 13px;
81
+        padding: 0 15px;
82
+        &:hover{
83
+          cursor: pointer;
84
+          background: #eee;
85
+        }
86
+      }
87
+      &::after{
88
+        content: '';
89
+        position: absolute;
90
+        width: 0;
91
+        height: 0;
92
+        border-style: dashed dashed solid dashed;
93
+        border-width: 8px;
94
+        border-color: transparent transparent #fff transparent;
95
+        right: 0;
96
+        top: -14px;
97
+      }
98
+    }
99
+    &:hover{
100
+      &>.userSet{
101
+        display: inline-block;
102
+      }
103
+    }
61 104
   }
62 105
 
63 106
 }

+ 1
- 1
src/store/app.js Datei anzeigen

@@ -32,7 +32,7 @@ function packChildren (data) {
32 32
       }
33 33
     }
34 34
 
35
-    if (!found) {
35
+    if (!found && cp[inx].IsShow === 1) {
36 36
       res.push(cp[inx])
37 37
     }
38 38
   })

+ 9
- 1
src/util/api.js Datei anzeigen

@@ -13,7 +13,15 @@ const $api = {
13 13
     init: { // 初始化菜单
14 14
       method: 'get',
15 15
       url: `${baseUrl}${common}/system/init`
16
-    }
16
+    },
17
+    signout: { // 登出
18
+      method: 'post',
19
+      url: `${baseUrl}${common}/signout`
20
+    },
21
+    editPassword: { // 修改密码
22
+      method: 'put',
23
+      url: `${baseUrl}${common}/user/:id/password`
24
+    },
17 25
   },
18 26
   systemSet: {
19 27
     getUserList: { // 获取用户列表