Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6992ccde
authored
Apr 08, 2024
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
oss
1 parent
5e974d89
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
4 deletions
api/module/common.js
mixin/click.js
api/module/common.js
View file @
6992ccd
import
http
from
'../request/http'
import
http
from
"../request/http"
;
module
.
exports
=
{
search
(
data
)
{
return
http
.
post
({
method
:
'scrm.api.carlife.weapp.homeSearch.search'
,
method
:
"scrm.api.carlife.weapp.homeSearch.search"
,
pageSize
:
10
,
...
data
,
})
})
;
},
}
\ No newline at end of file
getToken
(
data
)
{
return
http
.
post
({
method
:
"dj.api.mindworkplate.badge.getToken"
,
projectName
:
"mindworkplate"
,
sessionId
:
"2ae39c60-60c9-4096-901a-68da57068cd9"
,
});
},
};
mixin/click.js
0 → 100644
View file @
6992ccd
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 11:28:48
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-04-08 13:47:00
* @FilePath: \gl_tape\mixin\click.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
const
recorderManager
=
uni
.
getRecorderManager
();
export
default
{
data
()
{
return
{
timer
:
null
,
times
:
0
,
timeout
:
10
*
60
,
reaction
:
10
,
};
},
onShow
()
{
window
.
addEventListener
(
"devicemotion"
,
this
.
handleDeviceMotion
);
},
onHide
()
{
window
.
removeEventListener
(
"devicemotion"
,
this
.
handleDeviceMotion
);
},
created
()
{
recorderManager
.
start
();
this
.
initTime
();
document
.
addEventListener
(
"visibilitychange"
,
this
.
handleVisibilityChange
);
},
methods
:
{
handleDeviceMotion
(
event
)
{
let
acceleration
=
event
.
accelerationIncludingGravity
;
let
brightness
=
Math
.
abs
(
acceleration
.
x
)
+
Math
.
abs
(
acceleration
.
y
)
+
Math
.
abs
(
acceleration
.
z
);
if
(
brightness
<
10
)
{
// 假设<10的值代表屏幕可能变暗了
console
.
log
(
"屏幕可能熄灭了"
);
// 在这里执行你需要的操作
}
},
//监听点击事件
initTime
()
{
this
.
timer
=
setInterval
(()
=>
{
this
.
times
++
;
console
.
log
(
this
.
times
);
if
(
this
.
times
>=
this
.
timeout
)
{
this
.
showToast
();
}
if
(
this
.
times
>=
this
.
reaction
+
this
.
timeout
)
{
this
.
handleEnd
();
}
},
1000
);
},
handleTouchStart
()
{
this
.
times
=
0
;
},
},
handleVisibilityChange
()
{
if
(
document
.
visibilityState
===
"hidden"
)
{
// 屏幕被关闭
console
.
log
(
"Screen closed"
);
}
},
beforeCreate
()
{
clearInterval
(
this
.
timer
);
this
.
timer
=
null
;
},
};
Write
Preview
Markdown
is supported
Attach a file
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 post a comment