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