system-clients 3.2.63 → 3.2.64-wuhai

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