Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
new_taobao
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
wildfirecode13
new_taobao
Commits
59eec3b1
Commit
59eec3b1
authored
Oct 17, 2020
by
zhangjinzhou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码暂存
parent
221ae749
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
194 additions
and
133 deletions
+194
-133
pagegamemain.js
taobao_jn/client/pages/pagegamemain/pagegamemain.js
+131
-96
pagepageindex.js
taobao_jn/client/pages/pagepageindex/pagepageindex.js
+63
-37
No files found.
taobao_jn/client/pages/pagegamemain/pagegamemain.js
View file @
59eec3b1
This diff is collapsed.
Click to expand it.
taobao_jn/client/pages/pagepageindex/pagepageindex.js
View file @
59eec3b1
...
...
@@ -262,8 +262,6 @@ Page({
app
.
openId
=
data
.
openId
;
// app.step = data.inviteStep;
this
.
getActivityBaseInfoById
();
this
.
checkLastGameStat
();
}
},
/*
...
...
@@ -369,6 +367,11 @@ Page({
this
.
canOpenGamePage
=
true
;
this
.
start
=
true
;
my
.
hideLoading
();
let
lastGameInfo
=
data
.
lastGameInfo
;
lastGameInfo
[
"step"
]
=
data
.
step
;
this
.
checkLastGameStat
(
lastGameInfo
);
}
},
...
...
@@ -510,44 +513,67 @@ Page({
}
},
//检测上局的状态
async
checkLastGameStat
()
{
console
.
log
(
"checkLastGameStat======>"
,
1
);
let
key
=
'jn_'
+
app
.
openId
+
'_gamedata'
;
let
lgamedata
=
await
new
Promise
((
res
,
rej
)
=>
{
my
.
getStorage
({
key
:
key
,
success
:
(
result
)
=>
{
console
.
log
(
"checkLastGameStat======>suc"
,
result
);
res
(
result
.
data
);
},
fail
:
()
=>
{
rej
(
false
);
},
complete
:
()
=>
{
async
checkLastGameStat
(
data
)
{
//纯本地的
// let key = 'jn_' + app.openId + '_gamedata';
// let lgamedata = await new Promise((res, rej) => {
// my.getStorage({
// key: key,
// success: (result) => {
// res(result.data);
// },
// fail: () => {
// rej(false);
// },
// complete: () => {
}
});
})
//
}
//
});
//
})
console
.
log
(
"checkLastGameStat======>"
,
2
,
lgamedata
);
if
(
lgamedata
)
{
const
{
endtime
,
overequest
}
=
lgamedata
;
//上局结算过了,不用管
if
(
!
overequest
)
{
let
querystr
=
""
;
let
{
roomdata
,
roomnums
,
tooltime
,
canwin
,
step
,
startime
,
avatar2
,
avatar3
,
avatar4
,
othername
,
overequest
}
=
lgamedata
;
const
nowTime
=
await
getServerTime
().
catch
(()
=>
{
});
console
.
log
(
"checkLastGameStat======>"
,
3
,
endtime
-
nowTime
);
console
.
log
(
"checkLastGameStat======>"
,
4
,
endtime
,
nowTime
);
if
(
nowTime
&&
endtime
>
nowTime
)
{
//上局未结束,继续游戏
querystr
+=
"laststat=go"
;
}
else
{
//上局结束,未结算,去结算
querystr
=
"laststat=over"
;
}
my
.
redirectTo
({
url
:
'/pages/pagegamemain/pagegamemain?'
+
querystr
});
// if (lgamedata) {
// const { endtime, overequest } = lgamedata;
// //上局结算过了,不用管
// if (!overequest) {
// let querystr = "";
// let { roomdata, roomnums, tooltime, canwin, step, startime, avatar2, avatar3, avatar4, othername, overequest } = lgamedata;
// const nowTime = await getServerTime().catch(() => { });
// if (nowTime && endtime > nowTime) {//上局未结束,继续游戏
// querystr += "laststat=go";
// } else {//上局结束,未结算,去结算
// querystr = "laststat=over";
// }
// my.redirectTo({
// url: '/pages/pagegamemain/pagegamemain?' + querystr
// });
// }
// }
//服务器的
let
{
joinGameStartTime
,
joinGameEndTime
,
toolStartTime
,
toolEndTime
,
winRate
,
propsCD
,
step
}
=
data
;
if
(
joinGameStartTime
&&
joinGameEndTime
)
{
let
nowTime
=
await
getServerTime
().
catch
(()
=>
{
});
if
(
!
nowTime
){
nowTime
=
Date
.
now
();
}
let
toolcd
=
Math
.
ceil
((
toolEndTime
-
toolStartTime
)
/
1000
);
let
tooless
=
Math
.
ceil
((
toolEndTime
-
nowTime
)
/
1000
);
if
(
tooless
<
0
){
tooless
=
0
;
}
let
querystr
=
"step="
+
step
+
"&start="
+
joinGameStartTime
+
"&end="
+
joinGameEndTime
+
"&gl="
+
winRate
+
"&toolcd="
+
toolcd
+
"&tooless="
+
tooless
;
if
(
nowTime
&&
joinGameEndTime
>
nowTime
)
{
//上局未结束,继续游戏
querystr
+=
"&laststat=go"
;
}
else
{
//上局结束,未结算,去结算
querystr
+=
"&laststat=over"
;
}
my
.
redirectTo
({
url
:
'/pages/pagegamemain/pagegamemain?'
+
querystr
});
}
}
...
...
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