@melt-js/tpl-vue2-admin-ele 0.0.0-stage → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +68 -3
  3. package/hel_dist/entry.js +37 -0
  4. package/hel_dist/favicon.ico +0 -0
  5. package/hel_dist/hel-meta.json +127 -0
  6. package/hel_dist/hel_userChunk_1.js +1 -0
  7. package/hel_dist/index.html +1 -0
  8. package/hel_dist/static/css/chunk-017edab0.c58e968f.css +1 -0
  9. package/hel_dist/static/css/chunk-5eaa4e8c.fdc15fc9.css +1 -0
  10. package/hel_dist/static/css/chunk-67ce6001.3f0a3a92.css +1 -0
  11. package/hel_dist/static/css/chunk-6d379bf5.f23be7e7.css +1 -0
  12. package/hel_dist/static/css/chunk-718db1ae.6eddafbb.css +1 -0
  13. package/hel_dist/static/css/chunk-7ba44fd1.85e72a0e.css +1 -0
  14. package/hel_dist/static/css/chunk-de514d9e.00a6d6a6.css +1 -0
  15. package/hel_dist/static/css/chunk-elementUI.5646d24e.css +1 -0
  16. package/hel_dist/static/fonts/element-icons.535877f5.woff +0 -0
  17. package/hel_dist/static/fonts/element-icons.732389de.ttf +0 -0
  18. package/hel_dist/static/img/404.a57b6f31.png +0 -0
  19. package/hel_dist/static/img/404_cloud.0f4bc32b.png +0 -0
  20. package/hel_dist/static/img/logo.82b9c7a5.png +0 -0
  21. package/hel_dist/static/js/app.4c22465f.js +1 -0
  22. package/hel_dist/static/js/chunk-017edab0.362048d2.js +1 -0
  23. package/hel_dist/static/js/chunk-2d0c8bf7.70b29a00.js +1 -0
  24. package/hel_dist/static/js/chunk-2d0cfaef.084b1334.js +1 -0
  25. package/hel_dist/static/js/chunk-2d0d0f79.d7d27267.js +1 -0
  26. package/hel_dist/static/js/chunk-2d0e4b0c.3835385f.js +1 -0
  27. package/hel_dist/static/js/chunk-2d0e4e1f.0c68ea9c.js +1 -0
  28. package/hel_dist/static/js/chunk-2d0e944c.5d7311c9.js +1 -0
  29. package/hel_dist/static/js/chunk-2d2104c6.b1e1cf15.js +1 -0
  30. package/hel_dist/static/js/chunk-2d226cab.f4b20d3f.js +1 -0
  31. package/hel_dist/static/js/chunk-2d229205.b6def72f.js +1 -0
  32. package/hel_dist/static/js/chunk-5eaa4e8c.62e343d1.js +1 -0
  33. package/hel_dist/static/js/chunk-67ce6001.c7dec55f.js +1 -0
  34. package/hel_dist/static/js/chunk-6d379bf5.3d4baab7.js +1 -0
  35. package/hel_dist/static/js/chunk-718db1ae.a79def1c.js +1 -0
  36. package/hel_dist/static/js/chunk-7ba44fd1.b80386b8.js +33 -0
  37. package/hel_dist/static/js/chunk-de514d9e.96bc330f.js +1 -0
  38. package/hel_dist/static/js/chunk-elementUI.f4fd50f4.js +9 -0
  39. package/hel_dist/static/js/chunk-libs.8a568f76.js +17 -0
  40. package/hel_proxy/entry.js +37 -0
  41. package/hel_proxy_es/entry.js +28 -0
  42. package/package.json +95 -4
  43. package/scripts/check.js +13 -0
  44. package/scripts/meta.js +19 -0
  45. package/scripts/prepublishOnly.js +26 -0
  46. package/src/App.vue +11 -0
  47. package/src/api/table.js +9 -0
  48. package/src/api/user.js +24 -0
  49. package/src/assets/404_images/404.png +0 -0
  50. package/src/assets/404_images/404_cloud.png +0 -0
  51. package/src/components/Breadcrumb/index.vue +78 -0
  52. package/src/components/Hamburger/index.vue +44 -0
  53. package/src/components/SvgIcon/index.vue +62 -0
  54. package/src/components/index.js +2 -0
  55. package/src/configs/subApp.js +9 -0
  56. package/src/entrance/libProperties.js +10 -0
  57. package/src/entrance/libTypes.ts +24 -0
  58. package/src/icons/index.js +9 -0
  59. package/src/icons/svg/dashboard.svg +1 -0
  60. package/src/icons/svg/example.svg +1 -0
  61. package/src/icons/svg/eye-open.svg +1 -0
  62. package/src/icons/svg/eye.svg +1 -0
  63. package/src/icons/svg/form.svg +1 -0
  64. package/src/icons/svg/link.svg +1 -0
  65. package/src/icons/svg/nested.svg +1 -0
  66. package/src/icons/svg/password.svg +1 -0
  67. package/src/icons/svg/table.svg +1 -0
  68. package/src/icons/svg/tree.svg +1 -0
  69. package/src/icons/svg/user.svg +1 -0
  70. package/src/icons/svgo.config.js +9 -0
  71. package/src/layout/components/AppMain.vue +40 -0
  72. package/src/layout/components/Navbar.vue +139 -0
  73. package/src/layout/components/Sidebar/FixiOSBug.js +26 -0
  74. package/src/layout/components/Sidebar/Item.vue +41 -0
  75. package/src/layout/components/Sidebar/Link.vue +43 -0
  76. package/src/layout/components/Sidebar/Logo.vue +82 -0
  77. package/src/layout/components/Sidebar/SidebarItem.vue +95 -0
  78. package/src/layout/components/Sidebar/index.vue +56 -0
  79. package/src/layout/components/index.js +3 -0
  80. package/src/layout/index.vue +93 -0
  81. package/src/layout/mixin/ResizeHandler.js +45 -0
  82. package/src/loadApp.js +43 -0
  83. package/src/main.js +13 -0
  84. package/src/permission.js +64 -0
  85. package/src/router/index.js +181 -0
  86. package/src/settings.js +16 -0
  87. package/src/store/getters.js +8 -0
  88. package/src/store/index.js +19 -0
  89. package/src/store/modules/app.js +48 -0
  90. package/src/store/modules/settings.js +32 -0
  91. package/src/store/modules/user.js +97 -0
  92. package/src/styles/element-ui.scss +49 -0
  93. package/src/styles/index.scss +65 -0
  94. package/src/styles/mixin.scss +28 -0
  95. package/src/styles/sidebar.scss +226 -0
  96. package/src/styles/transition.scss +48 -0
  97. package/src/styles/variables.scss +25 -0
  98. package/src/utils/auth.js +15 -0
  99. package/src/utils/get-page-title.js +10 -0
  100. package/src/utils/index.js +117 -0
  101. package/src/utils/request.js +85 -0
  102. package/src/utils/validate.js +20 -0
  103. package/src/views/404.vue +228 -0
  104. package/src/views/dashboard/index.vue +37 -0
  105. package/src/views/form/index.vue +85 -0
  106. package/src/views/login/index.vue +237 -0
  107. package/src/views/nested/menu1/index.vue +7 -0
  108. package/src/views/nested/menu1/menu1-1/index.vue +7 -0
  109. package/src/views/nested/menu1/menu1-2/index.vue +7 -0
  110. package/src/views/nested/menu1/menu1-2/menu1-2-1/index.vue +5 -0
  111. package/src/views/nested/menu1/menu1-2/menu1-2-2/index.vue +5 -0
  112. package/src/views/nested/menu1/menu1-3/index.vue +5 -0
  113. package/src/views/nested/menu2/index.vue +5 -0
  114. package/src/views/table/index.vue +79 -0
  115. package/src/views/tree/index.vue +78 -0
@@ -0,0 +1,85 @@
1
+ import axios from 'axios'
2
+ import { MessageBox, Message } from 'element-ui'
3
+ import store from '@/store'
4
+ import { getToken } from '@/utils/auth'
5
+
6
+ // create an axios instance
7
+ const service = axios.create({
8
+ baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
9
+ // withCredentials: true, // send cookies when cross-domain requests
10
+ timeout: 5000 // request timeout
11
+ })
12
+
13
+ // request interceptor
14
+ service.interceptors.request.use(
15
+ config => {
16
+ // do something before request is sent
17
+
18
+ if (store.getters.token) {
19
+ // let each request carry token
20
+ // ['X-Token'] is a custom headers key
21
+ // please modify it according to the actual situation
22
+ config.headers['X-Token'] = getToken()
23
+ }
24
+ return config
25
+ },
26
+ error => {
27
+ // do something with request error
28
+ console.log(error) // for debug
29
+ return Promise.reject(error)
30
+ }
31
+ )
32
+
33
+ // response interceptor
34
+ service.interceptors.response.use(
35
+ /**
36
+ * If you want to get http information such as headers or status
37
+ * Please return response => response
38
+ */
39
+
40
+ /**
41
+ * Determine the request status by custom code
42
+ * Here is just an example
43
+ * You can also judge the status by HTTP Status Code
44
+ */
45
+ response => {
46
+ const res = response.data
47
+
48
+ // if the custom code is not 20000, it is judged as an error.
49
+ if (res.code !== 20000) {
50
+ Message({
51
+ message: res.message || 'Error',
52
+ type: 'error',
53
+ duration: 5 * 1000
54
+ })
55
+
56
+ // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
57
+ if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
58
+ // to re-login
59
+ MessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', {
60
+ confirmButtonText: 'Re-Login',
61
+ cancelButtonText: 'Cancel',
62
+ type: 'warning'
63
+ }).then(() => {
64
+ store.dispatch('user/resetToken').then(() => {
65
+ location.reload()
66
+ })
67
+ })
68
+ }
69
+ return Promise.reject(new Error(res.message || 'Error'))
70
+ } else {
71
+ return res
72
+ }
73
+ },
74
+ error => {
75
+ console.log('err' + error) // for debug
76
+ Message({
77
+ message: error.message,
78
+ type: 'error',
79
+ duration: 5 * 1000
80
+ })
81
+ return Promise.reject(error)
82
+ }
83
+ )
84
+
85
+ export default service
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Created by PanJiaChen on 16/11/18.
3
+ */
4
+
5
+ /**
6
+ * @param {string} path
7
+ * @returns {Boolean}
8
+ */
9
+ export function isExternal(path) {
10
+ return /^(https?:|mailto:|tel:)/.test(path)
11
+ }
12
+
13
+ /**
14
+ * @param {string} str
15
+ * @returns {Boolean}
16
+ */
17
+ export function validUsername(str) {
18
+ const valid_map = ['admin', 'editor']
19
+ return valid_map.indexOf(str.trim()) >= 0
20
+ }
@@ -0,0 +1,228 @@
1
+ <template>
2
+ <div class="wscn-http404-container">
3
+ <div class="wscn-http404">
4
+ <div class="pic-404">
5
+ <img class="pic-404__parent" src="@/assets/404_images/404.png" alt="404">
6
+ <img class="pic-404__child left" src="@/assets/404_images/404_cloud.png" alt="404">
7
+ <img class="pic-404__child mid" src="@/assets/404_images/404_cloud.png" alt="404">
8
+ <img class="pic-404__child right" src="@/assets/404_images/404_cloud.png" alt="404">
9
+ </div>
10
+ <div class="bullshit">
11
+ <div class="bullshit__oops">OOPS!</div>
12
+ <div class="bullshit__info">All rights reserved
13
+ <a style="color:#20a0ff" href="https://wallstreetcn.com" target="_blank">wallstreetcn</a>
14
+ </div>
15
+ <div class="bullshit__headline">{{ message }}</div>
16
+ <div class="bullshit__info">Please check that the URL you entered is correct, or click the button below to return to the homepage.</div>
17
+ <a href="" class="bullshit__return-home">Back to home</a>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+
25
+ export default {
26
+ name: 'Page404',
27
+ computed: {
28
+ message() {
29
+ return 'The webmaster said that you can not enter this page...'
30
+ }
31
+ }
32
+ }
33
+ </script>
34
+
35
+ <style lang="scss" scoped>
36
+ .wscn-http404-container{
37
+ transform: translate(-50%,-50%);
38
+ position: absolute;
39
+ top: 40%;
40
+ left: 50%;
41
+ }
42
+ .wscn-http404 {
43
+ position: relative;
44
+ width: 1200px;
45
+ padding: 0 50px;
46
+ overflow: hidden;
47
+ .pic-404 {
48
+ position: relative;
49
+ float: left;
50
+ width: 600px;
51
+ overflow: hidden;
52
+ &__parent {
53
+ width: 100%;
54
+ }
55
+ &__child {
56
+ position: absolute;
57
+ &.left {
58
+ width: 80px;
59
+ top: 17px;
60
+ left: 220px;
61
+ opacity: 0;
62
+ animation-name: cloudLeft;
63
+ animation-duration: 2s;
64
+ animation-timing-function: linear;
65
+ animation-fill-mode: forwards;
66
+ animation-delay: 1s;
67
+ }
68
+ &.mid {
69
+ width: 46px;
70
+ top: 10px;
71
+ left: 420px;
72
+ opacity: 0;
73
+ animation-name: cloudMid;
74
+ animation-duration: 2s;
75
+ animation-timing-function: linear;
76
+ animation-fill-mode: forwards;
77
+ animation-delay: 1.2s;
78
+ }
79
+ &.right {
80
+ width: 62px;
81
+ top: 100px;
82
+ left: 500px;
83
+ opacity: 0;
84
+ animation-name: cloudRight;
85
+ animation-duration: 2s;
86
+ animation-timing-function: linear;
87
+ animation-fill-mode: forwards;
88
+ animation-delay: 1s;
89
+ }
90
+ @keyframes cloudLeft {
91
+ 0% {
92
+ top: 17px;
93
+ left: 220px;
94
+ opacity: 0;
95
+ }
96
+ 20% {
97
+ top: 33px;
98
+ left: 188px;
99
+ opacity: 1;
100
+ }
101
+ 80% {
102
+ top: 81px;
103
+ left: 92px;
104
+ opacity: 1;
105
+ }
106
+ 100% {
107
+ top: 97px;
108
+ left: 60px;
109
+ opacity: 0;
110
+ }
111
+ }
112
+ @keyframes cloudMid {
113
+ 0% {
114
+ top: 10px;
115
+ left: 420px;
116
+ opacity: 0;
117
+ }
118
+ 20% {
119
+ top: 40px;
120
+ left: 360px;
121
+ opacity: 1;
122
+ }
123
+ 70% {
124
+ top: 130px;
125
+ left: 180px;
126
+ opacity: 1;
127
+ }
128
+ 100% {
129
+ top: 160px;
130
+ left: 120px;
131
+ opacity: 0;
132
+ }
133
+ }
134
+ @keyframes cloudRight {
135
+ 0% {
136
+ top: 100px;
137
+ left: 500px;
138
+ opacity: 0;
139
+ }
140
+ 20% {
141
+ top: 120px;
142
+ left: 460px;
143
+ opacity: 1;
144
+ }
145
+ 80% {
146
+ top: 180px;
147
+ left: 340px;
148
+ opacity: 1;
149
+ }
150
+ 100% {
151
+ top: 200px;
152
+ left: 300px;
153
+ opacity: 0;
154
+ }
155
+ }
156
+ }
157
+ }
158
+ .bullshit {
159
+ position: relative;
160
+ float: left;
161
+ width: 300px;
162
+ padding: 30px 0;
163
+ overflow: hidden;
164
+ &__oops {
165
+ font-size: 32px;
166
+ font-weight: bold;
167
+ line-height: 40px;
168
+ color: #1482f0;
169
+ opacity: 0;
170
+ margin-bottom: 20px;
171
+ animation-name: slideUp;
172
+ animation-duration: 0.5s;
173
+ animation-fill-mode: forwards;
174
+ }
175
+ &__headline {
176
+ font-size: 20px;
177
+ line-height: 24px;
178
+ color: #222;
179
+ font-weight: bold;
180
+ opacity: 0;
181
+ margin-bottom: 10px;
182
+ animation-name: slideUp;
183
+ animation-duration: 0.5s;
184
+ animation-delay: 0.1s;
185
+ animation-fill-mode: forwards;
186
+ }
187
+ &__info {
188
+ font-size: 13px;
189
+ line-height: 21px;
190
+ color: grey;
191
+ opacity: 0;
192
+ margin-bottom: 30px;
193
+ animation-name: slideUp;
194
+ animation-duration: 0.5s;
195
+ animation-delay: 0.2s;
196
+ animation-fill-mode: forwards;
197
+ }
198
+ &__return-home {
199
+ display: block;
200
+ float: left;
201
+ width: 110px;
202
+ height: 36px;
203
+ background: #1482f0;
204
+ border-radius: 100px;
205
+ text-align: center;
206
+ color: #ffffff;
207
+ opacity: 0;
208
+ font-size: 14px;
209
+ line-height: 36px;
210
+ cursor: pointer;
211
+ animation-name: slideUp;
212
+ animation-duration: 0.5s;
213
+ animation-delay: 0.3s;
214
+ animation-fill-mode: forwards;
215
+ }
216
+ @keyframes slideUp {
217
+ 0% {
218
+ transform: translateY(60px);
219
+ opacity: 0;
220
+ }
221
+ 100% {
222
+ transform: translateY(0);
223
+ opacity: 1;
224
+ }
225
+ }
226
+ }
227
+ }
228
+ </style>
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <div class="dashboard-container">
3
+ <div class="dashboard-text">name: {{ name }}</div>
4
+ <!-- 直接使用 comps 包(pnpm workspace 链接)的最新源码 -->
5
+ <HelloWorld msg="tpl 直接渲染 comps 的最新源码" />
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ import { mapGetters } from 'vuex'
11
+ // 从 comps 的源码入口导入,保证 tpl 始终使用 comps 的最新代码
12
+ import comps from '@melt-js/comps-vue2-ele/src/components'
13
+
14
+ export default {
15
+ name: 'Dashboard',
16
+ components: {
17
+ HelloWorld: comps.HelloWorld
18
+ },
19
+ computed: {
20
+ ...mapGetters([
21
+ 'name'
22
+ ])
23
+ }
24
+ }
25
+ </script>
26
+
27
+ <style lang="scss" scoped>
28
+ .dashboard {
29
+ &-container {
30
+ margin: 30px;
31
+ }
32
+ &-text {
33
+ font-size: 30px;
34
+ line-height: 46px;
35
+ }
36
+ }
37
+ </style>
@@ -0,0 +1,85 @@
1
+ <template>
2
+ <div class="app-container">
3
+ <el-form ref="form" :model="form" label-width="120px">
4
+ <el-form-item label="Activity name">
5
+ <el-input v-model="form.name" />
6
+ </el-form-item>
7
+ <el-form-item label="Activity zone">
8
+ <el-select v-model="form.region" placeholder="please select your zone">
9
+ <el-option label="Zone one" value="shanghai" />
10
+ <el-option label="Zone two" value="beijing" />
11
+ </el-select>
12
+ </el-form-item>
13
+ <el-form-item label="Activity time">
14
+ <el-col :span="11">
15
+ <el-date-picker v-model="form.date1" type="date" placeholder="Pick a date" style="width: 100%;" />
16
+ </el-col>
17
+ <el-col :span="2" class="line">-</el-col>
18
+ <el-col :span="11">
19
+ <el-time-picker v-model="form.date2" type="fixed-time" placeholder="Pick a time" style="width: 100%;" />
20
+ </el-col>
21
+ </el-form-item>
22
+ <el-form-item label="Instant delivery">
23
+ <el-switch v-model="form.delivery" />
24
+ </el-form-item>
25
+ <el-form-item label="Activity type">
26
+ <el-checkbox-group v-model="form.type">
27
+ <el-checkbox label="Online activities" name="type" />
28
+ <el-checkbox label="Promotion activities" name="type" />
29
+ <el-checkbox label="Offline activities" name="type" />
30
+ <el-checkbox label="Simple brand exposure" name="type" />
31
+ </el-checkbox-group>
32
+ </el-form-item>
33
+ <el-form-item label="Resources">
34
+ <el-radio-group v-model="form.resource">
35
+ <el-radio label="Sponsor" />
36
+ <el-radio label="Venue" />
37
+ </el-radio-group>
38
+ </el-form-item>
39
+ <el-form-item label="Activity form">
40
+ <el-input v-model="form.desc" type="textarea" />
41
+ </el-form-item>
42
+ <el-form-item>
43
+ <el-button type="primary" @click="onSubmit">Create</el-button>
44
+ <el-button @click="onCancel">Cancel</el-button>
45
+ </el-form-item>
46
+ </el-form>
47
+ </div>
48
+ </template>
49
+
50
+ <script>
51
+ export default {
52
+ data() {
53
+ return {
54
+ form: {
55
+ name: '',
56
+ region: '',
57
+ date1: '',
58
+ date2: '',
59
+ delivery: false,
60
+ type: [],
61
+ resource: '',
62
+ desc: ''
63
+ }
64
+ }
65
+ },
66
+ methods: {
67
+ onSubmit() {
68
+ this.$message('submit!')
69
+ },
70
+ onCancel() {
71
+ this.$message({
72
+ message: 'cancel!',
73
+ type: 'warning'
74
+ })
75
+ }
76
+ }
77
+ }
78
+ </script>
79
+
80
+ <style scoped>
81
+ .line{
82
+ text-align: center;
83
+ }
84
+ </style>
85
+
@@ -0,0 +1,237 @@
1
+ <template>
2
+ <div class="login-container">
3
+ <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left">
4
+
5
+ <div class="title-container">
6
+ <h3 class="title">Login Form</h3>
7
+ </div>
8
+
9
+ <el-form-item prop="username">
10
+ <span class="svg-container">
11
+ <svg-icon icon-class="user" />
12
+ </span>
13
+ <el-input
14
+ ref="username"
15
+ v-model="loginForm.username"
16
+ placeholder="Username"
17
+ name="username"
18
+ type="text"
19
+ tabindex="1"
20
+ auto-complete="on"
21
+ />
22
+ </el-form-item>
23
+
24
+ <el-form-item prop="password">
25
+ <span class="svg-container">
26
+ <svg-icon icon-class="password" />
27
+ </span>
28
+ <el-input
29
+ :key="passwordType"
30
+ ref="password"
31
+ v-model="loginForm.password"
32
+ :type="passwordType"
33
+ placeholder="Password"
34
+ name="password"
35
+ tabindex="2"
36
+ auto-complete="on"
37
+ @keyup.enter.native="handleLogin"
38
+ />
39
+ <span class="show-pwd" @click="showPwd">
40
+ <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
41
+ </span>
42
+ </el-form-item>
43
+
44
+ <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">Login</el-button>
45
+
46
+ <div class="tips">
47
+ <span style="margin-right:20px;">username: admin</span>
48
+ <span> password: any</span>
49
+ </div>
50
+
51
+ </el-form>
52
+ </div>
53
+ </template>
54
+
55
+ <script>
56
+ import { validUsername } from '@/utils/validate'
57
+
58
+ export default {
59
+ name: 'Login',
60
+ data() {
61
+ const validateUsername = (rule, value, callback) => {
62
+ if (!validUsername(value)) {
63
+ callback(new Error('Please enter the correct user name'))
64
+ } else {
65
+ callback()
66
+ }
67
+ }
68
+ const validatePassword = (rule, value, callback) => {
69
+ if (value.length < 6) {
70
+ callback(new Error('The password can not be less than 6 digits'))
71
+ } else {
72
+ callback()
73
+ }
74
+ }
75
+ return {
76
+ loginForm: {
77
+ username: 'admin',
78
+ password: '111111'
79
+ },
80
+ loginRules: {
81
+ username: [{ required: true, trigger: 'blur', validator: validateUsername }],
82
+ password: [{ required: true, trigger: 'blur', validator: validatePassword }]
83
+ },
84
+ loading: false,
85
+ passwordType: 'password',
86
+ redirect: undefined
87
+ }
88
+ },
89
+ watch: {
90
+ $route: {
91
+ handler: function(route) {
92
+ this.redirect = route.query && route.query.redirect
93
+ },
94
+ immediate: true
95
+ }
96
+ },
97
+ methods: {
98
+ showPwd() {
99
+ if (this.passwordType === 'password') {
100
+ this.passwordType = ''
101
+ } else {
102
+ this.passwordType = 'password'
103
+ }
104
+ this.$nextTick(() => {
105
+ this.$refs.password.focus()
106
+ })
107
+ },
108
+ handleLogin() {
109
+ this.$refs.loginForm.validate(valid => {
110
+ if (valid) {
111
+ this.loading = true
112
+ this.$store.dispatch('user/login', this.loginForm).then(() => {
113
+ this.$router.push({ path: this.redirect || '/' })
114
+ this.loading = false
115
+ }).catch(() => {
116
+ this.loading = false
117
+ })
118
+ } else {
119
+ console.log('error submit!!')
120
+ return false
121
+ }
122
+ })
123
+ }
124
+ }
125
+ }
126
+ </script>
127
+
128
+ <style lang="scss">
129
+ /* 修复input 背景不协调 和光标变色 */
130
+ /* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
131
+
132
+ $bg:#283443;
133
+ $light_gray:#fff;
134
+ $cursor: #fff;
135
+
136
+ @supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
137
+ .login-container .el-input input {
138
+ color: $cursor;
139
+ }
140
+ }
141
+
142
+ /* reset element-ui css */
143
+ .login-container {
144
+ .el-input {
145
+ display: inline-block;
146
+ height: 47px;
147
+ width: 85%;
148
+
149
+ input {
150
+ background: transparent;
151
+ border: 0px;
152
+ -webkit-appearance: none;
153
+ border-radius: 0px;
154
+ padding: 12px 5px 12px 15px;
155
+ color: $light_gray;
156
+ height: 47px;
157
+ caret-color: $cursor;
158
+
159
+ &:-webkit-autofill {
160
+ box-shadow: 0 0 0px 1000px $bg inset !important;
161
+ -webkit-text-fill-color: $cursor !important;
162
+ }
163
+ }
164
+ }
165
+
166
+ .el-form-item {
167
+ border: 1px solid rgba(255, 255, 255, 0.1);
168
+ background: rgba(0, 0, 0, 0.1);
169
+ border-radius: 5px;
170
+ color: #454545;
171
+ }
172
+ }
173
+ </style>
174
+
175
+ <style lang="scss" scoped>
176
+ $bg:#2d3a4b;
177
+ $dark_gray:#889aa4;
178
+ $light_gray:#eee;
179
+
180
+ .login-container {
181
+ min-height: 100%;
182
+ width: 100%;
183
+ background-color: $bg;
184
+ overflow: hidden;
185
+
186
+ .login-form {
187
+ position: relative;
188
+ width: 520px;
189
+ max-width: 100%;
190
+ padding: 160px 35px 0;
191
+ margin: 0 auto;
192
+ overflow: hidden;
193
+ }
194
+
195
+ .tips {
196
+ font-size: 14px;
197
+ color: #fff;
198
+ margin-bottom: 10px;
199
+
200
+ span {
201
+ &:first-of-type {
202
+ margin-right: 16px;
203
+ }
204
+ }
205
+ }
206
+
207
+ .svg-container {
208
+ padding: 6px 5px 6px 15px;
209
+ color: $dark_gray;
210
+ vertical-align: middle;
211
+ width: 30px;
212
+ display: inline-block;
213
+ }
214
+
215
+ .title-container {
216
+ position: relative;
217
+
218
+ .title {
219
+ font-size: 26px;
220
+ color: $light_gray;
221
+ margin: 0px auto 40px auto;
222
+ text-align: center;
223
+ font-weight: bold;
224
+ }
225
+ }
226
+
227
+ .show-pwd {
228
+ position: absolute;
229
+ right: 10px;
230
+ top: 7px;
231
+ font-size: 16px;
232
+ color: $dark_gray;
233
+ cursor: pointer;
234
+ user-select: none;
235
+ }
236
+ }
237
+ </style>
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <div style="padding:30px;">
3
+ <el-alert :closable="false" title="menu 1">
4
+ <router-view />
5
+ </el-alert>
6
+ </div>
7
+ </template>
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <div style="padding:30px;">
3
+ <el-alert :closable="false" title="menu 1-1" type="success">
4
+ <router-view />
5
+ </el-alert>
6
+ </div>
7
+ </template>