Commit dcc308f4 authored by AU-Pro-mac's avatar AU-Pro-mac

add new code --23

parent adb72aee
......@@ -26,8 +26,11 @@ App({
// 全局数据
globalData: {},
doHelpRefresh: undefined,
onLaunch(options) {
this.handleQuery(options.query || {});
console.warn(options)
},
onShow(options) {
// 从后台被 scheme 重新打开
......@@ -40,7 +43,9 @@ App({
handleQuery(query) {
const { activityId } = query;
// this.activityId = activityId || '5f73f1b09da6718132be23d1';
this.activityId = activityId || '5f7a893575cfb6f3d500933c';
// this.activityId = activityId || '5f7a893575cfb6f3d500933c';
this.activityId = activityId || '5f7d49259da671f3b6cf5dc6';
// this.activityId = activityId || '5f7c0c3c8e6a08f0821df465';
}
});
......@@ -13,7 +13,7 @@
<view class="ju_xing14"></view>
<image class="mission_icon" src="{{item.iconUrl}}" />
<view class="mission_content">
<view class="mission_title">{{item.taskNameActiv}}</view>
<view class="mission_title">{{item.title}}</view>
<view a:if="{{item.taskType === 'moneyGoods'}}" class="mission_describe">每支付1笔定金乐园门票<text class="mission_describe_hightlight">+{{item.rewards}}</text></view>
<view a:if="{{item.taskType === 'invites'}}" class="mission_describe">每邀请1名好友入会乐园门票<text class="mission_describe_hightlight">+{{item.rewards}}</text></view>
......@@ -33,7 +33,7 @@
<text a:if="{{item.status === 3 && item.taskType !== '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>
......
......@@ -17,7 +17,7 @@ const TASK_ENUM = {
"btnText": "去邀请"
},
"browseGoods": {
"title": "浏览指定商品15s",
"title": "浏览商品列表15s",
"iconUrl": "//yun.duiba.com.cn/spark/assets/43081f4ee9aed1c4d89d9e0882b2b5210a93ef17.png",
"btnText": "去浏览"
},
......@@ -46,7 +46,8 @@ const TASK_ENUM = {
Component({
data: {
resList: resList,
missionsList: []
missionsList: [],
missionRefresh: false
},
props: {
missionsList: []
......@@ -62,7 +63,9 @@ Component({
// if (this.data.missionsList.length !== prevData.missionsList.length) {
// this.setData({ missionsList: this.props.missionsList })
// }
// this.getMissionList()
if (this.props.missionRefresh) {
this.getMissionList()
}
},
methods: {
......@@ -78,7 +81,8 @@ Component({
let arr2 = []
let arr3 = []
data.forEach((item, index) => {
item.itemIds = item.itemIds ? item.itemIds : '11111'
// item.itemIds = item.itemIds ? item.itemIds : '11111'
item.itemIds = item.itemIds
item.iconUrl = TASK_ENUM[item.taskType].iconUrl
item.taskNameActiv = TASK_ENUM[item.taskType].title
item.btnText = TASK_ENUM[item.taskType].btnText
......@@ -95,6 +99,7 @@ Component({
}
})
.catch(res => { console.warn(res); commonToast(res && res.message); }) || {};
this.props.onCloseMissionRefresh()
},
onRefreshGameInfo () {
......@@ -148,19 +153,19 @@ Component({
if (ds.taskType === 'invites') {
commonToast(`已有${ds.info.todayCompleteTimes}位还有为你助力,获得次数,乐园门票+${Number(ds.info.todayCompleteTimes) * Number(ds.info.rewards)}`)
} else if (ds.taskType === 'follow') {
commonToast(`成功关注店铺,乐园门票+${Number(ds.info.rewards)}`)
commonToast(`成功关注店铺,乐园门票+${Number(ds.info.waitReceive)}`)
} else if (ds.taskType === 'member') {
commonToast(`成功入会,乐园门票+${Number(ds.info.rewards)}`)
commonToast(`成功入会,乐园门票+${Number(ds.info.waitReceive)}`)
} else if (ds.taskType === 'browseGoods') {
commonToast(`任务完成,乐园门票+${Number(ds.info.rewards)}`)
commonToast(`任务完成,乐园门票+${Number(ds.info.waitReceive)}`)
} else if (ds.taskType === 'jumpLink') {
commonToast(`任务完成,乐园门票+${Number(ds.info.rewards)}`)
commonToast(`任务完成,乐园门票+${Number(ds.info.waitReceive)}`)
} else if (ds.taskType === 'moneyGoods') {
commonToast(`成功下单,乐园门票+${Number(ds.info.rewards)}`)
commonToast(`成功下单,乐园门票+${Number(ds.info.waitReceive)}`)
} else if (ds.taskType === 'orderGoods') {
commonToast(`任务完成,乐园门票+${Number(ds.info.rewards)}`)
commonToast(`任务完成,乐园门票+${Number(ds.info.waitReceive)}`)
} else {
commonToast(`成功下单,乐园门票+${Number(ds.info.rewards)}`)
commonToast(`成功下单,乐园门票+${Number(ds.info.waitReceive)}`)
}
this.getMissionList()
this.onRefreshGameInfo()
......
......@@ -18,17 +18,23 @@
.noStartToast {
width: 300rpx;
height: 68rpx;
line-height: 68rpx;
height: 88rpx;
line-height: 88rpx;
text-align: center;
font-size: 28rpx;
font-size: 32rpx;
color: white;
position: absolute;
top: calc(50% - 34rpx);
left: calc(50% - 150rpx);
z-index: 101;
background-color: rgba(0,0,0,5);
border-radius: 6rpx;
background-color: rgba(0,0,0, .68);
border-radius: 10rpx;
}
.lowToast {
width: 700rpx;
left: 25rpx;
background-color: rgba(0,0,0, .68);
}
.homepage_wrapper {
......
......@@ -9,6 +9,7 @@
<view class="noStartToast" a:if="{{noStartToast}}">活动未开始</view>
<view class="noStartToast lowToast" a:if="{{lowToast}}">为保证活动正常参与,请升级淘宝版本</view>
<view class="transMask-noStart" a:if="{{noStart}}"></view>
<view class="transMask-end" a:if="{{end}}"></view>
<!-- 头部 规则-奖品 按钮 -->
......@@ -22,7 +23,7 @@
<view class="video_wrapper" a:if="{{videoShow}}">
<view class="video_wrapper_mask"></view>
<!--
-->
<video
id="videoCtx"
......@@ -49,7 +50,7 @@
</view>
<view a:if="{{videoShow}}" class="video_hide" onTap="videoHideFunc">
<image class="video_hide_img" src="{{resList['70d07de0-4fc3-4802-bc56-c5cb57a28b91'].url}}" mode="aspectFill" />
<image class="video_hide_img" src="{{resList['4d77ca71-1a5f-4db9-87dd-e54dfc671266'].url}}" mode="aspectFill" />
</view>
<!-- 视频部分 -->
......@@ -60,7 +61,7 @@
<view class="video_block_wrapper_postersmall_mask"></view>
<image class="video_block_wrapper_postersmall" src="{{videoImgSrcSmall}}" mode="aspectFill" />
<view class="video_block_text">
<view>观看XXXXX视频</view>
<view>观看视频</view>
<view>赢惊喜抽奖次数</view>
</view>
<!--
......@@ -129,4 +130,4 @@
<newuser-modal a:if="{{newUserModalVisible}}" onModalClose="closeNewUserModal"></newuser-modal>
<rewards-modal a:if="{{rewardsModalVisible}}" onModalClose="closeRewardsModal"></rewards-modal>
<prizes-modal a:if="{{prizesModalVisible}}" onModalClose="closePrizesModal"></prizes-modal>
<mission-modal a:if="{{missionModalVisible}}" refresh="{{missionRefresh}}" onModalClose="closeMissionModal" onRefreshGameInfo="getGameInfo"></mission-modal>
<mission-modal a:if="{{missionModalVisible}}" missionRefresh="{{missionRefresh}}" onCloseMissionRefresh="closeMissionRefresh" refresh="{{missionRefresh}}" onModalClose="closeMissionModal" onRefreshGameInfo="getGameInfo"></mission-modal>
......@@ -4,7 +4,7 @@ import { clickStat } from '../../md';
import resList from '../../resconfig/resList.js'
const { tbcc } = app;
const { SHARE_CONFIG, REDIRECT_URL } = tbcc.constants;
const { commonToast, getAuthUserInfo, navigateToOutside, ConsoleStyle, checkShopFavoredStatus, debounce } = tbcc.tb;
const { commonToast, getAuthUserInfo, navigateToOutside, ConsoleStyle, checkShopFavoredStatus, debounce, getSystemInfo } = tbcc.tb;
Page({
doExchange: () => {
......@@ -37,6 +37,7 @@ Page({
data: {
noStartToast: false,
noStart: true,
lowToast: false,
end: true,
resList: resList,
title: '',
......@@ -90,8 +91,29 @@ Page({
async onLoad (query) {
console.info(`%cPage onLoad with query: ${JSON.stringify(query)}`, ConsoleStyle)
// let queryArr = Object.keys(query)
// this.queryArr = queryArr.join('----')
// console.log(this.queryArr)
// commonToast(JSON.stringify(query))
// if (typeof query === 'string') {
// commonToast(query)
// let str = decodeURI(query)
// let str1 = decodeURIComponent(str)
// this.refresh = this.getQueryVariable('refresh')
// this.inviteId = this.getQueryVariable('inviteId')
// this.query = {
// refresh: this.refresh,
// inviteId: this.inviteId
// }
// } else {
// this.query = query
// if (this.query && this.query.inviteId) this.inviteId = this.query.inviteId
// if (this.query && this.query.refresh) this.refresh = this.query.refresh
// }
this.query = query
if (this.query && this.query.inviteId) this.inviteId = this.query.inviteId
if (this.query && this.query.refresh) this.refresh = this.query.refresh
// 页面加载
// 开场动画
......@@ -135,6 +157,18 @@ Page({
// 获取用户授权信息
async getAuth() {
let sysInfo = await getSystemInfo()
let sysArr = sysInfo.version.split('.')
// let sysArr = ["9", "8", "55"]
// 版本小于9.8
console.log(sysArr)
if (sysArr[0] <= 9 && sysArr[1] < 8) {
this.setData({
noStart: true,
lowToast: true
})
return
}
const userInfo = await getAuthUserInfo().catch(err => {
console.warn('未授权成功', err);
});
......@@ -162,24 +196,63 @@ Page({
console.log('%c-----用户登陆信息\n' + '-----yd.login\n', ConsoleStyle, data)
app.openId = data.openId
this.isNewUser = data.isNewUser
// 首次进入 弹出活动规则
if (this.isNewUser) this.showNewUserModal()
// this.checkNewUserInGame()
this.getGameInfo()
this.init(data);
this.init();
})
.catch(res => { commonToast(res && res.message); }) || {};
.catch(res => {
console.warn(res)
this.init()
if (res.code == '220002') {
// 活动未开始
this.setData({
end: false,
noStart: true,
noStartToast: true
})
} else if (res.code == '220003') {
// 活动已结束
this.setData({
end: true,
noStart: false
})
commonToast(res && res.message)
} else {
commonToast(res && res.message)
}
}) || {};
},
// 请求 业务接口 信息
async init(data) {
async init() {
API.getActivityBaseInfoById({activityId: app.activityId})
.then(res => {
const { success, message, data } = res
if (!success) { console.warn(res); commonToast(res && res.message) }
if (!success) {
console.warn(res)
if (res.code == '220002') {
// 活动未开始
this.setData({
end: false,
noStart: true,
noStartToast: true
})
} else if (res.code == '220003') {
// 活动已结束
this.setData({
end: true,
noStart: false
})
commonToast(res && res.message)
} else {
commonToast(res && res.message)
}
}
else {
console.log('%c-----活动基本信息\n' + '-----yd.getActivityBaseInfoById\n', ConsoleStyle, data)
app.liveUrl = data.liveUrl
......@@ -214,7 +287,26 @@ Page({
}
})
.catch(res => { console.warn(res); commonToast(res && res.message); }) || {};
.catch(res => {
console.warn(res)
if (res.code == '220002') {
// 活动未开始
this.setData({
end: false,
noStart: true,
noStartToast: true
})
} else if (res.code == '220003') {
// 活动已结束
this.setData({
end: true,
noStart: false
})
commonToast(res && res.message)
} else {
commonToast(res && res.message)
}
}) || {};
// 检查是否是vip
this.checkVip()
......@@ -260,10 +352,11 @@ Page({
// 助力
checkDohelp(){
if (this.query.inviteId) {
API.doHelp({activityId: app.activityId, inviteId: this.query.inviteId})
API.doHelp({activityId: app.activityId, inviteId: this.query.inviteId, refresh: 1})
.then(res=>{
const { code, data, success, message } = res
console.log('%c-----助力接口\n' + '-----yd.doHelp\n', ConsoleStyle, res)
// commonToast(data.url)
if (success) {
this.showCommonMoadalT1({
title: '恭喜您',
......@@ -279,6 +372,9 @@ Page({
title: '温馨提示',
content: '成为会员 才能为他助力哦~',
confirmCallback: () => {
setTimeout(() => {
this.checkDohelp()
}, 3000)
navigateToOutside(data.url)
},
btnImg: '//yun.duiba.com.cn/spark/assets/一秒成为会员.10be8a8ede8f6c62eadb005744dc54ae182911d9.png' })
......@@ -289,12 +385,16 @@ Page({
})
.catch(err => {
console.log(`%c助力失败!!!\n` + '-----yd.doHelp\n', ConsoleStyle, err)
if (err.data.url) {
// commonToast(err.data.url)
if (err.data && err.data.url) {
app.vipUrl = err.data.url
this.showCommonMoadalT1({
title: '温馨提示',
content: '成为会员 才能为他助力哦~',
confirmCallback: () => {
setTimeout(() => {
this.checkDohelp()
}, 3000)
navigateToOutside(err.data.url)
},
btnImg: '//yun.duiba.com.cn/spark/assets/一秒成为会员.10be8a8ede8f6c62eadb005744dc54ae182911d9.png'
......@@ -345,7 +445,11 @@ Page({
// 页面显示
onShow() {
if (this.userLogin) this.getGameInfo()
// this.setData({ missionRefresh: true })
this.setData({ missionRefresh: true })
},
closeMissionRefresh () {
this.setData({ missionRefresh: false })
},
// 获取 游戏门票 抽奖次数 今日是否首次登陆
......@@ -629,19 +733,20 @@ Page({
checkStartEndTime () {
let time = new Date()
if (!this.startTime || !this.endTime) return
// 活动结束
// 活动结束
if (time.getTime() > this.endTime) {
this.setData({
end: true,
noStart: false
})
commonToast('活动已结束')
// 活动进行中
} else if (time.getTime() <= this.endTime && time.getTime() >= this.startTime) {
this.setData({
end: false,
noStart: false
})
// 活动开始
// 活动开始
} else {
this.setData({
end: false,
......@@ -694,8 +799,22 @@ Page({
return url + '?' + replaceText;
}
}
},
getQueryVariable(variable, str) {
let query = str;
let vars = query.split("&");
for (let i = 0; i < vars.length; i++ ) {
let pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
return(false)
}
// // video - turn small
// onVideoTurnSmall () {
// this.videoCtx.pause()
......
......@@ -181,7 +181,7 @@ Page({
} else {
this.showCommonMoadalT1({
title: '很遗憾',
content: `奖励与您擦而过\n再接再厉哦~`,
content: `奖励与您擦而过\n再接再厉哦~`,
confirmCallback: async () => {
this.setData({ rotateFlag: false })
this.closeCommonModalT1()
......
......@@ -730,6 +730,12 @@ const resList = {
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/好的按钮.948e42751245099e12fef8ad2617d746f6370863.png',
uuid: '8aa6d279-6105-430a-8b5a-2132a983fa8a'
},
'4d77ca71-1a5f-4db9-87dd-e54dfc671266': {
name: '关闭按钮_白',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/关闭按钮_白.482eff6f4b25953c989ddaa608b754cd8af488b7.png',
uuid: '4d77ca71-1a5f-4db9-87dd-e54dfc671266'
}
};
export default resList;
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