vue2-client 1.2.41 → 1.2.44

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.
@@ -1,201 +1,194 @@
1
- <template>
2
- <common-layout>
3
- <div class="top">
4
- <div class="header">
5
- <img alt="logo" class="logo" src="@/assets/img/logo.png" />
6
- <span class="title">{{ systemName }}</span>
7
- </div>
8
- <div class="desc">{{ systemDesc }}</div>
9
- </div>
10
- <div class="login">
11
- <a-form @submit="onSubmit" :form="form">
12
- <a-tabs size="large" :tabBarStyle="{textAlign: 'center'}" style="padding: 0 2px;">
13
- <a-tab-pane tab="账户密码登录" key="1">
14
- <a-alert
15
- type="error"
16
- :closable="true"
17
- v-show="error"
18
- :message="error"
19
- showIcon
20
- style="margin-bottom: 24px;" />
21
- <a-form-item>
22
- <a-input
23
- autocomplete="autocomplete"
24
- size="large"
25
- placeholder="admin"
26
- v-decorator="['name', {rules: [{ required: true, message: '请输入账户名', whitespace: true}]}]"
27
- >
28
- <a-icon slot="prefix" type="user" />
29
- </a-input>
30
- </a-form-item>
31
- <a-form-item>
32
- <a-input
33
- size="large"
34
- placeholder="888888"
35
- autocomplete="autocomplete"
36
- type="password"
37
- v-decorator="['password', {rules: [{ required: true, message: '请输入密码', whitespace: true}]}]"
38
- >
39
- <a-icon slot="prefix" type="lock" />
40
- </a-input>
41
- </a-form-item>
42
- </a-tab-pane>
43
- </a-tabs>
44
- <div>
45
- <a-checkbox :checked="true" >自动登录</a-checkbox>
46
- </div>
47
- <a-form-item>
48
- <a-button :loading="logging" style="width: 100%;margin-top: 24px" size="large" htmlType="submit" type="primary">登录</a-button>
49
- </a-form-item>
50
- </a-form>
51
- </div>
52
- </common-layout>
53
- </template>
54
-
55
- <script>
56
- import CommonLayout from '@vue2-client/layouts/CommonLayout'
57
- import { getRoutesConfig, login } from '@vue2-client/services/user'
58
- import { setAuthorization } from '@vue2-client/utils/request'
59
- import { loadRoutes, funcToRouter } from '@vue2-client/utils/routerUtil'
60
- import { mapMutations } from 'vuex'
61
- import JSEncrypt from 'jsencrypt'
62
- import { ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
63
- import Vue from 'vue'
64
- import { positions } from '@vue2-client/mock/common'
65
- import { timeFix } from '@vue2-client/utils/util'
66
- const { homePage, ticketPage } = require('@vue2-client/config')
67
- // import { router } from '@vue2-client/mock/user/routes'
68
-
69
- export default {
70
- name: 'Login',
71
- components: { CommonLayout },
72
- data () {
73
- return {
74
- logging: false,
75
- error: '',
76
- form: this.$form.createForm(this)
77
- }
78
- },
79
- computed: {
80
- systemName () {
81
- return this.$store.state.setting.systemName
82
- },
83
- systemDesc () {
84
- return this.$store.state.setting.systemDesc
85
- }
86
- },
87
- methods: {
88
- ...mapMutations('account', ['setUser', 'setPermissions', 'setRoles']),
89
- onSubmit (e) {
90
- e.preventDefault()
91
- this.form.validateFields((err) => {
92
- if (!err) {
93
- this.logging = true
94
- const name = this.form.getFieldValue('name')
95
- const password = this.form.getFieldValue('password')
96
- login(name, password).then(this.afterLogin)
97
- }
98
- })
99
- },
100
- afterLogin (res) {
101
- const name = this.form.getFieldValue('name')
102
- const password = this.form.getFieldValue('password')
103
- this.logging = false
104
- const loginRes = res.states
105
- if (loginRes === '登录成功') {
106
- const encrypt = new JSEncrypt()
107
- encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
108
- const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
109
- localStorage.setItem(ACCESS_TOKEN, data)
110
- // 获取路由配置
111
- getRoutesConfig(data).then(result => {
112
- Vue.$login.login(result).then(() => {
113
- const user = Object.assign({
114
- username: result.ename,
115
- name: result.name,
116
- avatar: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
117
- address: '西安市',
118
- position: positions[0]
119
- }, result)
120
- this.setUser(user)
121
- this.setPermissions([{ id: 'queryForm', operation: ['add', 'edit'] }])
122
- this.setRoles([{ id: 'admin', operation: ['add', 'edit', 'delete'] }])
123
- let timestamp = new Date().getTime()// 当前的时间戳
124
- timestamp = timestamp + 60 * 60 * 1000
125
- // 格式化时间获取年月日, 登陆过期时间
126
- const dateAfter = new Date(timestamp)
127
- setAuthorization({ token: data, expireAt: dateAfter })
128
- loadRoutes(funcToRouter(user.functions))
129
- if (result.deps === '用户工单登记') {
130
- this.$router.push(ticketPage).catch(() => {})
131
- } else {
132
- this.$router.push(homePage).catch(() => {})
133
- }
134
- this.$message.success(timeFix().CN + ',欢迎回来', 3)
135
- })
136
- })
137
- } else {
138
- this.error = loginRes
139
- }
140
- }
141
- }
142
- }
143
- </script>
144
-
145
- <style lang="less" scoped>
146
- .common-layout{
147
- .top {
148
- text-align: center;
149
- .header {
150
- height: 44px;
151
- line-height: 44px;
152
- a {
153
- text-decoration: none;
154
- }
155
- .logo {
156
- height: 44px;
157
- vertical-align: top;
158
- margin-right: 16px;
159
- }
160
- .title {
161
- font-size: 33px;
162
- color: @title-color;
163
- font-family: 'Myriad Pro', 'Helvetica Neue', Arial, Helvetica, sans-serif;
164
- font-weight: 600;
165
- position: relative;
166
- top: 2px;
167
- }
168
- }
169
- .desc {
170
- font-size: 14px;
171
- color: @text-color-second;
172
- margin-top: 12px;
173
- margin-bottom: 40px;
174
- }
175
- }
176
- .login{
177
- width: 368px;
178
- margin: 0 auto;
179
- @media screen and (max-width: 576px) {
180
- width: 95%;
181
- }
182
- @media screen and (max-width: 320px) {
183
- .captcha-button{
184
- font-size: 14px;
185
- }
186
- }
187
- .icon {
188
- font-size: 24px;
189
- color: @text-color-second;
190
- margin-left: 16px;
191
- vertical-align: middle;
192
- cursor: pointer;
193
- transition: color 0.3s;
194
-
195
- &:hover {
196
- color: @primary-color;
197
- }
198
- }
199
- }
200
- }
201
- </style>
1
+ <template>
2
+ <common-layout>
3
+ <div class="top">
4
+ <div class="header">
5
+ <img alt="logo" class="logo" src="@vue2-client/assets/img/logo.png" />
6
+ <span class="title">{{ systemName }}</span>
7
+ </div>
8
+ <div class="desc">{{ systemDesc }}</div>
9
+ </div>
10
+ <div class="login">
11
+ <a-form @submit="onSubmit" :form="form">
12
+ <a-tabs size="large" :tabBarStyle="{textAlign: 'center'}" style="padding: 0 2px;">
13
+ <a-tab-pane tab="账户密码登录" key="1">
14
+ <a-alert
15
+ type="error"
16
+ :closable="true"
17
+ v-show="error"
18
+ :message="error"
19
+ showIcon
20
+ style="margin-bottom: 24px;" />
21
+ <a-form-item>
22
+ <a-input
23
+ autocomplete="autocomplete"
24
+ size="large"
25
+ placeholder="admin"
26
+ v-decorator="['name', {rules: [{ required: true, message: '请输入账户名', whitespace: true}]}]"
27
+ >
28
+ <a-icon slot="prefix" type="user" />
29
+ </a-input>
30
+ </a-form-item>
31
+ <a-form-item>
32
+ <a-input
33
+ size="large"
34
+ placeholder="888888"
35
+ autocomplete="autocomplete"
36
+ type="password"
37
+ v-decorator="['password', {rules: [{ required: true, message: '请输入密码', whitespace: true}]}]"
38
+ >
39
+ <a-icon slot="prefix" type="lock" />
40
+ </a-input>
41
+ </a-form-item>
42
+ </a-tab-pane>
43
+ </a-tabs>
44
+ <div>
45
+ <a-checkbox :checked="true" >自动登录</a-checkbox>
46
+ </div>
47
+ <a-form-item>
48
+ <a-button :loading="logging" style="width: 100%;margin-top: 24px" size="large" htmlType="submit" type="primary">登录</a-button>
49
+ </a-form-item>
50
+ </a-form>
51
+ </div>
52
+ </common-layout>
53
+ </template>
54
+
55
+ <script>
56
+ import CommonLayout from '@vue2-client/layouts/CommonLayout'
57
+ import { getRoutesConfig, login } from '@vue2-client/services/user'
58
+ import { setAuthorization } from '@vue2-client/utils/request'
59
+ import { loadRoutes, funcToRouter } from '@vue2-client/utils/routerUtil'
60
+ import { mapMutations, mapState } from 'vuex'
61
+ import JSEncrypt from 'jsencrypt'
62
+ import { ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
63
+ import Vue from 'vue'
64
+ import { positions } from '@vue2-client/mock/common'
65
+ import { timeFix } from '@vue2-client/utils/util'
66
+
67
+ export default {
68
+ name: 'Login',
69
+ components: { CommonLayout },
70
+ data () {
71
+ return {
72
+ logging: false,
73
+ error: '',
74
+ form: this.$form.createForm(this)
75
+ }
76
+ },
77
+ computed: {
78
+ ...mapState('setting', ['systemName', 'systemDesc', 'homePage', 'ticketPage'])
79
+ },
80
+ methods: {
81
+ ...mapMutations('account', ['setUser', 'setPermissions', 'setRoles']),
82
+ onSubmit (e) {
83
+ e.preventDefault()
84
+ this.form.validateFields((err) => {
85
+ if (!err) {
86
+ this.logging = true
87
+ const name = this.form.getFieldValue('name')
88
+ const password = this.form.getFieldValue('password')
89
+ login(name, password).then(this.afterLogin)
90
+ }
91
+ })
92
+ },
93
+ afterLogin (res) {
94
+ const name = this.form.getFieldValue('name')
95
+ const password = this.form.getFieldValue('password')
96
+ this.logging = false
97
+ const loginRes = res.states
98
+ if (loginRes === '登录成功') {
99
+ const encrypt = new JSEncrypt()
100
+ encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
101
+ const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
102
+ localStorage.setItem(ACCESS_TOKEN, data)
103
+ // 获取路由配置
104
+ getRoutesConfig(data).then(result => {
105
+ Vue.$login.login(result).then(() => {
106
+ const user = Object.assign({
107
+ username: result.ename,
108
+ name: result.name,
109
+ avatar: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
110
+ address: '西安市',
111
+ position: positions[0]
112
+ }, result)
113
+ this.setUser(user)
114
+ this.setPermissions([{ id: 'queryForm', operation: ['add', 'edit'] }])
115
+ this.setRoles([{ id: 'admin', operation: ['add', 'edit', 'delete'] }])
116
+ let timestamp = new Date().getTime()// 当前的时间戳
117
+ timestamp = timestamp + 60 * 60 * 1000
118
+ // 格式化时间获取年月日, 登陆过期时间
119
+ const dateAfter = new Date(timestamp)
120
+ setAuthorization({ token: data, expireAt: dateAfter })
121
+ loadRoutes(funcToRouter(user.functions))
122
+ if (result.deps === '用户工单登记') {
123
+ this.$router.push(this.ticketPage).catch(() => {})
124
+ } else {
125
+ this.$router.push(this.homePage).catch(() => {})
126
+ }
127
+ this.$message.success(timeFix().CN + ',欢迎回来', 3)
128
+ })
129
+ })
130
+ } else {
131
+ this.error = loginRes
132
+ }
133
+ }
134
+ }
135
+ }
136
+ </script>
137
+
138
+ <style lang="less" scoped>
139
+ .common-layout{
140
+ .top {
141
+ text-align: center;
142
+ .header {
143
+ height: 44px;
144
+ line-height: 44px;
145
+ a {
146
+ text-decoration: none;
147
+ }
148
+ .logo {
149
+ height: 44px;
150
+ vertical-align: top;
151
+ margin-right: 16px;
152
+ }
153
+ .title {
154
+ font-size: 33px;
155
+ color: @title-color;
156
+ font-family: 'Myriad Pro', 'Helvetica Neue', Arial, Helvetica, sans-serif;
157
+ font-weight: 600;
158
+ position: relative;
159
+ top: 2px;
160
+ }
161
+ }
162
+ .desc {
163
+ font-size: 14px;
164
+ color: @text-color-second;
165
+ margin-top: 12px;
166
+ margin-bottom: 40px;
167
+ }
168
+ }
169
+ .login{
170
+ width: 368px;
171
+ margin: 0 auto;
172
+ @media screen and (max-width: 576px) {
173
+ width: 95%;
174
+ }
175
+ @media screen and (max-width: 320px) {
176
+ .captcha-button{
177
+ font-size: 14px;
178
+ }
179
+ }
180
+ .icon {
181
+ font-size: 24px;
182
+ color: @text-color-second;
183
+ margin-left: 16px;
184
+ vertical-align: middle;
185
+ cursor: pointer;
186
+ transition: color 0.3s;
187
+
188
+ &:hover {
189
+ color: @primary-color;
190
+ }
191
+ }
192
+ }
193
+ }
194
+ </style>
@@ -239,7 +239,7 @@
239
239
 
240
240
  <script>
241
241
  import { TicketDetailsViewApi, post } from '@vue2-client/services/api'
242
- import { logout } from '@/services/user'
242
+ import { logout } from '@vue2-client/services/user'
243
243
  import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
244
244
  import Vue from 'vue'
245
245
 
@@ -76,8 +76,8 @@ export default {
76
76
  },
77
77
  setSingle (state, page) {
78
78
  if (page.path && page.delete) {
79
- // 删除 暂时不做删除操作
80
- // state.single = state.single.filter(item => item.path !== page.path)
79
+ // 删除
80
+ state.single = state.single.filter(item => item.fullPath !== page.path)
81
81
  } else if (state.single.filter(item => item.meta.singlePage === page.meta.singlePage).length === 0) {
82
82
  // 添加
83
83
  state.single.push(page)
@@ -31,3 +31,17 @@
31
31
  color: @disabled-color;
32
32
  pointer-events: none;
33
33
  }
34
+
35
+ ::-webkit-scrollbar{
36
+ width: 5px;
37
+ height: 5px;
38
+ }
39
+ ::-webkit-scrollbar-thumb {
40
+ border-radius: 3px;
41
+ background: @primary-3;
42
+ }
43
+ ::-webkit-scrollbar-track {
44
+ -webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0);
45
+ border-radius: 3px;
46
+ background: @primary-1;
47
+ }