system-clients 3.2.1-9 → 3.2.1-aodeToV4

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