Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
X
xzf_uniapp-wechat-web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
李智书
xzf_uniapp-wechat-web
Commits
75cdb723
Commit
75cdb723
authored
Nov 21, 2024
by
袁玲利
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
游戏排行榜
parent
3b1498ac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
0 deletions
+99
-0
src/pages/gameOrder/gameOrder.vue
src/pages/gameOrder/gameOrder.vue
+99
-0
No files found.
src/pages/gameOrder/gameOrder.vue
View file @
75cdb723
...
@@ -16,6 +16,10 @@
...
@@ -16,6 +16,10 @@
</
template
>
</
template
>
<
script
>
<
script
>
var
gHost
=
"
https://
"
+
window
.
location
.
host
;
if
(
window
.
location
.
protocol
!=
"
https:
"
)
{
gHost
=
"
https://uat-pay.xiaopay.net
"
;
}
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
...
@@ -99,22 +103,117 @@ export default {
...
@@ -99,22 +103,117 @@ export default {
appId
:
"
wxb5612f7e17786c46
"
,
appId
:
"
wxb5612f7e17786c46
"
,
},
},
],
],
params
:
{
userid
:
""
,
behavior
:
""
,
// 打开页面viewPage 、用户点击click 、 用户停留duration 、用户离开页面closePage
data
:
""
,
// 行为数据:填页面名称、点击元素标识、停留时长(5s/10s/30s/60s/5min/10min/30min)
},
timer
:
null
,
second
:
0
,
};
};
},
},
mounted
()
{
mounted
()
{
this
.
games
.
sort
(()
=>
0.5
-
Math
.
random
());
this
.
games
.
sort
(()
=>
0.5
-
Math
.
random
());
this
.
params
.
userId
=
getQueryParams
(
"
userId
"
);
this
.
params
.
behavior
=
"
viewPage
"
;
this
.
params
.
data
=
"
gameOrder
"
;
this
.
GameStatistics
();
this
.
init
();
},
},
methods
:
{
methods
:
{
init
()
{
const
self
=
this
;
this
.
timer
=
setInterval
(()
=>
{
this
.
second
+=
1
;
console
.
log
(
this
.
second
,
"
xxxxxxxxx
"
);
if
(
this
.
second
==
5
)
{
self
.
params
.
behavior
=
"
duration
"
;
self
.
params
.
data
=
"
5s
"
;
self
.
GameStatistics
();
}
else
if
(
this
.
second
==
10
)
{
self
.
params
.
behavior
=
"
duration
"
;
self
.
params
.
data
=
"
10s
"
;
self
.
GameStatistics
();
}
else
if
(
this
.
second
==
30
)
{
self
.
params
.
behavior
=
"
duration
"
;
self
.
params
.
data
=
"
30s
"
;
self
.
GameStatistics
();
}
else
if
(
this
.
second
==
60
)
{
self
.
params
.
behavior
=
"
duration
"
;
self
.
params
.
data
=
"
60s
"
;
self
.
GameStatistics
();
}
else
if
(
this
.
second
==
300
)
{
self
.
params
.
behavior
=
"
duration
"
;
self
.
params
.
data
=
"
5min
"
;
self
.
GameStatistics
();
}
else
if
(
this
.
second
==
600
)
{
self
.
params
.
behavior
=
"
duration
"
;
self
.
params
.
data
=
"
10min
"
;
self
.
GameStatistics
();
}
else
if
(
this
.
second
==
18000
)
{
self
.
params
.
behavior
=
"
duration
"
;
self
.
params
.
data
=
"
30min
"
;
self
.
GameStatistics
();
}
},
1000
);
},
//获取参数
getQueryParams
(
params
)
{
let
href
=
window
.
location
.
href
;
let
query
=
href
.
substring
(
href
.
indexOf
(
"
?
"
)
+
1
);
let
vars
=
query
.
split
(
"
&
"
);
for
(
var
i
=
0
;
i
<
vars
.
length
;
i
++
)
{
let
pair
=
vars
[
i
].
split
(
"
=
"
);
if
(
pair
[
0
]
==
params
)
{
return
pair
[
1
];
}
}
return
false
;
},
// 小程序游戏统计接口
async
GameStatistics
()
{
try
{
let
url
=
gHost
+
"
/wechat/svweapp/GameStatistics
"
;
let
data
=
await
this
.
$http
.
post
(
{
url
:
url
,
},
this
.
params
);
if
(
data
.
code
!=
200
)
{
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
data
.
msg
,
});
return
;
}
}
catch
(
e
)
{
console
.
log
(
e
);
}
},
launchGame
(
game
)
{
launchGame
(
game
)
{
// uni.navigateToMiniProgram({
// uni.navigateToMiniProgram({
// appId: game.appId,
// appId: game.appId,
// });
// });
this
.
params
.
behavior
=
"
click
"
;
this
.
params
.
data
=
game
.
appId
;
this
.
GameStatistics
();
jWeixin
.
miniProgram
.
navigateTo
({
jWeixin
.
miniProgram
.
navigateTo
({
url
:
"
/pages_subpackB/pages/game/main?appId=
"
+
game
.
appId
,
url
:
"
/pages_subpackB/pages/game/main?appId=
"
+
game
.
appId
,
});
});
// 这里可以添加游戏启动逻辑,比如跳转到游戏页面,或打开游戏等
// 这里可以添加游戏启动逻辑,比如跳转到游戏页面,或打开游戏等
},
},
},
},
onUnload
()
{
this
.
params
.
behavior
=
"
viewPage
"
;
this
.
params
.
data
=
"
closePage
"
;
this
.
GameStatistics
();
if
(
this
.
timer
!==
null
)
{
clearInterval
(
this
.
timer
);
this
.
timer
=
null
;
}
},
};
};
</
script
>
</
script
>
...
...
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