Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hls-easy-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
easyUI
hls-easy-ui
Commits
76c92fda
Commit
76c92fda
authored
Mar 01, 2021
by
nature
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
组建优化
parent
55b1153e
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
405 additions
and
1161 deletions
+405
-1161
hlsPopup.js
packages/common/scripts/hlsPopup.js
+326
-318
utils.js
packages/common/scripts/utils.js
+0
-0
index.js
packages/index.js
+66
-1
main.js
src/main.js
+4
-16
hlsPopup.vue
src/pages/hlsPopup.vue
+2
-2
directives.js
src/scripts/directives.js
+0
-376
elementUtil.js
src/scripts/elementUtil.js
+0
-17
filter.js
src/scripts/filter.js
+0
-40
hlsHttp.js
src/scripts/hlsHttp.js
+7
-4
hlsPopup.js
src/scripts/hlsPopup.js
+0
-351
prototype.js
src/scripts/prototype.js
+0
-36
No files found.
packages/common/scripts/hlsPopup.js
View file @
76c92fda
This diff is collapsed.
Click to expand it.
src
/scripts/utils.js
→
packages/common
/scripts/utils.js
View file @
76c92fda
File moved
packages/index.js
View file @
76c92fda
...
...
@@ -40,7 +40,33 @@ import NotifyPlugin from './components/Dialog/plugins/index'
import
NumberKeyboardPlugin
from
'./components/NumberKeyboard/index'
// styles
import
appStyle
from
'../packages/common/styles/app.core.less'
import
appStyle
from
'./common/styles/app.core.less'
import
{
showLoading
,
hideLoading
,
showLongTop
,
showLongCenter
,
showLongBottom
,
showSuccess
,
showError
,
showConfirm
,
showPopup
,
showActionSheet
,
showTime
,
showBigPicture
,
selectList
,
showNumberKeyboard
,
showNotify
}
from
'./common/scripts/hlsPopup'
import
elementUtil
from
'./common/scripts/elementUtil'
import
filter
from
'./common/scripts/filter'
import
directives
from
'./common/scripts/directives'
import
prototype
from
'./common/scripts/prototype'
import
{
getUrlParam
,
createScript
,
detectOS
}
from
'./common/scripts/utils'
import
{
timeout
,
assert
,
case2Param
,
range
,
formatNumber
,
isDef
,
isUndefined
,
isString
,
isNumber
,
isArray
,
isBoolean
,
isDate
,
isFunction
,
isNull
,
isObject
,
isRegExp
}
from
'./common/utils'
const
hlsPopup
=
{
showLoading
,
hideLoading
,
showLongTop
,
showLongCenter
,
showLongBottom
,
showSuccess
,
showError
,
showConfirm
,
showPopup
,
showActionSheet
,
showTime
,
showBigPicture
,
selectList
,
showNumberKeyboard
,
showNotify
,
}
const
version
=
'0.0.6'
...
...
@@ -82,6 +108,45 @@ export {
SelectPlugin
,
NotifyPlugin
,
NumberKeyboardPlugin
,
hlsPopup
,
showLoading
,
hideLoading
,
showActionSheet
,
showBigPicture
,
showConfirm
,
showError
,
selectList
,
showLongBottom
,
showLongCenter
,
showLongTop
,
showNotify
,
showNumberKeyborad
,
showPopup
,
showSuccess
,
showTime
,
filter
,
directives
,
prototype
,
elementUtil
,
getUrlParam
,
createScript
,
detectOS
,
timeout
,
assert
,
case2Param
,
range
,
formatNumber
,
isDef
,
isUndefined
,
isString
,
isNumber
,
isArray
,
isBoolean
,
isDate
,
isFunction
,
isNull
,
isObject
,
isRegExp
,
version
,
componentInstall
,
}
src/main.js
View file @
76c92fda
...
...
@@ -9,24 +9,9 @@ import router from './router/index'
import
flexible
from
'./common/ydui.flexible'
import
{
componentInstall
,
appStyle
}
from
'../packages/index'
import
{
componentInstall
,
appStyle
,
hlsPopup
,
directives
,
filter
,
prototype
}
from
'../packages/index'
import
component
from
'./components/index'
Vue
.
use
(
component
)
/**
* 指令
*/
import
directives
from
'./scripts/directives'
import
filter
from
'./scripts/filter'
import
'./scripts/prototype'
/**
* 弹框组件
*/
import
hlsPopup
from
'./scripts/hlsPopup'
/**
* http
...
...
@@ -37,6 +22,9 @@ import {post, get} from './scripts/hlsHttp'
import
hlsUtil
from
'./scripts/hlsUtil'
Vue
.
use
(
prototype
)
Vue
.
use
(
component
)
/** end**/
if
(
process
.
env
.
CONFIG_ENV
===
'uat'
)
{
...
...
src/pages/hlsPopup.vue
View file @
76c92fda
...
...
@@ -666,9 +666,9 @@ export default {
this
.
value
=
''
console
.
log
(
'delete'
)
},
keybo
ra
dShow
()
{
keybo
ar
dShow
()
{
let
vm
=
this
this
.
hlsPopup
.
showNumberKeybo
ra
d
({
this
.
hlsPopup
.
showNumberKeybo
ar
d
({
title
:
'数字键盘'
,
keyDown
:
(
text
)
=>
{
vm
.
onInput
(
text
)
...
...
src/scripts/directives.js
deleted
100755 → 0
View file @
55b1153e
This diff is collapsed.
Click to expand it.
src/scripts/elementUtil.js
deleted
100755 → 0
View file @
55b1153e
export
default
{
createElement
:
function
(
marker
,
tag
)
{
let
el
=
document
.
createElement
(
tag
||
'div'
)
el
.
setAttribute
(
marker
,
''
)
document
.
body
.
appendChild
(
el
)
},
removeElement
:
function
(
marker
)
{
let
el
=
document
.
querySelector
(
marker
)
||
document
.
querySelector
(
`[
${
marker
}
]`
)
if
(
el
)
{
document
.
body
.
removeChild
(
el
)
}
},
timeout
:
function
(
duration
=
0
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(
resolve
,
duration
)
})
},
}
src/scripts/filter.js
deleted
100644 → 0
View file @
55b1153e
export
default
(
Vue
)
=>
{
Vue
.
filter
(
'currency'
,
function
(
val
)
{
if
(
!
val
)
return
'0.00'
var
intPart
=
parseInt
(
Number
(
val
))
// 获取整数部分
var
intPartFormat
=
intPart
.
toString
().
replace
(
/
(\d)(?=(?:\d{3})
+$
)
/g
,
'$1,'
)
// 将整数部分逢三一断
var
floatPart
=
'.00'
// 预定义小数部分
var
value2Array
=
(
val
+
''
).
split
(
'.'
)
// =2表示数据有小数位
if
(
value2Array
.
length
===
2
)
{
floatPart
=
value2Array
[
1
].
toString
()
// 拿到小数部分
if
(
floatPart
.
length
===
1
)
{
// 补0,实际上用不着
return
intPartFormat
+
'.'
+
floatPart
+
'0'
}
else
{
return
intPartFormat
+
'.'
+
floatPart
}
}
else
{
return
intPartFormat
+
floatPart
}
})
Vue
.
filter
(
'uncurrency'
,
function
(
val
)
{
if
(
!
val
)
return
null
return
(
Number
((
val
).
replace
(
/,/gi
,
''
)))
===
0
?
null
:
Number
((
val
).
replace
(
/,/gi
,
''
))
})
Vue
.
filter
(
'datetime'
,
timestamp
=>
{
function
format
(
number
)
{
return
number
.
toString
().
padStart
(
2
,
'0'
)
}
const
date
=
new
Date
(
Number
.
parseInt
(
timestamp
,
10
))
const
YYYY
=
date
.
getFullYear
()
const
MM
=
date
.
getMonth
()
+
1
const
DD
=
date
.
getDate
()
const
hh
=
date
.
getHours
()
const
mm
=
date
.
getMinutes
()
const
ss
=
date
.
getSeconds
()
return
`
${
YYYY
}
-
${
format
(
MM
)}
-
${
format
(
DD
)}
${
format
(
hh
)}
:
${
format
(
mm
)}
:
${
format
(
ss
)}
`
})
}
src/scripts/hlsHttp.js
View file @
76c92fda
// 引入axios
import
axios
from
'axios'
import
hlsPopup
from
'./hlsPopup'
import
{
hlsPopup
}
from
'../../packages/index'
import
qs
from
'qs'
let
promiseArr
=
{}
let
cancel
=
{}
const
CancelToken
=
axios
.
CancelToken
...
...
@@ -98,9 +99,11 @@ axios.interceptors.response.use(response => {
})
axios
.
defaults
.
baseURL
=
''
axios
.
defaults
.
timeout
=
10000
axios
.
defaults
.
paramsSerializer
=
(
params
)
=>
{
return
qs
.
stringify
(
params
,
{
arrayFormat
:
'repeat'
})
}
// get请求
export
function
get
(
url
)
{
let
param
=
{}
export
function
get
(
url
,
param
=
{})
{
let
headers
=
{}
if
(
window
.
localStorage
.
access_token
)
{
headers
=
{
...
...
@@ -131,7 +134,7 @@ export function get (url) {
})
}
// post请求
export
function
post
(
url
,
param
)
{
export
function
post
(
url
,
param
=
{}
)
{
param
.
user_id
=
window
.
localStorage
.
user_id
param
.
access_token
=
window
.
localStorage
.
access_token
let
headers
=
{}
...
...
src/scripts/hlsPopup.js
deleted
100755 → 0
View file @
55b1153e
import
Vue
from
'vue'
import
{
ToastPlugin
,
AlertPlugin
,
ConfirmPlugin
,
LoadingPlugin
,
DatetimePlugin
}
from
'vux'
import
{
ActionSheetPlugin
,
ShowPicturePlugin
,
SelectPlugin
,
NotifyPlugin
,
NumberKeyboardPlugin
}
from
'../../packages/index'
Vue
.
use
(
ToastPlugin
)
Vue
.
use
(
AlertPlugin
)
Vue
.
use
(
ConfirmPlugin
)
Vue
.
use
(
LoadingPlugin
)
Vue
.
use
(
DatetimePlugin
)
Vue
.
use
(
ActionSheetPlugin
)
Vue
.
use
(
ShowPicturePlugin
)
Vue
.
use
(
SelectPlugin
)
Vue
.
use
(
NumberKeyboardPlugin
)
Vue
.
use
(
NotifyPlugin
)
export
default
{
isLoading
:
false
,
SHOW_TIMES
:
2000
,
IS_SHOW_MASK
:
true
,
/**
* 锁屏函数 超过10s后自动解屏用于防止屏幕锁死
* 自动截屏成弹出错误提示框
* @param content 锁屏内容
*/
showLoading
:
function
(
content
)
{
let
vm
=
this
Vue
.
$vux
.
loading
.
show
({
text
:
content
||
'Loading'
,
})
this
.
isLoading
=
true
// 10s后自动解屏用于防止屏幕锁死
setTimeout
(()
=>
{
if
(
vm
.
isLoading
)
{
Vue
.
$vux
.
loading
.
hide
()
vm
.
isLoading
=
false
// 弹出操作失败
/* Vue.$vux.toast.show({
text: '操作失败',
type: 'warn',
time: vm.SHOW_TIMES,
isShowMask: vm.IS_SHOW_MASK,
position: 'middle',
}) */
}
},
10000
)
},
/**
* 隐藏
*/
hideLoading
:
function
()
{
Vue
.
$vux
.
loading
.
hide
()
this
.
isLoading
=
false
},
/**
* 长时间顶部提示toast
* @param content
*/
showLongTop
:
function
(
content
)
{
let
vm
=
this
let
text
=
content
||
'操作失败'
Vue
.
$vux
.
toast
.
show
({
text
:
text
,
type
:
'text'
,
time
:
vm
.
SHOW_TIMES
,
isShowMask
:
vm
.
IS_SHOW_MASK
,
position
:
'top'
,
})
},
/**
* 长时间中部提示toast
* @param content
*/
showLongCenter
:
function
(
content
)
{
let
vm
=
this
let
text
=
content
||
'操作失败'
Vue
.
$vux
.
toast
.
show
({
text
:
text
,
type
:
'text'
,
time
:
vm
.
SHOW_TIMES
,
isShowMask
:
vm
.
IS_SHOW_MASK
,
position
:
'middle'
,
})
},
/**
* 长时间中部提示toast
* @param content
*/
showLongBottom
:
function
(
content
)
{
let
vm
=
this
let
text
=
content
||
'操作失败'
Vue
.
$vux
.
toast
.
show
({
text
:
text
,
time
:
vm
.
SHOW_TIMES
,
type
:
'text'
,
isShowMask
:
vm
.
IS_SHOW_MASK
,
position
:
'bottom'
,
})
},
/**
* 成功提示框
* @param content
*/
showSuccess
:
function
(
content
)
{
let
vm
=
this
Vue
.
$vux
.
toast
.
show
({
text
:
content
||
'操作成功'
,
time
:
vm
.
SHOW_TIMES
,
isShowMask
:
vm
.
IS_SHOW_MASK
,
type
:
'success'
,
position
:
'middle'
,
})
},
/**
* 成功提示框
* @param content
*/
showError
:
function
(
content
)
{
let
vm
=
this
Vue
.
$vux
.
toast
.
show
({
text
:
content
||
'操作失败'
,
type
:
'warn'
,
isShowMask
:
vm
.
IS_SHOW_MASK
,
time
:
vm
.
SHOW_TIMES
,
position
:
'middle'
,
})
},
/**
* 弹出是否确认的窗口
* @param confirmObject.title 标题
* @param confirmObject.content 内容
* @param confirmObject.onConfirm 确定函数
*/
showConfirm
:
function
(
confirmObject
)
{
let
def
=
{
title
:
confirmObject
.
title
||
'提示'
,
content
:
confirmObject
.
content
||
''
,
confirmText
:
'确定'
,
cancelText
:
'取消'
,
onConfirm
:
()
=>
{
confirmObject
.
onConfirm
(
1
)
},
onCancel
:
()
=>
{
confirmObject
.
onConfirm
(
0
)
},
}
Vue
.
$vux
.
confirm
.
show
(
def
)
},
/*
* 弹出确认的窗口
* @param confirmObject.title 标题
* @param confirmObject.content 内容
* @param confirmObject.onConfirm 确定函数
*
*/
showPopup
:
function
(
confirmObject
)
{
let
def
=
{
title
:
confirmObject
.
title
||
'提示'
,
content
:
confirmObject
.
content
||
''
,
confirmText
:
'确定'
,
showCancelButton
:
false
,
onConfirm
:
()
=>
{
confirmObject
.
onConfirm
()
},
}
Vue
.
$vux
.
confirm
.
show
(
def
)
},
/**
* @param actionObject.titleText 弹出框的标题可空
* @param actionObject.callback 点击按钮的回调函数 回传buttonArray数组下标
* @param actionObject.buttonArray 按钮数组支持[string,string],[object,object],
* 当为后一种是 object为{text:'拍照',type:'primary'},type支持 primary,warn,disabled
*
* {
* titleText: '照片',
* buttonArray: [{text:'拍照',type:'warn'}, {text:'从相册取',type:'primary'}],
* callback: (index) => {
* alert(index);
* }
* }
*
* {
* buttonArray: ['拍照','从相册取'],
* callback: (index) => {
* alert(index);
* }
* }
*
*/
showActionSheet
:
function
(
actionObject
)
{
if
(
typeof
actionObject
===
'object'
)
{
let
buttons
=
[]
for
(
let
i
=
0
;
i
<
actionObject
.
buttonArray
.
length
;
i
++
)
{
if
(
typeof
actionObject
.
buttonArray
[
i
]
===
'object'
)
{
buttons
.
push
({
text
:
actionObject
.
buttonArray
[
i
].
text
,
type
:
actionObject
.
buttonArray
[
i
].
type
,
callback
:
actionObject
.
callback
,
})
}
else
{
buttons
.
push
({
text
:
actionObject
.
buttonArray
[
i
],
callback
:
actionObject
.
callback
,
})
}
}
ActionSheetPlugin
.
show
({
title
:
actionObject
.
titleText
||
''
,
buttons
:
buttons
,
})
}
},
/**
* 时间选择函数
* @param timeObject.nowDate 当前展示的时间 可不填
* @param timeObject.format 时间格式支持不支持秒
* @param timeObject.callback 点击确定的回调函数
*
*/
showTime
:
function
(
timeObject
)
{
let
date
=
new
Date
().
format
(
'yyyy-MM-dd'
)
let
format
=
'YYYY-MM-DD'
if
(
timeObject
.
nowDate
)
{
date
=
timeObject
.
nowDate
}
if
(
timeObject
.
format
)
{
format
=
timeObject
.
format
||
'YYYY-MM-DD'
}
Vue
.
$vux
.
datetime
.
show
({
cancelText
:
'取消'
,
confirmText
:
'确定'
,
minYear
:
'1900'
,
maxYear
:
'2200'
,
format
:
format
,
value
:
date
,
onConfirm
(
val
)
{
timeObject
.
callback
(
val
)
},
})
},
/**
* 图片放大预览
* @param imgObject.imgUrl
*/
showBigPicture
:
function
(
imgObject
)
{
if
(
typeof
imgObject
===
'object'
)
{
ShowPicturePlugin
.
show
({
imgUrl
:
imgObject
.
imgUrl
,
imgOriginalUrl
:
imgObject
.
imgOriginalUrl
,
imgSize
:
imgObject
.
imgSize
,
width
:
imgObject
.
width
,
imgList
:
imgObject
.
imgList
||
[],
startPosition
:
imgObject
.
startPosition
,
loadSuccess
:
imgObject
.
loadSuccess
,
})
}
},
/**
* 下拉框 支持级联操作 需指定 parent 属性
* @param selectOption.list Array [{"code": "NP","code_name": "个人"}]
* @param selectOption.code String "bp_type"
* @param selectOption.object Object 当前数据对象
* @param selectOption.returnItem function 回调函数返回index与object
* var bp_class_list = [
* {
* "code": "NP",
* "code_name": "个人"
* },{
* "code": "NP1",
* "code_name": "个人1"
* }];
* hlsPopup.selectList({
* list: bp_class_list,
* code: 'bp_type',
* object: {},
* returnItem: function (index, obj) {
* console.log(obj)
* }
* })
*
*/
selectList
:
function
(
selectOption
)
{
if
(
typeof
selectOption
===
'object'
)
{
let
list
=
[]
let
length
=
selectOption
.
list
.
length
vum
.
forEach
(
selectOption
.
list
,
function
(
date
,
index
,
array
)
{
list
.
push
({
value
:
date
.
code
,
name
:
date
.
code_name
,
parent
:
date
.
parent
,
})
if
(
index
===
(
length
-
1
))
{
SelectPlugin
.
show
({
list
:
list
,
callBack
:
selectOption
.
returnItem
,
code
:
selectOption
.
code
,
object
:
selectOption
.
object
,
multiple
:
selectOption
.
multiple
,
})
}
})
}
},
/**
* 弹出数字键盘
* @param keyboardObject.title 键盘的title
* @param keyboardObject.closeButtonText 键盘的关闭按钮文字
* @param keyboardObject.keyDown 普通按键按下去事件
* @param keyboardObject.keyDelete 删除按键按下去事件
*/
showNumberKeyborad
:
function
(
keyboardObject
)
{
if
(
typeof
keyboardObject
===
'object'
)
{
NumberKeyboardPlugin
.
show
({
title
:
keyboardObject
.
title
,
closeButtonText
:
keyboardObject
.
closeButtonText
,
extraKey
:
keyboardObject
.
extraKey
||
'.'
,
keyDown
:
function
(
text
)
{
keyboardObject
.
keyDown
(
text
)
},
keyDelete
:
function
()
{
keyboardObject
.
keyDelete
()
// console.log('delete')
},
})
}
},
/**
* 弹出Notify
* @param notifyObject.content 内容
* @param notifyObject.position 位置
* @param notifyObject.time 显示时长
* @param notifyObject.type 类型 success warning default
*/
showNotify
:
function
(
notifyObject
)
{
if
(
typeof
notifyObject
===
'object'
)
{
NotifyPlugin
.
show
({
show
:
true
,
content
:
notifyObject
.
content
,
position
:
notifyObject
.
position
||
'top'
,
time
:
notifyObject
.
time
||
3000
,
type
:
notifyObject
.
type
||
'default'
,
})
}
},
}
src/scripts/prototype.js
deleted
100755 → 0
View file @
55b1153e
/**
*
* @param fmt
* @returns {*}
* @constructor
*/
Date
.
prototype
.
format
=
function
(
fmt
)
{
// eslint-disable-line
var
o
=
{
'M+'
:
this
.
getMonth
()
+
1
,
// 月份
'd+'
:
this
.
getDate
(),
// 日
'h+'
:
this
.
getHours
(),
// 小时
'm+'
:
this
.
getMinutes
(),
// 分
's+'
:
this
.
getSeconds
(),
// 秒
'q+'
:
Math
.
floor
((
this
.
getMonth
()
+
3
)
/
3
),
// 季度
'S'
:
this
.
getMilliseconds
(),
// 毫秒
}
if
(
/
(
y+
)
/
.
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
this
.
getFullYear
()
+
''
).
substr
(
4
-
RegExp
.
$1
.
length
))
for
(
var
k
in
o
)
{
if
(
new
RegExp
(
'('
+
k
+
')'
).
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
RegExp
.
$1
.
length
===
1
)
?
(
o
[
k
])
:
((
'00'
+
o
[
k
]).
substr
((
''
+
o
[
k
]).
length
)))
}
return
fmt
}
/**
* 移除数组的某个元素
* @param dx 下标
* @returns {boolean}
*/
Array
.
prototype
.
remove
=
function
(
dx
)
{
// eslint-disable-line
if
(
isNaN
(
dx
)
||
dx
>
this
.
length
)
{
return
false
}
for
(
var
i
=
0
,
n
=
0
;
i
<
this
.
length
;
i
++
)
{
if
(
this
[
i
]
!==
this
[
dx
])
{
this
[
n
++
]
=
this
[
i
]
}
}
this
.
length
-=
1
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment