Commit 9a90f4c5 authored by AU-Pro-mac's avatar AU-Pro-mac

add new code

parent 84bac9f7
......@@ -33,7 +33,7 @@ const apiList = {
},
// 大转盘抽奖
lottery: {
drawLotteryPrize: {
handle: 'lottery',
method: 'get',
isShowLoading: true
......
......@@ -17,6 +17,10 @@ App({
vipUrl: '',
// 直播间页面
liveUrl: '',
// 游戏胜率 - 消消乐
xxlWinRate: 0.7,
// 游戏胜率 - 传送带
csdWinRate: 0.7,
// 全局数据
globalData: {},
......
......@@ -22,6 +22,11 @@
<text a:if="{{item.status === 2}}" 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>
</view>
......
......@@ -95,6 +95,11 @@ Component({
.catch(res => { console.warn(res); commonToast(res && res.message); }) || {};
},
onRefreshGameInfo () {
const { onRefreshGameInfo } = this.props;
onRefreshGameInfo && onRefreshGameInfo();
},
onModalClose() {
const { onModalClose } = this.props;
onModalClose && onModalClose();
......@@ -129,6 +134,8 @@ Component({
break;
}
} 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})
.then(res => {
const { success, message, data } = res
......@@ -136,12 +143,14 @@ Component({
else {
console.log('%c--------领取成功\n' + '-----yd.receiveTaskRewards\n', ConsoleStyle, data)
this.getMissionList()
this.onRefreshGameInfo()
}
})
.catch(res => { console.warn(res); commonToast(res && res.message); }) || {};
} else if (ds.status === 3) {
commonToast('该任务您已经完成了哦')
this.onRefreshGameInfo()
}
},
......
......@@ -3,5 +3,5 @@
isBackFlag="{{isBackFlag}}"
goodsList="{{goodsList}}"
task="{{task}}"
onCompleteTask="onCompleteTask" />
onCompleteTask="onCompleteTaskHandle" />
</view>
\ No newline at end of file
......@@ -18,6 +18,7 @@ const app = getApp();
const { tbcc } = app;
const { openDetail, collectGoods, checkGoodsCollectedStatus, commonToast, ConsoleStyle } = tbcc.tb;
import API from '../../api';
import { debounce } from '../../tbcc-sdk/lib/tb';
Page({
data: {
......@@ -84,6 +85,13 @@ Page({
// this.setData({ goodsList: data || [] })
// }
},
// 完成任务 防抖
onCompleteTaskHandle (taskType,itemId) {
debounce(this.onCompleteTask(taskType,itemId), 300)
},
//任务完成
async onCompleteTask(taskType,itemId) {
console.log(taskType,itemId)
......
......@@ -267,15 +267,25 @@
background-color: #fff;
border-radius: 12rpx;
overflow: hidden;
position: relative;
box-shadow: 0 0 24rpx rgba(159, 87, 85, .46);
}
.an_niu {
.video_block_wrapper_playicon {
width: 95rpx;
height: 94rpx;
opacity: 1;
left: 170rpx;
top: 87rpx;
top: 84rpx;
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 {
width: 100%;
......
......@@ -48,8 +48,10 @@
<!-- 视频部分 -->
<view hidden="{{videoBottom_timeout}}" class="video_block {{ videoBottom ? 'block_opciaty0' : ''}}">
<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">
<image src="{{videoImgSrcSmall}}" mode="aspectFill" />
<view>观看XXXXX视频</view>
<view>赢惊喜抽奖次数</view>
</view>
......@@ -80,7 +82,7 @@
<view class="bottom_ydgame_block" onTap="openShowChooseGame">
<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 class="bottom_mission_block" onTap="showMissionModal">
......@@ -91,8 +93,8 @@
<!-- 选择游戏 -->
<view class="gamechoose_block" a:if='{{ showChooseGame }}'>
<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='2' onTap="changeGameOrPage" class="gamechoose_block_xxl {{ ticketNum ? '' : 'opciaty05' }}" src="{{resList['7aafb158-7fec-4ae1-a83e-496779c4a107'].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="handleClickGame" class="gamechoose_block_xxl {{ ticketNum ? '' : 'opciaty05' }}" src="{{resList['7aafb158-7fec-4ae1-a83e-496779c4a107'].url}}" />
<view class="gameChoose_mask" onTap="closeShowChooseGame"></view>
</view>
</view>
......@@ -106,6 +108,8 @@
class="homepage_pagecanvas"
onBackPage="backToPage"
gameType="{{ gameType }}"
gameData="{{ gameData }}"
gamePrize="{{ gamePrize }}"
>
</pagecanvas>
......@@ -117,4 +121,4 @@
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="closeRuleModal" text="{{rule}}"></rule-modal>
<rewards-modal a:if="{{rewardsModalVisible}}" onModalClose="closeRewardsModal"></rewards-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>
......@@ -20,6 +20,7 @@ Component({
messageMadalData: {},
messageMadalVisble: false,
},
gameData: null,
didMount() {
this.setData({
......@@ -35,13 +36,19 @@ Component({
// 切换游戏场景
if (!this.main) return
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: {
back () {
this.props.onBackPage()
},
back () { this.props.onBackPage() },
init() {
console.log('do init');
......@@ -75,7 +82,7 @@ Component({
onCanvasReady() {
console.log('onCanvasReady')
this.changeGameSence(this.props.gameType)
//授权和登录先搞
// 授权和登录先搞
checkSystem().then(r => {
if (r) {
this.getAuth();
......@@ -173,9 +180,6 @@ Component({
}
},
/**
* 获取用户授权信息
*/
async getAuth() {
const userInfo = await getAuthUserInfo().catch(err => {
console.log('未授权成功', err);
......@@ -188,9 +192,7 @@ Component({
this.login();
}
},
/**
* 登录接口
*/
async login() {
const { nickName, avatar } = app;
const { success } = await API.login({ userNick: nickName, avatar }).catch(res => {
......@@ -201,11 +203,10 @@ Component({
this.init();
}
},
closeRuleModal() {
this.setData({
ruleModalVisible: false
});
}
this.setData({ ruleModalVisible: false })
},
}
......
......@@ -49,7 +49,10 @@
<!-- 弹窗-奖品信息 -->
<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' /> -->
......@@ -8,6 +8,18 @@ const { commonToast, getAuthUserInfo, navigateToOutside, ConsoleStyle, checkShop
Page({
data: {
commonModalConfirmT1: null,
commonModalVisibleT1: false,
onModalT2One: null,
onModalT2Two: null,
commonModalVisibleT2: false,
ruleModalVisible: false,
rewardsModalVisible: false,
prizesModalVisible: false,
missionModalVisible: false,
resList: resList,
listTurnTable_test: [1, 2, 3, 4, 5], // 转盘奖品信息_测试
listTurnTable: [], // 转盘奖品信息
......@@ -253,54 +265,46 @@ Page({
const { commonModalConfirm } = this.data
commonModalConfirm && commonModalConfirm()
},
/**
* 执行开始
*/
doStart() {
this.showCommonModal({
content: '活动还未开始\n请稍后',
btnText: '我知道了',
commonModalVisible: true,
confirmCallback: () => {
this.closeCommonModal()
// 显示通用弹层
showCommonMoadalT1 ({
title = 'test- title',
content = 'test- content',
confirmCallback = () => {},
btnImg = '//yun.duiba.com.cn/spark/assets/32d8536184c3539c0d9655d03c1b60f3d5e1f60a.png' }) {
this.setData({
commonModalVisibleT1: true,
commonModalDataT1: { title, content, btnImg },
confirmCommonModalT1: () => {
confirmCallback()
this.closeCommonModalT1()
}
})
},
/**
* 显示通用弹层
* @param {object} options content: 通用弹层内容 btnText:按钮文案 confirmCallback: 按钮确认回调
*/
showCommonModal({ content, btnText, confirmCallback }) {
// 显示通用弹层
showCommonMoadalT2 (obj) {
let { title, content, confirmCallback1, confirmCallback2, btnImg1, btnImg2, rewardsImg } = obj
this.setData({
commonModalConfirm: confirmCallback || null,
commonModalVisible: true,
commonModalData: { content, btnText }
commonModalVisibleT2: true,
commonModalDataT2: { title, content, btnImg1, btnImg2, rewardsImg },
onModalT2One: () => { confirmCallback1() },
onModalT2Two: () => { confirmCallback2() }
})
},
onModalT2One () { this.data.onModalT2One() },
onModalT2Two () { this.data.onModalT2Two() },
confirmCommonModalT1 () { this.data.confirmCommonModalT1() },
/**
* 跳转到天猫页面
*/
goTmallPage() {
navigateToOutside(REDIRECT_URL['tmall'])
},
/**
* 关闭通用弹层
*/
closeCommonModal() {
this.setData({
commonModalVisible: false
})
},
/**
* 关闭活动规则弹层
*/
closeRuleModal() {
this.setData({
ruleModalVisible: false
})
},
onShareAppMessage() {
// 返回自定义分享信息
return SHARE_CONFIG
// return SHARE_CONFIG
},
})
{
"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