Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz-Vue-Mob-R7-Res
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7前端标准模板
iBiz-Vue-Mob-R7-Res
提交
117edf77
提交
117edf77
编写于
11月 12, 2020
作者:
KK
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增动画服务类 & 新增第三方震动 & 视图工具类
上级
8a67ac84
变更
3
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
93 行增加
和
1 行删除
+93
-1
animation-service.ts
src/ibiz-core/service/animation-service.ts
+68
-0
DingTalkService.ts
src/ibiz-core/third-party-service/DingTalkService.ts
+18
-1
view-tool.ts
src/utils/view-tool/view-tool.ts
+7
-0
未找到文件。
src/ibiz-core/service/animation-service.ts
0 → 100644
浏览文件 @
117edf77
import
{
ViewTool
}
from
'@/utils'
;
/**
* 动画服务类
*
* @class AnimationService
*/
export
class
AnimationService
{
/**
* 工具类
*/
public
static
$viewTool
:
ViewTool
=
ViewTool
.
getInstance
();
/**
* 长按元素拖动
*/
public
static
draggable
(
ele
:
HTMLElement
|
null
,
event
:
Function
)
{
if
(
!
ele
){
return
}
let
l
:
number
=
0
;
let
x
:
number
=
0
;
let
y
:
number
=
0
;
let
right
:
number
=
0
;
let
bottom
:
number
=
0
;
let
time
=
0
let
canMove
:
boolean
=
false
// 开始长按
ele
.
addEventListener
(
"touchstart"
,(
e
:
any
)
=>
{
l
=
e
.
srcElement
.
offsetLeft
x
=
e
.
targetTouches
[
0
].
clientX
;
y
=
e
.
targetTouches
[
0
].
clientY
;
if
(
ele
){
right
=
Number
(
ele
.
style
.
right
.
replace
(
'px'
,
""
));
bottom
=
Number
(
ele
.
style
.
bottom
.
replace
(
'px'
,
""
));
}
time
=
setTimeout
(()
=>
{
if
(
this
.
$viewTool
.
getThirdPartyName
()){
this
.
$viewTool
.
thirdPartyEvent
(
'vibrate'
,
100
);
}
else
{
// navigator.vibrate(100);
}
canMove
=
true
;
},
1000
);
})
// 开始移动
ele
.
addEventListener
(
"touchmove"
,(
e
:
any
)
=>
{
clearTimeout
(
time
);
if
(
!
canMove
){
return
}
let
_x
=
e
.
targetTouches
[
0
].
clientX
;
let
_y
=
e
.
targetTouches
[
0
].
clientY
;
let
move_x
=
(
_x
-
x
);
let
move_y
=
(
_y
-
y
);
event
(
`right:
${
right
-
move_x
}
px;bottom:
${
bottom
-
move_y
}
px`
);
})
// 开始移动
ele
.
addEventListener
(
"touchend"
,(
e
:
any
)
=>
{
clearTimeout
(
time
);
canMove
=
false
;
})
}
}
\ No newline at end of file
src/ibiz-core/third-party-service/DingTalkService.ts
浏览文件 @
117edf77
...
...
@@ -264,12 +264,24 @@ export class DingTalkService {
resolve
(
res
);
},
onFail
:
(
err
:
any
)
=>
{
// alert(JSON.stringify(err));
},
});
});
}
/**
* 震动
*/
public
vibrate
(
arg
:
any
)
:
Promise
<
any
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
dd
.
device
.
notification
.
vibrate
({
duration
:
arg
,
//震动时间,android可配置 iOS忽略
})
resolve
({});
});
}
/**
* 清楚登录用户信息
*
...
...
@@ -340,6 +352,8 @@ export class DingTalkService {
}
}
/**
* 钉钉导航栏返回事件
*
...
...
@@ -394,5 +408,8 @@ export class DingTalkService {
if
(
Object
.
is
(
tag
,
"close"
))
{
return
this
.
close
();
}
if
(
Object
.
is
(
tag
,
"vibrate"
))
{
return
this
.
vibrate
(
arg
);
}
}
}
\ No newline at end of file
src/utils/view-tool/view-tool.ts
浏览文件 @
117edf77
...
...
@@ -424,4 +424,11 @@ export class ViewTool {
public
destroyBackEvent
()
{
this
.
thirdPartyService
.
destroyBackEvent
();
}
/**
* 第三方事件
*/
public
thirdPartyEvent
(
tag
:
string
,
arg
:
any
=
{}){
this
.
thirdPartyService
.
thirdPartyEvent
(
tag
,
arg
);
}
}
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录