system-phone 3.1.41 → 3.1.42
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.
- package/.babelrc +5 -5
- package/.editorconfig +9 -9
- package/.eslintrc.js +16 -16
- package/CHANGELOG.md +1 -1
- package/Dockerfile +3 -3
- package/README.md +36 -36
- package/build/css-loaders.js +34 -34
- package/build/dev-client.js +8 -8
- package/build/example-server.js +80 -80
- package/build/release.sh +28 -28
- package/build/utils.js +71 -71
- package/build/webpack.dev.conf.js +31 -31
- package/build/webpack.example.conf.js +49 -49
- package/build/webpack.prod.conf.js +60 -60
- package/build/webpack.test.conf.js +31 -31
- package/config/dev.env.js +6 -6
- package/config/index.js +38 -38
- package/config/prod.env.js +3 -3
- package/config/test.env.js +6 -6
- package/nginx.conf +304 -304
- package/package.json +1 -1
- package/release.bat +5 -5
- package/src/App.vue +25 -25
- package/src/Util.js +415 -415
- package/src/android-bootstrap/fonts/glyphicons-halflings-regular.svg +287 -287
- package/src/android-bootstrap/less/.csscomb.json +304 -304
- package/src/android-bootstrap/less/.csslintrc +19 -19
- package/src/android-bootstrap/less/alerts.less +73 -73
- package/src/android-bootstrap/less/badges.less +66 -66
- package/src/android-bootstrap/less/bootstrap.less +56 -56
- package/src/android-bootstrap/less/breadcrumbs.less +26 -26
- package/src/android-bootstrap/less/button-groups.less +247 -247
- package/src/android-bootstrap/less/buttons.less +173 -173
- package/src/android-bootstrap/less/carousel.less +269 -269
- package/src/android-bootstrap/less/close.less +34 -34
- package/src/android-bootstrap/less/code.less +69 -69
- package/src/android-bootstrap/less/component-animations.less +33 -33
- package/src/android-bootstrap/less/dropdowns.less +216 -216
- package/src/android-bootstrap/less/forms.less +626 -626
- package/src/android-bootstrap/less/glyphicons.less +305 -305
- package/src/android-bootstrap/less/grid.less +84 -84
- package/src/android-bootstrap/less/input-groups.less +167 -167
- package/src/android-bootstrap/less/jumbotron.less +52 -52
- package/src/android-bootstrap/less/labels.less +64 -64
- package/src/android-bootstrap/less/list-group.less +141 -141
- package/src/android-bootstrap/less/media.less +66 -66
- package/src/android-bootstrap/less/mixins/alerts.less +14 -14
- package/src/android-bootstrap/less/mixins/background-variant.less +9 -9
- package/src/android-bootstrap/less/mixins/border-radius.less +18 -18
- package/src/android-bootstrap/less/mixins/buttons.less +69 -69
- package/src/android-bootstrap/less/mixins/center-block.less +7 -7
- package/src/android-bootstrap/less/mixins/clearfix.less +22 -22
- package/src/android-bootstrap/less/mixins/forms.less +90 -90
- package/src/android-bootstrap/less/mixins/gradients.less +59 -59
- package/src/android-bootstrap/less/mixins/grid-framework.less +92 -92
- package/src/android-bootstrap/less/mixins/grid.less +122 -122
- package/src/android-bootstrap/less/mixins/hide-text.less +21 -21
- package/src/android-bootstrap/less/mixins/image.less +33 -33
- package/src/android-bootstrap/less/mixins/labels.less +12 -12
- package/src/android-bootstrap/less/mixins/list-group.less +30 -30
- package/src/android-bootstrap/less/mixins/nav-divider.less +10 -10
- package/src/android-bootstrap/less/mixins/nav-vertical-align.less +9 -9
- package/src/android-bootstrap/less/mixins/opacity.less +8 -8
- package/src/android-bootstrap/less/mixins/pagination.less +24 -24
- package/src/android-bootstrap/less/mixins/panels.less +24 -24
- package/src/android-bootstrap/less/mixins/progress-bar.less +10 -10
- package/src/android-bootstrap/less/mixins/reset-filter.less +8 -8
- package/src/android-bootstrap/less/mixins/reset-text.less +18 -18
- package/src/android-bootstrap/less/mixins/resize.less +6 -6
- package/src/android-bootstrap/less/mixins/responsive-visibility.less +15 -15
- package/src/android-bootstrap/less/mixins/size.less +10 -10
- package/src/android-bootstrap/less/mixins/tab-focus.less +9 -9
- package/src/android-bootstrap/less/mixins/table-row.less +44 -44
- package/src/android-bootstrap/less/mixins/text-emphasis.less +9 -9
- package/src/android-bootstrap/less/mixins/text-overflow.less +8 -8
- package/src/android-bootstrap/less/mixins/vendor-prefixes.less +227 -227
- package/src/android-bootstrap/less/mixins.less +40 -40
- package/src/android-bootstrap/less/modals.less +151 -151
- package/src/android-bootstrap/less/navbar.less +660 -660
- package/src/android-bootstrap/less/navs.less +290 -290
- package/src/android-bootstrap/less/normalize.less +424 -424
- package/src/android-bootstrap/less/pager.less +76 -76
- package/src/android-bootstrap/less/pagination.less +89 -89
- package/src/android-bootstrap/less/panels.less +274 -274
- package/src/android-bootstrap/less/popovers.less +131 -131
- package/src/android-bootstrap/less/print.less +101 -101
- package/src/android-bootstrap/less/progress-bars.less +87 -87
- package/src/android-bootstrap/less/responsive-embed.less +35 -35
- package/src/android-bootstrap/less/responsive-utilities.less +194 -194
- package/src/android-bootstrap/less/scaffolding.less +161 -161
- package/src/android-bootstrap/less/tables.less +262 -262
- package/src/android-bootstrap/less/theme.less +291 -291
- package/src/android-bootstrap/less/thumbnails.less +36 -36
- package/src/android-bootstrap/less/tooltip.less +102 -102
- package/src/android-bootstrap/less/type.less +303 -303
- package/src/android-bootstrap/less/utilities.less +55 -55
- package/src/android-bootstrap/less/variables.less +896 -896
- package/src/android-bootstrap/less/wells.less +29 -29
- package/src/bootstrap/fonts/glyphicons-halflings-regular.svg +287 -287
- package/src/bootstrap/less/.csscomb.json +304 -304
- package/src/bootstrap/less/.csslintrc +19 -19
- package/src/bootstrap/less/alerts.less +73 -73
- package/src/bootstrap/less/badges.less +66 -66
- package/src/bootstrap/less/bootstrap.less +56 -56
- package/src/bootstrap/less/breadcrumbs.less +26 -26
- package/src/bootstrap/less/button-groups.less +247 -247
- package/src/bootstrap/less/buttons.less +172 -172
- package/src/bootstrap/less/carousel.less +269 -269
- package/src/bootstrap/less/close.less +34 -34
- package/src/bootstrap/less/code.less +69 -69
- package/src/bootstrap/less/component-animations.less +33 -33
- package/src/bootstrap/less/dropdowns.less +216 -216
- package/src/bootstrap/less/forms.less +626 -626
- package/src/bootstrap/less/glyphicons.less +305 -305
- package/src/bootstrap/less/grid.less +84 -84
- package/src/bootstrap/less/input-groups.less +167 -167
- package/src/bootstrap/less/jumbotron.less +52 -52
- package/src/bootstrap/less/labels.less +64 -64
- package/src/bootstrap/less/list-group.less +141 -141
- package/src/bootstrap/less/media.less +66 -66
- package/src/bootstrap/less/mixins/alerts.less +14 -14
- package/src/bootstrap/less/mixins/background-variant.less +9 -9
- package/src/bootstrap/less/mixins/border-radius.less +18 -18
- package/src/bootstrap/less/mixins/buttons.less +69 -69
- package/src/bootstrap/less/mixins/center-block.less +7 -7
- package/src/bootstrap/less/mixins/clearfix.less +22 -22
- package/src/bootstrap/less/mixins/forms.less +90 -90
- package/src/bootstrap/less/mixins/gradients.less +59 -59
- package/src/bootstrap/less/mixins/grid-framework.less +92 -92
- package/src/bootstrap/less/mixins/grid.less +122 -122
- package/src/bootstrap/less/mixins/hide-text.less +21 -21
- package/src/bootstrap/less/mixins/image.less +33 -33
- package/src/bootstrap/less/mixins/labels.less +12 -12
- package/src/bootstrap/less/mixins/list-group.less +30 -30
- package/src/bootstrap/less/mixins/nav-divider.less +10 -10
- package/src/bootstrap/less/mixins/nav-vertical-align.less +9 -9
- package/src/bootstrap/less/mixins/opacity.less +8 -8
- package/src/bootstrap/less/mixins/pagination.less +24 -24
- package/src/bootstrap/less/mixins/panels.less +24 -24
- package/src/bootstrap/less/mixins/progress-bar.less +10 -10
- package/src/bootstrap/less/mixins/reset-filter.less +8 -8
- package/src/bootstrap/less/mixins/reset-text.less +18 -18
- package/src/bootstrap/less/mixins/resize.less +6 -6
- package/src/bootstrap/less/mixins/responsive-visibility.less +15 -15
- package/src/bootstrap/less/mixins/size.less +10 -10
- package/src/bootstrap/less/mixins/tab-focus.less +9 -9
- package/src/bootstrap/less/mixins/table-row.less +44 -44
- package/src/bootstrap/less/mixins/text-emphasis.less +9 -9
- package/src/bootstrap/less/mixins/text-overflow.less +8 -8
- package/src/bootstrap/less/mixins/vendor-prefixes.less +227 -227
- package/src/bootstrap/less/mixins.less +40 -40
- package/src/bootstrap/less/modals.less +151 -151
- package/src/bootstrap/less/navbar.less +660 -660
- package/src/bootstrap/less/navs.less +286 -286
- package/src/bootstrap/less/normalize.less +424 -424
- package/src/bootstrap/less/pager.less +76 -76
- package/src/bootstrap/less/pagination.less +89 -89
- package/src/bootstrap/less/panels.less +275 -275
- package/src/bootstrap/less/popovers.less +131 -131
- package/src/bootstrap/less/print.less +101 -101
- package/src/bootstrap/less/progress-bars.less +87 -87
- package/src/bootstrap/less/responsive-embed.less +35 -35
- package/src/bootstrap/less/responsive-utilities.less +194 -194
- package/src/bootstrap/less/scaffolding.less +161 -161
- package/src/bootstrap/less/tables.less +262 -262
- package/src/bootstrap/less/theme.less +291 -291
- package/src/bootstrap/less/thumbnails.less +36 -36
- package/src/bootstrap/less/tooltip.less +102 -102
- package/src/bootstrap/less/type.less +303 -303
- package/src/bootstrap/less/utilities.less +55 -55
- package/src/bootstrap/less/variables.less +895 -895
- package/src/bootstrap/less/wells.less +29 -29
- package/src/components/AloneLoadParams.vue +26 -26
- package/src/components/AlreadyService.vue +210 -210
- package/src/components/AttendManage.vue +591 -591
- package/src/components/LoadAppdata.vue +38 -38
- package/src/components/LoginAppV4.vue +787 -790
- package/src/components/ModifyPassWord.vue +216 -219
- package/src/components/OnlineManage.vue +278 -278
- package/src/components/PhoneSellInfo.vue +148 -148
- package/src/components/Test.vue +14 -14
- package/src/filiale/liaoyuan/LoginApp.vue +734 -725
- package/src/filiale/liaoyuan/SystemSetUp.vue +352 -0
- package/src/filiale/liaoyuan/systemphonegrid.js +1 -0
- package/src/plugins/GetStringData.js +18 -18
- package/src/plugins/LoadParams.js +24 -24
- package/src/services/ConfigService.js +24 -24
- package/static/app.json +4 -4
- package/static/globals.txt +74 -74
- package/test/unit/.eslintrc +5 -5
- package/test/unit/TestUtil.js +35 -35
- package/test/unit/context.html +20 -20
- package/test/unit/index.js +13 -13
- package/test/unit/init.js +13 -13
- package/test/unit/karma.conf.js +50 -50
- package/test/unit/specs/App.spec.js +17 -17
- package/test/unit/specs/Test.spec.js +28 -28
- package/test/unit/specs/components/LoginApp.spec.js +21 -21
- package/test/unit/specs/sevices/ConfigService.spec.js +23 -23
- package/test/unit/specs/sevices/GetDBTest.spec.js +28 -28
- package/src/plugins/validateStrongPasswordPhone.js +0 -162
package/src/Util.js
CHANGED
|
@@ -1,415 +1,415 @@
|
|
|
1
|
-
import Vue from 'vue'
|
|
2
|
-
import { HttpResetClass } from 'vue-client'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export var f = {
|
|
6
|
-
id: '',
|
|
7
|
-
// role: null 如果是话务员,该值为null
|
|
8
|
-
role: 'repairman'
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export var attendant = {
|
|
12
|
-
aModule: 1,
|
|
13
|
-
aChannel: 0
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// 当前登录用户的ip地址
|
|
17
|
-
export var ip = '127.0.0.1'
|
|
18
|
-
|
|
19
|
-
export function afterCallBz(id, name) {
|
|
20
|
-
let http = new HttpResetClass()
|
|
21
|
-
http.load('POST', data.voiceUrl,
|
|
22
|
-
{
|
|
23
|
-
aId: id,
|
|
24
|
-
RecordsID: '',
|
|
25
|
-
aChannel: attendant.aChannel,
|
|
26
|
-
aModule: attendant.aModule,
|
|
27
|
-
aBzType: "save",
|
|
28
|
-
bzExtra: null,
|
|
29
|
-
bzId: null,
|
|
30
|
-
aName: name
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
resolveMsg: null,
|
|
34
|
-
rejectMsg: null
|
|
35
|
-
}).then((req) => {
|
|
36
|
-
console.log("话后调用成功")
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function getDaysInOneMonth (year, month) {
|
|
41
|
-
month = parseInt(month, 10)
|
|
42
|
-
var d = new Date(year, month, 0)
|
|
43
|
-
return d.getDate()
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function getAttendanceState(item, timeToWork, timeToGo) {
|
|
47
|
-
item.f_state = ''
|
|
48
|
-
if(!item.f_signin_time || !item.f_knockoff_time)
|
|
49
|
-
item.f_state = '缺勤'
|
|
50
|
-
else {
|
|
51
|
-
let signin_time = item.f_signin_time.substring(11, 16)
|
|
52
|
-
let knockoff_time = item.f_knockoff_time.substring(11, 16)
|
|
53
|
-
if(signin_time > timeToWork)
|
|
54
|
-
item.f_state = '迟到'
|
|
55
|
-
if(knockoff_time < timeToGo)
|
|
56
|
-
item.f_state = item.f_state + '早退'
|
|
57
|
-
}
|
|
58
|
-
if(!item.f_state)
|
|
59
|
-
item.f_state = '正常'
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function toStandardYearMonth() {
|
|
63
|
-
let dt = new Date()
|
|
64
|
-
let month = dt.getMonth()+1
|
|
65
|
-
return dt.getFullYear() + '-' + (month<10? '0'+ month : month)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function toStandardDateString() {
|
|
69
|
-
let dt = new Date()
|
|
70
|
-
let month = dt.getMonth()+1
|
|
71
|
-
let date = dt.getDate()
|
|
72
|
-
return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function toStandardTimeString() {
|
|
76
|
-
let dt = new Date()
|
|
77
|
-
let month = dt.getMonth()+1
|
|
78
|
-
let date = dt.getDate()
|
|
79
|
-
let hour = dt.getHours()
|
|
80
|
-
let min = dt.getMinutes()
|
|
81
|
-
let sec = dt.getSeconds()
|
|
82
|
-
return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
|
|
83
|
-
+ ' ' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
|
|
84
|
-
}
|
|
85
|
-
export function toStandardTimeStringByTimestamp(time) {
|
|
86
|
-
let dt = new Date(time)
|
|
87
|
-
let month = dt.getMonth()+1
|
|
88
|
-
let date = dt.getDate()
|
|
89
|
-
let hour = dt.getHours()
|
|
90
|
-
let min = dt.getMinutes()
|
|
91
|
-
let sec = dt.getSeconds()
|
|
92
|
-
return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
|
|
93
|
-
+ ' ' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export function to3339TimeString() {
|
|
97
|
-
let dt = new Date()
|
|
98
|
-
let month = dt.getMonth()+1
|
|
99
|
-
let date = dt.getDate()
|
|
100
|
-
let hour = dt.getHours()
|
|
101
|
-
let min = dt.getMinutes()
|
|
102
|
-
let sec = dt.getSeconds()
|
|
103
|
-
return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
|
|
104
|
-
+ 'T' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export function parse3339String(strDate) {
|
|
108
|
-
return new Date(
|
|
109
|
-
strDate.substr(0, 4), strDate.substr(5, 2)-1, strDate.substr(8, 2),
|
|
110
|
-
strDate.substr(11, 2), strDate.substr(14, 2), strDate.substr(17, 2)
|
|
111
|
-
)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export function format3339TimeString(dt) {
|
|
115
|
-
let month = dt.getMonth()+1
|
|
116
|
-
let date = dt.getDate()
|
|
117
|
-
let hour = dt.getHours()
|
|
118
|
-
let min = dt.getMinutes()
|
|
119
|
-
let sec = dt.getSeconds()
|
|
120
|
-
return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
|
|
121
|
-
+ 'T' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export function guid() {
|
|
125
|
-
let buf = new Uint16Array(8)
|
|
126
|
-
window.crypto.getRandomValues(buf)
|
|
127
|
-
let S4 = function(num) {
|
|
128
|
-
let ret = num.toString(16)
|
|
129
|
-
while(ret.length < 4){
|
|
130
|
-
ret = '0' + ret
|
|
131
|
-
}
|
|
132
|
-
return ret
|
|
133
|
-
}
|
|
134
|
-
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]))
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export function choices(role, param, hasBlank = false, blankHint='请选择') {
|
|
138
|
-
if(role == 'view') {
|
|
139
|
-
Vue.getParams(param, [null])
|
|
140
|
-
} else {
|
|
141
|
-
let result = []
|
|
142
|
-
if(hasBlank)
|
|
143
|
-
result.push({label: blankHint, value: null})
|
|
144
|
-
if(!Vue.param || !Vue.param[param])
|
|
145
|
-
result.push({label: '请在系统设置里更新参数', value: '请在系统设置里更新参数'})
|
|
146
|
-
else {
|
|
147
|
-
//console.log(param)
|
|
148
|
-
//console.log(JSON.stringify(Vue.param))
|
|
149
|
-
let p = Vue.param[param]
|
|
150
|
-
p.forEach(function(item) {
|
|
151
|
-
result.push({label: item.name, value: item.name})
|
|
152
|
-
})
|
|
153
|
-
}
|
|
154
|
-
return result
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export function required(param) {
|
|
159
|
-
if(typeof param === 'number' && param == 0)
|
|
160
|
-
return false
|
|
161
|
-
if(!param)
|
|
162
|
-
return true
|
|
163
|
-
param = param + ''
|
|
164
|
-
param = param.trim()
|
|
165
|
-
if(!param)
|
|
166
|
-
return true
|
|
167
|
-
return false
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export function isInt(n){
|
|
171
|
-
console.log('判断整数' + n)
|
|
172
|
-
return !window.isNaN(n) && n % 1 === 0
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export function isFloat(n){
|
|
176
|
-
console.log('判断小数' + n)
|
|
177
|
-
return !window.isNaN(n)
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// this will convert all true/false to boolean
|
|
181
|
-
export function booleanFilter(paper) {
|
|
182
|
-
for(let key in paper) {
|
|
183
|
-
if(!paper.hasOwnProperty(key))
|
|
184
|
-
continue
|
|
185
|
-
if(typeof paper[key] == "object" && paper[key] != null) {
|
|
186
|
-
booleanFilter(paper[key]);
|
|
187
|
-
} else {
|
|
188
|
-
if(paper[key] === "true" || paper[key] == "false")
|
|
189
|
-
paper[key] = (paper[key] === "true")
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
// recursively traverse through each path
|
|
194
|
-
export function ratifyPics(paper) {
|
|
195
|
-
for(let key in paper) {
|
|
196
|
-
if(key.endsWith('_path')) {
|
|
197
|
-
if(!paper[key]) {
|
|
198
|
-
paper[key] = 'rs/db/file/nopic.png'
|
|
199
|
-
} else {
|
|
200
|
-
paper[key] = 'rs/db/file/' + paper[key]
|
|
201
|
-
}
|
|
202
|
-
} else if(paper[key] !== null && typeof(paper[key]) == "object") {
|
|
203
|
-
ratifyPics(paper[key])
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// load script and other stuff
|
|
209
|
-
export function loadscript(type, fileName) {
|
|
210
|
-
return new Promise((resolve, reject)=> {
|
|
211
|
-
let element
|
|
212
|
-
if(type == 'css') {
|
|
213
|
-
element = document.createElement('link')
|
|
214
|
-
element.setAttribute("rel", "stylesheet")
|
|
215
|
-
element.setAttribute("type", "text/css")
|
|
216
|
-
element.setAttribute("href", fileName)
|
|
217
|
-
} else if(type == 'js') {
|
|
218
|
-
element = document.createElement('script')
|
|
219
|
-
element.setAttribute("type","text/javascript")
|
|
220
|
-
element.setAttribute("src", fileName)
|
|
221
|
-
}
|
|
222
|
-
if(element) {
|
|
223
|
-
element.setAttribute('async', '')
|
|
224
|
-
element.setAttribute('defer', '')
|
|
225
|
-
element.addEventListener('load', function() {
|
|
226
|
-
resolve(element)
|
|
227
|
-
console.log('load script resolved')
|
|
228
|
-
}, false)
|
|
229
|
-
element.addEventListener('error', function() {
|
|
230
|
-
reject(element)
|
|
231
|
-
console.log('load script rejected')
|
|
232
|
-
}, false)
|
|
233
|
-
document.body.appendChild(element)
|
|
234
|
-
}
|
|
235
|
-
})
|
|
236
|
-
}
|
|
237
|
-
// 不能选择器中截取掉多余的字符
|
|
238
|
-
export function orgName (name) {
|
|
239
|
-
return name.substring(10)
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
export function getNowDate (name) {
|
|
243
|
-
let year = ''
|
|
244
|
-
let month = ''
|
|
245
|
-
let day = ''
|
|
246
|
-
let hour = ''
|
|
247
|
-
let minutes = ''
|
|
248
|
-
let seconds = ''
|
|
249
|
-
let mydate = new Date()
|
|
250
|
-
let mymonth = mydate.getMonth() + 1
|
|
251
|
-
let myday = mydate.getDate()
|
|
252
|
-
let myyear = mydate.getYear()
|
|
253
|
-
let myhour = mydate.getHours()
|
|
254
|
-
let myminutes = mydate.getMinutes()
|
|
255
|
-
let myseconds = mydate.getSeconds()
|
|
256
|
-
year = (myyear > 200) ? myyear : 1900 + myyear
|
|
257
|
-
month = (mymonth > 9) ? mymonth : '0' + mymonth
|
|
258
|
-
day = (myday > 9) ? myday : '0' + myday
|
|
259
|
-
hour = (myhour > 9) ? myhour : '0' + myhour
|
|
260
|
-
minutes = (myminutes > 9) ? myminutes : '0' + myminutes
|
|
261
|
-
seconds = (myseconds > 9) ? myseconds : '0' + myseconds
|
|
262
|
-
// document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
|
|
263
|
-
return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
|
|
264
|
-
}
|
|
265
|
-
// 数组深度复制
|
|
266
|
-
export function deepcopy (obj) {
|
|
267
|
-
let out = []
|
|
268
|
-
let len = obj.length
|
|
269
|
-
for (let i = 0; i < len; i++) {
|
|
270
|
-
if (obj[i] instanceof Array) {
|
|
271
|
-
out[i] = deepcopy(obj[i])
|
|
272
|
-
} else {
|
|
273
|
-
if (typeof obj[i] === 'object') {
|
|
274
|
-
out[i] = Object.assign({}, out[i], obj[i])
|
|
275
|
-
} else {
|
|
276
|
-
out[i] = obj[i]
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return out
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export function dateDescripte (date) {
|
|
284
|
-
let nowTime = new Date().getTime()
|
|
285
|
-
let oldTime = new Date(date).getTime()
|
|
286
|
-
let timeDiff = nowTime - oldTime
|
|
287
|
-
// 规则说明
|
|
288
|
-
// 小于等于2分钟为刚刚
|
|
289
|
-
// 大于2分钟小于等于1小时为取整的分钟前(例如:35分钟前)
|
|
290
|
-
// 大于1小时小于等于24小时为取整的小时前(例如:15小时前)
|
|
291
|
-
// 大于24小时小于等于30天为取整的天前(例如:12天前)
|
|
292
|
-
// 大于30天小于等于12月为取整的月前,月份统一为30天一月,不做额外处理(例如:3个月前)
|
|
293
|
-
// 大于365取整的年前,(例如:2年前)
|
|
294
|
-
let minute = 1000 * 60
|
|
295
|
-
let hour = minute * 60
|
|
296
|
-
let day = hour * 24
|
|
297
|
-
let month = day * 30
|
|
298
|
-
let year = month * 12
|
|
299
|
-
let des = ''
|
|
300
|
-
if (timeDiff <= minute * 2) {
|
|
301
|
-
des = '刚刚'
|
|
302
|
-
} else if (minute * 2 < timeDiff && timeDiff < hour) {
|
|
303
|
-
des = `${Math.floor(timeDiff / minute)}分钟前`
|
|
304
|
-
} else if (hour < timeDiff && timeDiff <= day) {
|
|
305
|
-
des = `${Math.floor(timeDiff / hour)}小时前`
|
|
306
|
-
} else if (day < timeDiff && timeDiff <= month) {
|
|
307
|
-
des = `${Math.floor(timeDiff / day)}天前`
|
|
308
|
-
} else if (month < timeDiff && timeDiff <= year) {
|
|
309
|
-
des = `${Math.floor(timeDiff / month)}个月前`
|
|
310
|
-
} else if (year < timeDiff) {
|
|
311
|
-
des = `${Math.floor(timeDiff / year)}年前`
|
|
312
|
-
}
|
|
313
|
-
return des
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// 通过地址栏的参数获取参数内容
|
|
317
|
-
export function getUrlParames (param) {
|
|
318
|
-
var query = window.location.search
|
|
319
|
-
var iLen = param.length
|
|
320
|
-
var iStart = query.indexOf(param)
|
|
321
|
-
if (iStart === -1) {
|
|
322
|
-
return ''
|
|
323
|
-
}
|
|
324
|
-
iStart += iLen + 1
|
|
325
|
-
var iEnd = query.indexOf('&', iStart)
|
|
326
|
-
if (iEnd === -1) {
|
|
327
|
-
return query.substring(iStart)
|
|
328
|
-
}
|
|
329
|
-
return query.substring(iStart, iEnd)
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// 从地址栏获取加密的参数
|
|
333
|
-
export function getUrlCompileParames (param) {
|
|
334
|
-
var query = uncompileStr(window.location.search.slice(1, window.location.search.length))
|
|
335
|
-
var iLen = param.length
|
|
336
|
-
var iStart = query.indexOf(param)
|
|
337
|
-
if (iStart === -1) {
|
|
338
|
-
return ''
|
|
339
|
-
}
|
|
340
|
-
iStart += iLen + 1
|
|
341
|
-
var iEnd = query.indexOf('&', iStart)
|
|
342
|
-
if (iEnd === -1) {
|
|
343
|
-
return query.substring(iStart)
|
|
344
|
-
}
|
|
345
|
-
return query.substring(iStart, iEnd)
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// 对字符串进行加密
|
|
349
|
-
export function compileStr (code) {
|
|
350
|
-
let c = String.fromCharCode(code.charCodeAt(0) + code.length)
|
|
351
|
-
for (let i = 1; i < code.length; i++) {
|
|
352
|
-
c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
|
|
353
|
-
}
|
|
354
|
-
return escape(c)
|
|
355
|
-
}
|
|
356
|
-
// 字符串进行解密
|
|
357
|
-
export function uncompileStr (code) {
|
|
358
|
-
code = unescape(code)
|
|
359
|
-
let c = String.fromCharCode(code.charCodeAt(0) - code.length)
|
|
360
|
-
for (var i = 1; i < code.length; i++) {
|
|
361
|
-
c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1))
|
|
362
|
-
}
|
|
363
|
-
return c
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
export function getCurrentTime () {
|
|
367
|
-
return Date.parse(new Date());
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
export function uuid() {
|
|
371
|
-
var s = [];
|
|
372
|
-
var hexDigits = "0123456789abcdef";
|
|
373
|
-
for (var i = 0; i < 36; i++) {
|
|
374
|
-
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
|
375
|
-
}
|
|
376
|
-
s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
|
|
377
|
-
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
|
|
378
|
-
s[8] = s[13] = s[18] = s[23] = "-";
|
|
379
|
-
|
|
380
|
-
var uuid = s.join("");
|
|
381
|
-
return uuid;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
export function randnum() {
|
|
386
|
-
var s = [];
|
|
387
|
-
var hexDigits = "0123456789abcdef";
|
|
388
|
-
for (var i = 0; i <10; i++) {
|
|
389
|
-
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
|
390
|
-
}
|
|
391
|
-
var randnum = s.join("");
|
|
392
|
-
return randnum;
|
|
393
|
-
}
|
|
394
|
-
// export function getNowDate () {
|
|
395
|
-
// // 求取当前时间的工具
|
|
396
|
-
// let myweekday = ''
|
|
397
|
-
// let year = ''
|
|
398
|
-
// let mydate = new Date()
|
|
399
|
-
// myweekday = mydate.getDay()
|
|
400
|
-
// let mymonth = mydate.getMonth() + 1
|
|
401
|
-
// let myday = mydate.getDate()
|
|
402
|
-
// let myyear = mydate.getYear()
|
|
403
|
-
// year = (myyear > 200) ? myyear : 1900 + myyear
|
|
404
|
-
// let week = ['星期日','星期一','星期二','星期三','星期四','星期五','星期日','星期六']
|
|
405
|
-
// let weekday = week[myweekday]
|
|
406
|
-
//
|
|
407
|
-
// // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
|
|
408
|
-
// return year + '年' + mymonth + '月' + myday + '日 ' + weekday
|
|
409
|
-
// }
|
|
410
|
-
//
|
|
411
|
-
// export function getImgsrc (name) {
|
|
412
|
-
// return "http://127.0.0.1:8081/images/"+name+".gif"
|
|
413
|
-
// }
|
|
414
|
-
//
|
|
415
|
-
// export var f;
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import { HttpResetClass } from 'vue-client'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export var f = {
|
|
6
|
+
id: '',
|
|
7
|
+
// role: null 如果是话务员,该值为null
|
|
8
|
+
role: 'repairman'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export var attendant = {
|
|
12
|
+
aModule: 1,
|
|
13
|
+
aChannel: 0
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// 当前登录用户的ip地址
|
|
17
|
+
export var ip = '127.0.0.1'
|
|
18
|
+
|
|
19
|
+
export function afterCallBz(id, name) {
|
|
20
|
+
let http = new HttpResetClass()
|
|
21
|
+
http.load('POST', data.voiceUrl,
|
|
22
|
+
{
|
|
23
|
+
aId: id,
|
|
24
|
+
RecordsID: '',
|
|
25
|
+
aChannel: attendant.aChannel,
|
|
26
|
+
aModule: attendant.aModule,
|
|
27
|
+
aBzType: "save",
|
|
28
|
+
bzExtra: null,
|
|
29
|
+
bzId: null,
|
|
30
|
+
aName: name
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
resolveMsg: null,
|
|
34
|
+
rejectMsg: null
|
|
35
|
+
}).then((req) => {
|
|
36
|
+
console.log("话后调用成功")
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function getDaysInOneMonth (year, month) {
|
|
41
|
+
month = parseInt(month, 10)
|
|
42
|
+
var d = new Date(year, month, 0)
|
|
43
|
+
return d.getDate()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function getAttendanceState(item, timeToWork, timeToGo) {
|
|
47
|
+
item.f_state = ''
|
|
48
|
+
if(!item.f_signin_time || !item.f_knockoff_time)
|
|
49
|
+
item.f_state = '缺勤'
|
|
50
|
+
else {
|
|
51
|
+
let signin_time = item.f_signin_time.substring(11, 16)
|
|
52
|
+
let knockoff_time = item.f_knockoff_time.substring(11, 16)
|
|
53
|
+
if(signin_time > timeToWork)
|
|
54
|
+
item.f_state = '迟到'
|
|
55
|
+
if(knockoff_time < timeToGo)
|
|
56
|
+
item.f_state = item.f_state + '早退'
|
|
57
|
+
}
|
|
58
|
+
if(!item.f_state)
|
|
59
|
+
item.f_state = '正常'
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function toStandardYearMonth() {
|
|
63
|
+
let dt = new Date()
|
|
64
|
+
let month = dt.getMonth()+1
|
|
65
|
+
return dt.getFullYear() + '-' + (month<10? '0'+ month : month)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function toStandardDateString() {
|
|
69
|
+
let dt = new Date()
|
|
70
|
+
let month = dt.getMonth()+1
|
|
71
|
+
let date = dt.getDate()
|
|
72
|
+
return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function toStandardTimeString() {
|
|
76
|
+
let dt = new Date()
|
|
77
|
+
let month = dt.getMonth()+1
|
|
78
|
+
let date = dt.getDate()
|
|
79
|
+
let hour = dt.getHours()
|
|
80
|
+
let min = dt.getMinutes()
|
|
81
|
+
let sec = dt.getSeconds()
|
|
82
|
+
return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
|
|
83
|
+
+ ' ' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
|
|
84
|
+
}
|
|
85
|
+
export function toStandardTimeStringByTimestamp(time) {
|
|
86
|
+
let dt = new Date(time)
|
|
87
|
+
let month = dt.getMonth()+1
|
|
88
|
+
let date = dt.getDate()
|
|
89
|
+
let hour = dt.getHours()
|
|
90
|
+
let min = dt.getMinutes()
|
|
91
|
+
let sec = dt.getSeconds()
|
|
92
|
+
return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
|
|
93
|
+
+ ' ' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function to3339TimeString() {
|
|
97
|
+
let dt = new Date()
|
|
98
|
+
let month = dt.getMonth()+1
|
|
99
|
+
let date = dt.getDate()
|
|
100
|
+
let hour = dt.getHours()
|
|
101
|
+
let min = dt.getMinutes()
|
|
102
|
+
let sec = dt.getSeconds()
|
|
103
|
+
return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
|
|
104
|
+
+ 'T' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function parse3339String(strDate) {
|
|
108
|
+
return new Date(
|
|
109
|
+
strDate.substr(0, 4), strDate.substr(5, 2)-1, strDate.substr(8, 2),
|
|
110
|
+
strDate.substr(11, 2), strDate.substr(14, 2), strDate.substr(17, 2)
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function format3339TimeString(dt) {
|
|
115
|
+
let month = dt.getMonth()+1
|
|
116
|
+
let date = dt.getDate()
|
|
117
|
+
let hour = dt.getHours()
|
|
118
|
+
let min = dt.getMinutes()
|
|
119
|
+
let sec = dt.getSeconds()
|
|
120
|
+
return dt.getFullYear() + '-' + (month<10? '0'+ month : month) + '-' + (date<10? '0'+ date : date)
|
|
121
|
+
+ 'T' + (hour<10? '0'+ hour : hour) + ':' + (min<10? '0'+ min : min) + ':' + (sec<10? '0'+ sec : sec)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function guid() {
|
|
125
|
+
let buf = new Uint16Array(8)
|
|
126
|
+
window.crypto.getRandomValues(buf)
|
|
127
|
+
let S4 = function(num) {
|
|
128
|
+
let ret = num.toString(16)
|
|
129
|
+
while(ret.length < 4){
|
|
130
|
+
ret = '0' + ret
|
|
131
|
+
}
|
|
132
|
+
return ret
|
|
133
|
+
}
|
|
134
|
+
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]))
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function choices(role, param, hasBlank = false, blankHint='请选择') {
|
|
138
|
+
if(role == 'view') {
|
|
139
|
+
Vue.getParams(param, [null])
|
|
140
|
+
} else {
|
|
141
|
+
let result = []
|
|
142
|
+
if(hasBlank)
|
|
143
|
+
result.push({label: blankHint, value: null})
|
|
144
|
+
if(!Vue.param || !Vue.param[param])
|
|
145
|
+
result.push({label: '请在系统设置里更新参数', value: '请在系统设置里更新参数'})
|
|
146
|
+
else {
|
|
147
|
+
//console.log(param)
|
|
148
|
+
//console.log(JSON.stringify(Vue.param))
|
|
149
|
+
let p = Vue.param[param]
|
|
150
|
+
p.forEach(function(item) {
|
|
151
|
+
result.push({label: item.name, value: item.name})
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
return result
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function required(param) {
|
|
159
|
+
if(typeof param === 'number' && param == 0)
|
|
160
|
+
return false
|
|
161
|
+
if(!param)
|
|
162
|
+
return true
|
|
163
|
+
param = param + ''
|
|
164
|
+
param = param.trim()
|
|
165
|
+
if(!param)
|
|
166
|
+
return true
|
|
167
|
+
return false
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export function isInt(n){
|
|
171
|
+
console.log('判断整数' + n)
|
|
172
|
+
return !window.isNaN(n) && n % 1 === 0
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function isFloat(n){
|
|
176
|
+
console.log('判断小数' + n)
|
|
177
|
+
return !window.isNaN(n)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// this will convert all true/false to boolean
|
|
181
|
+
export function booleanFilter(paper) {
|
|
182
|
+
for(let key in paper) {
|
|
183
|
+
if(!paper.hasOwnProperty(key))
|
|
184
|
+
continue
|
|
185
|
+
if(typeof paper[key] == "object" && paper[key] != null) {
|
|
186
|
+
booleanFilter(paper[key]);
|
|
187
|
+
} else {
|
|
188
|
+
if(paper[key] === "true" || paper[key] == "false")
|
|
189
|
+
paper[key] = (paper[key] === "true")
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
// recursively traverse through each path
|
|
194
|
+
export function ratifyPics(paper) {
|
|
195
|
+
for(let key in paper) {
|
|
196
|
+
if(key.endsWith('_path')) {
|
|
197
|
+
if(!paper[key]) {
|
|
198
|
+
paper[key] = 'rs/db/file/nopic.png'
|
|
199
|
+
} else {
|
|
200
|
+
paper[key] = 'rs/db/file/' + paper[key]
|
|
201
|
+
}
|
|
202
|
+
} else if(paper[key] !== null && typeof(paper[key]) == "object") {
|
|
203
|
+
ratifyPics(paper[key])
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// load script and other stuff
|
|
209
|
+
export function loadscript(type, fileName) {
|
|
210
|
+
return new Promise((resolve, reject)=> {
|
|
211
|
+
let element
|
|
212
|
+
if(type == 'css') {
|
|
213
|
+
element = document.createElement('link')
|
|
214
|
+
element.setAttribute("rel", "stylesheet")
|
|
215
|
+
element.setAttribute("type", "text/css")
|
|
216
|
+
element.setAttribute("href", fileName)
|
|
217
|
+
} else if(type == 'js') {
|
|
218
|
+
element = document.createElement('script')
|
|
219
|
+
element.setAttribute("type","text/javascript")
|
|
220
|
+
element.setAttribute("src", fileName)
|
|
221
|
+
}
|
|
222
|
+
if(element) {
|
|
223
|
+
element.setAttribute('async', '')
|
|
224
|
+
element.setAttribute('defer', '')
|
|
225
|
+
element.addEventListener('load', function() {
|
|
226
|
+
resolve(element)
|
|
227
|
+
console.log('load script resolved')
|
|
228
|
+
}, false)
|
|
229
|
+
element.addEventListener('error', function() {
|
|
230
|
+
reject(element)
|
|
231
|
+
console.log('load script rejected')
|
|
232
|
+
}, false)
|
|
233
|
+
document.body.appendChild(element)
|
|
234
|
+
}
|
|
235
|
+
})
|
|
236
|
+
}
|
|
237
|
+
// 不能选择器中截取掉多余的字符
|
|
238
|
+
export function orgName (name) {
|
|
239
|
+
return name.substring(10)
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function getNowDate (name) {
|
|
243
|
+
let year = ''
|
|
244
|
+
let month = ''
|
|
245
|
+
let day = ''
|
|
246
|
+
let hour = ''
|
|
247
|
+
let minutes = ''
|
|
248
|
+
let seconds = ''
|
|
249
|
+
let mydate = new Date()
|
|
250
|
+
let mymonth = mydate.getMonth() + 1
|
|
251
|
+
let myday = mydate.getDate()
|
|
252
|
+
let myyear = mydate.getYear()
|
|
253
|
+
let myhour = mydate.getHours()
|
|
254
|
+
let myminutes = mydate.getMinutes()
|
|
255
|
+
let myseconds = mydate.getSeconds()
|
|
256
|
+
year = (myyear > 200) ? myyear : 1900 + myyear
|
|
257
|
+
month = (mymonth > 9) ? mymonth : '0' + mymonth
|
|
258
|
+
day = (myday > 9) ? myday : '0' + myday
|
|
259
|
+
hour = (myhour > 9) ? myhour : '0' + myhour
|
|
260
|
+
minutes = (myminutes > 9) ? myminutes : '0' + myminutes
|
|
261
|
+
seconds = (myseconds > 9) ? myseconds : '0' + myseconds
|
|
262
|
+
// document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
|
|
263
|
+
return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
|
|
264
|
+
}
|
|
265
|
+
// 数组深度复制
|
|
266
|
+
export function deepcopy (obj) {
|
|
267
|
+
let out = []
|
|
268
|
+
let len = obj.length
|
|
269
|
+
for (let i = 0; i < len; i++) {
|
|
270
|
+
if (obj[i] instanceof Array) {
|
|
271
|
+
out[i] = deepcopy(obj[i])
|
|
272
|
+
} else {
|
|
273
|
+
if (typeof obj[i] === 'object') {
|
|
274
|
+
out[i] = Object.assign({}, out[i], obj[i])
|
|
275
|
+
} else {
|
|
276
|
+
out[i] = obj[i]
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return out
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export function dateDescripte (date) {
|
|
284
|
+
let nowTime = new Date().getTime()
|
|
285
|
+
let oldTime = new Date(date).getTime()
|
|
286
|
+
let timeDiff = nowTime - oldTime
|
|
287
|
+
// 规则说明
|
|
288
|
+
// 小于等于2分钟为刚刚
|
|
289
|
+
// 大于2分钟小于等于1小时为取整的分钟前(例如:35分钟前)
|
|
290
|
+
// 大于1小时小于等于24小时为取整的小时前(例如:15小时前)
|
|
291
|
+
// 大于24小时小于等于30天为取整的天前(例如:12天前)
|
|
292
|
+
// 大于30天小于等于12月为取整的月前,月份统一为30天一月,不做额外处理(例如:3个月前)
|
|
293
|
+
// 大于365取整的年前,(例如:2年前)
|
|
294
|
+
let minute = 1000 * 60
|
|
295
|
+
let hour = minute * 60
|
|
296
|
+
let day = hour * 24
|
|
297
|
+
let month = day * 30
|
|
298
|
+
let year = month * 12
|
|
299
|
+
let des = ''
|
|
300
|
+
if (timeDiff <= minute * 2) {
|
|
301
|
+
des = '刚刚'
|
|
302
|
+
} else if (minute * 2 < timeDiff && timeDiff < hour) {
|
|
303
|
+
des = `${Math.floor(timeDiff / minute)}分钟前`
|
|
304
|
+
} else if (hour < timeDiff && timeDiff <= day) {
|
|
305
|
+
des = `${Math.floor(timeDiff / hour)}小时前`
|
|
306
|
+
} else if (day < timeDiff && timeDiff <= month) {
|
|
307
|
+
des = `${Math.floor(timeDiff / day)}天前`
|
|
308
|
+
} else if (month < timeDiff && timeDiff <= year) {
|
|
309
|
+
des = `${Math.floor(timeDiff / month)}个月前`
|
|
310
|
+
} else if (year < timeDiff) {
|
|
311
|
+
des = `${Math.floor(timeDiff / year)}年前`
|
|
312
|
+
}
|
|
313
|
+
return des
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// 通过地址栏的参数获取参数内容
|
|
317
|
+
export function getUrlParames (param) {
|
|
318
|
+
var query = window.location.search
|
|
319
|
+
var iLen = param.length
|
|
320
|
+
var iStart = query.indexOf(param)
|
|
321
|
+
if (iStart === -1) {
|
|
322
|
+
return ''
|
|
323
|
+
}
|
|
324
|
+
iStart += iLen + 1
|
|
325
|
+
var iEnd = query.indexOf('&', iStart)
|
|
326
|
+
if (iEnd === -1) {
|
|
327
|
+
return query.substring(iStart)
|
|
328
|
+
}
|
|
329
|
+
return query.substring(iStart, iEnd)
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// 从地址栏获取加密的参数
|
|
333
|
+
export function getUrlCompileParames (param) {
|
|
334
|
+
var query = uncompileStr(window.location.search.slice(1, window.location.search.length))
|
|
335
|
+
var iLen = param.length
|
|
336
|
+
var iStart = query.indexOf(param)
|
|
337
|
+
if (iStart === -1) {
|
|
338
|
+
return ''
|
|
339
|
+
}
|
|
340
|
+
iStart += iLen + 1
|
|
341
|
+
var iEnd = query.indexOf('&', iStart)
|
|
342
|
+
if (iEnd === -1) {
|
|
343
|
+
return query.substring(iStart)
|
|
344
|
+
}
|
|
345
|
+
return query.substring(iStart, iEnd)
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// 对字符串进行加密
|
|
349
|
+
export function compileStr (code) {
|
|
350
|
+
let c = String.fromCharCode(code.charCodeAt(0) + code.length)
|
|
351
|
+
for (let i = 1; i < code.length; i++) {
|
|
352
|
+
c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1))
|
|
353
|
+
}
|
|
354
|
+
return escape(c)
|
|
355
|
+
}
|
|
356
|
+
// 字符串进行解密
|
|
357
|
+
export function uncompileStr (code) {
|
|
358
|
+
code = unescape(code)
|
|
359
|
+
let c = String.fromCharCode(code.charCodeAt(0) - code.length)
|
|
360
|
+
for (var i = 1; i < code.length; i++) {
|
|
361
|
+
c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1))
|
|
362
|
+
}
|
|
363
|
+
return c
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export function getCurrentTime () {
|
|
367
|
+
return Date.parse(new Date());
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export function uuid() {
|
|
371
|
+
var s = [];
|
|
372
|
+
var hexDigits = "0123456789abcdef";
|
|
373
|
+
for (var i = 0; i < 36; i++) {
|
|
374
|
+
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
|
375
|
+
}
|
|
376
|
+
s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
|
|
377
|
+
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
|
|
378
|
+
s[8] = s[13] = s[18] = s[23] = "-";
|
|
379
|
+
|
|
380
|
+
var uuid = s.join("");
|
|
381
|
+
return uuid;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
export function randnum() {
|
|
386
|
+
var s = [];
|
|
387
|
+
var hexDigits = "0123456789abcdef";
|
|
388
|
+
for (var i = 0; i <10; i++) {
|
|
389
|
+
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
|
390
|
+
}
|
|
391
|
+
var randnum = s.join("");
|
|
392
|
+
return randnum;
|
|
393
|
+
}
|
|
394
|
+
// export function getNowDate () {
|
|
395
|
+
// // 求取当前时间的工具
|
|
396
|
+
// let myweekday = ''
|
|
397
|
+
// let year = ''
|
|
398
|
+
// let mydate = new Date()
|
|
399
|
+
// myweekday = mydate.getDay()
|
|
400
|
+
// let mymonth = mydate.getMonth() + 1
|
|
401
|
+
// let myday = mydate.getDate()
|
|
402
|
+
// let myyear = mydate.getYear()
|
|
403
|
+
// year = (myyear > 200) ? myyear : 1900 + myyear
|
|
404
|
+
// let week = ['星期日','星期一','星期二','星期三','星期四','星期五','星期日','星期六']
|
|
405
|
+
// let weekday = week[myweekday]
|
|
406
|
+
//
|
|
407
|
+
// // document.write("<font color=#ffffff>今天是 "+year+"年"+mymonth+"月"+myday+"日 "+weekday+"</font>");
|
|
408
|
+
// return year + '年' + mymonth + '月' + myday + '日 ' + weekday
|
|
409
|
+
// }
|
|
410
|
+
//
|
|
411
|
+
// export function getImgsrc (name) {
|
|
412
|
+
// return "http://127.0.0.1:8081/images/"+name+".gif"
|
|
413
|
+
// }
|
|
414
|
+
//
|
|
415
|
+
// export var f;
|