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
Show 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
import
Vue
from
'vue'
import
{
ToastPlugin
,
AlertPlugin
,
ConfirmPlugin
,
LoadingPlugin
,
DatetimePlugin
}
from
'vux'
import
ActionSheet
from
'../../components/ActionSheet/index'
import
{
ToastPlugin
,
AlertPlugin
,
ConfirmPlugin
,
LoadingPlugin
,
DatetimePlugin
}
from
'vux'
/*
import ActionSheet from '../../components/ActionSheet/index'
import ShowPicture from '../../components/ShowPicture/index'
import Select from '../../components/select/index'
import
Notify
from
'../../components/Dialog/plugins/index'
import Notify from '../../components/Dialog/plugins/index'
*/
// import HlsModal from '../../components/Modal/index'
import
NumberKeyboard
from
'../../components/NumberKeyboard/index'
import
{
ActionSheetPlugin
,
NotifyPlugin
,
NumberKeyboardPlugin
,
SelectPlugin
,
ShowPicturePlugin
}
from
'../../index'
Vue
.
use
(
ToastPlugin
)
Vue
.
use
(
AlertPlugin
)
Vue
.
use
(
ConfirmPlugin
)
Vue
.
use
(
LoadingPlugin
)
Vue
.
use
(
DatetimePlugin
)
Vue
.
use
(
ActionSheet
)
Vue
.
use
(
ShowPicture
)
Vue
.
use
(
Select
)
Vue
.
use
(
NumberKeyboard
)
Vue
.
use
(
Notify
)
// Vue.prototype.HlsModal = window.HlsModal = HlsModal
export
default
{
// Vue.prototype.HlsModal = window.HlsModal = HlsModal
isLoading
:
false
,
SHOW_TIMES
:
2000
,
IS_SHOW_MASK
:
true
,
/**
/**
* 锁屏函数 超过10s后自动解屏用于防止屏幕锁死
* 自动截屏成弹出错误提示框
* @param content 锁屏内容
*/
showLoading
:
function
(
content
)
{
export
function
showLoading
(
content
=
''
)
{
let
vm
=
this
Vue
.
$vux
.
loading
.
show
({
text
:
content
||
'Loading'
,
...
...
@@ -45,102 +38,109 @@ export default {
/* Vue.$vux.toast.show({
text: '操作失败',
type: 'warn',
time:
vm.SHOW_TIMES
,
isShowMask:
vm.IS_SHOW_MASK
,
time:
2000
,
isShowMask:
true
,
position: 'middle',
}) */
}
},
10000
)
},
/**
}
/**
* 隐藏
*/
hideLoading
:
function
()
{
export
function
hideLoading
()
{
Vue
.
$vux
.
loading
.
hide
()
this
.
isLoading
=
false
},
}
/**
/**
* 长时间顶部提示toast
* @param content
* @param time
*/
showLongTop
:
function
(
content
)
{
let
vm
=
this
export
function
showLongTop
(
content
=
''
,
time
=
2000
)
{
let
text
=
content
||
'操作失败'
Vue
.
$vux
.
toast
.
show
({
text
:
text
,
type
:
'text'
,
time
:
vm
.
SHOW_TIMES
,
isShowMask
:
vm
.
IS_SHOW_MASK
,
time
:
time
,
isShowMask
:
true
,
position
:
'top'
,
})
},
}
/**
/**
* 长时间中部提示toast
* @param content
* @param time
*/
showLongCenter
:
function
(
content
)
{
let
vm
=
this
export
function
showLongCenter
(
content
=
''
,
time
=
2000
)
{
let
text
=
content
||
'操作失败'
Vue
.
$vux
.
toast
.
show
({
text
:
text
,
type
:
'text'
,
time
:
vm
.
SHOW_TIMES
,
isShowMask
:
vm
.
IS_SHOW_MASK
,
time
:
time
,
isShowMask
:
true
,
position
:
'middle'
,
})
},
/**
}
/**
* 长时间中部提示toast
* @param content
* @param time
*/
showLongBottom
:
function
(
content
)
{
let
vm
=
this
export
function
showLongBottom
(
content
=
''
,
time
=
2000
)
{
let
text
=
content
||
'操作失败'
Vue
.
$vux
.
toast
.
show
({
text
:
text
,
time
:
vm
.
SHOW_TIMES
,
time
:
time
,
type
:
'text'
,
isShowMask
:
vm
.
IS_SHOW_MASK
,
isShowMask
:
true
,
position
:
'bottom'
,
})
},
/**
}
/**
* 成功提示框
* @param content
* @param time
*/
showSuccess
:
function
(
content
)
{
let
vm
=
this
export
function
showSuccess
(
content
=
''
,
time
=
2000
)
{
Vue
.
$vux
.
toast
.
show
({
text
:
content
||
'操作成功'
,
time
:
vm
.
SHOW_TIMES
,
isShowMask
:
vm
.
IS_SHOW_MASK
,
time
:
time
,
isShowMask
:
true
,
type
:
'success'
,
position
:
'middle'
,
})
},
/**
}
/**
* 成功提示框
* @param content
* @param time
*/
showError
:
function
(
content
)
{
let
vm
=
this
export
function
showError
(
content
=
''
,
time
=
2000
)
{
Vue
.
$vux
.
toast
.
show
({
text
:
content
||
'操作失败'
,
type
:
'warn'
,
isShowMask
:
vm
.
IS_SHOW_MASK
,
time
:
vm
.
SHOW_TIMES
,
isShowMask
:
true
,
time
:
time
,
position
:
'middle'
,
})
},
/**
}
/**
* 弹出是否确认的窗口
* @param confirmObject.title 标题
* @param confirmObject.content 内容
* @param confirmObject.onConfirm 确定函数
*/
showConfirm
:
function
(
confirmObject
)
{
export
function
showConfirm
(
confirmObject
)
{
let
def
=
{
title
:
confirmObject
.
title
||
'提示'
,
content
:
confirmObject
.
content
||
''
,
...
...
@@ -154,15 +154,16 @@ export default {
},
}
Vue
.
$vux
.
confirm
.
show
(
def
)
},
/*
}
/*
* 弹出确认的窗口
* @param confirmObject.title 标题
* @param confirmObject.content 内容
* @param confirmObject.onConfirm 确定函数
*
*/
showPopup
:
function
(
confirmObject
)
{
export
function
showPopup
(
confirmObject
)
{
let
def
=
{
title
:
confirmObject
.
title
||
'提示'
,
content
:
confirmObject
.
content
||
''
,
...
...
@@ -173,8 +174,9 @@ export default {
},
}
Vue
.
$vux
.
confirm
.
show
(
def
)
},
/**
}
/**
* @param actionObject.titleText 弹出框的标题可空
* @param actionObject.callback 点击按钮的回调函数 回传buttonArray数组下标
* @param actionObject.buttonArray 按钮数组支持[string,string],[object,object],
...
...
@@ -196,7 +198,7 @@ export default {
* }
*
*/
showActionSheet
:
function
(
actionObject
)
{
export
function
showActionSheet
(
actionObject
)
{
if
(
typeof
actionObject
===
'object'
)
{
let
buttons
=
[]
for
(
let
i
=
0
;
i
<
actionObject
.
buttonArray
.
length
;
i
++
)
{
...
...
@@ -213,28 +215,28 @@ export default {
})
}
}
ActionSheet
.
show
({
ActionSheetPlugin
.
show
({
title
:
actionObject
.
titleText
||
''
,
buttons
:
buttons
,
})
}
},
}
/**
/**
* 时间选择函数
* @param timeObject.nowDate 当前展示的时间 可不填
* @param timeObject.format 时间格式支持不支持秒
* @param timeObject.callback 点击确定的回调函数
*
*/
showTime
:
function
(
timeObject
)
{
export
function
showTime
(
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
format
=
timeObject
.
format
||
'YYYY-MM-DD'
}
Vue
.
$vux
.
datetime
.
show
({
cancelText
:
'取消'
,
...
...
@@ -247,23 +249,27 @@ export default {
timeObject
.
callback
(
val
)
},
})
},
/**
}
/**
* 图片放大预览
* @param imgObject.imgUrl
*/
showBigPicture
:
function
(
imgObject
)
{
export
function
showBigPicture
(
imgObject
)
{
if
(
typeof
imgObject
===
'object'
)
{
ShowPicture
.
show
({
ShowPicturePlugin
.
show
({
imgUrl
:
imgObject
.
imgUrl
,
imgOriginalUrl
:
imgObject
.
imgOriginalUrl
,
imgSize
:
imgObject
.
imgSize
,
width
:
imgObject
.
width
,
imgList
:
imgObject
.
imgList
,
imgList
:
imgObject
.
imgList
||
[]
,
startPosition
:
imgObject
.
startPosition
,
loadSuccess
:
imgObject
.
loadSuccess
,
})
}
},
}
/**
/**
* 下拉框 支持级联操作 需指定 parent 属性
* @param selectOption.list Array [{"code": "NP","code_name": "个人"}]
* @param selectOption.code String "bp_type"
...
...
@@ -287,37 +293,39 @@ export default {
* })
*
*/
selectList
:
function
(
selectOption
)
{
export
function
selectList
(
selectOption
)
{
if
(
typeof
selectOption
===
'object'
)
{
let
list
=
[]
let
length
=
selectOption
.
list
.
length
vum
.
forEach
(
selectOption
.
list
,
function
(
date
,
index
,
array
)
{
selectOption
.
list
.
forEach
(
function
(
date
,
index
,
array
)
{
list
.
push
({
value
:
date
.
code
,
name
:
date
.
code_name
,
parent
:
date
.
parent
,
})
if
(
index
===
(
length
-
1
))
{
Select
.
show
({
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
)
{
export
function
showNumberKeyboard
(
keyboardObject
)
{
if
(
typeof
keyboardObject
===
'object'
)
{
NumberKeyboard
.
show
({
NumberKeyboardPlugin
.
show
({
title
:
keyboardObject
.
title
,
closeButtonText
:
keyboardObject
.
closeButtonText
,
extraKey
:
keyboardObject
.
extraKey
||
'.'
,
...
...
@@ -330,17 +338,18 @@ export default {
},
})
}
},
/**
}
/**
* 弹出Notify
* @param notifyObject.content 内容
* @param notifyObject.position 位置
* @param notifyObject.time 显示时长
* @param notifyObject.type 类型 success warning default
*/
showNotify
:
function
(
notifyObject
)
{
export
function
showNotify
(
notifyObject
)
{
if
(
typeof
notifyObject
===
'object'
)
{
Notify
.
show
({
NotifyPlugin
.
show
({
show
:
true
,
content
:
notifyObject
.
content
,
position
:
notifyObject
.
position
||
'top'
,
...
...
@@ -348,5 +357,4 @@ export default {
type
:
notifyObject
.
type
||
'default'
,
})
}
},
}
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
import
Autosize
from
'autosize'
function
vueTouch
(
el
,
binding
,
type
)
{
var
_this
=
this
this
.
obj
=
el
this
.
binding
=
binding
this
.
touchType
=
type
this
.
vueTouches
=
{
x
:
0
,
y
:
0
}
this
.
vueMoves
=
true
this
.
vueLeave
=
true
this
.
longTouch
=
true
this
.
vueCallBack
=
typeof
(
binding
.
value
)
===
'object'
?
binding
.
value
.
fn
:
binding
.
value
this
.
obj
.
addEventListener
(
'touchstart'
,
function
(
e
)
{
_this
.
start
(
e
)
},
false
)
this
.
obj
.
addEventListener
(
'touchend'
,
function
(
e
)
{
_this
.
end
(
e
)
},
false
)
this
.
obj
.
addEventListener
(
'touchmove'
,
function
(
e
)
{
_this
.
move
(
e
)
},
false
)
};
vueTouch
.
prototype
=
{
start
:
function
(
e
)
{
this
.
vueMoves
=
true
this
.
vueLeave
=
true
this
.
longTouch
=
true
this
.
vueTouches
=
{
x
:
e
.
changedTouches
[
0
].
pageX
,
y
:
e
.
changedTouches
[
0
].
pageY
}
this
.
time
=
setTimeout
(
function
()
{
if
(
this
.
vueLeave
&&
this
.
vueMoves
)
{
this
.
touchType
===
'longtap'
&&
this
.
vueCallBack
(
this
.
binding
.
value
,
e
)
this
.
longTouch
=
false
}
}.
bind
(
this
),
1000
)
},
end
:
function
(
e
)
{
var
disX
=
e
.
changedTouches
[
0
].
pageX
-
this
.
vueTouches
.
x
var
disY
=
e
.
changedTouches
[
0
].
pageY
-
this
.
vueTouches
.
y
clearTimeout
(
this
.
time
)
if
(
Math
.
abs
(
disX
)
>
100
||
Math
.
abs
(
disY
)
>
100
)
{
this
.
touchType
===
'swipe'
&&
this
.
vueCallBack
(
this
.
binding
.
value
,
e
)
if
(
Math
.
abs
(
disX
)
>
Math
.
abs
(
disY
))
{
if
(
disX
>
100
)
{
this
.
touchType
===
'swiperight'
&&
this
.
vueCallBack
(
this
.
binding
.
value
,
e
)
}
if
(
disX
<
-
100
)
{
this
.
touchType
===
'swipeleft'
&&
this
.
vueCallBack
(
this
.
binding
.
value
,
e
)
}
}
else
{
if
(
disY
>
100
)
{
this
.
touchType
===
'swipedown'
&&
this
.
vueCallBack
(
this
.
binding
.
value
,
e
)
}
if
(
disY
<
-
100
)
{
this
.
touchType
===
'swipeup'
&&
this
.
vueCallBack
(
this
.
binding
.
value
,
e
)
}
}
}
else
{
if
(
this
.
longTouch
&&
this
.
vueMoves
)
{
this
.
touchType
===
'tap'
&&
this
.
vueCallBack
(
this
.
binding
.
value
,
e
)
this
.
vueLeave
=
false
}
}
},
move
:
function
(
e
)
{
this
.
vueMoves
=
false
},
}
// prop.autosize
export
default
(
Vue
)
=>
{
Vue
.
directive
(
'focus'
,
{
// 自动获取鼠标焦点
inserted
:
function
(
el
)
{
el
.
focus
()
},
})
Vue
.
directive
(
'tap'
,
{
// 点击事件
bind
:
function
(
el
,
binding
)
{
new
vueTouch
(
el
,
binding
,
'tap'
)
// eslint-disable-line
},
})
Vue
.
directive
(
'swipe'
,
{
// 滑动事件
bind
:
function
(
el
,
binding
)
{
new
vueTouch
(
el
,
binding
,
'swipe'
)
// eslint-disable-line
},
})
Vue
.
directive
(
'swipeleft'
,
{
// 左滑事件
bind
:
function
(
el
,
binding
)
{
new
vueTouch
(
el
,
binding
,
'swipeleft'
)
// eslint-disable-line
},
})
Vue
.
directive
(
'swiperight'
,
{
// 右滑事件
bind
:
function
(
el
,
binding
)
{
new
vueTouch
(
el
,
binding
,
'swiperight'
)
// eslint-disable-line
},
})
Vue
.
directive
(
'swipedown'
,
{
// 下滑事件
bind
:
function
(
el
,
binding
)
{
new
vueTouch
(
el
,
binding
,
'swipedown'
)
// eslint-disable-line
},
})
Vue
.
directive
(
'swipeup'
,
{
// 上滑事件
bind
:
function
(
el
,
binding
)
{
new
vueTouch
(
el
,
binding
,
'swipeup'
)
// eslint-disable-line
},
})
Vue
.
directive
(
'longtap'
,
{
// 长按事件
bind
:
function
(
el
,
binding
)
{
new
vueTouch
(
el
,
binding
,
'longtap'
)
// eslint-disable-line
},
})
Vue
.
directive
(
'hlsImgZoom'
,
{
componentUpdated
:
function
(
element
)
{
var
elWidth
,
elHeight
// mode : 'pinch' or 'swipe'
var
mode
=
''
// distance between two touche points (mode : 'pinch')
var
distance
=
0
var
initialDistance
=
0
// image scaling
var
scale
=
1
var
relativeScale
=
1
var
initialScale
=
1
var
maxScale
=
5
if
(
isNaN
(
maxScale
)
||
maxScale
<=
1
)
{
maxScale
=
3
}
// position of the upper left corner of the element
var
positionX
=
0
var
positionY
=
0
var
initialPositionX
=
0
var
initialPositionY
=
0
// central origin (mode : 'pinch')
var
originX
=
0
var
originY
=
0
// start coordinate and amount of movement (mode : 'swipe')
var
startX
=
0
var
startY
=
0
var
moveX
=
0
var
moveY
=
0
var
image
=
new
Image
()
image
.
onload
=
function
()
{
elWidth
=
element
.
clientWidth
elHeight
=
element
.
clientHeight
element
.
style
.
webkitTransformOrigin
=
'0px 0px 0px'
element
.
style
.
transformOrigin
=
'0px 0px 0px'
element
.
addEventListener
(
'touchstart'
,
touchstartHandler
)
element
.
addEventListener
(
'touchmove'
,
touchmoveHandler
)
element
.
addEventListener
(
'touchend'
,
touchendHandler
)
}
image
.
src
=
element
.
src
/**
* @param {object} evt
*/
function
touchstartHandler
(
evt
)
{
var
touches
=
evt
.
originalEvent
?
evt
.
originalEvent
.
touches
:
evt
.
touches
startX
=
touches
[
0
].
clientX
startY
=
touches
[
0
].
clientY
initialPositionX
=
positionX
initialPositionY
=
positionY
moveX
=
0
moveY
=
0
}
/**
* @param {object} evt
*/
function
touchmoveHandler
(
evt
)
{
var
touches
=
evt
.
originalEvent
?
evt
.
originalEvent
.
touches
:
evt
.
touches
if
(
mode
===
''
)
{
if
(
touches
.
length
===
1
&&
scale
>
1
)
{
mode
=
'swipe'
}
else
if
(
touches
.
length
===
2
)
{
mode
=
'pinch'
initialScale
=
scale
initialDistance
=
getDistance
(
touches
)
originX
=
touches
[
0
].
clientX
-
parseInt
((
touches
[
0
].
clientX
-
touches
[
1
].
clientX
)
/
2
,
10
)
-
element
.
offsetLeft
-
initialPositionX
originY
=
touches
[
0
].
clientY
-
parseInt
((
touches
[
0
].
clientY
-
touches
[
1
].
clientY
)
/
2
,
10
)
-
element
.
offsetTop
-
initialPositionY
}
}
if
(
mode
===
'swipe'
)
{
evt
.
preventDefault
()
moveX
=
touches
[
0
].
clientX
-
startX
moveY
=
touches
[
0
].
clientY
-
startY
positionX
=
initialPositionX
+
moveX
positionY
=
initialPositionY
+
moveY
transformElement
()
}
else
if
(
mode
===
'pinch'
)
{
evt
.
preventDefault
()
distance
=
getDistance
(
touches
)
relativeScale
=
distance
/
initialDistance
scale
=
relativeScale
*
initialScale
positionX
=
originX
*
(
1
-
relativeScale
)
+
initialPositionX
+
moveX
positionY
=
originY
*
(
1
-
relativeScale
)
+
initialPositionY
+
moveY
transformElement
()
}
}
/**
* @param {object} evt
*/
function
touchendHandler
(
evt
)
{
var
touches
=
evt
.
originalEvent
?
evt
.
originalEvent
.
touches
:
evt
.
touches
if
(
mode
===
''
||
touches
.
length
>
0
)
{
return
}
if
(
scale
<
1
)
{
scale
=
1
positionX
=
0
positionY
=
0
}
else
if
(
scale
>
maxScale
)
{
scale
=
maxScale
relativeScale
=
scale
/
initialScale
positionX
=
originX
*
(
1
-
relativeScale
)
+
initialPositionX
+
moveX
positionY
=
originY
*
(
1
-
relativeScale
)
+
initialPositionY
+
moveY
}
else
{
if
(
positionX
>
0
)
{
positionX
=
0
}
else
if
(
positionX
<
elWidth
*
(
1
-
scale
))
{
positionX
=
elWidth
*
(
1
-
scale
)
}
if
(
positionY
>
0
)
{
positionY
=
0
}
else
if
(
positionY
<
elHeight
*
(
1
-
scale
))
{
positionY
=
elHeight
*
(
1
-
scale
)
}
}
transformElement
(
0.1
)
mode
=
''
}
/**
* @param {Array} touches
* @return {number}
*/
function
getDistance
(
touches
)
{
var
d
=
Math
.
sqrt
(
Math
.
pow
(
touches
[
0
].
clientX
-
touches
[
1
].
clientX
,
2
)
+
Math
.
pow
(
touches
[
0
].
clientY
-
touches
[
1
].
clientY
,
2
))
return
parseInt
(
d
,
10
)
}
/**
* @param {number} [duration]
*/
function
transformElement
(
duration
)
{
var
transition
=
duration
?
'all cubic-bezier(0,0,.5,1) '
+
duration
+
's'
:
''
var
matrixArray
=
[
scale
,
0
,
0
,
scale
,
positionX
,
positionY
]
var
matrix
=
'matrix('
+
matrixArray
.
join
(
','
)
+
')'
element
.
style
.
webkitTransition
=
transition
element
.
style
.
transition
=
transition
element
.
style
.
webkitTransform
=
matrix
+
' translate3d(0,0,0)'
element
.
style
.
transform
=
matrix
+
' translate3d(0,0,0)'
}
},
})
Vue
.
directive
(
'keyboardAttach'
,
{
// 监听键盘
inserted
:
function
(
el
,
binding
)
{
let
KEYBOARD_OPEN_CSS
=
'foot-keyboard-open'
function
keyboardHeight
()
{
let
innerHeight
=
window
.
innerHeight
let
innerWidth
=
window
.
innerWidth
if
(
vum
.
Platform
.
isIOS
())
{
if
(
!
vum
.
Platform
.
isWebView
())
{
return
266
}
if
(
innerWidth
>=
375
&&
innerHeight
>=
812
)
{
return
330
}
return
300
}
else
{
return
275
}
}
let
height
=
keyboardHeight
()
function
hasClass
(
element
,
csName
)
{
return
element
.
className
.
match
(
RegExp
(
'(
\\
s|^)'
+
csName
+
'(
\\
s|$)'
))
}
function
addClass
(
element
,
csName
)
{
if
(
!
hasClass
(
element
,
csName
))
{
element
.
className
+=
' '
+
csName
}
element
.
style
.
marginBottom
=
height
+
'px'
}
function
removeClass
(
element
,
csName
)
{
if
(
hasClass
(
element
,
csName
))
{
element
.
classList
.
remove
(
csName
)
}
element
.
style
.
marginBottom
=
0
+
'px'
}
window
.
addEventListener
(
'native.keyboardshow'
,
function
(
e
)
{
addClass
(
el
,
KEYBOARD_OPEN_CSS
)
})
window
.
addEventListener
(
'native.keyboardhide'
,
function
(
e
)
{
removeClass
(
el
,
KEYBOARD_OPEN_CSS
)
})
},
unbind
:
function
(
el
,
binding
)
{
let
KEYBOARD_OPEN_CSS
=
'foot-keyboard-open'
function
hasClass
(
element
,
csName
)
{
return
element
.
className
.
match
(
RegExp
(
'(
\\
s|^)'
+
csName
+
'(
\\
s|$)'
))
}
function
removeClass
(
element
,
csName
)
{
if
(
hasClass
(
element
,
csName
))
{
element
.
classList
.
remove
(
csName
)
}
element
.
style
.
marginBottom
=
0
+
'px'
}
removeClass
(
el
,
KEYBOARD_OPEN_CSS
)
window
.
removeEventListener
(
'native.keyboardshow'
,
function
(
e
)
{
})
window
.
removeEventListener
(
'native.keyboardhide'
,
function
(
e
)
{
})
},
})
Vue
.
directive
(
'autoSize'
,
{
bind
:
function
(
el
,
binding
)
{
if
(
el
.
nodeName
===
'TEXTAREA'
)
{
Autosize
(
el
)
}
el
.
addEventListener
(
'oninput'
,
function
(
e
)
{
Autosize
.
update
(
el
)
})
},
unbind
:
function
(
el
,
binding
)
{
Autosize
.
update
(
el
)
Autosize
.
destroy
(
el
)
el
.
removeEventListener
(
'oninput'
,
function
(
e
)
{
})
},
})
}
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