apply-clients 3.2.32 → 3.2.37

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 (37) hide show
  1. package/package.json +1 -1
  2. package/src/AndroidApp.vue +26 -26
  3. package/src/App.vue +20 -20
  4. package/src/apply.js +67 -67
  5. package/src/applyAndroid.js +24 -24
  6. package/src/components/Util.js +359 -359
  7. package/src/components/app_apply/AppOnetomany.vue +90 -90
  8. package/src/components/app_apply/AppServiceView.vue +664 -664
  9. package/src/components/app_apply/AppTakePic.vue +112 -112
  10. package/src/components/app_apply/Process/AppExplorationUser.vue +310 -310
  11. package/src/components/app_apply/Process/AppServiceControl.vue +409 -409
  12. package/src/components/app_apply/Process/Processes/AppInstallationDetails.vue +456 -456
  13. package/src/components/app_apply/Supervisory/AppProcessSupervisory.vue +300 -300
  14. package/src/components/app_apply/Supervisory/AppSupervisoryCart.vue +121 -121
  15. package/src/components/product/ApplyCharge/ApplyChargeList.vue +251 -251
  16. package/src/components/product/ApplyCharge/ApplyChargeReport.vue +107 -107
  17. package/src/components/product/ApplyCharge/ApplyChargeSearch.vue +30 -30
  18. package/src/components/product/Function/InstallFunction.vue +147 -147
  19. package/src/components/product/Function/InstallInfoSelect.vue +281 -281
  20. package/src/components/product/Function/Service/FunctionServiceControl.vue +245 -245
  21. package/src/components/product/Function/StopApplyCrrdList.vue +176 -176
  22. package/src/components/product/Function/functions/StopInstall.vue +106 -106
  23. package/src/components/product/Process/ExplorationSelect.vue +346 -346
  24. package/src/components/product/Process/ExplorationUser.vue +134 -134
  25. package/src/components/product/Process/Processes/InstallationDetails.vue +243 -233
  26. package/src/components/product/Process/Processes/addressAndUserinfoManagement.vue +201 -201
  27. package/src/components/product/Process/Processes/chargeManagement.vue +555 -555
  28. package/src/components/product/Process/Processes/printCharge.vue +133 -133
  29. package/src/components/product/Process/Processes/supplementalAgreement.vue +297 -297
  30. package/src/components/product/Process/ShowBackReason.vue +32 -32
  31. package/src/components/product/ServiceView.vue +759 -759
  32. package/src/components/product/Supervisory/Service/SupervisoryServiceControl.vue +199 -199
  33. package/src/components/product/Supervisory/SupervisoryControl.vue +119 -119
  34. package/src/components/product/Supervisory/SupervisoryList.vue +208 -208
  35. package/src/components/product/Supervisory/SupervisoryhCart.vue +103 -103
  36. package/src/components/product/VueUtils/ApplyUpload.vue +261 -261
  37. package/src/main.js +23 -23
@@ -1,359 +1,359 @@
1
- import Vue from 'vue'
2
- // 登录后获取的所有数据,需要自行获取
3
- export var f
4
-
5
- export function getAttendanceState (item, timeToWork, timeToGo) {
6
- item.f_state = ''
7
- if (!item.f_signin_time || !item.f_knockoff_time) {
8
- item.f_state = '缺勤'
9
- } else {
10
- let signin_time = item.f_signin_time.substring(11, 16)
11
- let knockoff_time = item.f_knockoff_time.substring(11, 16)
12
- if (signin_time > timeToWork) {
13
- item.f_state = '迟到'
14
- }
15
- if (knockoff_time < timeToGo) {
16
- item.f_state = item.f_state + '早退'
17
- }
18
- }
19
- if (!item.f_state) {
20
- item.f_state = '正常'
21
- }
22
- }
23
-
24
- export function isEmpty (str) {
25
- return str === undefined || str === null || str.toString().trim() === ''
26
- }
27
-
28
- export function toStandardYearMonth () {
29
- let dt = new Date()
30
- let month = dt.getMonth() + 1
31
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month)
32
- }
33
- export function toStandardYearMonth1 () {
34
- let dt = new Date()
35
- let month = dt.getMonth() + 1
36
- return dt.getFullYear() + (month < 10 ? '0' + month : month)
37
- }
38
-
39
- export function toStandardDateString () {
40
- let dt = new Date()
41
- let month = dt.getMonth() + 1
42
- let date = dt.getDate()
43
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
44
- }
45
-
46
- export function toStartAndEndDateString () {
47
- let dt = new Date()
48
- let month = dt.getMonth() + 1
49
- // let date = dt.getDate()
50
- return [dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-01',
51
- dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (new Date(dt.getFullYear(), month, 0).getDate())]
52
- // return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
53
- }
54
-
55
- export function toStandardTimeString () {
56
- let dt = new Date()
57
- let month = dt.getMonth() + 1
58
- let date = dt.getDate()
59
- let hour = dt.getHours()
60
- let min = dt.getMinutes()
61
- let sec = dt.getSeconds()
62
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date) +
63
- ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
64
- }
65
-
66
- export function to3339TimeString () {
67
- let dt = new Date()
68
- let month = dt.getMonth() + 1
69
- let date = dt.getDate()
70
- let hour = dt.getHours()
71
- let min = dt.getMinutes()
72
- let sec = dt.getSeconds()
73
- return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date) +
74
- 'T' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
75
- }
76
-
77
- export function parse3339String(strDate) {
78
- return new Date(
79
- strDate.substr(0, 4), strDate.substr(5, 2)-1, strDate.substr(8, 2),
80
- strDate.substr(11, 2), strDate.substr(14, 2), strDate.substr(17, 2)
81
- )
82
- }
83
-
84
- export function format3339TimeString(dt) {
85
- let month = dt.getMonth()+1
86
- let date = dt.getDate()
87
- let hour = dt.getHours()
88
- let min = dt.getMinutes()
89
- let sec = dt.getSeconds()
90
- return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
91
- + 'T' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
92
- }
93
-
94
- export function guid() {
95
- let buf = new Uint16Array(8)
96
- window.crypto.getRandomValues(buf)
97
- let S4 = function(num) {
98
- let ret = num.toString(16)
99
- while(ret.length < 4){
100
- ret = '0' + ret
101
- }
102
- return ret
103
- }
104
- 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]))
105
- }
106
-
107
- export function choices(role, param, hasBlank = false, blankHint='请选择') {
108
- if(role == 'view') {
109
- Vue.getParams(param, [null])
110
- } else {
111
- let result = []
112
- if(hasBlank)
113
- result.push({label: blankHint, value: null})
114
- if(!Vue.param || !Vue.param[param])
115
- result.push({label: '请在系统设置里更新参数', value: '请在系统设置里更新参数'})
116
- else {
117
- let p = Vue.param[param]
118
- p.forEach(function(item) {
119
- result.push({label: item.name, value: item.name})
120
- })
121
- }
122
- return result
123
- }
124
- }
125
-
126
- export function required(param) {
127
- if(typeof param === 'number' && param == 0)
128
- return false
129
- if(!param)
130
- return true
131
- param = param + ''
132
- param = param.trim()
133
- if(!param)
134
- return true
135
- return false
136
- }
137
-
138
- export function isInt(n){
139
- return !window.isNaN(n) && n % 1 === 0
140
- }
141
-
142
- export function isFloat(n){
143
- return !window.isNaN(n)
144
- }
145
-
146
- // this will convert all true/false to boolean
147
- export function booleanFilter(paper) {
148
- for(let key in paper) {
149
- if(!paper.hasOwnProperty(key))
150
- continue
151
- if(typeof paper[key] == "object" && paper[key] != null) {
152
- booleanFilter(paper[key]);
153
- } else {
154
- if(paper[key] === "true" || paper[key] == "false")
155
- paper[key] = (paper[key] === "true")
156
- }
157
- }
158
- }
159
- // recursively traverse through each path
160
- export function ratifyPics(paper) {
161
- for(let key in paper) {
162
- if(key.endsWith('_path')) {
163
- if(!paper[key]) {
164
- paper[key] = 'rs/db/file/nopic.png'
165
- } else {
166
- paper[key] = 'rs/db/file/' + paper[key]
167
- }
168
- } else if(paper[key] !== null && typeof(paper[key]) == "object") {
169
- ratifyPics(paper[key])
170
- }
171
- }
172
- }
173
-
174
- // load script and other stuff
175
- export function loadscript(type, fileName) {
176
- return new Promise((resolve, reject)=> {
177
- let element
178
- if(type == 'css') {
179
- element = document.createElement('link')
180
- element.setAttribute("rel", "stylesheet")
181
- element.setAttribute("type", "text/css")
182
- element.setAttribute("href", fileName)
183
- } else if(type == 'js') {
184
- element = document.createElement('script')
185
- element.setAttribute("type","text/javascript")
186
- element.setAttribute("src", fileName)
187
- }
188
- if(element) {
189
- element.setAttribute('async', '')
190
- element.setAttribute('defer', '')
191
- element.addEventListener('load', function() {
192
- resolve(element)
193
- }, false)
194
- element.addEventListener('error', function() {
195
- reject(element)
196
- }, false)
197
- document.body.appendChild(element)
198
- }
199
- })
200
- }
201
- // 不能选择器中截取掉多余的字符
202
- export function orgName (name) {
203
- return name.substring(10)
204
- }
205
-
206
- export function getNowDate (name) {
207
- // 求取当前时间的工具
208
- let myweekday = ''
209
- let year = ''
210
- let mydate = new Date()
211
- myweekday = mydate.getDay()
212
- let mymonth = mydate.getMonth() + 1
213
- let myday = mydate.getDate()
214
- let myyear = mydate.getYear()
215
- year = (myyear > 200) ? myyear : 1900 + myyear
216
- let week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期日', '星期六']
217
- // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
218
- return year + '年' + mymonth + '月' + myday + '日 ' + week[myweekday]
219
- }
220
-
221
-
222
- export function addDate (date, days) {
223
- // 求取当前时间的工具
224
- let endDate = new Date(date)
225
- endDate = endDate.valueOf()
226
- endDate = endDate + days * 24 * 60 * 60 * 1000
227
- endDate = new Date(endDate)
228
- let month = endDate.getMonth() + 1
229
- let day = endDate.getDate()
230
- let hour = endDate.getHours()
231
- let min = endDate.getMinutes()
232
- let sec = endDate.getSeconds()
233
- return endDate.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day) +
234
- ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
235
- // return a
236
- }
237
-
238
- // 通过地址栏的参数获取参数内容
239
- export function getUrlParames (param) {
240
- var query = window.location.search
241
- var iLen = param.length
242
- var iStart = query.indexOf(param)
243
- if (iStart === -1) {
244
- return ''
245
- }
246
- iStart += iLen + 1
247
- var iEnd = query.indexOf('&', iStart)
248
- if (iEnd === -1) {
249
- return query.substring(iStart)
250
- }
251
- return query.substring(iStart, iEnd)
252
- }
253
-
254
- // 从地址栏获取加密的参数
255
- export function getUrlCompileParames (param) {
256
- var query = uncompileStr(window.location.search.slice(1, window.location.search.length))
257
- var iLen = param.length
258
- var iStart = query.indexOf(param)
259
- if (iStart === -1) {
260
- return ''
261
- }
262
- iStart += iLen + 1
263
- var iEnd = query.indexOf('&', iStart)
264
- if (iEnd === -1) {
265
- return query.substring(iStart)
266
- }
267
- return query.substring(iStart, iEnd)
268
- }
269
-
270
- // 对字符串进行加密
271
- export function compileStr (code) {
272
- let c = String.fromCharCode(code.charCodeAt(0) + code.length)
273
- for (let i = 1; i < code.length; i++) {
274
- c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
275
- }
276
- return escape(c)
277
- }
278
- // 字符串进行解密
279
- export function uncompileStr (code) {
280
- code = unescape(code)
281
- let c = String.fromCharCode(code.charCodeAt(0) - code.length)
282
- for (var i = 1; i < code.length; i++) {
283
- c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1))
284
- }
285
- return c
286
- }
287
-
288
- export function dateDescripte (date) {
289
- let nowTime = new Date().getTime()
290
- let oldTime = new Date(date).getTime()
291
- let timeDiff = nowTime - oldTime
292
- // 规则说明
293
- // 小于等于2分钟为刚刚
294
- // 大于2分钟小于等于1小时为取整的分钟前(例如:35分钟前)
295
- // 大于1小时小于等于24小时为取整的小时前(例如:15小时前)
296
- // 大于24小时小于等于30天为取整的天前(例如:12天前)
297
- // 大于30天小于等于12月为取整的月前,月份统一为30天一月,不做额外处理(例如:3个月前)
298
- // 大于365取整的年前,(例如:2年前)
299
- let minute = 1000 * 60
300
- let hour = minute * 60
301
- let day = hour * 24
302
- let month = day * 30
303
- let year = month * 12
304
- let des = ''
305
- if (timeDiff <= minute * 2) {
306
- des = '刚刚'
307
- } else if (minute * 2 < timeDiff && timeDiff < hour) {
308
- des = `${Math.floor(timeDiff / minute)}分钟前`
309
- } else if (hour < timeDiff && timeDiff <= day) {
310
- des = `${Math.floor(timeDiff / hour)}小时前`
311
- } else if (day < timeDiff && timeDiff <= month) {
312
- des = `${Math.floor(timeDiff / day)}天前`
313
- } else if (month < timeDiff && timeDiff <= year) {
314
- des = `${Math.floor(timeDiff / month)}个月前`
315
- } else if (year < timeDiff) {
316
- des = `${Math.floor(timeDiff / year)}年前`
317
- }
318
- return des
319
- }
320
-
321
- export function nextMonth20 (date) {
322
- let ds = date.split('-')
323
- let nextMonth = ds[1] - 0 + 1
324
- return ds[0] + '-' + (nextMonth < 10 ? '0' + nextMonth : nextMonth) + '-20 00:00:00'
325
- }
326
-
327
- export function beginDate (date) {
328
- let arr = date.split(' ')
329
- if (arr.length > 1) {
330
- // 带有时分秒的 将时分秒归0
331
- arr[1] = '00:00:00'
332
- } else {
333
- arr.push('00:00:00')
334
- }
335
- return arr[0] + ' ' +arr[1]
336
- }
337
-
338
- // export function getNowDate () {
339
- // // 求取当前时间的工具
340
- // let myweekday = ''
341
- // let year = ''
342
- // let mydate = new Date()
343
- // myweekday = mydate.getDay()
344
- // let mymonth = mydate.getMonth() + 1
345
- // let myday = mydate.getDate()
346
- // let myyear = mydate.getYear()
347
- // year = (myyear > 200) ? myyear : 1900 + myyear
348
- // let week = ['星期日','星期一','星期二','星期三','星期四','星期五','星期日','星期六']
349
- // let weekday = week[myweekday]
350
- //
351
- // // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
352
- // return year + '年' + mymonth + '月' + myday + '日 ' + weekday
353
- // }
354
- //
355
- // export function getImgsrc (name) {
356
- // return "http://127.0.0.1:8081/images/"+name+".gif"
357
- // }
358
- //
359
- // export var f;
1
+ import Vue from 'vue'
2
+ // 登录后获取的所有数据,需要自行获取
3
+ export var f
4
+
5
+ export function getAttendanceState (item, timeToWork, timeToGo) {
6
+ item.f_state = ''
7
+ if (!item.f_signin_time || !item.f_knockoff_time) {
8
+ item.f_state = '缺勤'
9
+ } else {
10
+ let signin_time = item.f_signin_time.substring(11, 16)
11
+ let knockoff_time = item.f_knockoff_time.substring(11, 16)
12
+ if (signin_time > timeToWork) {
13
+ item.f_state = '迟到'
14
+ }
15
+ if (knockoff_time < timeToGo) {
16
+ item.f_state = item.f_state + '早退'
17
+ }
18
+ }
19
+ if (!item.f_state) {
20
+ item.f_state = '正常'
21
+ }
22
+ }
23
+
24
+ export function isEmpty (str) {
25
+ return str === undefined || str === null || str.toString().trim() === ''
26
+ }
27
+
28
+ export function toStandardYearMonth () {
29
+ let dt = new Date()
30
+ let month = dt.getMonth() + 1
31
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month)
32
+ }
33
+ export function toStandardYearMonth1 () {
34
+ let dt = new Date()
35
+ let month = dt.getMonth() + 1
36
+ return dt.getFullYear() + (month < 10 ? '0' + month : month)
37
+ }
38
+
39
+ export function toStandardDateString () {
40
+ let dt = new Date()
41
+ let month = dt.getMonth() + 1
42
+ let date = dt.getDate()
43
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
44
+ }
45
+
46
+ export function toStartAndEndDateString () {
47
+ let dt = new Date()
48
+ let month = dt.getMonth() + 1
49
+ // let date = dt.getDate()
50
+ return [dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-01',
51
+ dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (new Date(dt.getFullYear(), month, 0).getDate())]
52
+ // return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date)
53
+ }
54
+
55
+ export function toStandardTimeString () {
56
+ let dt = new Date()
57
+ let month = dt.getMonth() + 1
58
+ let date = dt.getDate()
59
+ let hour = dt.getHours()
60
+ let min = dt.getMinutes()
61
+ let sec = dt.getSeconds()
62
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date) +
63
+ ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
64
+ }
65
+
66
+ export function to3339TimeString () {
67
+ let dt = new Date()
68
+ let month = dt.getMonth() + 1
69
+ let date = dt.getDate()
70
+ let hour = dt.getHours()
71
+ let min = dt.getMinutes()
72
+ let sec = dt.getSeconds()
73
+ return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (date < 10 ? '0' + date : date) +
74
+ 'T' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
75
+ }
76
+
77
+ export function parse3339String(strDate) {
78
+ return new Date(
79
+ strDate.substr(0, 4), strDate.substr(5, 2)-1, strDate.substr(8, 2),
80
+ strDate.substr(11, 2), strDate.substr(14, 2), strDate.substr(17, 2)
81
+ )
82
+ }
83
+
84
+ export function format3339TimeString(dt) {
85
+ let month = dt.getMonth()+1
86
+ let date = dt.getDate()
87
+ let hour = dt.getHours()
88
+ let min = dt.getMinutes()
89
+ let sec = dt.getSeconds()
90
+ return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
91
+ + 'T' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
92
+ }
93
+
94
+ export function guid() {
95
+ let buf = new Uint16Array(8)
96
+ window.crypto.getRandomValues(buf)
97
+ let S4 = function(num) {
98
+ let ret = num.toString(16)
99
+ while(ret.length < 4){
100
+ ret = '0' + ret
101
+ }
102
+ return ret
103
+ }
104
+ 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]))
105
+ }
106
+
107
+ export function choices(role, param, hasBlank = false, blankHint='请选择') {
108
+ if(role == 'view') {
109
+ Vue.getParams(param, [null])
110
+ } else {
111
+ let result = []
112
+ if(hasBlank)
113
+ result.push({label: blankHint, value: null})
114
+ if(!Vue.param || !Vue.param[param])
115
+ result.push({label: '请在系统设置里更新参数', value: '请在系统设置里更新参数'})
116
+ else {
117
+ let p = Vue.param[param]
118
+ p.forEach(function(item) {
119
+ result.push({label: item.name, value: item.name})
120
+ })
121
+ }
122
+ return result
123
+ }
124
+ }
125
+
126
+ export function required(param) {
127
+ if(typeof param === 'number' && param == 0)
128
+ return false
129
+ if(!param)
130
+ return true
131
+ param = param + ''
132
+ param = param.trim()
133
+ if(!param)
134
+ return true
135
+ return false
136
+ }
137
+
138
+ export function isInt(n){
139
+ return !window.isNaN(n) && n % 1 === 0
140
+ }
141
+
142
+ export function isFloat(n){
143
+ return !window.isNaN(n)
144
+ }
145
+
146
+ // this will convert all true/false to boolean
147
+ export function booleanFilter(paper) {
148
+ for(let key in paper) {
149
+ if(!paper.hasOwnProperty(key))
150
+ continue
151
+ if(typeof paper[key] == "object" && paper[key] != null) {
152
+ booleanFilter(paper[key]);
153
+ } else {
154
+ if(paper[key] === "true" || paper[key] == "false")
155
+ paper[key] = (paper[key] === "true")
156
+ }
157
+ }
158
+ }
159
+ // recursively traverse through each path
160
+ export function ratifyPics(paper) {
161
+ for(let key in paper) {
162
+ if(key.endsWith('_path')) {
163
+ if(!paper[key]) {
164
+ paper[key] = 'rs/db/file/nopic.png'
165
+ } else {
166
+ paper[key] = 'rs/db/file/' + paper[key]
167
+ }
168
+ } else if(paper[key] !== null && typeof(paper[key]) == "object") {
169
+ ratifyPics(paper[key])
170
+ }
171
+ }
172
+ }
173
+
174
+ // load script and other stuff
175
+ export function loadscript(type, fileName) {
176
+ return new Promise((resolve, reject)=> {
177
+ let element
178
+ if(type == 'css') {
179
+ element = document.createElement('link')
180
+ element.setAttribute("rel", "stylesheet")
181
+ element.setAttribute("type", "text/css")
182
+ element.setAttribute("href", fileName)
183
+ } else if(type == 'js') {
184
+ element = document.createElement('script')
185
+ element.setAttribute("type","text/javascript")
186
+ element.setAttribute("src", fileName)
187
+ }
188
+ if(element) {
189
+ element.setAttribute('async', '')
190
+ element.setAttribute('defer', '')
191
+ element.addEventListener('load', function() {
192
+ resolve(element)
193
+ }, false)
194
+ element.addEventListener('error', function() {
195
+ reject(element)
196
+ }, false)
197
+ document.body.appendChild(element)
198
+ }
199
+ })
200
+ }
201
+ // 不能选择器中截取掉多余的字符
202
+ export function orgName (name) {
203
+ return name.substring(10)
204
+ }
205
+
206
+ export function getNowDate (name) {
207
+ // 求取当前时间的工具
208
+ let myweekday = ''
209
+ let year = ''
210
+ let mydate = new Date()
211
+ myweekday = mydate.getDay()
212
+ let mymonth = mydate.getMonth() + 1
213
+ let myday = mydate.getDate()
214
+ let myyear = mydate.getYear()
215
+ year = (myyear > 200) ? myyear : 1900 + myyear
216
+ let week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期日', '星期六']
217
+ // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
218
+ return year + '年' + mymonth + '月' + myday + '日 ' + week[myweekday]
219
+ }
220
+
221
+
222
+ export function addDate (date, days) {
223
+ // 求取当前时间的工具
224
+ let endDate = new Date(date)
225
+ endDate = endDate.valueOf()
226
+ endDate = endDate + days * 24 * 60 * 60 * 1000
227
+ endDate = new Date(endDate)
228
+ let month = endDate.getMonth() + 1
229
+ let day = endDate.getDate()
230
+ let hour = endDate.getHours()
231
+ let min = endDate.getMinutes()
232
+ let sec = endDate.getSeconds()
233
+ return endDate.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day) +
234
+ ' ' + (hour < 10 ? '0' + hour : hour) + ':' + (min < 10 ? '0' + min : min) + ':' + (sec < 10 ? '0' + sec : sec)
235
+ // return a
236
+ }
237
+
238
+ // 通过地址栏的参数获取参数内容
239
+ export function getUrlParames (param) {
240
+ var query = window.location.search
241
+ var iLen = param.length
242
+ var iStart = query.indexOf(param)
243
+ if (iStart === -1) {
244
+ return ''
245
+ }
246
+ iStart += iLen + 1
247
+ var iEnd = query.indexOf('&', iStart)
248
+ if (iEnd === -1) {
249
+ return query.substring(iStart)
250
+ }
251
+ return query.substring(iStart, iEnd)
252
+ }
253
+
254
+ // 从地址栏获取加密的参数
255
+ export function getUrlCompileParames (param) {
256
+ var query = uncompileStr(window.location.search.slice(1, window.location.search.length))
257
+ var iLen = param.length
258
+ var iStart = query.indexOf(param)
259
+ if (iStart === -1) {
260
+ return ''
261
+ }
262
+ iStart += iLen + 1
263
+ var iEnd = query.indexOf('&', iStart)
264
+ if (iEnd === -1) {
265
+ return query.substring(iStart)
266
+ }
267
+ return query.substring(iStart, iEnd)
268
+ }
269
+
270
+ // 对字符串进行加密
271
+ export function compileStr (code) {
272
+ let c = String.fromCharCode(code.charCodeAt(0) + code.length)
273
+ for (let i = 1; i < code.length; i++) {
274
+ c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
275
+ }
276
+ return escape(c)
277
+ }
278
+ // 字符串进行解密
279
+ export function uncompileStr (code) {
280
+ code = unescape(code)
281
+ let c = String.fromCharCode(code.charCodeAt(0) - code.length)
282
+ for (var i = 1; i < code.length; i++) {
283
+ c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1))
284
+ }
285
+ return c
286
+ }
287
+
288
+ export function dateDescripte (date) {
289
+ let nowTime = new Date().getTime()
290
+ let oldTime = new Date(date).getTime()
291
+ let timeDiff = nowTime - oldTime
292
+ // 规则说明
293
+ // 小于等于2分钟为刚刚
294
+ // 大于2分钟小于等于1小时为取整的分钟前(例如:35分钟前)
295
+ // 大于1小时小于等于24小时为取整的小时前(例如:15小时前)
296
+ // 大于24小时小于等于30天为取整的天前(例如:12天前)
297
+ // 大于30天小于等于12月为取整的月前,月份统一为30天一月,不做额外处理(例如:3个月前)
298
+ // 大于365取整的年前,(例如:2年前)
299
+ let minute = 1000 * 60
300
+ let hour = minute * 60
301
+ let day = hour * 24
302
+ let month = day * 30
303
+ let year = month * 12
304
+ let des = ''
305
+ if (timeDiff <= minute * 2) {
306
+ des = '刚刚'
307
+ } else if (minute * 2 < timeDiff && timeDiff < hour) {
308
+ des = `${Math.floor(timeDiff / minute)}分钟前`
309
+ } else if (hour < timeDiff && timeDiff <= day) {
310
+ des = `${Math.floor(timeDiff / hour)}小时前`
311
+ } else if (day < timeDiff && timeDiff <= month) {
312
+ des = `${Math.floor(timeDiff / day)}天前`
313
+ } else if (month < timeDiff && timeDiff <= year) {
314
+ des = `${Math.floor(timeDiff / month)}个月前`
315
+ } else if (year < timeDiff) {
316
+ des = `${Math.floor(timeDiff / year)}年前`
317
+ }
318
+ return des
319
+ }
320
+
321
+ export function nextMonth20 (date) {
322
+ let ds = date.split('-')
323
+ let nextMonth = ds[1] - 0 + 1
324
+ return ds[0] + '-' + (nextMonth < 10 ? '0' + nextMonth : nextMonth) + '-20 00:00:00'
325
+ }
326
+
327
+ export function beginDate (date) {
328
+ let arr = date.split(' ')
329
+ if (arr.length > 1) {
330
+ // 带有时分秒的 将时分秒归0
331
+ arr[1] = '00:00:00'
332
+ } else {
333
+ arr.push('00:00:00')
334
+ }
335
+ return arr[0] + ' ' +arr[1]
336
+ }
337
+
338
+ // export function getNowDate () {
339
+ // // 求取当前时间的工具
340
+ // let myweekday = ''
341
+ // let year = ''
342
+ // let mydate = new Date()
343
+ // myweekday = mydate.getDay()
344
+ // let mymonth = mydate.getMonth() + 1
345
+ // let myday = mydate.getDate()
346
+ // let myyear = mydate.getYear()
347
+ // year = (myyear > 200) ? myyear : 1900 + myyear
348
+ // let week = ['星期日','星期一','星期二','星期三','星期四','星期五','星期日','星期六']
349
+ // let weekday = week[myweekday]
350
+ //
351
+ // // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
352
+ // return year + '年' + mymonth + '月' + myday + '日 ' + weekday
353
+ // }
354
+ //
355
+ // export function getImgsrc (name) {
356
+ // return "http://127.0.0.1:8081/images/"+name+".gif"
357
+ // }
358
+ //
359
+ // export var f;