Commit 96d25d31 authored by Edwise's avatar Edwise 🍷

版本过低

parent e8f63d73
......@@ -94,7 +94,7 @@
transform-origin: 0px 0px 0px;
}
.invitelistmodal .inviteList .inviteItem .inviteId{
width: 300rpx;
width: 380rpx;
height: 40rpx;
opacity: 1;
display: block;
......
......@@ -12,6 +12,7 @@ const {
getUserAddress,
setClipboard
} = tbcc.tb;
const changeStr = '***'
Component({
props: {},
data: {
......@@ -48,9 +49,9 @@ Component({
let len = data.list[i].userNick.length;
let str = data.list[i].userNick;
if(len<=4){
data.list[i].userNick = str.substr(0,0)+this.changeStr+str.substr(len-1,len-1);
data.list[i].userNick = str.substr(0,0)+changeStr+str.substr(len-1,len-1);
}else{
data.list[i].userNick = str.substr(0,Math.floor((len-3)/2))+this.changeStr+str.substr(len-Math.floor((len-3)/2)-1,len-1)
data.list[i].userNick = str.substr(0,Math.floor((len-3)/2))+changeStr+str.substr(len-Math.floor((len-3)/2)-1,len-1)
}
}
console.log(data.list);
......
......@@ -5,576 +5,609 @@ import API from '../../api';
import * as FYGE from "fyge-tbmini";
import * as SvgaParser from "svga-parser";
import {
modalType,
SHARE_CONFIG
modalType,
SHARE_CONFIG
} from '../../tbcc-sdk/lib/constants';
const app = getApp();
const {
tbcc
tbcc
} = app;
const {
commonToast,
getAuthUserInfo,
navigateToOutside,
getSystemInfo,
checkShopFavoredStatus,
getServerTime,
commonToast,
getAuthUserInfo,
navigateToOutside,
getSystemInfo,
checkShopFavoredStatus,
getServerTime,
} = tbcc.tb;
const snowSrc = "cloud://B975D7429522C2AA89E6FD651523DC57//snow.svga";
const fireSrc = "cloud://F03F0071205084B1A58F9C560010C076//fire.svga"
const checkSystem = async () => {
const {
version
} = await getSystemInfo();
console.log('version', version);
return tbcc.utils.versionCompare(version, '9.8.0');
const {
version
} = await getSystemInfo();
console.log('version', version);
return tbcc.utils.versionCompare(version, '9.8.0');
}
Page({
gameConfigList: {},
favoredStatus: false,
goVip: false,
start: false,
data: {
indexPrize: [{
id: 1,
name: '301+热皮',
url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4d7c687df8mh9y&id=624231380919"
}, {
id: 2,
name: '502++热皮',
url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4e60687do2J7Y4&id=625018335779"
}, {
id: 3,
name: '500E内裤',
url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4e60687do2J7Y4&id=560474460284"
}, {
id: 4,
name: '311S袜子',
url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4e60687do2J7Y4&id=600583964263"
}],
/**弹窗状态 */
modalStatus: 0,
/**当前温暖值 */
curWarms: '',
/**当前排名 */
curRank: '',
/**当前游戏阶段 */
curGameStep: 1,
/**活动结束后排行榜奖励信息 */
rankPrize: {},
/**游戏信息 */
gameInfo: {},
/**5系解锁需要场数 */
unLock5Times: 0,
/**7系解锁需要场数 */
unLock7Times: 0,
},
navigateToOutsideGoodsDetail(e) {
const {
item
} = e.target.dataset;
navigateToOutside(item.url);
},
onLoad(query) {
if (query) {
app.inviteId = query.openId;
app.step = query.inviteStep;
}
console.log('onload=>query', query);
this.setData({
resList: resList
});
},
onReady() {
// this.openModal("inviteList")
my._showIndexModal = (type) => {
this.setData({
modalStatus: modalType[type] || 0
});
}
my._hideIndexModal = () => {
this.setData({
modalStatus: 0
})
}
checkSystem().then(r => {
if (r) {
this.getAuth();
}
})
// this.getAuth();
},
canvasOnReady() {
console.log("onCanvas Ready")
this.createMain();
},
/**添加canvas,用来显示svga */
async createMain() {
console.log(123)
var canvas = await new Promise((r) => {
my.createCanvas({
id: 'canvas',
success: (ccc) => {
const dpr = my.getSystemInfoSync().pixelRatio
const windowWidth = my.getSystemInfoSync().windowWidth;
const windowHeight = my.getSystemInfoSync().windowHeight;
ccc.width = windowWidth * dpr + dpr; //重新修改会有误差
ccc.height = windowHeight * dpr + dpr;
r(ccc);
}
})
})
console.log(111)
FYGE.initedByCanvas(canvas)
var sysInfo = my.getSystemInfoSync()
//建舞台
var stage = new FYGE.Stage(
canvas,
750, //设计宽度,按设计搞给的就行
1624, //设计高度
sysInfo && sysInfo.windowWidth || document.body.clientWidth,
sysInfo && sysInfo.windowHeight || document.body.clientHeight,
FYGE.RENDERER_TYPE.CANVAS
);
var con = stage.addChild(new FYGE.Container())
con.y = stage.viewRect.y;
//stage初始化
stage.addEventListener(FYGE.Event.INIT_STAGE, () => {
SvgaParser.loadSvga(
fireSrc,
(v) => {
console.log("svga" + v);
var mv = con.addChild(new FYGE.MovieClip(v));
mv.x = 275;
mv.y = 780;
console.log("svgmv", mv)
},
(err) => {
console.log("aa", err);
tbVersionOk: false,
gameConfigList: {},
favoredStatus: false,
goVip: false,
start: false,
data: {
indexPrize: [{
id: 1,
name: '301+热皮',
url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4d7c687df8mh9y&id=624231380919"
}, {
id: 2,
name: '502++热皮',
url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4e60687do2J7Y4&id=625018335779"
}, {
id: 3,
name: '500E内裤',
url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4e60687do2J7Y4&id=560474460284"
}, {
id: 4,
name: '311S袜子',
url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4e60687do2J7Y4&id=600583964263"
}],
/**弹窗状态 */
modalStatus: 0,
/**当前温暖值 */
curWarms: '',
/**当前排名 */
curRank: '',
/**当前游戏阶段 */
curGameStep: 1,
/**活动结束后排行榜奖励信息 */
rankPrize: {},
/**游戏信息 */
gameInfo: {},
/**5系解锁需要场数 */
unLock5Times: 0,
/**7系解锁需要场数 */
unLock7Times: 0,
},
navigateToOutsideGoodsDetail(e) {
if (!this.tbVersionOk) {
commonToast("为保证活动正常参与,请升级淘宝版本");
return;
}
)
SvgaParser.loadSvga(
snowSrc,
(v) => {
console.log("svga" + v);
var mv = con.addChild(new FYGE.MovieClip(v));
mv.x = 175;
mv.y = 590;
console.log("svgmv", mv)
},
(err) => {
console.log("bb", err);
const {
item
} = e.target.dataset;
navigateToOutside(item.url);
},
onLoad(query) {
if (query) {
app.inviteId = query.openId;
app.step = query.inviteStep;
}
)
}, this);
console.log('onload=>query', query);
this.setData({
resList: resList
});
//循环
loop();
},
function loop() {
FYGE.Tween.flush()
stage.flush();
FYGE.getRequestAnimationFrame()(loop);
}
},
/**
* 获取用户授权信息
*/
async getAuth() {
console.log(my.getSystemInfoSync());
my.showLoading();
const userInfo = await getAuthUserInfo().catch(err => {
console.log('未授权成功', err);
// my.hideLoading();
});
if (userInfo) {
// my.hideLoading();
console.log('userInfo', userInfo);
const {
nickName,
avatar
} = userInfo;
app.nickName = nickName;
app.avatar = avatar;
// const favoredStatus = await checkShopFavoredStatus(3035493001).catch(err => {
// console.log('查询关注店铺状态失败', err);
// });
this.favoredStatus = await checkShopFavoredStatus(3035493001).catch(r => {
console.log("关注不对劲")
}) || false;
// my.tb.checkShopFavoredStatus({
// id: 3035493001,
// success: (res) => {
// if (res.isFavor) {
// this.favoredStatus = true
// } else {
// this.favoredStatus = false;
// }
// }
// })
// this.judgeDoHelp();
console.log("关注店铺", this.favoredStatus)
this.login();
}
},
/**
* 登录接口
*/
async login() {
// my.showLoading();
const {
nickName,
avatar
} = app;
const {
success,
data
} = await API.login({
userNick: nickName,
avatar,
isFollow: this.favoredStatus,
inviteId: app.inviteId,
inviteStep: app.step
}).catch(res => {
// my.hideLoading();
if (res.code == "220003") {
this.getRankPrize();
} else {
commonToast(res && res.message);
}
}) || {};
if (success) {
// my.hideLoading();
app.openId = data.openId;
// app.step = data.inviteStep;
this.getActivityBaseInfoById();
}
},
/*
* 获取活动信息
*/
async getActivityBaseInfoById() {
// my.showLoading();
const {
success,
data
} = await API.getActivityBaseInfoById().catch(r => {
// my.hideLoading();
commonToast(r && r.message)
}) || {};
if (success) {
const nowTime = await getServerTime().catch(() => { });
if (nowTime && data.startTime > nowTime) {
my.hideLoading();
my.showToast({
content: '活动未开始',
duration: 5000,
});
return;
}
this.gameConfigList = data.gameConfigList;
// my.hideLoading();
app.activityInfo = data;
this.judgeDoHelp();
}
},
async getRankPrize() {
const {
success,
data
} = await API.getGameInfo().catch(r => {
my.hideLoading();
commonToast(r && r.message);
}) || {};
if (success) {
let str = data.rank > 500 ? '500+' : data.rank
this.setData({
gameInfo: data,
curWarms: data.warms + '',
curRank: str,
curGameStep: data.step,
unLock5Times: data.promotionNum1,
unLock7Times: data.promotionNum2
})
if (data.rankPrize && data.rankPrize.type == 5) {
this.setData({
modalStatus: modalType['ranknoprize']
})
} else if (data.rankPrize && data.rankPrize.type != 5 && data.rankPrize.image && data.rankPrize.image.length > 0) {
this.setData({
modalStatus: modalType['rankprize']
})
}
}
my.hideLoading();
},
/**判断是否是助力 */
judgeDoHelp() {
console.log("啦啦啦", typeof (app.inviteId), app.inviteId, typeof (app.openId), app.openId)
if (app.inviteId && app.inviteId != app.openId) {
this.setData({
modalStatus: modalType['invite']
})
}
this.updateGameInfo();
onReady() {
// this.openModal("inviteList")
my._showIndexModal = (type) => {
this.setData({
modalStatus: modalType[type] || 0
});
}
my._hideIndexModal = () => {
this.setData({
modalStatus: 0
})
}
},
/**更新游戏信息 */
async updateGameInfo() {
// my.showLoading();
const {
success,
data
} = await API.getGameInfo().catch(r => {
my.hideLoading();
commonToast(r && r.message);
}) || {};
if (success) {
let str = data.rank > 500 ? '500+' : data.rank
this.setData({
gameInfo: data,
curWarms: data.warms + '',
curRank: str,
curGameStep: data.step,
unLock5Times: data.promotionNum1,
unLock7Times: data.promotionNum2
})
if (data.rankPrize && data.rankPrize.type == 5) {
this.setData({
modalStatus: modalType['ranknoprize']
checkSystem().then(r => {
if (r) {
this.tbVersionOk = true;
this.getAuth();
} else {
this.tbVersionOk = false;
commonToast("为保证活动正常参与,请升级淘宝版本");
}
})
} else if (data.rankPrize && data.rankPrize.type != 5 && data.rankPrize.image && data.rankPrize.image.length > 0) {
this.setData({
modalStatus: modalType['rankprize']
// this.getAuth();
},
canvasOnReady() {
console.log("onCanvas Ready")
this.createMain();
},
/**添加canvas,用来显示svga */
async createMain() {
console.log(123)
var canvas = await new Promise((r) => {
my.createCanvas({
id: 'canvas',
success: (ccc) => {
const dpr = my.getSystemInfoSync().pixelRatio
const windowWidth = my.getSystemInfoSync().windowWidth;
const windowHeight = my.getSystemInfoSync().windowHeight;
ccc.width = windowWidth * dpr + dpr; //重新修改会有误差
ccc.height = windowHeight * dpr + dpr;
r(ccc);
}
})
})
}
this.canOpenGamePage = true;
this.start = true;
my.hideLoading();
console.log(111)
FYGE.initedByCanvas(canvas)
var sysInfo = my.getSystemInfoSync()
//建舞台
var stage = new FYGE.Stage(
canvas,
750, //设计宽度,按设计搞给的就行
1624, //设计高度
sysInfo && sysInfo.windowWidth || document.body.clientWidth,
sysInfo && sysInfo.windowHeight || document.body.clientHeight,
FYGE.RENDERER_TYPE.CANVAS
);
var con = stage.addChild(new FYGE.Container())
con.y = stage.viewRect.y;
//stage初始化
stage.addEventListener(FYGE.Event.INIT_STAGE, () => {
SvgaParser.loadSvga(
fireSrc,
(v) => {
console.log("svga" + v);
var mv = con.addChild(new FYGE.MovieClip(v));
mv.x = 275;
mv.y = 780;
console.log("svgmv", mv)
},
(err) => {
console.log("aa", err);
}
)
SvgaParser.loadSvga(
snowSrc,
(v) => {
console.log("svga" + v);
var mv = con.addChild(new FYGE.MovieClip(v));
mv.x = 175;
mv.y = 590;
console.log("svgmv", mv)
},
(err) => {
console.log("bb", err);
}
)
}, this);
//循环
loop();
function loop() {
FYGE.Tween.flush()
stage.flush();
FYGE.getRequestAnimationFrame()(loop);
}
},
/**
* 获取用户授权信息
*/
async getAuth() {
console.log(my.getSystemInfoSync());
my.showLoading();
const userInfo = await getAuthUserInfo().catch(err => {
console.log('未授权成功', err);
// my.hideLoading();
});
if (userInfo) {
// my.hideLoading();
console.log('userInfo', userInfo);
const {
nickName,
avatar
} = userInfo;
app.nickName = nickName;
app.avatar = avatar;
// const favoredStatus = await checkShopFavoredStatus(3035493001).catch(err => {
// console.log('查询关注店铺状态失败', err);
// });
this.favoredStatus = await checkShopFavoredStatus(3035493001).catch(r => {
console.log("关注不对劲")
}) || false;
// my.tb.checkShopFavoredStatus({
// id: 3035493001,
// success: (res) => {
// if (res.isFavor) {
// this.favoredStatus = true
// } else {
// this.favoredStatus = false;
// }
// }
// })
// this.judgeDoHelp();
console.log("关注店铺", this.favoredStatus)
this.login();
}
},
/**
* 登录接口
*/
async login() {
// my.showLoading();
const {
nickName,
avatar
} = app;
const {
success,
data
} = await API.login({
userNick: nickName,
avatar,
isFollow: this.favoredStatus,
inviteId: app.inviteId,
inviteStep: app.step
}).catch(res => {
// my.hideLoading();
if (res && res.code && res.code == "220003") {
this.getRankPrize();
} else {
commonToast(res && res.message);
}
}) || {};
if (success) {
// my.hideLoading();
app.openId = data.openId;
// app.step = data.inviteStep;
this.getActivityBaseInfoById();
}
},
/*
* 获取活动信息
*/
async getActivityBaseInfoById() {
// my.showLoading();
const {
success,
data
} = await API.getActivityBaseInfoById().catch(r => {
// my.hideLoading();
commonToast(r && r.message)
}) || {};
if (success) {
const nowTime = await getServerTime().catch(() => {});
if (nowTime && data.startTime > nowTime) {
my.hideLoading();
my.showToast({
content: '活动未开始',
duration: 5000,
});
return;
}
this.gameConfigList = data.gameConfigList;
// my.hideLoading();
app.activityInfo = data;
this.judgeDoHelp();
}
},
async getRankPrize() {
const {
success,
data
} = await API.getGameInfo().catch(r => {
my.hideLoading();
commonToast(r && r.message);
}) || {};
if (success) {
let str = data.rank > 500 ? '500+' : data.rank
this.setData({
gameInfo: data,
curWarms: data.warms + '',
curRank: str,
curGameStep: data.step,
unLock5Times: data.promotionNum1,
unLock7Times: data.promotionNum2
})
if (data.rankPrize && data.rankPrize.type == 5) {
this.setData({
modalStatus: modalType['ranknoprize']
})
} else if (data.rankPrize && data.rankPrize.type != 5 && data.rankPrize.image && data.rankPrize.image.length > 0) {
this.setData({
modalStatus: modalType['rankprize']
})
}
}
my.hideLoading();
},
/**判断是否是助力 */
judgeDoHelp() {
console.log("啦啦啦", typeof (app.inviteId), app.inviteId, typeof (app.openId), app.openId)
if (app.inviteId && app.inviteId != app.openId) {
this.setData({
modalStatus: modalType['invite']
})
}
this.updateGameInfo();
},
/**更新游戏信息 */
async updateGameInfo() {
// my.showLoading();
const {
success,
data
} = await API.getGameInfo().catch(r => {
my.hideLoading();
commonToast(r && r.message);
}) || {};
if (success) {
let str = data.rank > 500 ? '500+' : data.rank
this.setData({
gameInfo: data,
curWarms: data.warms + '',
curRank: str,
curGameStep: data.step,
unLock5Times: data.promotionNum1,
unLock7Times: data.promotionNum2
})
if (data.rankPrize && data.rankPrize.type == 5) {
this.setData({
modalStatus: modalType['ranknoprize']
})
} else if (data.rankPrize && data.rankPrize.type != 5 && data.rankPrize.image && data.rankPrize.image.length > 0) {
this.setData({
modalStatus: modalType['rankprize']
})
}
this.canOpenGamePage = true;
this.start = true;
my.hideLoading();
let lastGameInfo = data.lastGameInfo;
lastGameInfo["step"] = data.step;
this.checkLastGameStat(lastGameInfo);
}
let lastGameInfo = data.lastGameInfo;
lastGameInfo["step"] = data.step;
this.checkLastGameStat(lastGameInfo);
}
},
canOpenGamePage: false,
/**进入游戏页面 */
async openGamePage() {
if (!this.tbVersionOk) {
commonToast("为保证活动正常参与,请升级淘宝版本");
return;
}
if (!this.start) {
commonToast("活动已结束")
return;
}
if (!this.canOpenGamePage) return;
this.canOpenGamePage = false
my.showLoading();
const {
success,
data,
message
} = await API.doJoin({
step: this.data.curGameStep
}).catch(r => {
if (r && r.data && !r.data.isVip) {
commonToast("3s入会,即可为好友助力", 1500, () => {
this.goVip = true;
this.canOpenGamePage = true;
navigateToOutside(r.data.url);
})
} else {
this.canOpenGamePage = true;
commonToast(r && r.message)
}
my.hideLoading();
}) || {};
if (success) {
this.canOpenGamePage = true;
const winRate = this.gameConfigList[this.data.curGameStep - 1].winRate * 0.01;
const propsCD = this.gameConfigList[this.data.curGameStep - 1].propsCD;
my.redirectTo({
url: '/pages/pagegamemain/pagegamemain?' +
"step=" + this.data.curGameStep + "&start=" + data.joinGameStartTime +
"&end=" + data.joinGameEndTime + "&gl=" + winRate + "&toolcd=" + propsCD
})
my.hideLoading();
} else {
},
canOpenGamePage: false,
/**进入游戏页面 */
async openGamePage() {
if (!this.start) {
commonToast("活动已结束")
return;
}
if (!this.canOpenGamePage) return;
this.canOpenGamePage = false
my.showLoading();
const {
success,
data,
message
} = await API.doJoin({
step: this.data.curGameStep
}).catch(r => {
if (r && r.data && !r.data.isVip) {
commonToast("3s入会,即可为好友助力", 1500, () => {
this.goVip = true;
this.canOpenGamePage = true;
navigateToOutside(r.data.url);
}
console.log("点击进入游戏页面")
},
/**打开弹窗 */
openModal(e) {
if (!this.tbVersionOk) {
commonToast("为保证活动正常参与,请升级淘宝版本");
return;
}
console.log(e);
const {
item
} = e.target.dataset;
// if (!this.start && item == 'inviteList') {
// commonToast("活动已结束")
// return;
// }
// if (!this.start && item != 'rule') return;
this.setData({
modalStatus: modalType[item] || 0
});
},
/**关闭弹窗 */
closeModal(type) {
this.setData({
modalStatus: 0
})
} else {
this.canOpenGamePage = true;
commonToast(r && r.message)
}
my.hideLoading();
}) || {};
if (success) {
this.canOpenGamePage = true;
const winRate = this.gameConfigList[this.data.curGameStep - 1].winRate * 0.01;
const propsCD = this.gameConfigList[this.data.curGameStep - 1].propsCD;
my.redirectTo({
url: '/pages/pagegamemain/pagegamemain?' +
"step=" + this.data.curGameStep + "&start=" + data.joinGameStartTime +
"&end=" + data.joinGameEndTime + "&gl=" + winRate + "&toolcd=" + propsCD
})
my.hideLoading();
} else {
}
console.log("点击进入游戏页面")
},
/**打开弹窗 */
openModal(e) {
console.log(e);
const {
item
} = e.target.dataset;
if (!this.start && item == 'inviteList') {
commonToast("活动已结束")
return;
}
if (!this.start && item != 'rule') return;
this.setData({
modalStatus: modalType[item] || 0
});
},
/**关闭弹窗 */
closeModal(type) {
this.setData({
modalStatus: 0
})
},
/**点击跳转页面 */
navigateTo(e) {
const {
item
} = e.target.dataset;
if (!this.start && item == 'pagepagerank') {
commonToast("活动已结束")
return;
}
},
/**点击跳转页面 */
navigateTo(e) {
if (!this.tbVersionOk) {
commonToast("为保证活动正常参与,请升级淘宝版本");
return;
}
const {
item
} = e.target.dataset;
if (!this.start && item == 'pagepagerank') {
commonToast("活动已结束")
return;
}
my.navigateTo({
url: `/pages/${item}/${item}`
});
},
onShareAppMessage() {
// 返回自定义分享信息
let {
path,
...rest
} = SHARE_CONFIG;
console.log('app.openId', app.openId);
if (app.openId) {
path = '/pages/pagepageindex/pagepageindex' + '?openId=' + app.openId + '&inviteStep=' + this.data.curGameStep;
}
console.log('path', path)
my.navigateTo({
url: `/pages/${item}/${item}`
});
},
onShareAppMessage() {
// 返回自定义分享信息
let {
path,
...rest
} = SHARE_CONFIG;
console.log('app.openId', app.openId);
if (app.openId) {
path = '/pages/pagepageindex/pagepageindex' + '?openId=' + app.openId + '&inviteStep=' + this.data.curGameStep;
}
console.log('path', path)
return {
...rest,
path
}
},
onShow() {
if (app.isGoVip) {
this.doHelp();
}
if (this.goVip) {
this.openGamePage();
this.goVip = false;
}
},
openInviteFailedModal() {
my._showIndexModal("invitefail");
},
openInviteSuccessModal() {
my._showIndexModal("invitesuccess");
},
/**助力 */
async doHelp() {
const {
success,
data,
message
} = await API.doHelp({
inviteId: app.inviteId,
inviteStep: app.step
});
console.log("hhahahha")
if (!success) {
if (data && !data.isVip) {
commonToast("3s入会,即可为好友助力", 1500, () => {
navigateToOutside(data.url);
})
} else if (data && data.isVip) {
this.openInviteFailedModal();
} else {
commonToast(message);
}
} else {
this.openInviteSuccessModal();
}
},
//检测上局的状态
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: () => {
// }
// });
// })
// 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
// });
// }
// }
console.log("上局状态",data);
//服务器的
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(propsCD);
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
});
return {
...rest,
path
}
},
onShow() {
if (app.isGoVip) {
this.doHelp();
}
if (this.goVip) {
this.openGamePage();
this.goVip = false;
}
},
openInviteFailedModal() {
my._showIndexModal("invitefail");
},
openInviteSuccessModal() {
my._showIndexModal("invitesuccess");
},
/**助力 */
async doHelp() {
const {
success,
data,
message
} = await API.doHelp({
inviteId: app.inviteId,
inviteStep: app.step
});
console.log("hhahahha")
if (!success) {
if (data && !data.isVip) {
commonToast("3s入会,即可进行PK", 1500, () => {
navigateToOutside(data.url);
})
} else if (data && data.isVip) {
this.openInviteFailedModal();
} else {
commonToast(message);
}
} else {
this.openInviteSuccessModal();
}
},
//检测上局的状态
async checkLastGameStat(data) {
if (!this.tbVersionOk) {
commonToast("为保证活动正常参与,请升级淘宝版本");
return;
}
//纯本地的
// 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: () => {
// }
// });
// })
// 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
// });
// }
// }
console.log("上局状态", data);
//服务器的
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(propsCD);
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
});
}
}
}
});
\ No newline at end of file
......@@ -313,8 +313,8 @@ const resList = {
},
'3ee62d6c-3e44-470b-b2a5-fb805ec6a6c3': {
name: 'mainBG',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/mainBG.c7698e5dba4494258624138e18429842bb37e85f.png',
ext: '.jpg',
url: '//yun.duiba.com.cn/spark/assets/mainBG.677d8c562ee2f8a1fc9aef7830b7fd7e1f3604f9.jpg',
uuid: '3ee62d6c-3e44-470b-b2a5-fb805ec6a6c3'
},
'f3909518-193e-49eb-a1cd-357c4f83d796': {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -7,11 +7,11 @@
"totalPage": -12361727.86125888,
"list": [
{
"userNick": "1111",
"userNick": "111ythtyjhytj1",
"createTime": "1602482660574"
},
{
"userNick": "2222",
"userNick": "2222tyjtyjytjtyjtyjtyjtyjtyj",
"createTime": "1602485660574"
},
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment