Commit a7923cce authored by spc's avatar spc

Merge branch 'yd11_20200922' of gitlab2.dui88.com:wanghongyuan/new_taobao into yd11_20200922

parents a13386be 7aa323bf
...@@ -33,7 +33,7 @@ const apiList = { ...@@ -33,7 +33,7 @@ const apiList = {
}, },
// 大转盘抽奖 // 大转盘抽奖
lottery: { drawLotteryPrize: {
handle: 'lottery', handle: 'lottery',
method: 'get', method: 'get',
isShowLoading: true isShowLoading: true
......
...@@ -17,6 +17,10 @@ App({ ...@@ -17,6 +17,10 @@ App({
vipUrl: '', vipUrl: '',
// 直播间页面 // 直播间页面
liveUrl: '', liveUrl: '',
// 游戏胜率 - 消消乐
xxlWinRate: 0.7,
// 游戏胜率 - 传送带
csdWinRate: 0.7,
// 全局数据 // 全局数据
globalData: {}, globalData: {},
......
...@@ -22,6 +22,11 @@ ...@@ -22,6 +22,11 @@
<text a:if="{{item.status === 2}}" class="mission_btn_text">待领取</text> <text a:if="{{item.status === 2}}" class="mission_btn_text">待领取</text>
<text a:if="{{item.status === 3}}" class="mission_btn_text">已完成</text> <text a:if="{{item.status === 3}}" class="mission_btn_text">已完成</text>
<!-- 如果测试 这里 关注店铺 任务有bug
<text a:if="{{item.status === 2 && item.type === 'follow'}}" class="mission_btn_text">待领取</text>
<text a:if="{{item.status === 3 && item.type !== 'follow'}}" class="mission_btn_text">已完成</text>
-->
<view a:if="{{item.taskType === 'invites'}}" class="mission_invite_tips">{{item.completeTimes}}个好友为你助力成功</view> <view a:if="{{item.taskType === 'invites'}}" class="mission_invite_tips">{{item.completeTimes}}个好友为你助力成功</view>
</view> </view>
</view> </view>
......
...@@ -95,6 +95,11 @@ Component({ ...@@ -95,6 +95,11 @@ Component({
.catch(res => { console.warn(res); commonToast(res && res.message); }) || {}; .catch(res => { console.warn(res); commonToast(res && res.message); }) || {};
}, },
onRefreshGameInfo () {
const { onRefreshGameInfo } = this.props;
onRefreshGameInfo && onRefreshGameInfo();
},
onModalClose() { onModalClose() {
const { onModalClose } = this.props; const { onModalClose } = this.props;
onModalClose && onModalClose(); onModalClose && onModalClose();
...@@ -129,6 +134,8 @@ Component({ ...@@ -129,6 +134,8 @@ Component({
break; break;
} }
} else if (ds.status === 2) { } else if (ds.status === 2) {
// 如果测试 这里 关注店铺 任务有bug
// } else if (ds.status === 2 || (ds.status === 3 && ds.type === 'follow')) {
API.receiveTaskRewards({activityId: app.activityId, taskType: ds.type}) API.receiveTaskRewards({activityId: app.activityId, taskType: ds.type})
.then(res => { .then(res => {
const { success, message, data } = res const { success, message, data } = res
...@@ -136,12 +143,14 @@ Component({ ...@@ -136,12 +143,14 @@ Component({
else { else {
console.log('%c--------领取成功\n' + '-----yd.receiveTaskRewards\n', ConsoleStyle, data) console.log('%c--------领取成功\n' + '-----yd.receiveTaskRewards\n', ConsoleStyle, data)
this.getMissionList() this.getMissionList()
this.onRefreshGameInfo()
} }
}) })
.catch(res => { console.warn(res); commonToast(res && res.message); }) || {}; .catch(res => { console.warn(res); commonToast(res && res.message); }) || {};
} else if (ds.status === 3) { } else if (ds.status === 3) {
commonToast('该任务您已经完成了哦') commonToast('该任务您已经完成了哦')
this.onRefreshGameInfo()
} }
}, },
......
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
isBackFlag="{{isBackFlag}}" isBackFlag="{{isBackFlag}}"
goodsList="{{goodsList}}" goodsList="{{goodsList}}"
task="{{task}}" task="{{task}}"
onCompleteTask="onCompleteTask" /> onCompleteTask="onCompleteTaskHandle" />
</view> </view>
\ No newline at end of file
...@@ -18,6 +18,7 @@ const app = getApp(); ...@@ -18,6 +18,7 @@ const app = getApp();
const { tbcc } = app; const { tbcc } = app;
const { openDetail, collectGoods, checkGoodsCollectedStatus, commonToast, ConsoleStyle } = tbcc.tb; const { openDetail, collectGoods, checkGoodsCollectedStatus, commonToast, ConsoleStyle } = tbcc.tb;
import API from '../../api'; import API from '../../api';
import { debounce } from '../../tbcc-sdk/lib/tb';
Page({ Page({
data: { data: {
...@@ -84,6 +85,13 @@ Page({ ...@@ -84,6 +85,13 @@ Page({
// this.setData({ goodsList: data || [] }) // this.setData({ goodsList: data || [] })
// } // }
}, },
// 完成任务 防抖
onCompleteTaskHandle (taskType,itemId) {
debounce(this.onCompleteTask(taskType,itemId), 300)
},
//任务完成 //任务完成
async onCompleteTask(taskType,itemId) { async onCompleteTask(taskType,itemId) {
console.log(taskType,itemId) console.log(taskType,itemId)
......
...@@ -267,15 +267,25 @@ ...@@ -267,15 +267,25 @@
background-color: #fff; background-color: #fff;
border-radius: 12rpx; border-radius: 12rpx;
overflow: hidden; overflow: hidden;
position: relative;
box-shadow: 0 0 24rpx rgba(159, 87, 85, .46); box-shadow: 0 0 24rpx rgba(159, 87, 85, .46);
} }
.an_niu { .video_block_wrapper_playicon {
width: 95rpx; width: 95rpx;
height: 94rpx; height: 94rpx;
opacity: 1; opacity: 1;
left: 170rpx; left: 170rpx;
top: 87rpx; top: 84rpx;
position: absolute; position: absolute;
z-index: 10;
}
.video_block_wrapper_postersmall {
width: 400rpx;
height: 180rpx;
left: 15rpx;
top: 15rpx;
position: absolute;
z-index: 8;
} }
.video_block_text { .video_block_text {
width: 100%; width: 100%;
......
...@@ -48,8 +48,10 @@ ...@@ -48,8 +48,10 @@
<!-- 视频部分 --> <!-- 视频部分 -->
<view hidden="{{videoBottom_timeout}}" class="video_block {{ videoBottom ? 'block_opciaty0' : ''}}"> <view hidden="{{videoBottom_timeout}}" class="video_block {{ videoBottom ? 'block_opciaty0' : ''}}">
<view class="video_block_wrapper" onTap="videoShowFunc" > <view class="video_block_wrapper" onTap="videoShowFunc" >
<!-- 视频播放按钮 -->
<image class="video_block_wrapper_playicon" src="" mode="aspectFill" />
<image class="video_block_wrapper_postersmall" src="{{videoImgSrcSmall}}" mode="aspectFill" />
<view class="video_block_text"> <view class="video_block_text">
<image src="{{videoImgSrcSmall}}" mode="aspectFill" />
<view>观看XXXXX视频</view> <view>观看XXXXX视频</view>
<view>赢惊喜抽奖次数</view> <view>赢惊喜抽奖次数</view>
</view> </view>
...@@ -80,7 +82,7 @@ ...@@ -80,7 +82,7 @@
<view class="bottom_ydgame_block" onTap="openShowChooseGame"> <view class="bottom_ydgame_block" onTap="openShowChooseGame">
<image class="bottom_ydgame_block_image" src="{{resList['81a085b2-ce9c-4a8f-bdcc-d08f10083134'].url}}" /> <image class="bottom_ydgame_block_image" src="{{resList['81a085b2-ce9c-4a8f-bdcc-d08f10083134'].url}}" />
<view class="bottom_mission_block_freenum">免费抽奖次数 X{{drawNum}}</view> <view class="bottom_mission_block_freenum">抽奖次数 X{{drawNum}}</view>
</view> </view>
<view class="bottom_mission_block" onTap="showMissionModal"> <view class="bottom_mission_block" onTap="showMissionModal">
...@@ -91,8 +93,8 @@ ...@@ -91,8 +93,8 @@
<!-- 选择游戏 --> <!-- 选择游戏 -->
<view class="gamechoose_block" a:if='{{ showChooseGame }}'> <view class="gamechoose_block" a:if='{{ showChooseGame }}'>
<image class="gamechoose_block_back" src="{{resList['22c949b8-84af-4a22-bb21-70088d1eafad'].url}}" /> <image class="gamechoose_block_back" src="{{resList['22c949b8-84af-4a22-bb21-70088d1eafad'].url}}" />
<image data-gameType='1' onTap="changeGameOrPage" class="gamechoose_block_sc {{ ticketNum ? '' : 'opciaty05' }}" src="{{resList['f2915694-4e09-4776-8f38-9ddb285e4d17'].url}}" /> <image data-gameType='1' onTap="handleClickGame" class="gamechoose_block_sc {{ ticketNum ? '' : 'opciaty05' }}" src="{{resList['f2915694-4e09-4776-8f38-9ddb285e4d17'].url}}" />
<image data-gameType='2' onTap="changeGameOrPage" class="gamechoose_block_xxl {{ ticketNum ? '' : 'opciaty05' }}" src="{{resList['7aafb158-7fec-4ae1-a83e-496779c4a107'].url}}" /> <image data-gameType='2' onTap="handleClickGame" class="gamechoose_block_xxl {{ ticketNum ? '' : 'opciaty05' }}" src="{{resList['7aafb158-7fec-4ae1-a83e-496779c4a107'].url}}" />
<view class="gameChoose_mask" onTap="closeShowChooseGame"></view> <view class="gameChoose_mask" onTap="closeShowChooseGame"></view>
</view> </view>
</view> </view>
...@@ -106,6 +108,8 @@ ...@@ -106,6 +108,8 @@
class="homepage_pagecanvas" class="homepage_pagecanvas"
onBackPage="backToPage" onBackPage="backToPage"
gameType="{{ gameType }}" gameType="{{ gameType }}"
gameData="{{ gameData }}"
gamePrize="{{ gamePrize }}"
> >
</pagecanvas> </pagecanvas>
...@@ -117,4 +121,4 @@ ...@@ -117,4 +121,4 @@
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="closeRuleModal" text="{{rule}}"></rule-modal> <rule-modal a:if="{{ruleModalVisible}}" onModalClose="closeRuleModal" text="{{rule}}"></rule-modal>
<rewards-modal a:if="{{rewardsModalVisible}}" onModalClose="closeRewardsModal"></rewards-modal> <rewards-modal a:if="{{rewardsModalVisible}}" onModalClose="closeRewardsModal"></rewards-modal>
<prizes-modal a:if="{{prizesModalVisible}}" onModalClose="closePrizesModal"></prizes-modal> <prizes-modal a:if="{{prizesModalVisible}}" onModalClose="closePrizesModal"></prizes-modal>
<mission-modal a:if="{{missionModalVisible}}" onModalClose="closeMissionModal"></mission-modal> <mission-modal a:if="{{missionModalVisible}}" onModalClose="closeMissionModal" onRefreshGameInfo="getGameInfo"></mission-modal>
...@@ -4,7 +4,7 @@ import { clickStat } from '../../md'; ...@@ -4,7 +4,7 @@ import { clickStat } from '../../md';
import resList from '../../resconfig/resList.js' import resList from '../../resconfig/resList.js'
const { tbcc } = app; const { tbcc } = app;
const { SHARE_CONFIG, REDIRECT_URL } = tbcc.constants; const { SHARE_CONFIG, REDIRECT_URL } = tbcc.constants;
const { commonToast, getAuthUserInfo, navigateToOutside, ConsoleStyle, checkShopFavoredStatus } = tbcc.tb; const { commonToast, getAuthUserInfo, navigateToOutside, ConsoleStyle, checkShopFavoredStatus, debounce } = tbcc.tb;
Page({ Page({
doExchange: () => { doExchange: () => {
...@@ -42,14 +42,16 @@ Page({ ...@@ -42,14 +42,16 @@ Page({
// 用户是否登陆 // 用户是否登陆
userLogin: false, userLogin: false,
data: { data: {
// 游戏数据
gameData: null,
// 游戏抽奖
gamePrize: null,
resList: resList, resList: resList,
title: '', title: '',
content: '', content: '',
rule: '', rule: '',
commonModalData: {
content: '',
btnText: ''
},
// 视频收起 - flag // 视频收起 - flag
videoBottom: false, videoBottom: false,
// 具有延迟的 视频收起 - flag // 具有延迟的 视频收起 - flag
...@@ -98,19 +100,14 @@ Page({ ...@@ -98,19 +100,14 @@ Page({
async onLoad (query) { async onLoad (query) {
console.info(`%cPage onLoad with query: ${JSON.stringify(query)}`, ConsoleStyle) console.info(`%cPage onLoad with query: ${JSON.stringify(query)}`, ConsoleStyle)
if (query.inviteId) { this.query = query
app.inviteId = query.inviteId
this.inviteId = query.inviteId
console.log('%c该用户是 通过邀请链接 进入', 'color:green; font-size:16px; font-weight:bold;')
}
// 页面加载 // 页面加载
// 开场动画 // 开场动画
// this.openAnimation().then(async res_ => { this.openAnimation().then(async res_ => {
// this.backToPage() this.backToPage()
// let res = await this.getAuth() this.init()
// this.init() })
// })
// test - 打点 // test - 打点
// clickStat(1, '2') // clickStat(1, '2')
...@@ -163,12 +160,18 @@ Page({ ...@@ -163,12 +160,18 @@ Page({
if (!success) { console.warn(res); commonToast(res && res.message) } if (!success) { console.warn(res); commonToast(res && res.message) }
else { else {
console.log('%c-----活动基本信息\n' + '-----yd.getActivityBaseInfoById\n', ConsoleStyle, data) console.log('%c-----活动基本信息\n' + '-----yd.getActivityBaseInfoById\n', ConsoleStyle, data)
app.liveUrl = data.liveUrl
// 游戏胜率 - 消消乐
app.xxlWinRate = data.timeChangeWinRate
// 游戏胜率 - 传送带
app.csdWinRate = data.conveyBeltWinRate
data.videoUrlArr.forEach((item, index) => { data.videoUrlArr.forEach((item, index) => {
// // 获取视频 视频封面 视频小封面
// this.videoSrcArr[index] = { // this.videoSrcArr[index] = {
// url: item, timeStamp: 0, totalTime: 0, completed: false // url: item, timeStamp: 0, totalTime: 0, completed: false
// } // }
// this.posterSrcArr // this.posterSrcArr = data.
// this.videoImgSrcSmallArr = data.videoImgSrcSmallArr // this.videoImgSrcSmallArr = data.
}) })
this.setData({ this.setData({
rule: data.rule, rule: data.rule,
...@@ -179,25 +182,58 @@ Page({ ...@@ -179,25 +182,58 @@ Page({
} }
}) })
.catch(res => { console.warn(res); commonToast(res && res.message); }) || {}; .catch(res => { console.warn(res); commonToast(res && res.message); }) || {};
// this.checkDohelp();
// 助力逻辑
if (this.checkDohelpReturnMark()) {
// TODO: 若是助力返回信息,直接调用 this.checkDohelp()
this.checkDohelp()
} else if (this.query.inviteId) {
console.log('%c该用户是 通过邀请链接 进入', 'color:green; font-size:16px; font-weight:bold;')
app.inviteId = this.query.inviteId
this.inviteId = this.query.inviteId
}
}, },
// 检查助力标记
checkDohelpReturnMark () {
console.warn('检查助力返回标记!!', this.query)
return false
},
// 助力 // 助力
checkDohelp(){ checkDohelp(){
if (this.inviteId) { if (this.inviteId) {
//是分享落地页,可以助力
//todo 需要判断是不是会员
commonToast('准备5秒后给邀请者助力~');
setTimeout(() => {
API.doHelp({activityId: app.activityId,inviteId:this.inviteId}).then(res=>{ API.doHelp({activityId: app.activityId,inviteId:this.inviteId}).then(res=>{
commonToast('助力成功~'); const { data, success } = res
}).catch(err=>{ console.log('%c-----助力接口\n' + '-----yd.doHelp\n', ConsoleStyle, res)
if (success) {
this.showCommonMoadalT1({
title: '恭喜您',
content: '助力成功~',
confirmCallback: () => {
this.closeCommonModalT1()
},
btnImg: '//yun.duiba.com.cn/spark/assets/我也要赢大奖.a22bebbd5be4a6e557ee4ef611216ba73b729d10.png' })
} else {
if (!data.isVip) {
app.vipUrl = data.url
this.showCommonMoadalT1({
title: '温馨提示',
content: '成为会员 才能为他助力哦~',
confirmCallback: () => {
navigateToOutside(data.url)
},
btnImg: '//yun.duiba.com.cn/spark/assets/一秒成为会员.10be8a8ede8f6c62eadb005744dc54ae182911d9.png' })
}
commonToast(JSON.stringify(err)); commonToast(JSON.stringify(err));
}
}).catch(err=>{
console.log(err)
commonToast(err.message);
}); });
}, 5000);
} else { } else {
commonToast('不是分享落地页,不需要走助力~') console.log('不是分享落地页,不需要走助力~')
} }
}, },
...@@ -220,13 +256,7 @@ Page({ ...@@ -220,13 +256,7 @@ Page({
// 新用户 助力链接 // 新用户 助力链接
if (this.isNewUser && this.inviteId) { if (this.isNewUser && this.inviteId) {
this.showCommonMoadalT1({ this.checkDohelp()
title: '温馨提示',
content: '成为会员 才能为他助力哦~',
confirmCallback: () => {
navigateToOutside(app.vipUrl)
},
btnImg: '//yun.duiba.com.cn/spark/assets/一秒成为会员.10be8a8ede8f6c62eadb005744dc54ae182911d9.png' })
// //yun.duiba.com.cn/spark/assets/为他助力.bc57a24aecb04934067712c76186d800343dabd5.png // //yun.duiba.com.cn/spark/assets/为他助力.bc57a24aecb04934067712c76186d800343dabd5.png
} }
// 新用户 不是助力链接 // 新用户 不是助力链接
...@@ -271,6 +301,7 @@ Page({ ...@@ -271,6 +301,7 @@ Page({
// 获取 游戏门票 抽奖次数 今日是否首次登陆 // 获取 游戏门票 抽奖次数 今日是否首次登陆
getGameInfo () { getGameInfo () {
return new Promise ((resolve, reject) => {
API.getGameInfo({ activityId: app.activityId }) API.getGameInfo({ activityId: app.activityId })
.then(res => { .then(res => {
const { success, message, data } = res const { success, message, data } = res
...@@ -284,8 +315,10 @@ Page({ ...@@ -284,8 +315,10 @@ Page({
}) })
if (this.data.todayFirstLogin) this.userFirstInToday() if (this.data.todayFirstLogin) this.userFirstInToday()
} }
resolve('complete')
})
.catch(res => { console.warn(res); commonToast(res && res.message); reject('fail') }) || {};
}) })
.catch(res => { console.warn(res); commonToast(res && res.message); }) || {};
}, },
// 开场动画 // 开场动画
...@@ -298,8 +331,36 @@ Page({ ...@@ -298,8 +331,36 @@ Page({
}) })
}, },
// 去游戏 防抖
handleClickGame (e) { debounce(this.changeGameOrPage(e), 300) },
// 切换到游戏 // 切换到游戏
changeGameOrPage (e) { async changeGameOrPage (e) {
// 测试
this.setData({
gameShow: true,
gameType: 1,
gameData: {
win: true,
fakeUserName: 'xxxxxxxx',
fakeUserImgUrl: '//yun.duiba.com.cn/spark/assets/赚门票.21d8c2fd01dffd454116bb6c1189ba6bb74306f4.png',
userName: app.nickName,
userImgUrl: app.avatar
}
})
setTimeout(() => { this.setData({ gameShow_timeout: true }) }, 350)
this.setData({
gamePrize: {
name: '一碗热翔',
image: '//yun.duiba.com.cn/spark/assets/赚门票.21d8c2fd01dffd454116bb6c1189ba6bb74306f4.png',
type: 1
}
})
// 测试
return
if (this.data.ticketNum == 0 && e.currentTarget.dataset.gameType != 3) { if (this.data.ticketNum == 0 && e.currentTarget.dataset.gameType != 3) {
this.showCommonMoadalT1({ this.showCommonMoadalT1({
title: '门票不足', title: '门票不足',
...@@ -311,15 +372,102 @@ Page({ ...@@ -311,15 +372,102 @@ Page({
return return
} else { } else {
let type = Number(e.currentTarget.dataset.gameType) let type = Number(e.currentTarget.dataset.gameType)
this.videoCtx.pause() API.doJoin({activityId: app.activityId, type: type === 1 ? 'slide' : 'timeline'})
this.setData({ gameShow: true, gameType: type }) .then(res => {
const { data, success } = res
if (success) {
// 计算胜负
let win = this.countWinRange()
let fname = this.getFakeUserName()
let favatar = this.getFakeAvatar()
this.setData({
gameShow: true,
gameType: type,
gameData: {
win: win,
fakeUserName: fname,
fakeUserImgUrl: favatar,
userName: app.nickName,
userImgUrl: app.avatar
}
})
setTimeout(() => { this.setData({ gameShow_timeout: true }) }, 350) setTimeout(() => { this.setData({ gameShow_timeout: true }) }, 350)
// 游戏结束开奖 -- 提前
this.getGameOverPrize()
} else {
commonToast(res.message)
}
})
.catch(res => { console.warn(res); commonToast(res && res.message) }) || {};
} }
}, },
// 游戏结束 获取开奖
getGameOverPrize () {
API.gameOver({activityId: app.activityId, type: type === 1 ? 'slide' : 'timeline', isWin: win})
.then(res => {
const { data, success} = res
if (success) {
this.setData({
gamePrize: {
name: data.prize.name,
image: data.prize.image,
type: data.prize.type
}
})
} else {
this.setData({
gamePrize: {
name: '谢谢参与',
image: '',
type: 5
}
})
}
})
.catch(err => {
console.warn(err)
this.setData({
gamePrize: {
name: '谢谢参与',
image: '',
type: 5
}
})
})
},
// 游戏胜率计算
countWinRange (type) {
let win = false
let num = Math.floor(Math.random() * (100 - 1) + 1)
if (type === 1) {
if (num <= app.xxlWinRate * 100) win = true
else win = false
} else if (type === 2) {
if (num <= app.csdWinRate * 100) win = true
else win = false
}
return win
},
// 生成假用户名
getFakeUserName () {
},
// 生成假用户头像
getFakeAvatar () {
},
// 从游戏 返回 到 主页 // 从游戏 返回 到 主页
backToPage () { backToPage () {
this.setData({ gameShow_timeout: false, gameType: 0 }) this.setData({ gameShow_timeout: false, gameType: 0, gamePrize: null, gameData: null })
this.getGameInfo()
setTimeout(() => { this.setData({ gameShow: false }) }, 350) setTimeout(() => { this.setData({ gameShow: false }) }, 350)
}, },
...@@ -422,12 +570,14 @@ Page({ ...@@ -422,12 +570,14 @@ Page({
} }
}, },
// 观看视频领奖 // video - 观看视频领奖
getWatchRewards() { getWatchRewards() {
API.sendCoinsByWatch({activityId: app.activityId, videoIndex: this.data.videoActiveIndex}) API.sendCoinsByWatch({activityId: app.activityId, videoIndex: this.data.videoActiveIndex})
.then(res => { .then(res => {
const {success, data} = res const {success, data} = res
if (success) { if (success) {
let num = this.data.drawNum
this.setData({drawNum: num + data.lotteryTimes})
this.showCommonMoadalT2({ this.showCommonMoadalT2({
title: '看视频奖励', title: '看视频奖励',
content: `抽奖次数+${data.lotteryTimes}`, content: `抽奖次数+${data.lotteryTimes}`,
...@@ -447,6 +597,7 @@ Page({ ...@@ -447,6 +597,7 @@ Page({
}) })
}, },
// video - 展示视频
videoShowFunc() { videoShowFunc() {
this.setData({ videoShow: true }) this.setData({ videoShow: true })
setTimeout(() => { setTimeout(() => {
...@@ -542,18 +693,6 @@ Page({ ...@@ -542,18 +693,6 @@ Page({
} }
}, },
/**
* 显示通用弹层
* @param {object} options content: 通用弹层内容 btnText:按钮文案 confirmCallback: 按钮确认回调
*/
showCommonModal({ content, btnText, confirmCallback }) {
this.setData({
commonModalConfirm: confirmCallback || null,
commonModalVisible: true,
commonModalData: { content, btnText }
});
},
changeURLArg(url, arg, arg_val) { changeURLArg(url, arg, arg_val) {
var pattern = arg + '=([^&]*)'; var pattern = arg + '=([^&]*)';
var replaceText = arg + '=' + arg_val; var replaceText = arg + '=' + arg_val;
......
...@@ -20,6 +20,7 @@ Component({ ...@@ -20,6 +20,7 @@ Component({
messageMadalData: {}, messageMadalData: {},
messageMadalVisble: false, messageMadalVisble: false,
}, },
gameData: null,
didMount() { didMount() {
this.setData({ this.setData({
...@@ -35,13 +36,19 @@ Component({ ...@@ -35,13 +36,19 @@ Component({
// 切换游戏场景 // 切换游戏场景
if (!this.main) return if (!this.main) return
this.main.changeGameSence(this.props.gameType) this.main.changeGameSence(this.props.gameType)
setTimeout(() => {
if (this.props.gameType === 2) this.postMessage('xxlGameData', this.props.gameData)
else if (this.props.gameType === 1) this.postMessage('csdGameData', this.props.gameData)
}, 60)
}
if (this.props.gamePrize !== prevProps.gamePrize && this.props.gamePrize !== null) {
if (this.props.gameType === 2) this.postMessage('xxlGamePrize', this.props.gamePrize)
else if (this.props.gameType === 1) this.postMessage('csdGamePrize', this.props.gamePrize)
} }
}, },
methods: { methods: {
back () { back () { this.props.onBackPage() },
this.props.onBackPage()
},
init() { init() {
console.log('do init'); console.log('do init');
...@@ -75,7 +82,7 @@ Component({ ...@@ -75,7 +82,7 @@ Component({
onCanvasReady() { onCanvasReady() {
console.log('onCanvasReady') console.log('onCanvasReady')
this.changeGameSence(this.props.gameType) this.changeGameSence(this.props.gameType)
//授权和登录先搞 // 授权和登录先搞
checkSystem().then(r => { checkSystem().then(r => {
if (r) { if (r) {
this.getAuth(); this.getAuth();
...@@ -173,9 +180,6 @@ Component({ ...@@ -173,9 +180,6 @@ Component({
} }
}, },
/**
* 获取用户授权信息
*/
async getAuth() { async getAuth() {
const userInfo = await getAuthUserInfo().catch(err => { const userInfo = await getAuthUserInfo().catch(err => {
console.log('未授权成功', err); console.log('未授权成功', err);
...@@ -188,9 +192,7 @@ Component({ ...@@ -188,9 +192,7 @@ Component({
this.login(); this.login();
} }
}, },
/**
* 登录接口
*/
async login() { async login() {
const { nickName, avatar } = app; const { nickName, avatar } = app;
const { success } = await API.login({ userNick: nickName, avatar }).catch(res => { const { success } = await API.login({ userNick: nickName, avatar }).catch(res => {
...@@ -201,11 +203,10 @@ Component({ ...@@ -201,11 +203,10 @@ Component({
this.init(); this.init();
} }
}, },
closeRuleModal() { closeRuleModal() {
this.setData({ this.setData({ ruleModalVisible: false })
ruleModalVisible: false },
});
}
} }
......
...@@ -49,7 +49,10 @@ ...@@ -49,7 +49,10 @@
<!-- 弹窗-奖品信息 --> <!-- 弹窗-奖品信息 -->
<rewards-modal a:if='{{rewardsModalShow}}' modalData='{{rewardsModalData}}' onModalClose='onModalClose' onModalConfirm='onModalConfirm' data-modalType='rewards' /> <rewards-modal a:if='{{rewardsModalShow}}' modalData='{{rewardsModalData}}' onModalClose='onModalClose' onModalConfirm='onModalConfirm' data-modalType='rewards' />
<!-- 弹窗部分 -->
<common-modal-t1 a:if="{{commonModalVisibleT1}}" data="{{commonModalDataT1}}" onModalClose="closeCommonModalT1" onModalConfirm="confirmCommonModalT1" />
<common-modal-t2 a:if="{{commonModalVisibleT2}}" data="{{commonModalDataT2}}" onModalClose="closeCommonModalT2" onModalOne="onModalT2One" onModalTwo="onModalT2Two"/>
<!-- 抽奖次数不足,快去雅顿乐园玩游戏赢抽奖次数吧 -->
<!-- 弹窗-抽奖结果 --> <!-- 弹窗-抽奖结果 -->
<!-- <draw-modal a:if='{{drawModalShow}}' modalData='{{drawModalData}}' onModalClose='onModalClose' onModalConfirm='onModalConfirm' data-modalType='draw' /> --> <!-- <draw-modal a:if='{{drawModalShow}}' modalData='{{drawModalData}}' onModalClose='onModalClose' onModalConfirm='onModalConfirm' data-modalType='draw' /> -->
...@@ -8,6 +8,18 @@ const { commonToast, getAuthUserInfo, navigateToOutside, ConsoleStyle, checkShop ...@@ -8,6 +8,18 @@ const { commonToast, getAuthUserInfo, navigateToOutside, ConsoleStyle, checkShop
Page({ Page({
data: { data: {
commonModalConfirmT1: null,
commonModalVisibleT1: false,
onModalT2One: null,
onModalT2Two: null,
commonModalVisibleT2: false,
ruleModalVisible: false,
rewardsModalVisible: false,
prizesModalVisible: false,
missionModalVisible: false,
resList: resList, resList: resList,
listTurnTable_test: [1, 2, 3, 4, 5], // 转盘奖品信息_测试 listTurnTable_test: [1, 2, 3, 4, 5], // 转盘奖品信息_测试
listTurnTable: [], // 转盘奖品信息 listTurnTable: [], // 转盘奖品信息
...@@ -253,54 +265,46 @@ Page({ ...@@ -253,54 +265,46 @@ Page({
const { commonModalConfirm } = this.data const { commonModalConfirm } = this.data
commonModalConfirm && commonModalConfirm() commonModalConfirm && commonModalConfirm()
}, },
/**
* 执行开始 // 显示通用弹层
*/ showCommonMoadalT1 ({
doStart() { title = 'test- title',
this.showCommonModal({ content = 'test- content',
content: '活动还未开始\n请稍后', confirmCallback = () => {},
btnText: '我知道了', btnImg = '//yun.duiba.com.cn/spark/assets/32d8536184c3539c0d9655d03c1b60f3d5e1f60a.png' }) {
commonModalVisible: true, this.setData({
confirmCallback: () => { commonModalVisibleT1: true,
this.closeCommonModal() commonModalDataT1: { title, content, btnImg },
confirmCommonModalT1: () => {
confirmCallback()
this.closeCommonModalT1()
} }
}) })
}, },
/**
* 显示通用弹层 // 显示通用弹层
* @param {object} options content: 通用弹层内容 btnText:按钮文案 confirmCallback: 按钮确认回调 showCommonMoadalT2 (obj) {
*/ let { title, content, confirmCallback1, confirmCallback2, btnImg1, btnImg2, rewardsImg } = obj
showCommonModal({ content, btnText, confirmCallback }) {
this.setData({ this.setData({
commonModalConfirm: confirmCallback || null, commonModalVisibleT2: true,
commonModalVisible: true, commonModalDataT2: { title, content, btnImg1, btnImg2, rewardsImg },
commonModalData: { content, btnText } onModalT2One: () => { confirmCallback1() },
onModalT2Two: () => { confirmCallback2() }
}) })
}, },
onModalT2One () { this.data.onModalT2One() },
onModalT2Two () { this.data.onModalT2Two() },
confirmCommonModalT1 () { this.data.confirmCommonModalT1() },
/** /**
* 跳转到天猫页面 * 跳转到天猫页面
*/ */
goTmallPage() { goTmallPage() {
navigateToOutside(REDIRECT_URL['tmall']) navigateToOutside(REDIRECT_URL['tmall'])
}, },
/**
* 关闭通用弹层
*/
closeCommonModal() {
this.setData({
commonModalVisible: false
})
},
/**
* 关闭活动规则弹层
*/
closeRuleModal() {
this.setData({
ruleModalVisible: false
})
},
onShareAppMessage() { onShareAppMessage() {
// 返回自定义分享信息 // 返回自定义分享信息
return SHARE_CONFIG // return SHARE_CONFIG
}, },
}) })
{ {
"usingComponents": { "usingComponents": {
"common-modal-t1": "/components/commonModalT1/commonModalT1",
"common-modal-t2": "/components/commonModalT2/commonModalT2"
} }
} }
\ No newline at end of file
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