vue2-client 1.3.19 → 1.3.21

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 (96) hide show
  1. package/CHANGELOG.md +323 -315
  2. package/index.js +30 -30
  3. package/package.json +76 -76
  4. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -225
  5. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +551 -551
  6. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +777 -777
  7. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +553 -553
  8. package/src/base-client/components/common/CustomColumnsDrawer/index.md +46 -46
  9. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  10. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  11. package/src/base-client/components/common/Upload/Upload.vue +162 -165
  12. package/src/base-client/components/common/XAddForm/XAddForm.vue +354 -354
  13. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +327 -327
  14. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  15. package/src/base-client/components/common/XForm/XForm.vue +274 -274
  16. package/src/base-client/components/common/XForm/XFormItem.vue +389 -389
  17. package/src/base-client/components/common/XFormTable/index.md +96 -96
  18. package/src/base-client/components/common/XTable/XTable.vue +278 -278
  19. package/src/base-client/components/system/LogDetailsView/LogDetailsView.vue +376 -376
  20. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  21. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  22. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  23. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  24. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  25. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  26. package/src/base-client/plugins/AppData.js +69 -69
  27. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  28. package/src/base-client/plugins/PagedList.js +177 -177
  29. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  30. package/src/base-client/plugins/i18n-extend.js +32 -32
  31. package/src/components/Ellipsis/index.md +38 -38
  32. package/src/components/NumberInfo/index.md +43 -43
  33. package/src/components/STable/README.md +341 -341
  34. package/src/components/STable/index.js +318 -318
  35. package/src/components/Trend/index.md +45 -45
  36. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  37. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  38. package/src/components/exception/ExceptionPage.vue +70 -70
  39. package/src/components/form/FormRow.vue +52 -52
  40. package/src/components/index.js +36 -36
  41. package/src/components/menu/SideMenu.vue +62 -62
  42. package/src/components/menu/menu.js +273 -273
  43. package/src/components/setting/Setting.vue +235 -235
  44. package/src/components/table/StandardTable.vue +141 -141
  45. package/src/components/table/advance/ActionColumns.vue +158 -158
  46. package/src/components/table/advance/SearchArea.vue +355 -355
  47. package/src/components/tool/AStepItem.vue +60 -60
  48. package/src/components/tool/AvatarList.vue +68 -68
  49. package/src/components/tool/Drawer.vue +142 -142
  50. package/src/components/tool/TagSelect.vue +83 -83
  51. package/src/components/transition/PageToggleTransition.vue +97 -97
  52. package/src/config/default/setting.config.js +41 -41
  53. package/src/config/replacer/resolve.config.js +67 -67
  54. package/src/layouts/AdminLayout.vue +174 -174
  55. package/src/layouts/header/AdminHeader.vue +104 -104
  56. package/src/layouts/header/HeaderNotice.vue +167 -167
  57. package/src/layouts/header/HeaderSearch.vue +67 -67
  58. package/src/layouts/header/InstitutionDetail.vue +181 -181
  59. package/src/layouts/tabs/TabsHead.vue +190 -190
  60. package/src/layouts/tabs/TabsView.vue +379 -379
  61. package/src/mock/goods/index.js +108 -108
  62. package/src/pages/CreateQueryPage.vue +65 -65
  63. package/src/pages/login/Login.vue +277 -277
  64. package/src/pages/report/ReportTable.js +124 -124
  65. package/src/pages/report/ReportTableHome.vue +28 -28
  66. package/src/pages/resourceManage/orgListManage.vue +98 -98
  67. package/src/pages/system/dictionary/index.vue +43 -43
  68. package/src/pages/system/file/index.vue +317 -317
  69. package/src/pages/system/queryParams/index.vue +43 -43
  70. package/src/pages/system/ticket/index.vue +504 -461
  71. package/src/pages/system/ticket/submitTicketSuccess.vue +208 -206
  72. package/src/router/async/config.async.js +27 -27
  73. package/src/router/async/router.map.js +56 -56
  74. package/src/router/index.js +27 -27
  75. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  76. package/src/services/api/LogDetailsViewApi.js +10 -10
  77. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  78. package/src/services/api/TicketDetailsViewApi.js +34 -34
  79. package/src/services/api/common.js +58 -58
  80. package/src/services/api/commonTempTable.js +10 -10
  81. package/src/services/api/index.js +17 -17
  82. package/src/services/api/manage.js +8 -8
  83. package/src/store/mutation-types.js +2 -2
  84. package/src/theme/default/nprogress.less +76 -76
  85. package/src/theme/default/style.less +47 -47
  86. package/src/utils/colors.js +103 -103
  87. package/src/utils/excel/Blob.js +180 -180
  88. package/src/utils/excel/Export2Excel.js +141 -141
  89. package/src/utils/formatter.js +68 -68
  90. package/src/utils/i18n.js +80 -80
  91. package/src/utils/request.js +225 -225
  92. package/src/utils/routerUtil.js +364 -364
  93. package/src/utils/theme-color-replacer-extend.js +91 -91
  94. package/src/utils/themeUtil.js +100 -100
  95. package/src/utils/util.js +230 -230
  96. package/vue.config.js +99 -99
@@ -1,277 +1,277 @@
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 :form="form" @submit="onSubmit">
12
- <a-tabs :tabBarStyle="{textAlign: 'center'}" size="large" style="padding: 0 2px;">
13
- <a-tab-pane key="1" tab="账户密码登录">
14
- <a-alert
15
- v-show="error"
16
- :closable="true"
17
- :message="error"
18
- showIcon
19
- style="margin-bottom: 24px;"
20
- type="error" />
21
- <a-form-item>
22
- <a-input
23
- v-decorator="['name', {rules: [{ required: true, message: '请输入账户名', whitespace: true}]}]"
24
- autocomplete="autocomplete"
25
- placeholder="admin"
26
- size="large"
27
- >
28
- <a-icon slot="prefix" type="user" />
29
- </a-input>
30
- </a-form-item>
31
- <a-form-item>
32
- <a-input
33
- v-decorator="['password', {rules: [{ required: true, message: '请输入密码', whitespace: true}]}]"
34
- autocomplete="autocomplete"
35
- placeholder="888888"
36
- size="large"
37
- type="password"
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" htmlType="submit" size="large" style="width: 100%;margin-top: 24px" 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, V4Login } 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 { positions } from '@vue2-client/mock/common'
64
- import { timeFix } from '@vue2-client/utils/util'
65
- import { loginStart } from '@vue2-client/base-client/plugins/compatible/LoginServiceOA'
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', 'compatible'])
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
- switch (this.compatible) {
90
- case 'V3': {
91
- login(name, password).then(this.afterLogin)
92
- break
93
- }
94
- case 'OA' : {
95
- loginStart(name, password).then(this.afterLoginOA).finally(() => { this.logging = false })
96
- break
97
- }
98
- case 'V4' : {
99
- V4Login(name, password).then(this.afterLoginV4)
100
- break
101
- }
102
- }
103
- }
104
- })
105
- },
106
- afterLoginOA (result) {
107
- // 默认第一个是旧OA地址
108
- result.functions[0].navigate = result.functions[0].link
109
- result.functions[0].link = null
110
- this.afterGeneral(result)
111
- this.setAccessToken(result.password)
112
- this.$router.push(this.homePage).catch(() => {})
113
- },
114
- afterLoginV4 (res) {
115
- const name = this.form.getFieldValue('name')
116
- const password = this.form.getFieldValue('password')
117
- this.logging = false
118
- const loginRes = res
119
- // 如果这是用户首次打开本系统,localStorage无法初始化,改用code判断
120
- let pass = false
121
- let V4Token = {}
122
- // 判断是否是第一次使用本系统
123
- if (res.code) {
124
- if (res.code === 200) {
125
- pass = true
126
- // 如果返回值有code,证明是第一次使用系统,localStorage判断compatible失效
127
- // token需要从.data中获取
128
- V4Token = { token: res.data.access_token, expire: res.data.expires_in }
129
- }
130
- } else {
131
- V4Token = { token: res.access_token, expire: res.expires_in }
132
- }
133
- this.setV4AccessToken(V4Token)
134
- // 向本地缓存中临时存储compatible
135
- if (loginRes.access_token || pass) {
136
- const encrypt = new JSEncrypt()
137
- encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
138
- const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
139
- // 获取路由配置
140
- getRoutesConfig(data).then(result => {
141
- this.$login.login(result).then(() => {
142
- this.afterGeneral(result)
143
- if (result.deps === '用户工单登记') {
144
- this.$router.push(this.ticketPage).catch(() => {})
145
- } else {
146
- this.$router.push(this.homePage).catch(() => {})
147
- }
148
- })
149
- })
150
- } else {
151
- this.error = loginRes.msg
152
- }
153
- },
154
- afterLogin (res) {
155
- const name = this.form.getFieldValue('name')
156
- const password = this.form.getFieldValue('password')
157
- this.logging = false
158
- const loginRes = res.states
159
- if (loginRes === '登录成功') {
160
- const encrypt = new JSEncrypt()
161
- encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
162
- const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
163
- // 获取路由配置
164
- getRoutesConfig(data).then(result => {
165
- this.$login.login(result).then(() => {
166
- // V3任何情况首位加入资源管理
167
- const resourceManageMain = {
168
- name: '资源管理',
169
- icon: 'api',
170
- position: 1,
171
- link: 'resourceManageMain'
172
- }
173
- result.functions.unshift(resourceManageMain)
174
- this.afterGeneral(result)
175
- this.setAccessToken(data)
176
- if (result.deps === '用户工单登记') {
177
- this.$router.push(this.ticketPage).catch(() => {})
178
- } else {
179
- this.$router.push(this.homePage).catch(() => {})
180
- }
181
- })
182
- })
183
- } else {
184
- this.error = loginRes
185
- }
186
- },
187
- afterGeneral (result) {
188
- const user = Object.assign({
189
- username: result.ename,
190
- name: result.name,
191
- avatar: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
192
- address: '西安市',
193
- position: positions[0]
194
- }, result)
195
- this.setUser(user)
196
- this.setPermissions([{ id: 'queryForm', operation: ['add', 'edit'] }])
197
- this.setRoles([{ id: 'admin', operation: ['add', 'edit', 'delete'] }])
198
- loadRoutes(funcToRouter(user.functions))
199
- this.$message.success(timeFix().CN + `,${result.name} 欢迎回来`, 3)
200
- },
201
- setAccessToken (data) {
202
- if (data) {
203
- localStorage.setItem(ACCESS_TOKEN, data)
204
- let timestamp = new Date().getTime()// 当前的时间戳
205
- timestamp = timestamp + 12 * 60 * 60 * 1000
206
- // 格式化时间获取年月日, 登陆过期时间
207
- const dateAfter = new Date(timestamp)
208
- setAuthorization({ token: data, expireAt: dateAfter })
209
- }
210
- },
211
- setV4AccessToken (data) {
212
- if (data.token) {
213
- localStorage.setItem(ACCESS_TOKEN, data.token)
214
- setAuthorization({ token: data.token, expire: data.expire })
215
- }
216
- }
217
- }
218
- }
219
- </script>
220
-
221
- <style lang="less" scoped>
222
- .common-layout{
223
- .top {
224
- text-align: center;
225
- .header {
226
- height: 44px;
227
- line-height: 44px;
228
- a {
229
- text-decoration: none;
230
- }
231
- .logo {
232
- height: 44px;
233
- vertical-align: top;
234
- margin-right: 16px;
235
- }
236
- .title {
237
- font-size: 33px;
238
- color: @title-color;
239
- font-family: 'Myriad Pro', 'Helvetica Neue', Arial, Helvetica, sans-serif;
240
- font-weight: 600;
241
- position: relative;
242
- top: 2px;
243
- }
244
- }
245
- .desc {
246
- font-size: 14px;
247
- color: @text-color-second;
248
- margin-top: 12px;
249
- margin-bottom: 40px;
250
- }
251
- }
252
- .login{
253
- width: 368px;
254
- margin: 0 auto;
255
- @media screen and (max-width: 576px) {
256
- width: 95%;
257
- }
258
- @media screen and (max-width: 320px) {
259
- .captcha-button{
260
- font-size: 14px;
261
- }
262
- }
263
- .icon {
264
- font-size: 24px;
265
- color: @text-color-second;
266
- margin-left: 16px;
267
- vertical-align: middle;
268
- cursor: pointer;
269
- transition: color 0.3s;
270
-
271
- &:hover {
272
- color: @primary-color;
273
- }
274
- }
275
- }
276
- }
277
- </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 :form="form" @submit="onSubmit">
12
+ <a-tabs :tabBarStyle="{textAlign: 'center'}" size="large" style="padding: 0 2px;">
13
+ <a-tab-pane key="1" tab="账户密码登录">
14
+ <a-alert
15
+ v-show="error"
16
+ :closable="true"
17
+ :message="error"
18
+ showIcon
19
+ style="margin-bottom: 24px;"
20
+ type="error" />
21
+ <a-form-item>
22
+ <a-input
23
+ v-decorator="['name', {rules: [{ required: true, message: '请输入账户名', whitespace: true}]}]"
24
+ autocomplete="autocomplete"
25
+ placeholder="admin"
26
+ size="large"
27
+ >
28
+ <a-icon slot="prefix" type="user" />
29
+ </a-input>
30
+ </a-form-item>
31
+ <a-form-item>
32
+ <a-input
33
+ v-decorator="['password', {rules: [{ required: true, message: '请输入密码', whitespace: true}]}]"
34
+ autocomplete="autocomplete"
35
+ placeholder="888888"
36
+ size="large"
37
+ type="password"
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" htmlType="submit" size="large" style="width: 100%;margin-top: 24px" 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, V4Login } 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 { positions } from '@vue2-client/mock/common'
64
+ import { timeFix } from '@vue2-client/utils/util'
65
+ import { loginStart } from '@vue2-client/base-client/plugins/compatible/LoginServiceOA'
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', 'compatible'])
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
+ switch (this.compatible) {
90
+ case 'V3': {
91
+ login(name, password).then(this.afterLogin)
92
+ break
93
+ }
94
+ case 'OA' : {
95
+ loginStart(name, password).then(this.afterLoginOA).finally(() => { this.logging = false })
96
+ break
97
+ }
98
+ case 'V4' : {
99
+ V4Login(name, password).then(this.afterLoginV4)
100
+ break
101
+ }
102
+ }
103
+ }
104
+ })
105
+ },
106
+ afterLoginOA (result) {
107
+ // 默认第一个是旧OA地址
108
+ result.functions[0].navigate = result.functions[0].link
109
+ result.functions[0].link = null
110
+ this.afterGeneral(result)
111
+ this.setAccessToken(result.password)
112
+ this.$router.push(this.homePage).catch(() => {})
113
+ },
114
+ afterLoginV4 (res) {
115
+ const name = this.form.getFieldValue('name')
116
+ const password = this.form.getFieldValue('password')
117
+ this.logging = false
118
+ const loginRes = res
119
+ // 如果这是用户首次打开本系统,localStorage无法初始化,改用code判断
120
+ let pass = false
121
+ let V4Token = {}
122
+ // 判断是否是第一次使用本系统
123
+ if (res.code) {
124
+ if (res.code === 200) {
125
+ pass = true
126
+ // 如果返回值有code,证明是第一次使用系统,localStorage判断compatible失效
127
+ // token需要从.data中获取
128
+ V4Token = { token: res.data.access_token, expire: res.data.expires_in }
129
+ }
130
+ } else {
131
+ V4Token = { token: res.access_token, expire: res.expires_in }
132
+ }
133
+ this.setV4AccessToken(V4Token)
134
+ // 向本地缓存中临时存储compatible
135
+ if (loginRes.access_token || pass) {
136
+ const encrypt = new JSEncrypt()
137
+ encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
138
+ const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
139
+ // 获取路由配置
140
+ getRoutesConfig(data).then(result => {
141
+ this.$login.login(result).then(() => {
142
+ this.afterGeneral(result)
143
+ if (result.deps === '用户工单登记') {
144
+ this.$router.push(this.ticketPage).catch(() => {})
145
+ } else {
146
+ this.$router.push(this.homePage).catch(() => {})
147
+ }
148
+ })
149
+ })
150
+ } else {
151
+ this.error = loginRes.msg
152
+ }
153
+ },
154
+ afterLogin (res) {
155
+ const name = this.form.getFieldValue('name')
156
+ const password = this.form.getFieldValue('password')
157
+ this.logging = false
158
+ const loginRes = res.states
159
+ if (loginRes === '登录成功') {
160
+ const encrypt = new JSEncrypt()
161
+ encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
162
+ const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
163
+ // 获取路由配置
164
+ getRoutesConfig(data).then(result => {
165
+ this.$login.login(result).then(() => {
166
+ // V3任何情况首位加入资源管理
167
+ const resourceManageMain = {
168
+ name: '资源管理',
169
+ icon: 'api',
170
+ position: 1,
171
+ link: 'resourceManageMain'
172
+ }
173
+ result.functions.unshift(resourceManageMain)
174
+ this.afterGeneral(result)
175
+ this.setAccessToken(data)
176
+ if (result.deps === '用户工单登记') {
177
+ this.$router.push(this.ticketPage).catch(() => {})
178
+ } else {
179
+ this.$router.push(this.homePage).catch(() => {})
180
+ }
181
+ })
182
+ })
183
+ } else {
184
+ this.error = loginRes
185
+ }
186
+ },
187
+ afterGeneral (result) {
188
+ const user = Object.assign({
189
+ username: result.ename,
190
+ name: result.name,
191
+ avatar: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
192
+ address: '西安市',
193
+ position: positions[0]
194
+ }, result)
195
+ this.setUser(user)
196
+ this.setPermissions([{ id: 'queryForm', operation: ['add', 'edit'] }])
197
+ this.setRoles([{ id: 'admin', operation: ['add', 'edit', 'delete'] }])
198
+ loadRoutes(funcToRouter(user.functions))
199
+ this.$message.success(timeFix().CN + `,${result.name} 欢迎回来`, 3)
200
+ },
201
+ setAccessToken (data) {
202
+ if (data) {
203
+ localStorage.setItem(ACCESS_TOKEN, data)
204
+ let timestamp = new Date().getTime()// 当前的时间戳
205
+ timestamp = timestamp + 12 * 60 * 60 * 1000
206
+ // 格式化时间获取年月日, 登陆过期时间
207
+ const dateAfter = new Date(timestamp)
208
+ setAuthorization({ token: data, expireAt: dateAfter })
209
+ }
210
+ },
211
+ setV4AccessToken (data) {
212
+ if (data.token) {
213
+ localStorage.setItem(ACCESS_TOKEN, data.token)
214
+ setAuthorization({ token: data.token, expire: data.expire })
215
+ }
216
+ }
217
+ }
218
+ }
219
+ </script>
220
+
221
+ <style lang="less" scoped>
222
+ .common-layout{
223
+ .top {
224
+ text-align: center;
225
+ .header {
226
+ height: 44px;
227
+ line-height: 44px;
228
+ a {
229
+ text-decoration: none;
230
+ }
231
+ .logo {
232
+ height: 44px;
233
+ vertical-align: top;
234
+ margin-right: 16px;
235
+ }
236
+ .title {
237
+ font-size: 33px;
238
+ color: @title-color;
239
+ font-family: 'Myriad Pro', 'Helvetica Neue', Arial, Helvetica, sans-serif;
240
+ font-weight: 600;
241
+ position: relative;
242
+ top: 2px;
243
+ }
244
+ }
245
+ .desc {
246
+ font-size: 14px;
247
+ color: @text-color-second;
248
+ margin-top: 12px;
249
+ margin-bottom: 40px;
250
+ }
251
+ }
252
+ .login{
253
+ width: 368px;
254
+ margin: 0 auto;
255
+ @media screen and (max-width: 576px) {
256
+ width: 95%;
257
+ }
258
+ @media screen and (max-width: 320px) {
259
+ .captcha-button{
260
+ font-size: 14px;
261
+ }
262
+ }
263
+ .icon {
264
+ font-size: 24px;
265
+ color: @text-color-second;
266
+ margin-left: 16px;
267
+ vertical-align: middle;
268
+ cursor: pointer;
269
+ transition: color 0.3s;
270
+
271
+ &:hover {
272
+ color: @primary-color;
273
+ }
274
+ }
275
+ }
276
+ }
277
+ </style>