Commit 96d25d31 authored by Edwise's avatar Edwise 🍷

版本过低

parent e8f63d73
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
transform-origin: 0px 0px 0px; transform-origin: 0px 0px 0px;
} }
.invitelistmodal .inviteList .inviteItem .inviteId{ .invitelistmodal .inviteList .inviteItem .inviteId{
width: 300rpx; width: 380rpx;
height: 40rpx; height: 40rpx;
opacity: 1; opacity: 1;
display: block; display: block;
......
...@@ -12,6 +12,7 @@ const { ...@@ -12,6 +12,7 @@ const {
getUserAddress, getUserAddress,
setClipboard setClipboard
} = tbcc.tb; } = tbcc.tb;
const changeStr = '***'
Component({ Component({
props: {}, props: {},
data: { data: {
...@@ -48,9 +49,9 @@ Component({ ...@@ -48,9 +49,9 @@ Component({
let len = data.list[i].userNick.length; let len = data.list[i].userNick.length;
let str = data.list[i].userNick; let str = data.list[i].userNick;
if(len<=4){ 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{ }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); console.log(data.list);
......
...@@ -5,576 +5,609 @@ import API from '../../api'; ...@@ -5,576 +5,609 @@ import API from '../../api';
import * as FYGE from "fyge-tbmini"; import * as FYGE from "fyge-tbmini";
import * as SvgaParser from "svga-parser"; import * as SvgaParser from "svga-parser";
import { import {
modalType, modalType,
SHARE_CONFIG SHARE_CONFIG
} from '../../tbcc-sdk/lib/constants'; } from '../../tbcc-sdk/lib/constants';
const app = getApp(); const app = getApp();
const { const {
tbcc tbcc
} = app; } = app;
const { const {
commonToast, commonToast,
getAuthUserInfo, getAuthUserInfo,
navigateToOutside, navigateToOutside,
getSystemInfo, getSystemInfo,
checkShopFavoredStatus, checkShopFavoredStatus,
getServerTime, getServerTime,
} = tbcc.tb; } = tbcc.tb;
const snowSrc = "cloud://B975D7429522C2AA89E6FD651523DC57//snow.svga"; const snowSrc = "cloud://B975D7429522C2AA89E6FD651523DC57//snow.svga";
const fireSrc = "cloud://F03F0071205084B1A58F9C560010C076//fire.svga" const fireSrc = "cloud://F03F0071205084B1A58F9C560010C076//fire.svga"
const checkSystem = async () => { const checkSystem = async () => {
const { const {
version version
} = await getSystemInfo(); } = await getSystemInfo();
console.log('version', version); console.log('version', version);
return tbcc.utils.versionCompare(version, '9.8.0'); return tbcc.utils.versionCompare(version, '9.8.0');
} }
Page({ Page({
gameConfigList: {}, tbVersionOk: false,
favoredStatus: false, gameConfigList: {},
goVip: false, favoredStatus: false,
start: false, goVip: false,
data: { start: false,
indexPrize: [{ data: {
id: 1, indexPrize: [{
name: '301+热皮', id: 1,
url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4d7c687df8mh9y&id=624231380919" name: '301+热皮',
}, { url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4d7c687df8mh9y&id=624231380919"
id: 2, }, {
name: '502++热皮', id: 2,
url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4e60687do2J7Y4&id=625018335779" name: '502++热皮',
}, { url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4e60687do2J7Y4&id=625018335779"
id: 3, }, {
name: '500E内裤', id: 3,
url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4e60687do2J7Y4&id=560474460284" name: '500E内裤',
}, { url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4e60687do2J7Y4&id=560474460284"
id: 4, }, {
name: '311S袜子', id: 4,
url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4e60687do2J7Y4&id=600583964263" name: '311S袜子',
}], url: "https://detail.tmall.com/item.htm?spm=a212k0.12153887.0.0.4e60687do2J7Y4&id=600583964263"
/**弹窗状态 */ }],
modalStatus: 0, /**弹窗状态 */
/**当前温暖值 */ modalStatus: 0,
curWarms: '', /**当前温暖值 */
/**当前排名 */ curWarms: '',
curRank: '', /**当前排名 */
/**当前游戏阶段 */ curRank: '',
curGameStep: 1, /**当前游戏阶段 */
/**活动结束后排行榜奖励信息 */ curGameStep: 1,
rankPrize: {}, /**活动结束后排行榜奖励信息 */
/**游戏信息 */ rankPrize: {},
gameInfo: {}, /**游戏信息 */
/**5系解锁需要场数 */ gameInfo: {},
unLock5Times: 0, /**5系解锁需要场数 */
/**7系解锁需要场数 */ unLock5Times: 0,
unLock7Times: 0, /**7系解锁需要场数 */
}, unLock7Times: 0,
},
navigateToOutsideGoodsDetail(e) {
const { navigateToOutsideGoodsDetail(e) {
item if (!this.tbVersionOk) {
} = e.target.dataset; commonToast("为保证活动正常参与,请升级淘宝版本");
navigateToOutside(item.url); return;
},
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);
} }
) const {
SvgaParser.loadSvga( item
snowSrc, } = e.target.dataset;
(v) => { navigateToOutside(item.url);
console.log("svga" + v); },
var mv = con.addChild(new FYGE.MovieClip(v));
mv.x = 175; onLoad(query) {
mv.y = 590; if (query) {
console.log("svgmv", mv) app.inviteId = query.openId;
app.step = query.inviteStep;
},
(err) => {
console.log("bb", err);
} }
)
}, this); console.log('onload=>query', query);
this.setData({
resList: resList
});
//循环 },
loop();
function loop() { onReady() {
FYGE.Tween.flush() // this.openModal("inviteList")
stage.flush(); my._showIndexModal = (type) => {
FYGE.getRequestAnimationFrame()(loop); this.setData({
} modalStatus: modalType[type] || 0
});
}, }
/** my._hideIndexModal = () => {
* 获取用户授权信息 this.setData({
*/ modalStatus: 0
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();
}, checkSystem().then(r => {
/**更新游戏信息 */ if (r) {
async updateGameInfo() { this.tbVersionOk = true;
// my.showLoading(); this.getAuth();
const { } else {
success, this.tbVersionOk = false;
data commonToast("为保证活动正常参与,请升级淘宝版本");
} = 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.getAuth();
this.setData({ },
modalStatus: modalType['rankprize'] 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)
this.canOpenGamePage = true; FYGE.initedByCanvas(canvas)
this.start = true; var sysInfo = my.getSystemInfoSync()
my.hideLoading(); //建舞台
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; canOpenGamePage: false,
this.checkLastGameStat(lastGameInfo); /**进入游戏页面 */
} 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, console.log("点击进入游戏页面")
/**进入游戏页面 */
async openGamePage() { },
if (!this.start) { /**打开弹窗 */
commonToast("活动已结束") openModal(e) {
return; if (!this.tbVersionOk) {
} commonToast("为保证活动正常参与,请升级淘宝版本");
if (!this.canOpenGamePage) return; return;
this.canOpenGamePage = false }
my.showLoading(); console.log(e);
const { const {
success, item
data, } = e.target.dataset;
message // if (!this.start && item == 'inviteList') {
} = await API.doJoin({ // commonToast("活动已结束")
step: this.data.curGameStep // return;
}).catch(r => { // }
if (r && r.data && !r.data.isVip) { // if (!this.start && item != 'rule') return;
commonToast("3s入会,即可为好友助力", 1500, () => { this.setData({
this.goVip = true; modalStatus: modalType[item] || 0
this.canOpenGamePage = true; });
navigateToOutside(r.data.url); },
/**关闭弹窗 */
closeModal(type) {
this.setData({
modalStatus: 0
}) })
} else { },
this.canOpenGamePage = true; /**点击跳转页面 */
commonToast(r && r.message) navigateTo(e) {
} if (!this.tbVersionOk) {
my.hideLoading(); commonToast("为保证活动正常参与,请升级淘宝版本");
}) || {}; return;
if (success) { }
this.canOpenGamePage = true; const {
const winRate = this.gameConfigList[this.data.curGameStep - 1].winRate * 0.01; item
const propsCD = this.gameConfigList[this.data.curGameStep - 1].propsCD; } = e.target.dataset;
my.redirectTo({ if (!this.start && item == 'pagepagerank') {
url: '/pages/pagegamemain/pagegamemain?' + commonToast("活动已结束")
"step=" + this.data.curGameStep + "&start=" + data.joinGameStartTime + return;
"&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;
}
my.navigateTo({ my.navigateTo({
url: `/pages/${item}/${item}` url: `/pages/${item}/${item}`
}); });
}, },
onShareAppMessage() { onShareAppMessage() {
// 返回自定义分享信息 // 返回自定义分享信息
let { let {
path, path,
...rest ...rest
} = SHARE_CONFIG; } = SHARE_CONFIG;
console.log('app.openId', app.openId); console.log('app.openId', app.openId);
if (app.openId) { if (app.openId) {
path = '/pages/pagepageindex/pagepageindex' + '?openId=' + app.openId + '&inviteStep=' + this.data.curGameStep; path = '/pages/pagepageindex/pagepageindex' + '?openId=' + app.openId + '&inviteStep=' + this.data.curGameStep;
} }
console.log('path', path) console.log('path', path)
return { return {
...rest, ...rest,
path path
} }
}, },
onShow() { onShow() {
if (app.isGoVip) { if (app.isGoVip) {
this.doHelp(); this.doHelp();
} }
if (this.goVip) { if (this.goVip) {
this.openGamePage(); this.openGamePage();
this.goVip = false; this.goVip = false;
} }
}, },
openInviteFailedModal() { openInviteFailedModal() {
my._showIndexModal("invitefail"); my._showIndexModal("invitefail");
}, },
openInviteSuccessModal() { openInviteSuccessModal() {
my._showIndexModal("invitesuccess"); my._showIndexModal("invitesuccess");
}, },
/**助力 */ /**助力 */
async doHelp() { async doHelp() {
const { const {
success, success,
data, data,
message message
} = await API.doHelp({ } = await API.doHelp({
inviteId: app.inviteId, inviteId: app.inviteId,
inviteStep: app.step inviteStep: app.step
}); });
console.log("hhahahha") console.log("hhahahha")
if (!success) { if (!success) {
if (data && !data.isVip) { if (data && !data.isVip) {
commonToast("3s入会,即可为好友助力", 1500, () => { commonToast("3s入会,即可进行PK", 1500, () => {
navigateToOutside(data.url); navigateToOutside(data.url);
}) })
} else if (data && data.isVip) { } else if (data && data.isVip) {
this.openInviteFailedModal(); this.openInviteFailedModal();
} else { } else {
commonToast(message); commonToast(message);
} }
} else { } else {
this.openInviteSuccessModal(); this.openInviteSuccessModal();
} }
}, },
//检测上局的状态 //检测上局的状态
async checkLastGameStat(data) { async checkLastGameStat(data) {
//纯本地的 if (!this.tbVersionOk) {
// let key = 'jn_' + app.openId + '_gamedata'; commonToast("为保证活动正常参与,请升级淘宝版本");
// let lgamedata = await new Promise((res, rej) => { return;
// my.getStorage({ }
// key: key, //纯本地的
// success: (result) => { // let key = 'jn_' + app.openId + '_gamedata';
// res(result.data); // let lgamedata = await new Promise((res, rej) => {
// }, // my.getStorage({
// fail: () => { // key: key,
// rej(false); // success: (result) => {
// }, // res(result.data);
// complete: () => { // },
// fail: () => {
// } // rej(false);
// }); // },
// }) // complete: () => {
// if (lgamedata) { // }
// const { endtime, overequest } = lgamedata; // });
// //上局结算过了,不用管 // })
// if (!overequest) {
// let querystr = ""; // if (lgamedata) {
// let { roomdata, roomnums, tooltime, canwin, step, startime, avatar2, avatar3, avatar4, othername, overequest } = lgamedata; // const { endtime, overequest } = lgamedata;
// const nowTime = await getServerTime().catch(() => { }); // //上局结算过了,不用管
// if (nowTime && endtime > nowTime) {//上局未结束,继续游戏 // if (!overequest) {
// querystr += "laststat=go"; // let querystr = "";
// } else {//上局结束,未结算,去结算 // let { roomdata, roomnums, tooltime, canwin, step, startime, avatar2, avatar3, avatar4, othername, overequest } = lgamedata;
// querystr = "laststat=over"; // const nowTime = await getServerTime().catch(() => { });
// } // if (nowTime && endtime > nowTime) {//上局未结束,继续游戏
// my.redirectTo({ // querystr += "laststat=go";
// url: '/pages/pagegamemain/pagegamemain?' + querystr // } 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(() => { }); console.log("上局状态", data);
if(!nowTime){ //服务器的
nowTime = Date.now(); let {
} joinGameStartTime,
joinGameEndTime,
let toolcd = Math.ceil(propsCD); toolStartTime,
let tooless = Math.ceil((toolEndTime-nowTime)/1000); toolEndTime,
if(tooless<0){ winRate,
tooless = 0; propsCD,
} step
let querystr = "step=" + step + "&start=" + joinGameStartTime + } = data;
"&end=" + joinGameEndTime + "&gl=" + winRate + "&toolcd=" + toolcd+"&tooless="+tooless; if (joinGameStartTime && joinGameEndTime) {
let nowTime = await getServerTime().catch(() => {});
if (nowTime && joinGameEndTime > nowTime) {//上局未结束,继续游戏 if (!nowTime) {
querystr += "&laststat=go"; nowTime = Date.now();
} else {//上局结束,未结算,去结算 }
querystr += "&laststat=over";
} let toolcd = Math.ceil(propsCD);
my.redirectTo({ let tooless = Math.ceil((toolEndTime - nowTime) / 1000);
url: '/pages/pagegamemain/pagegamemain?' + querystr 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 = { ...@@ -313,8 +313,8 @@ const resList = {
}, },
'3ee62d6c-3e44-470b-b2a5-fb805ec6a6c3': { '3ee62d6c-3e44-470b-b2a5-fb805ec6a6c3': {
name: 'mainBG', name: 'mainBG',
ext: '.png', ext: '.jpg',
url: '//yun.duiba.com.cn/spark/assets/mainBG.c7698e5dba4494258624138e18429842bb37e85f.png', url: '//yun.duiba.com.cn/spark/assets/mainBG.677d8c562ee2f8a1fc9aef7830b7fd7e1f3604f9.jpg',
uuid: '3ee62d6c-3e44-470b-b2a5-fb805ec6a6c3' uuid: '3ee62d6c-3e44-470b-b2a5-fb805ec6a6c3'
}, },
'f3909518-193e-49eb-a1cd-357c4f83d796': { '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 @@ ...@@ -7,11 +7,11 @@
"totalPage": -12361727.86125888, "totalPage": -12361727.86125888,
"list": [ "list": [
{ {
"userNick": "1111", "userNick": "111ythtyjhytj1",
"createTime": "1602482660574" "createTime": "1602482660574"
}, },
{ {
"userNick": "2222", "userNick": "2222tyjtyjytjtyjtyjtyjtyjtyj",
"createTime": "1602485660574" "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