Commit c2c079c7 authored by zhangjinzhou's avatar zhangjinzhou

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

parents d0925085 746c1354
......@@ -9,7 +9,7 @@ cloud.init({
App({
env,
requestType: 'cloud', // yapi,cloud: 云函数
// requestType: 'local', // yapi,cloud: 云函数
// requestType: 'local', // yapi,cloud: 云函数
cloudName: 'jn', // 主云函数项目名 tmallCat
// cloudName: 'bubbleSurviva', // 主云函数项目名 tmallCat
cloud,
......@@ -31,7 +31,9 @@ App({
*/
handleQuery(query) {
const { activityId } = query;
this.activityId = activityId || '5f8550a3964f97be3647a635';
// this.activityId = activityId || '5f8550a3964f97be3647a635';
this.activityId = activityId || '5f8831e67389891bfd6bb35f'; //赵然1
}
});
......@@ -33,6 +33,7 @@ Component({
},
/**助力 */
async doHelp() {
my.showLoading();
const {
success,
data,
......@@ -42,13 +43,20 @@ Component({
inviteStep: app.step
}).catch(r => {
if (r.data && !r.data.isVip) {
my.hideLoading();
commonToast("3s入会,即可为好友助力", 1500, () => {
app.isGoVip = true;
navigateToOutside(r.data.url);
})
} else if (r.data && r.data.isVip) {
my.hideLoading();
this.openInviteFailedModal();
} else {
my.hideLoading();
const {
onCloseModal
} = this.props;
onCloseModal && onCloseModal();
commonToast(r&&r.message);
}
}) || {};
......@@ -56,6 +64,7 @@ Component({
if (success) {
this.openInviteSuccessModal();
}
my.hideLoading();
}
},
......
......@@ -72,7 +72,8 @@ Component({
const {
taskType,
sellerId,
rewards
rewards,
todayCompleteTimes
} = item;
const {
success,
......@@ -103,7 +104,11 @@ Component({
// }
console.log('taskType', taskType)
// if (taskType == 'invites')
if (taskType == 'collectGoods') {
str = `任务完成,增加${data.addWarms}个温暖值`
} else {
str = `任务完成,增加${rewards}个温暖值`
}
commonToast(str || '领取成功');
}
/**领取成功,增加温暖值 */
......@@ -152,6 +157,7 @@ Component({
flag = 0;
},
async handleGoColletcGoods(itemIds) {
this.onModalClose();
my.navigateTo({
url: '/pages/goodsPage/goodsPage?taskType=collectGoods&&itemIds=' + itemIds
})
......@@ -162,6 +168,7 @@ Component({
}) || {};
},
async handleGoBrowseGoods(itemIds) {
this.onModalClose();
my.navigateTo({
url: '/pages/goodsPage/goodsPage?taskType=browseGoods&&itemIds=' + itemIds
})
......
......@@ -86,10 +86,13 @@ Component({
})
const {
itemId,
url
url,
collected
} = e.target.dataset.item
if(!collected){
const {onSetCurItemId} = this.props;
onSetCurItemId&&onSetCurItemId(itemId);
}
// const {
// onSetNotColletArr
// } = this.props;
......@@ -128,7 +131,7 @@ Component({
}, () => {
if (this.data.usePercent >= 10) {
console.log(this.data.usePercent)
this.props.onCompleteTask(taskType,1)
this.props.onCompleteTask(taskType)
clearInterval(this.timer)
}
})
......
......@@ -30,6 +30,7 @@ Page({
collectGoodsArr: [],
notCollectGoodsArr: [],
curItemId: null,
defaultItemId:0,
data: {
query: {},
task: {},
......@@ -66,12 +67,15 @@ Page({
},
jdgeCollect(){
console.log("判断是否收藏")
let index = this.notCollectGoodsArr.indexOf(this.curItemId)
if(index>=0){
my.tb.checkGoodsCollectedStatus({
id: this.curItemId,
success: (res) => {
const {isCollect,id} = res;
if(isCollect){
this.onCompleteTask("collectGoods",id)
this.notCollectGoodsArr.splice(index,1);
this.onCompleteTask("collectGoods",this.curItemId)
console.log("收藏成功")
}else{
console.log("收藏失败",id)
......@@ -85,6 +89,10 @@ Page({
// my.alert({ content: "fail - " + isCollect })
}
})
}else{
return;
}
},
init() {
const {
......@@ -167,6 +175,10 @@ Page({
res && commonToast(res)
}) || {}
if (success) {
this.defaultItemId = data[0]?data[0].itemId:0;
if(taskType=='collectGoods'){
this.getNotCollectItem(data);
}
this.setData({
goodsList: data || []
})
......@@ -176,6 +188,13 @@ Page({
// this.isCanCompleteCollectTask();
// }
},
getNotCollectItem(list){
for(let i=0;i<list.length;i++){
if(!list[i].collected){
this.notCollectGoodsArr.push(list[i].itemId);
}
}
},
/**判断收藏商品任务是否完成 */
async isCanCompleteCollectTask(itemId) {
// let result = await checkGoodsCollectedStatus(itemId);
......@@ -208,7 +227,7 @@ Page({
success, data
} = await API.doCollectGoodsTask({
taskType,
itemId
itemId:itemId
}).catch(res => {
res && commonToast(res)
}) || {}
......@@ -219,7 +238,7 @@ Page({
case 'browseGoods':
let browsResult = await API.doBrowseGoodsTask({
taskType,
itemId
itemId:this.defaultItemId
}).catch(res => {
res && commonToast(res)
}) || {}
......
......@@ -33,6 +33,7 @@ Page({
gameConfigList: {},
favoredStatus: false,
goVip: false,
start: false,
data: {
indexPrize: [{
id: 1,
......@@ -309,6 +310,7 @@ Page({
})
}
this.canOpenGamePage = true;
this.start = true;
my.hideLoading();
}
......@@ -317,6 +319,7 @@ Page({
/**进入游戏页面 */
async openGamePage() {
if(!this.canOpenGamePage) return;
this.canOpenGamePage = false
my.showLoading();
const {
success,
......@@ -327,14 +330,17 @@ Page({
}).catch(r => {
if (r&&r.data && !r.data.isVip) {
commonToast("3s入会,即可为好友助力", 1500, () => {
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({
......@@ -351,6 +357,7 @@ Page({
},
/**打开弹窗 */
openModal(e) {
if(!this.start) return;
console.log(e);
const {
item
......@@ -367,6 +374,7 @@ Page({
},
/**点击跳转页面 */
navigateTo(e) {
if(!this.start) return;
const {
item
} = e.target.dataset;
......
This diff is collapsed.
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