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({
...
@@ -262,8 +262,6 @@ Page({
app
.
openId
=
data
.
openId
;
app
.
openId
=
data
.
openId
;
// app.step = data.inviteStep;
// app.step = data.inviteStep;
this
.
getActivityBaseInfoById
();
this
.
getActivityBaseInfoById
();
this
.
checkLastGameStat
();
}
}
},
},
/*
/*
...
@@ -369,6 +367,11 @@ Page({
...
@@ -369,6 +367,11 @@ Page({
this
.
canOpenGamePage
=
true
;
this
.
canOpenGamePage
=
true
;
this
.
start
=
true
;
this
.
start
=
true
;
my
.
hideLoading
();
my
.
hideLoading
();
let
lastGameInfo
=
data
.
lastGameInfo
;
lastGameInfo
[
"step"
]
=
data
.
step
;
this
.
checkLastGameStat
(
lastGameInfo
);
}
}
},
},
...
@@ -510,44 +513,67 @@ Page({
...
@@ -510,44 +513,67 @@ Page({
}
}
},
},
//检测上局的状态
//检测上局的状态
async
checkLastGameStat
()
{
async
checkLastGameStat
(
data
)
{
console
.
log
(
"checkLastGameStat======>"
,
1
);
//纯本地的
let
key
=
'jn_'
+
app
.
openId
+
'_gamedata'
;
// let key = 'jn_' + app.openId + '_gamedata';
let
lgamedata
=
await
new
Promise
((
res
,
rej
)
=>
{
// let lgamedata = await new Promise((res, rej) => {
my
.
getStorage
({
// my.getStorage({
key
:
key
,
// key: key,
success
:
(
result
)
=>
{
// success: (result) => {
console
.
log
(
"checkLastGameStat======>suc"
,
result
);
// res(result.data);
res
(
result
.
data
);
// },
},
// fail: () => {
fail
:
()
=>
{
// rej(false);
rej
(
false
);
// },
},
// complete: () => {
complete
:
()
=>
{
}
//
}
});
//
});
})
//
})
console
.
log
(
"checkLastGameStat======>"
,
2
,
lgamedata
);
// if (lgamedata) {
if
(
lgamedata
)
{
// const { endtime, overequest } = lgamedata;
const
{
endtime
,
overequest
}
=
lgamedata
;
// //上局结算过了,不用管
//上局结算过了,不用管
// if (!overequest) {
if
(
!
overequest
)
{
// let querystr = "";
let
querystr
=
""
;
// let { roomdata, roomnums, tooltime, canwin, step, startime, avatar2, avatar3, avatar4, othername, overequest } = lgamedata;
let
{
roomdata
,
roomnums
,
tooltime
,
canwin
,
step
,
startime
,
avatar2
,
avatar3
,
avatar4
,
othername
,
overequest
}
=
lgamedata
;
// const nowTime = await getServerTime().catch(() => { });
const
nowTime
=
await
getServerTime
().
catch
(()
=>
{
});
// if (nowTime && endtime > nowTime) {//上局未结束,继续游戏
console
.
log
(
"checkLastGameStat======>"
,
3
,
endtime
-
nowTime
);
// querystr += "laststat=go";
console
.
log
(
"checkLastGameStat======>"
,
4
,
endtime
,
nowTime
);
// } else {//上局结束,未结算,去结算
if
(
nowTime
&&
endtime
>
nowTime
)
{
//上局未结束,继续游戏
// querystr = "laststat=over";
querystr
+=
"laststat=go"
;
// }
}
else
{
//上局结束,未结算,去结算
// my.redirectTo({
querystr
=
"laststat=over"
;
// url: '/pages/pagegamemain/pagegamemain?' + querystr
}
// });
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