system-clients 3.1.90-aode → 3.1.90-xianyang

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 (134) hide show
  1. package/SystemClient.iml +1 -1
  2. package/build/webpack.base.conf.js +1 -4
  3. package/package.json +2 -2
  4. package/src/components/Main.vue +547 -508
  5. package/src/components/equipment/EquipmentManage.vue +3 -0
  6. package/src/components/equipment/PcAdd.vue +5 -5
  7. package/src/components/equipment/PcList.vue +5 -5
  8. package/src/components/equipment/PhoneAdd.vue +4 -4
  9. package/src/components/equipment/PhoneList.vue +4 -4
  10. package/src/components/equipment/PosAdd.vue +205 -43
  11. package/src/components/equipment/PosList.vue +153 -63
  12. package/src/components/equipment/PosManage.vue +92 -9
  13. package/src/components/equipment/QCAdd.vue +333 -0
  14. package/src/components/equipment/QCList.vue +230 -0
  15. package/src/components/equipment/QCManage.vue +150 -0
  16. package/src/components/server/Login.vue +642 -711
  17. package/src/components/server/ModifyPw.vue +4 -5
  18. package/src/components/server/ResSelect.vue +5 -1
  19. package/src/components/server/ResSelectGroup.vue +1 -1
  20. package/src/components/server/RightTree.vue +314 -343
  21. package/src/plugins/EncryptUtil.js +53 -0
  22. package/src/plugins/GetLoginInfoService.js +517 -514
  23. package/src/plugins/validation.js +1 -1
  24. package/src/system.js +7 -1
  25. package/.gradle/3.5/file-changes/last-build.bin +0 -0
  26. package/.gradle/3.5/taskHistory/taskHistory.lock +0 -0
  27. package/.gradle/5.5/fileChanges/last-build.bin +0 -0
  28. package/.gradle/5.5/fileHashes/fileHashes.lock +0 -0
  29. package/.gradle/5.5/gc.properties +0 -0
  30. package/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  31. package/.gradle/buildOutputCleanup/cache.properties +0 -2
  32. package/.gradle/vcs-1/gc.properties +0 -0
  33. package/src/styles/fonts/PINGFANG LIGHT.TTF +0 -0
  34. package/src/styles/fonts/PingFangSC-Regular.ttf +0 -0
  35. package/src/styles/fonts/glyphicons-halflings-regular.eot +0 -0
  36. package/src/styles/fonts/glyphicons-halflings-regular.svg +0 -288
  37. package/src/styles/fonts/glyphicons-halflings-regular.ttf +0 -0
  38. package/src/styles/fonts/glyphicons-halflings-regular.woff +0 -0
  39. package/src/styles/fonts/glyphicons-halflings-regular.woff2 +0 -0
  40. package/src/styles/fonts/pingfang-bold.ttf +0 -0
  41. package/src/styles/fonts/pingfang-medium.ttf +0 -0
  42. package/src/styles/fonts/pingfang-regular.ttf +0 -0
  43. package/src/styles/fonts/trendstrends.ttf +0 -0
  44. package/src/styles/fonts//346/261/211/344/273/252/350/217/261/345/277/203/344/275/223/347/256/200.ttf +0 -0
  45. package/src/styles/less/.csscomb.json +0 -304
  46. package/src/styles/less/.csslintrc +0 -19
  47. package/src/styles/less/alerts.less +0 -73
  48. package/src/styles/less/aofeng/animate.min.css +0 -11
  49. package/src/styles/less/aofeng/expandcss.less +0 -569
  50. package/src/styles/less/aofeng/standard.less +0 -2121
  51. package/src/styles/less/aofeng/themeOne/BinaryTemplate.less +0 -686
  52. package/src/styles/less/aofeng/themeOne/loginStyle.less +0 -1586
  53. package/src/styles/less/aofeng/themeOne/systemStyle.less +0 -2650
  54. package/src/styles/less/aofeng/themeOne.less +0 -17
  55. package/src/styles/less/aofeng/themeTwo/newStyle1.less +0 -415
  56. package/src/styles/less/aofeng/themeTwo.less +0 -3
  57. package/src/styles/less/badges.less +0 -66
  58. package/src/styles/less/bootstrap.less +0 -66
  59. package/src/styles/less/breadcrumbs.less +0 -26
  60. package/src/styles/less/button-groups.less +0 -247
  61. package/src/styles/less/buttons.less +0 -172
  62. package/src/styles/less/carousel.less +0 -269
  63. package/src/styles/less/close.less +0 -34
  64. package/src/styles/less/code.less +0 -69
  65. package/src/styles/less/component-animations.less +0 -33
  66. package/src/styles/less/dropdowns.less +0 -216
  67. package/src/styles/less/fonts-list.less +0 -25
  68. package/src/styles/less/forms.less +0 -626
  69. package/src/styles/less/glyphicons.less +0 -305
  70. package/src/styles/less/grid.less +0 -84
  71. package/src/styles/less/input-groups.less +0 -167
  72. package/src/styles/less/jumbotron.less +0 -52
  73. package/src/styles/less/labels.less +0 -64
  74. package/src/styles/less/list-group.less +0 -141
  75. package/src/styles/less/manageStyle/manageChile.less +0 -180
  76. package/src/styles/less/manageStyle/manageStyle.less +0 -1102
  77. package/src/styles/less/manageStyle/safeStyle.less +0 -498
  78. package/src/styles/less/media.less +0 -66
  79. package/src/styles/less/mixins/alerts.less +0 -14
  80. package/src/styles/less/mixins/background-variant.less +0 -9
  81. package/src/styles/less/mixins/border-radius.less +0 -18
  82. package/src/styles/less/mixins/buttons.less +0 -69
  83. package/src/styles/less/mixins/center-block.less +0 -7
  84. package/src/styles/less/mixins/clearfix.less +0 -22
  85. package/src/styles/less/mixins/forms.less +0 -90
  86. package/src/styles/less/mixins/gradients.less +0 -59
  87. package/src/styles/less/mixins/grid-framework.less +0 -92
  88. package/src/styles/less/mixins/grid.less +0 -122
  89. package/src/styles/less/mixins/hide-text.less +0 -21
  90. package/src/styles/less/mixins/image.less +0 -33
  91. package/src/styles/less/mixins/labels.less +0 -12
  92. package/src/styles/less/mixins/list-group.less +0 -30
  93. package/src/styles/less/mixins/nav-divider.less +0 -10
  94. package/src/styles/less/mixins/nav-vertical-align.less +0 -9
  95. package/src/styles/less/mixins/opacity.less +0 -8
  96. package/src/styles/less/mixins/pagination.less +0 -24
  97. package/src/styles/less/mixins/panels.less +0 -24
  98. package/src/styles/less/mixins/progress-bar.less +0 -10
  99. package/src/styles/less/mixins/reset-filter.less +0 -8
  100. package/src/styles/less/mixins/reset-text.less +0 -18
  101. package/src/styles/less/mixins/resize.less +0 -6
  102. package/src/styles/less/mixins/responsive-visibility.less +0 -15
  103. package/src/styles/less/mixins/size.less +0 -10
  104. package/src/styles/less/mixins/tab-focus.less +0 -9
  105. package/src/styles/less/mixins/table-row.less +0 -44
  106. package/src/styles/less/mixins/text-emphasis.less +0 -9
  107. package/src/styles/less/mixins/text-overflow.less +0 -8
  108. package/src/styles/less/mixins/vendor-prefixes.less +0 -227
  109. package/src/styles/less/mixins.less +0 -40
  110. package/src/styles/less/modals.less +0 -151
  111. package/src/styles/less/navbar.less +0 -660
  112. package/src/styles/less/navs.less +0 -285
  113. package/src/styles/less/normalize.less +0 -424
  114. package/src/styles/less/pager.less +0 -76
  115. package/src/styles/less/pagination.less +0 -89
  116. package/src/styles/less/panels.less +0 -275
  117. package/src/styles/less/popovers.less +0 -131
  118. package/src/styles/less/print.less +0 -101
  119. package/src/styles/less/progress-bars.less +0 -87
  120. package/src/styles/less/responsive-embed.less +0 -35
  121. package/src/styles/less/responsive-utilities.less +0 -194
  122. package/src/styles/less/scaffolding.less +0 -161
  123. package/src/styles/less/stand.less +0 -207
  124. package/src/styles/less/tables.less +0 -262
  125. package/src/styles/less/theme.less +0 -291
  126. package/src/styles/less/thumbnails.less +0 -36
  127. package/src/styles/less/tooltip.less +0 -102
  128. package/src/styles/less/type.less +0 -303
  129. package/src/styles/less/utilities.less +0 -55
  130. package/src/styles/less/variables.less +0 -896
  131. package/src/styles/less/wells.less +0 -29
  132. package/static/aodelogo.png +0 -0
  133. package/static/aodenewlogo.png +0 -0
  134. package/static/logo.png +0 -0
@@ -1,514 +1,517 @@
1
- import Vue from 'vue'
2
- import JSEncrypt from 'jsencrypt'
3
- import {HttpResetClass} from 'vue-client'
4
-
5
- let loginGen = async function (name, password) {
6
- let data = {name: name, password: password}
7
- // rsa加密
8
- let encrypt = new JSEncrypt();
9
- encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB');
10
- console.log(data)
11
-
12
- let getLogin = await Vue.resetpost('/rs/logic/getLogin', data, {resolveMsg: null, rejectMsg: null}, 'RSA')
13
- if (getLogin.data.states === '登录成功') {
14
- // 调用远程登录服务,获取所有有权访问的功能
15
- data = {username: name, password: password}
16
- data = encrypt.encrypt(JSON.stringify(data))
17
- let resource = await Vue.resetpost(`/rs/user/userLogin/客服系统`, data, {
18
- resolveMsg: null,
19
- rejectMsg: null
20
- })
21
- console.log('登陆获取Util', JSON.stringify(resource.data))
22
- Vue.$login.f = resource.data
23
- //获取jwt
24
- Vue.$login.jwt = getLogin.data.jwt
25
- // 把登录用户添加到cookie里
26
- Vue.cookie.set('loginId', Vue.$login.f.id)
27
-
28
- try {
29
- //获取有权限的功能树
30
- let hasRight = await Vue.resetpost(`/rs/search`, {
31
- source: "tool.getFullTree(this.getRights().where(row.getType() == $function$))",
32
- userid: Vue.$login.f.id
33
- },
34
- {
35
- resolveMsg: null,
36
- rejectMsg: null
37
- })
38
- console.log('有权限功能返回数据', JSON.stringify(hasRight.data))
39
- //准备替换功能树
40
- var fun=[]
41
- hasRight.data[0].children[0].children.forEach((item) => {
42
- if(item.name=='客服系统'){
43
- item.children.forEach((item1) => {
44
- fun.push(item1)
45
- })
46
- }
47
- })
48
- // console.log('替换前', JSON.stringify(Vue.$login.f.functions))
49
- // console.log('替换后', JSON.stringify(fun))
50
- Vue.$login.f.functions=fun
51
- }catch (error) {
52
- }
53
- if (Vue.$login.f.id !== '11') {
54
- try {
55
- let getAllArea = await Vue.resetpost('/rs/search', {
56
- source: 'this.getParentByType($organization$).getChildByName($片区$).getChildren()',
57
- userid: Vue.$login.f.id
58
- }, {resolveMsg: null, rejectMsg: null})
59
-
60
- let areaTemp = []
61
- for (let i = 0; i < getAllArea.data.length; i++) {
62
- areaTemp.push({label: getAllArea.data[i].name, value: getAllArea.data[i]})
63
- }
64
- Vue.$login.f.f_allArea = areaTemp
65
- }catch (error) {
66
- Vue.$login.f.f_allArea =[]
67
- console.log('获取区县',error)
68
- }
69
- // 获取抄表员
70
- try {
71
- let getGasman = await Vue.resetpost('/rs/search', {
72
- source: 'this.getParentByType($organization$).getChildByName($抄表员$).getUsers()',
73
- userid: Vue.$login.f.id
74
- }, {resolveMsg: null, rejectMsg: null})
75
- let gasman = []
76
- for (let i = 0; i < getGasman.data.length; i++) {
77
- gasman.push(getGasman.data[i])
78
- }
79
- Vue.$login.f.f_gasman = gasman
80
- }catch (error) {
81
- Vue.$login.f.f_gasman = []
82
- console.log('抄表员模块',error)
83
- }
84
- // // 获取安装人
85
- // try {
86
- // let getInstallman = await Vue.resetpost('/rs/search', {
87
- // source: 'this.getParentByType($organization$).getChildByName($安装员$).getUsers()',
88
- // userid: Vue.$login.f.id
89
- // }, {resolveMsg: null, rejectMsg: null})
90
- // console.log('获取安装员', getInstallman)
91
- // let installman = []
92
- // for (let i = 0; i < getInstallman.data.length; i++) {
93
- // installman.push(getInstallman.data[i])
94
- // }
95
- // Vue.$login.f.f_installman = installman
96
- // }catch (error) {
97
- // Vue.$login.f.f_installman =[]
98
- // console.log('安装人模块',error)
99
- // }
100
- // 获取换表员
101
- // try {
102
- // let getChangeMeterman = await Vue.resetpost('/rs/search', {
103
- // source: 'this.getParentByType($organization$).getChildByName($换表员$).getUsers()',
104
- // userid: Vue.$login.f.id
105
- // }, {resolveMsg: null, rejectMsg: null})
106
- // let changemeterman = []
107
- // for (let i = 0; i < getChangeMeterman.data.length; i++) {
108
- // changemeterman.push(getChangeMeterman.data[i])
109
- // }
110
- // Vue.$login.f.f_changemeterman = changemeterman
111
- // }catch (error) {
112
- // Vue.$login.f.f_changemeterman = []
113
- // console.log('换表员模块',error)
114
- // }
115
- // 获取资源服务权限
116
- try {
117
- let getLic = await Vue.resetpost('/rs/search', {data: {
118
- source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($资源操作$) != -1)',
119
- userid: Vue.$login.f.id
120
- }}, {resolveMsg: null, rejectMsg: null})
121
- let arry=[]
122
- getLic.data.forEach((item) => {
123
- arry.push(item.name)
124
- })
125
- Vue.$login.f.lics=arry
126
- }catch (error) {
127
- Vue.$login.f.f_gasman = []
128
- console.log('资源服务权限',error)
129
- }
130
- // // 票据使用人
131
- // try {
132
- // let getPaperUseman = await Vue.resetpost('/rs/search', {
133
- // source: 'this.getParentByType($organization$).getChildByName($票据使用人$).getUsers()',
134
- // userid: Vue.$login.f.id
135
- // }, {resolveMsg: null, rejectMsg: null})
136
- // let perperuseman = []
137
- // for (let i = 0; i < getPaperUseman.data.length; i++) {
138
- // perperuseman.push(getPaperUseman.data[i])
139
- // }
140
- // Vue.$login.f.f_paperUseman = perperuseman
141
- // }catch (error) {
142
- // Vue.$login.f.f_paperUseman = []
143
- // console.log('票据使用人模块',error)
144
- //
145
- // }
146
- // // 票据分配人
147
- // try {
148
- // let getPaperAllotman = await Vue.resetpost('/rs/search', {
149
- // source: 'this.getParentByType($organization$).getChildByName($票据分配人$).getUsers()',
150
- // userid: Vue.$login.f.id
151
- // }, {resolveMsg: null, rejectMsg: null})
152
- // let paperallotman = []
153
- // for (let i = 0; i < getPaperAllotman.data.length; i++) {
154
- // paperallotman.push(getPaperAllotman.data[i])
155
- // }
156
- // Vue.$login.f.f_paperAllotman = paperallotman
157
- // }catch (error) {
158
- // Vue.$login.f.f_paperAllotman = []
159
- // console.log('票据分配人模块',error)
160
- // }
161
- // TODO 处理界面细节
162
- try {
163
- let viewDetails = await Vue.resetpost('rs/search', {
164
- source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($功能权限$) != -1)',
165
- userid: Vue.$login.f.id
166
- }, {resolveMsg: null, rejectMsg: null})
167
- let r = viewDetails.data
168
- Vue.$login.r = []
169
- r.forEach(x => Vue.$login.r.push(x.name))
170
- }catch (error) {
171
- Vue.$login.r = []
172
- console.log('加载模块失败',error)
173
- }
174
- // 调用登录后处理
175
- for(let proc of Vue.$login.afterLogin) {
176
- await proc(Vue.$login.f)
177
- }
178
- // 定时发送心跳
179
- setInterval(()=> {
180
- let http = new HttpResetClass()
181
- //暂时不出现不出现异地登录校验
182
- http.load('POST', `rs/user/access/${Vue.$login.f.id}`, {}, {resolveMsg: null, rejectMsg: null}).then((req) => {
183
- if(req.data.status==710){
184
- Vue.showMessage(req.data.msg+",您将被强制退出系统", ['confirm']).then((res) => {
185
- if (res === 'confirm') {
186
- location.reload()
187
- }
188
- })
189
- }
190
- })
191
- }, 2 * 60 * 1000)
192
- }
193
-
194
- } else {
195
- let error = {status: 401, data: getLogin.data.states}
196
- // 抛出错误
197
- throw error
198
- }
199
- }
200
-
201
- let GetLoginInfoService = {
202
- // 登录后要处理的异步对象
203
- afterLogin: [],
204
- //验证码开关
205
- Verification: true,
206
- install (Vue, options) {
207
- // 给vue增添对话框显示方法
208
- Vue.$login = Vue.prototype.$login = GetLoginInfoService
209
- },
210
-
211
- f: {
212
-
213
- },
214
-
215
- /**
216
- * 登录
217
- * @param name
218
- * @param password
219
- */
220
- login (name, password) {
221
- return loginGen(name, password)
222
- },
223
-
224
- convertToIn (val) {
225
- let temp = ''
226
- if (val instanceof Array) {
227
- if (val.length >= 1) {
228
- temp = '('
229
- val.forEach((res) => {
230
- temp += `'${res}',`
231
- })
232
- temp = temp.substr(0, temp.length - 1) + ')'
233
- }
234
- }
235
- return temp
236
- },
237
-
238
- toStandardYearMonth () {
239
- let dt = new Date()
240
- let month = dt.getMonth() + 1
241
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month)
242
- },
243
-
244
- toStandardYearMonth1 () {
245
- let dt = new Date()
246
- let month = dt.getMonth() + 1
247
- return dt.getFullYear() + (month < 10 ? '0' + month : month)
248
- },
249
-
250
- toStandardDateString () {
251
- let dt = new Date()
252
- let month = dt.getMonth() + 1
253
- let date = dt.getDate()
254
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
255
- },
256
-
257
- toStartAndEndDateString () {
258
- let dt = new Date()
259
- let month = dt.getMonth() + 1
260
- // let date = dt.getDate()
261
- return [dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-01',
262
- dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (new Date(dt.getFullYear(), month, 0).getDate())]
263
- // return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
264
- },
265
-
266
- toStandardTimeString () {
267
- let dt = new Date()
268
- let month = dt.getMonth() + 1
269
- let date = dt.getDate()
270
- let hour = dt.getHours()
271
- let min = dt.getMinutes()
272
- let sec = dt.getSeconds()
273
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date) +
274
- ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
275
- },
276
-
277
- guid () {
278
- let buf = new Uint16Array(8)
279
- window.crypto.getRandomValues(buf)
280
- let S4 = function (num) {
281
- let ret = num.toString(16)
282
- while (ret.length < 4) {
283
- ret = '0' + ret
284
- }
285
- return ret
286
- }
287
- return (S4(buf[0]) + S4(buf[1]) + S4(buf[2]) + S4(buf[3]) + S4(buf[4]) + S4(buf[5]) + S4(buf[6]) + S4(buf[7]))
288
- },
289
-
290
- choices (role, param, hasBlank = false, blankHint = '请选择') {
291
- if (role == 'view') {
292
- Vue.getParams(param, [null])
293
- } else {
294
- let result = []
295
- if (hasBlank)
296
- result.push({label: blankHint, value: null})
297
- if (!Vue.param || !Vue.param[param])
298
- result.push({label: '请在系统设置里更新参数', value: '请在系统设置里更新参数'})
299
- else {
300
- let p = Vue.param[param]
301
- p.forEach(function (item) {
302
- result.push({label: item.name, value: item.name})
303
- })
304
- }
305
- return result
306
- }
307
- },
308
-
309
- required (param) {
310
- if (typeof param === 'number' && param == 0)
311
- return false
312
- if (!param)
313
- return true
314
- param = param + ''
315
- param = param.trim()
316
- if (!param)
317
- return true
318
- return false
319
- },
320
-
321
- isInt (n) {
322
- return !window.isNaN(n) && n % 1 === 0
323
- },
324
-
325
- isFloat (n) {
326
- return !window.isNaN(n)
327
- },
328
-
329
- // this will convert all true/false to boolean
330
- booleanFilter (paper) {
331
- for (let key in paper) {
332
- if (!paper.hasOwnProperty(key))
333
- continue
334
- if (typeof paper[key] == 'object' && paper[key] != null) {
335
- booleanFilter(paper[key])
336
- } else {
337
- if (paper[key] === 'true' || paper[key] == 'false')
338
- paper[key] = (paper[key] === 'true')
339
- }
340
- }
341
- },
342
- // recursively traverse through each path
343
- ratifyPics (paper) {
344
- for (let key in paper) {
345
- if (key.endsWith('_path')) {
346
- if (!paper[key]) {
347
- paper[key] = 'rs/db/file/nopic.png'
348
- } else {
349
- paper[key] = 'rs/db/file/' + paper[key]
350
- }
351
- } else if (paper[key] !== null && typeof (paper[key]) == 'object') {
352
- ratifyPics(paper[key])
353
- }
354
- }
355
- },
356
-
357
- // load script and other stuff
358
- loadscript (type, fileName) {
359
- return new Promise((resolve, reject) => {
360
- let element
361
- if (type == 'css') {
362
- element = document.createElement('link')
363
- element.setAttribute('rel', 'stylesheet')
364
- element.setAttribute('type', 'text/css')
365
- element.setAttribute('href', fileName)
366
- } else if (type == 'js') {
367
- element = document.createElement('script')
368
- element.setAttribute('type', 'text/javascript')
369
- element.setAttribute('src', fileName)
370
- }
371
- if (element) {
372
- element.setAttribute('async', '')
373
- element.setAttribute('defer', '')
374
- element.addEventListener('load', function () {
375
- resolve(element)
376
- }, false)
377
- element.addEventListener('error', function () {
378
- reject(element)
379
- }, false)
380
- document.body.appendChild(element)
381
- }
382
- })
383
- },
384
- // 不能选择器中截取掉多余的字符
385
- orgName (name) {
386
- return name.substring(10)
387
- },
388
-
389
- getNowDate (name) {
390
- // 求取当前时间的工具
391
- let myweekday = ''
392
- let year = ''
393
- let mydate = new Date()
394
- myweekday = mydate.getDay()
395
- let mymonth = mydate.getMonth() + 1
396
- let myday = mydate.getDate()
397
- let myyear = mydate.getYear()
398
- year = (myyear > 200) ? myyear : 1900 + myyear
399
- let week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期日', '星期六']
400
- // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
401
- return year + '年' + mymonth + '月' + myday + '日 ' + week[myweekday]
402
- },
403
-
404
- addDate (date, days) {
405
- // 求取当前时间的工具
406
- let endDate = new Date(date)
407
- endDate = endDate.valueOf()
408
- endDate = endDate + days * 24 * 60 * 60 * 1000
409
- endDate = new Date(endDate)
410
- let month = endDate.getMonth() + 1
411
- let day = endDate.getDate()
412
- let hour = endDate.getHours()
413
- let min = endDate.getMinutes()
414
- let sec = endDate.getSeconds()
415
- return endDate.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day) +
416
- ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
417
- // return a
418
- },
419
-
420
- // 通过地址栏的参数获取参数内容
421
- getUrlParames (param) {
422
- var query = window.location.search
423
- var iLen = param.length
424
- var iStart = query.indexOf(param)
425
- if (iStart === -1) {
426
- return ''
427
- }
428
- iStart += iLen + 1
429
- var iEnd = query.indexOf('&', iStart)
430
- if (iEnd === -1) {
431
- return query.substring(iStart)
432
- }
433
- return query.substring(iStart, iEnd)
434
- },
435
-
436
- // 从地址栏获取加密的参数
437
- getUrlCompileParames (param) {
438
- let code = unescape(window.location.search.slice(1, window.location.search.length))
439
- let query = String.fromCharCode(code.charCodeAt(0) - code.length)
440
- for (var i = 1; i < code.length; i++) {
441
- query += String.fromCharCode(code.charCodeAt(i) - query.charCodeAt(i - 1))
442
- }
443
- let iLen = param.length
444
- let iStart = query.indexOf(param)
445
- if (iStart === -1) {
446
- return ''
447
- }
448
- iStart += iLen + 1
449
- let iEnd = query.indexOf('&', iStart)
450
- if (iEnd === -1) {
451
- return query.substring(iStart)
452
- }
453
- return query.substring(iStart, iEnd)
454
- },
455
-
456
- // 对字符串进行加密
457
- compileStr (code) {
458
- let c = String.fromCharCode(code.charCodeAt(0) + code.length)
459
- for (let i = 1; i < code.length; i++) {
460
- c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
461
- }
462
- return escape(c)
463
- },
464
- // 字符串进行解密
465
- uncompileStr (code) {
466
- code = unescape(code)
467
- let c = String.fromCharCode(code.charCodeAt(0) - code.length)
468
- for (var i = 1; i < code.length; i++) {
469
- c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1))
470
- }
471
- return c
472
- },
473
-
474
- dateDescripte (date) {
475
- let nowTime = new Date().getTime()
476
- let oldTime = new Date(date).getTime()
477
- let timeDiff = nowTime - oldTime
478
- // 规则说明
479
- // 小于等于2分钟为刚刚
480
- // 大于2分钟小于等于1小时为取整的分钟前(例如:35分钟前)
481
- // 大于1小时小于等于24小时为取整的小时前(例如:15小时前)
482
- // 大于24小时小于等于30天为取整的天前(例如:12天前)
483
- // 大于30天小于等于12月为取整的月前,月份统一为30天一月,不做额外处理(例如:3个月前)
484
- // 大于365取整的年前,(例如:2年前)
485
- let minute = 1000 * 60
486
- let hour = minute * 60
487
- let day = hour * 24
488
- let month = day * 30
489
- let year = month * 12
490
- let des = ''
491
- if (timeDiff <= minute * 2) {
492
- des = '刚刚'
493
- } else if (minute * 2 < timeDiff && timeDiff < hour) {
494
- des = `${Math.floor(timeDiff / minute)}分钟前`
495
- } else if (hour < timeDiff && timeDiff <= day) {
496
- des = `${Math.floor(timeDiff / hour)}小时前`
497
- } else if (day < timeDiff && timeDiff <= month) {
498
- des = `${Math.floor(timeDiff / day)}天前`
499
- } else if (month < timeDiff && timeDiff <= year) {
500
- des = `${Math.floor(timeDiff / month)}个月前`
501
- } else if (year < timeDiff) {
502
- des = `${Math.floor(timeDiff / year)}年前`
503
- }
504
- return des
505
- },
506
-
507
- nextMonth20 (date) {
508
- let ds = date.split('-')
509
- let nextMonth = ds[1] - 0 + 1
510
- return ds[0] + '-' + (nextMonth < 10 ? '0' + nextMonth : nextMonth) + '-20 00:00:00'
511
- }
512
- }
513
-
514
- export default GetLoginInfoService
1
+ import Vue from 'vue'
2
+ import JSEncrypt from 'jsencrypt'
3
+ import {HttpResetClass} from 'vue-client'
4
+ import cryptJS from './EncryptUtil'
5
+
6
+ let loginGen = async function (name, password) {
7
+ let data = {name: name, password: password}
8
+ // rsa加密
9
+ let encrypt = new JSEncrypt();
10
+ encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB');
11
+ console.log(data)
12
+
13
+ let getLogin = await Vue.resetpost('/rs/logic/getLogin', data, {resolveMsg: null, rejectMsg: null}, 'RSA')
14
+ if (getLogin.data.states === '登录成功') {
15
+ // 调用远程登录服务,获取所有有权访问的功能
16
+ data = {username: name, password: password}
17
+ data = encrypt.encrypt(JSON.stringify(data))
18
+ let resource = await Vue.resetpost(`/rs/user/userLogin/客服系统`, data, {
19
+ resolveMsg: null,
20
+ rejectMsg: null
21
+ })
22
+ console.log('登陆获取Util', JSON.stringify(resource.data))
23
+ Vue.$login.f = resource.data
24
+ //获取jwt
25
+ Vue.$login.jwt = getLogin.data.jwt
26
+ // 把登录用户添加到cookie
27
+ Vue.cookie.set('loginId', Vue.$login.f.id)
28
+
29
+ try {
30
+ //获取有权限的功能树
31
+ let hasRight = await Vue.resetpost(`/rs/search`, {
32
+ source: "tool.getFullTree(this.getRights().where(row.getType() == $function$))",
33
+ userid: Vue.$login.f.id
34
+ },
35
+ {
36
+ resolveMsg: null,
37
+ rejectMsg: null
38
+ })
39
+ console.log('有权限功能返回数据', JSON.stringify(hasRight.data))
40
+ //准备替换功能树
41
+ var fun=[]
42
+ hasRight.data[0].children[0].children.forEach((item) => {
43
+ if(item.name=='客服系统'){
44
+ item.children.forEach((item1) => {
45
+ fun.push(item1)
46
+ })
47
+ }
48
+ })
49
+ // console.log('替换前', JSON.stringify(Vue.$login.f.functions))
50
+ // console.log('替换后', JSON.stringify(fun))
51
+ Vue.$login.f.functions=fun
52
+ }catch (error) {
53
+ }
54
+ if (Vue.$login.f.id !== '11') {
55
+ try {
56
+ let getAllArea = await Vue.resetpost('/rs/search', {
57
+ source: 'this.getParentByType($organization$).getChildByName($片区$).getChildren()',
58
+ userid: Vue.$login.f.id
59
+ }, {resolveMsg: null, rejectMsg: null})
60
+
61
+ let areaTemp = []
62
+ for (let i = 0; i < getAllArea.data.length; i++) {
63
+ areaTemp.push({label: getAllArea.data[i].name, value: getAllArea.data[i]})
64
+ }
65
+ Vue.$login.f.f_allArea = areaTemp
66
+ }catch (error) {
67
+ Vue.$login.f.f_allArea =[]
68
+ console.log('获取区县',error)
69
+ }
70
+ // 获取抄表员
71
+ try {
72
+ let getGasman = await Vue.resetpost('/rs/search', {
73
+ source: 'this.getParentByType($organization$).getChildByName($抄表员$).getUsers()',
74
+ userid: Vue.$login.f.id
75
+ }, {resolveMsg: null, rejectMsg: null})
76
+ let gasman = []
77
+ for (let i = 0; i < getGasman.data.length; i++) {
78
+ gasman.push(getGasman.data[i])
79
+ }
80
+ Vue.$login.f.f_gasman = gasman
81
+ }catch (error) {
82
+ Vue.$login.f.f_gasman = []
83
+ console.log('抄表员模块',error)
84
+ }
85
+ // // 获取安装人
86
+ // try {
87
+ // let getInstallman = await Vue.resetpost('/rs/search', {
88
+ // source: 'this.getParentByType($organization$).getChildByName($安装员$).getUsers()',
89
+ // userid: Vue.$login.f.id
90
+ // }, {resolveMsg: null, rejectMsg: null})
91
+ // console.log('获取安装员', getInstallman)
92
+ // let installman = []
93
+ // for (let i = 0; i < getInstallman.data.length; i++) {
94
+ // installman.push(getInstallman.data[i])
95
+ // }
96
+ // Vue.$login.f.f_installman = installman
97
+ // }catch (error) {
98
+ // Vue.$login.f.f_installman =[]
99
+ // console.log('安装人模块',error)
100
+ // }
101
+ // 获取换表员
102
+ // try {
103
+ // let getChangeMeterman = await Vue.resetpost('/rs/search', {
104
+ // source: 'this.getParentByType($organization$).getChildByName($换表员$).getUsers()',
105
+ // userid: Vue.$login.f.id
106
+ // }, {resolveMsg: null, rejectMsg: null})
107
+ // let changemeterman = []
108
+ // for (let i = 0; i < getChangeMeterman.data.length; i++) {
109
+ // changemeterman.push(getChangeMeterman.data[i])
110
+ // }
111
+ // Vue.$login.f.f_changemeterman = changemeterman
112
+ // }catch (error) {
113
+ // Vue.$login.f.f_changemeterman = []
114
+ // console.log('换表员模块',error)
115
+ // }
116
+ // 获取资源服务权限
117
+ try {
118
+ let getLic = await Vue.resetpost('/rs/search', {data: {
119
+ source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($资源操作$) != -1)',
120
+ userid: Vue.$login.f.id
121
+ }}, {resolveMsg: null, rejectMsg: null})
122
+ let arry=[]
123
+ getLic.data.forEach((item) => {
124
+ arry.push(item.name)
125
+ })
126
+ Vue.$login.f.lics=arry
127
+ }catch (error) {
128
+ Vue.$login.f.f_gasman = []
129
+ console.log('资源服务权限',error)
130
+ }
131
+ // // 票据使用人
132
+ // try {
133
+ // let getPaperUseman = await Vue.resetpost('/rs/search', {
134
+ // source: 'this.getParentByType($organization$).getChildByName($票据使用人$).getUsers()',
135
+ // userid: Vue.$login.f.id
136
+ // }, {resolveMsg: null, rejectMsg: null})
137
+ // let perperuseman = []
138
+ // for (let i = 0; i < getPaperUseman.data.length; i++) {
139
+ // perperuseman.push(getPaperUseman.data[i])
140
+ // }
141
+ // Vue.$login.f.f_paperUseman = perperuseman
142
+ // }catch (error) {
143
+ // Vue.$login.f.f_paperUseman = []
144
+ // console.log('票据使用人模块',error)
145
+ //
146
+ // }
147
+ // // 票据分配人
148
+ // try {
149
+ // let getPaperAllotman = await Vue.resetpost('/rs/search', {
150
+ // source: 'this.getParentByType($organization$).getChildByName($票据分配人$).getUsers()',
151
+ // userid: Vue.$login.f.id
152
+ // }, {resolveMsg: null, rejectMsg: null})
153
+ // let paperallotman = []
154
+ // for (let i = 0; i < getPaperAllotman.data.length; i++) {
155
+ // paperallotman.push(getPaperAllotman.data[i])
156
+ // }
157
+ // Vue.$login.f.f_paperAllotman = paperallotman
158
+ // }catch (error) {
159
+ // Vue.$login.f.f_paperAllotman = []
160
+ // console.log('票据分配人模块',error)
161
+ // }
162
+ // TODO 处理界面细节
163
+ try {
164
+ let viewDetails = await Vue.resetpost('rs/search', {
165
+ source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($功能权限$) != -1)',
166
+ userid: Vue.$login.f.id
167
+ }, {resolveMsg: null, rejectMsg: null})
168
+ let r = viewDetails.data
169
+ Vue.$login.r = []
170
+ r.forEach(x => Vue.$login.r.push(x.name))
171
+ }catch (error) {
172
+ Vue.$login.r = []
173
+ console.log('加载模块失败',error)
174
+ }
175
+ // 调用登录后处理
176
+ for(let proc of Vue.$login.afterLogin) {
177
+ await proc(Vue.$login.f)
178
+ }
179
+ // 定时发送心跳
180
+ setInterval(()=> {
181
+ let http = new HttpResetClass()
182
+ //暂时不出现不出现异地登录校验
183
+ http.load('POST', `rs/user/access/${Vue.$login.f.id}`, {}, {resolveMsg: null, rejectMsg: null}).then((req) => {
184
+ //if(req.data.status==710){
185
+ // Vue.showMessage(req.data.msg+",您将被强制退出系统", ['confirm']).then((res) => {
186
+ // if (res === 'confirm') {
187
+ // location.reload()
188
+ // }
189
+ //})
190
+ //}
191
+ })
192
+ }, 2 * 60 * 1000)
193
+ }
194
+
195
+ } else {
196
+ let error = {status: 401, data: getLogin.data.states}
197
+ // 抛出错误
198
+ throw error
199
+ }
200
+ }
201
+
202
+ let GetLoginInfoService = {
203
+ // 登录后要处理的异步对象
204
+ afterLogin: [],
205
+ //验证码开关
206
+ Verification: true,
207
+ SinglePageToken: {},
208
+ install (Vue, options) {
209
+ // 给vue增添对话框显示方法
210
+ Vue.$login = Vue.prototype.$login = GetLoginInfoService
211
+ },
212
+
213
+ f: {
214
+
215
+ },
216
+
217
+ /**
218
+ * 登录
219
+ * @param name
220
+ * @param password
221
+ */
222
+ login (name, password) {
223
+ Vue.$login.SinglePageToken = cryptJS.AESEncrypt(JSON.stringify({name: name, password: password}), "3KMKqvgwR8ULbR8Z")
224
+ return loginGen(name, password)
225
+ },
226
+
227
+ convertToIn (val) {
228
+ let temp = ''
229
+ if (val instanceof Array) {
230
+ if (val.length >= 1) {
231
+ temp = '('
232
+ val.forEach((res) => {
233
+ temp += `'${res}',`
234
+ })
235
+ temp = temp.substr(0, temp.length - 1) + ')'
236
+ }
237
+ }
238
+ return temp
239
+ },
240
+
241
+ toStandardYearMonth () {
242
+ let dt = new Date()
243
+ let month = dt.getMonth() + 1
244
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month)
245
+ },
246
+
247
+ toStandardYearMonth1 () {
248
+ let dt = new Date()
249
+ let month = dt.getMonth() + 1
250
+ return dt.getFullYear() + (month < 10 ? '0' + month : month)
251
+ },
252
+
253
+ toStandardDateString () {
254
+ let dt = new Date()
255
+ let month = dt.getMonth() + 1
256
+ let date = dt.getDate()
257
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
258
+ },
259
+
260
+ toStartAndEndDateString () {
261
+ let dt = new Date()
262
+ let month = dt.getMonth() + 1
263
+ // let date = dt.getDate()
264
+ return [dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-01',
265
+ dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (new Date(dt.getFullYear(), month, 0).getDate())]
266
+ // return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
267
+ },
268
+
269
+ toStandardTimeString () {
270
+ let dt = new Date()
271
+ let month = dt.getMonth() + 1
272
+ let date = dt.getDate()
273
+ let hour = dt.getHours()
274
+ let min = dt.getMinutes()
275
+ let sec = dt.getSeconds()
276
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date) +
277
+ ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
278
+ },
279
+
280
+ guid () {
281
+ let buf = new Uint16Array(8)
282
+ window.crypto.getRandomValues(buf)
283
+ let S4 = function (num) {
284
+ let ret = num.toString(16)
285
+ while (ret.length < 4) {
286
+ ret = '0' + ret
287
+ }
288
+ return ret
289
+ }
290
+ return (S4(buf[0]) + S4(buf[1]) + S4(buf[2]) + S4(buf[3]) + S4(buf[4]) + S4(buf[5]) + S4(buf[6]) + S4(buf[7]))
291
+ },
292
+
293
+ choices (role, param, hasBlank = false, blankHint = '请选择') {
294
+ if (role == 'view') {
295
+ Vue.getParams(param, [null])
296
+ } else {
297
+ let result = []
298
+ if (hasBlank)
299
+ result.push({label: blankHint, value: null})
300
+ if (!Vue.param || !Vue.param[param])
301
+ result.push({label: '请在系统设置里更新参数', value: '请在系统设置里更新参数'})
302
+ else {
303
+ let p = Vue.param[param]
304
+ p.forEach(function (item) {
305
+ result.push({label: item.name, value: item.name})
306
+ })
307
+ }
308
+ return result
309
+ }
310
+ },
311
+
312
+ required (param) {
313
+ if (typeof param === 'number' && param == 0)
314
+ return false
315
+ if (!param)
316
+ return true
317
+ param = param + ''
318
+ param = param.trim()
319
+ if (!param)
320
+ return true
321
+ return false
322
+ },
323
+
324
+ isInt (n) {
325
+ return !window.isNaN(n) && n % 1 === 0
326
+ },
327
+
328
+ isFloat (n) {
329
+ return !window.isNaN(n)
330
+ },
331
+
332
+ // this will convert all true/false to boolean
333
+ booleanFilter (paper) {
334
+ for (let key in paper) {
335
+ if (!paper.hasOwnProperty(key))
336
+ continue
337
+ if (typeof paper[key] == 'object' && paper[key] != null) {
338
+ booleanFilter(paper[key])
339
+ } else {
340
+ if (paper[key] === 'true' || paper[key] == 'false')
341
+ paper[key] = (paper[key] === 'true')
342
+ }
343
+ }
344
+ },
345
+ // recursively traverse through each path
346
+ ratifyPics (paper) {
347
+ for (let key in paper) {
348
+ if (key.endsWith('_path')) {
349
+ if (!paper[key]) {
350
+ paper[key] = 'rs/db/file/nopic.png'
351
+ } else {
352
+ paper[key] = 'rs/db/file/' + paper[key]
353
+ }
354
+ } else if (paper[key] !== null && typeof (paper[key]) == 'object') {
355
+ ratifyPics(paper[key])
356
+ }
357
+ }
358
+ },
359
+
360
+ // load script and other stuff
361
+ loadscript (type, fileName) {
362
+ return new Promise((resolve, reject) => {
363
+ let element
364
+ if (type == 'css') {
365
+ element = document.createElement('link')
366
+ element.setAttribute('rel', 'stylesheet')
367
+ element.setAttribute('type', 'text/css')
368
+ element.setAttribute('href', fileName)
369
+ } else if (type == 'js') {
370
+ element = document.createElement('script')
371
+ element.setAttribute('type', 'text/javascript')
372
+ element.setAttribute('src', fileName)
373
+ }
374
+ if (element) {
375
+ element.setAttribute('async', '')
376
+ element.setAttribute('defer', '')
377
+ element.addEventListener('load', function () {
378
+ resolve(element)
379
+ }, false)
380
+ element.addEventListener('error', function () {
381
+ reject(element)
382
+ }, false)
383
+ document.body.appendChild(element)
384
+ }
385
+ })
386
+ },
387
+ // 不能选择器中截取掉多余的字符
388
+ orgName (name) {
389
+ return name.substring(10)
390
+ },
391
+
392
+ getNowDate (name) {
393
+ // 求取当前时间的工具
394
+ let myweekday = ''
395
+ let year = ''
396
+ let mydate = new Date()
397
+ myweekday = mydate.getDay()
398
+ let mymonth = mydate.getMonth() + 1
399
+ let myday = mydate.getDate()
400
+ let myyear = mydate.getYear()
401
+ year = (myyear > 200) ? myyear : 1900 + myyear
402
+ let week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期日', '星期六']
403
+ // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
404
+ return year + '年' + mymonth + '月' + myday + '日 ' + week[myweekday]
405
+ },
406
+
407
+ addDate (date, days) {
408
+ // 求取当前时间的工具
409
+ let endDate = new Date(date)
410
+ endDate = endDate.valueOf()
411
+ endDate = endDate + days * 24 * 60 * 60 * 1000
412
+ endDate = new Date(endDate)
413
+ let month = endDate.getMonth() + 1
414
+ let day = endDate.getDate()
415
+ let hour = endDate.getHours()
416
+ let min = endDate.getMinutes()
417
+ let sec = endDate.getSeconds()
418
+ return endDate.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day) +
419
+ ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
420
+ // return a
421
+ },
422
+
423
+ // 通过地址栏的参数获取参数内容
424
+ getUrlParames (param) {
425
+ var query = window.location.search
426
+ var iLen = param.length
427
+ var iStart = query.indexOf(param)
428
+ if (iStart === -1) {
429
+ return ''
430
+ }
431
+ iStart += iLen + 1
432
+ var iEnd = query.indexOf('&', iStart)
433
+ if (iEnd === -1) {
434
+ return query.substring(iStart)
435
+ }
436
+ return query.substring(iStart, iEnd)
437
+ },
438
+
439
+ // 从地址栏获取加密的参数
440
+ getUrlCompileParames (param) {
441
+ let code = unescape(window.location.search.slice(1, window.location.search.length))
442
+ let query = String.fromCharCode(code.charCodeAt(0) - code.length)
443
+ for (var i = 1; i < code.length; i++) {
444
+ query += String.fromCharCode(code.charCodeAt(i) - query.charCodeAt(i - 1))
445
+ }
446
+ let iLen = param.length
447
+ let iStart = query.indexOf(param)
448
+ if (iStart === -1) {
449
+ return ''
450
+ }
451
+ iStart += iLen + 1
452
+ let iEnd = query.indexOf('&', iStart)
453
+ if (iEnd === -1) {
454
+ return query.substring(iStart)
455
+ }
456
+ return query.substring(iStart, iEnd)
457
+ },
458
+
459
+ // 对字符串进行加密
460
+ compileStr (code) {
461
+ let c = String.fromCharCode(code.charCodeAt(0) + code.length)
462
+ for (let i = 1; i < code.length; i++) {
463
+ c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
464
+ }
465
+ return escape(c)
466
+ },
467
+ // 字符串进行解密
468
+ uncompileStr (code) {
469
+ code = unescape(code)
470
+ let c = String.fromCharCode(code.charCodeAt(0) - code.length)
471
+ for (var i = 1; i < code.length; i++) {
472
+ c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1))
473
+ }
474
+ return c
475
+ },
476
+
477
+ dateDescripte (date) {
478
+ let nowTime = new Date().getTime()
479
+ let oldTime = new Date(date).getTime()
480
+ let timeDiff = nowTime - oldTime
481
+ // 规则说明
482
+ // 小于等于2分钟为刚刚
483
+ // 大于2分钟小于等于1小时为取整的分钟前(例如:35分钟前)
484
+ // 大于1小时小于等于24小时为取整的小时前(例如:15小时前)
485
+ // 大于24小时小于等于30天为取整的天前(例如:12天前)
486
+ // 大于30天小于等于12月为取整的月前,月份统一为30天一月,不做额外处理(例如:3个月前)
487
+ // 大于365取整的年前,(例如:2年前)
488
+ let minute = 1000 * 60
489
+ let hour = minute * 60
490
+ let day = hour * 24
491
+ let month = day * 30
492
+ let year = month * 12
493
+ let des = ''
494
+ if (timeDiff <= minute * 2) {
495
+ des = '刚刚'
496
+ } else if (minute * 2 < timeDiff && timeDiff < hour) {
497
+ des = `${Math.floor(timeDiff / minute)}分钟前`
498
+ } else if (hour < timeDiff && timeDiff <= day) {
499
+ des = `${Math.floor(timeDiff / hour)}小时前`
500
+ } else if (day < timeDiff && timeDiff <= month) {
501
+ des = `${Math.floor(timeDiff / day)}天前`
502
+ } else if (month < timeDiff && timeDiff <= year) {
503
+ des = `${Math.floor(timeDiff / month)}个月前`
504
+ } else if (year < timeDiff) {
505
+ des = `${Math.floor(timeDiff / year)}年前`
506
+ }
507
+ return des
508
+ },
509
+
510
+ nextMonth20 (date) {
511
+ let ds = date.split('-')
512
+ let nextMonth = ds[1] - 0 + 1
513
+ return ds[0] + '-' + (nextMonth < 10 ? '0' + nextMonth : nextMonth) + '-20 00:00:00'
514
+ }
515
+ }
516
+
517
+ export default GetLoginInfoService