91d68f79 by simon

版本提交

1 parent 8c056043
......@@ -67,16 +67,7 @@ App({
}).then((result) => {
this.globalData.indexInfo = result;
this.globalData.userInfo = result.userInfo;
if (result.isNeedAuth == 1 && auth == true) {
//需要授权
this.router.push({
path: "authorize"
})
reject();
// resolve();
} else {
resolve(result)
}
}).catch((err) => {
reject();
});
......
......@@ -24,6 +24,11 @@ Component({
name: "_evt_hide_mask"
});
},
authComplete() {
this.triggerEvent('evtcomp', {
name: "_evt_auth_complete"
});
},
bindGetUserInfo(e) {
wx.showLoading();
this.getUserInfo(e.detail);
......@@ -51,6 +56,7 @@ Component({
// })
}
_this.hideMask();
_this.authComplete();
}).catch((err) => {})
},
}
......
......@@ -8,7 +8,8 @@ $contentWidth:690px;
position: relative;
background-color: #fff;
// width: 750px;
max-height: 860px;
// max-height: 860px;
height: 860px;
.cont {
// width: 750px;
......
......@@ -32,8 +32,13 @@ Page({
this.setData({
options
})
console.log("onLoad");
},
onHide() {
},
onShow() {
console.log("onShow");
this.initData();
},
initData() {
......@@ -41,19 +46,6 @@ Page({
this.setData({
userInfo: app.globalData.userInfo
})
// 判断是否需要授权
if (result.isNeedAuth == 1) {
app.router.push({
path: "authorize",
query: {
redirect: "coop"
}
})
} else {
// this.queryWishbillDetail();
// this.initShake();
}
this.queryWishbillDetail();
this.initShake();
})
......@@ -81,20 +73,29 @@ Page({
},
// 助力
queryWishbillAssist() {
if (!this.data.canShake || this.data.tipsCommonVisible) {
return;
}
this.setData({
canShake: false
})
app.post({
url: app.api.wishbillAssist,
data: {
billCode: this.data.options.code
}
}).then((result) => {
console.log("queryWishbillAssist result:", result);
let status = result.status;
this.setData({
status: status
})
if (status == 1) {
// 助力成功
// 合并数据
let wishList = result.elasticValueList;
wishList.forEach(element => {
let product = productMap[element.prizeDefineCode + ""];
console.log("product:", product);
element = Object.assign(element, product);
let progress = element.elasticValue / element.conditionElasticValue * 100;
if (progress > 100) progress = 100;
......@@ -103,6 +104,7 @@ Page({
element.progress = progress;
element.progressLeft = progressLeft;
});
console.log("wishList:", wishList);
this.setData({
coopInfo: result,
wishList: wishList
......@@ -125,10 +127,15 @@ Page({
})
}
this.setData({
canShake: true
})
})
},
// 获取心愿单详情
queryWishbillDetail() {
console.log("queryWishbillDetail code:", this.data.options.code);
return new Promise((resolve, reject) => {
app.post({
url: app.api.wishbillDetail,
......@@ -136,10 +143,10 @@ Page({
billCode: this.data.options.code
}
}).then((result) => {
let status = result.isAssist;
this.setData({
status
})
// let status = result.isAssist;
// this.setData({
// status
// })
let wishList = result.wishGifts;
wishList.forEach(element => {
let product = productMap[element.prizeDefineCode + ""];
......@@ -157,7 +164,7 @@ Page({
})
console.log("wishInfo:", this.data.wishInfo);
console.log("wishList:", this.data.wishList);
resolve();
})
});
},
......@@ -180,6 +187,10 @@ Page({
this.hideMask();
break;
case "_evt_auth_complete:":
this.initData();
break;
default:
break;
}
......
......@@ -60,7 +60,8 @@
color: #333333;
font-size: 28px;
line-height: 1.6;
height: 150px;
height: 140px;
@include ellipsis(3);
}
// 心愿
......
......@@ -9,7 +9,7 @@
<view class="content">
<!-- 摇一摇 -->
<!-- bindtap="queryWishbillAssist" -->
<view wx:if="{{status != 1}}" class="shake">
<view bindtap="queryWishbillAssist" wx:if="{{status != 1}}" class="shake">
<image class="ebg" mode="widthFix" src="../../image/oss/coop/coop-c2.png" />
<view class="space1"></view>
<view class="cont">
......@@ -47,7 +47,7 @@
</view>
</view>
<view class="tips2">
<text class="t1">太厉害了\n您总共摇出了{{wishInfo.totalElasticValue}}弹力值</text>
<text class="t1">太厉害了\n您总共摇出了{{coopInfo.totalElasticValue}}弹力值</text>
</view>
<!-- 奖品 -->
<view class="wish">
......
......@@ -30,6 +30,7 @@ Page({
wishList: [], // 创建后的心愿单列表
userInfo: {},
isPageVisible: false,
// canShake:false,
},
onShareAppMessage() {},
onShow() {
......@@ -39,10 +40,11 @@ Page({
this.isPageVisible = false;
},
onLoad(options) {
// console.log("cw -- onLoad");
this.initData();
},
initData() {
this.hideMask();
// 还原缓存心愿单
let myWishList = app.store.getItem("wish") || [];
this.setData({
......@@ -56,6 +58,7 @@ Page({
this.queryWishbillPrizeCandidate().then((result) => {
this.initBorder();
})
this.checkNeedQuestion();
});
this.initShake();
},
......@@ -93,6 +96,68 @@ Page({
}
});
},
/**
* 检验是否需要先答题 是的话弹答题
* 1.已经登陆
* 2.是新会员
* 3.不是黑名单
* 4.未答题
*/
checkNeedQuestion() {
return new Promise((resolve, reject) => {
let indexInfo = app.globalData.indexInfo;
let {
isCrmLogin,
isNewMember,
isBlackList,
hadAnswerQuestion,
} = indexInfo;
if (isCrmLogin == 1 && isNewMember == 1 && isBlackList == 0 && hadAnswerQuestion == 0) {
this.setData({
tipsNewMemberVisible: true,
})
} else {}
resolve();
});
},
/**
* 检查是否有资格玩
* 1.未已经登陆 => 提示登陆
* 2.非黑名单 => 弹团购会员弹窗
* 3.是新会员且未答题 => 弹未答题弹窗
*/
checkCanPlay() {
return new Promise((resolve, reject) => {
let indexInfo = app.globalData.indexInfo;
let {
isCrmLogin,
isNewMember,
isBlackList,
hadAnswerQuestion,
} = indexInfo;
if (isCrmLogin == 0) {
this.setData({
tipsRegisterVisible: true,
})
reject();
} else if (isBlackList == 1) {
this.setData({
tipsGroupMemberVisible: true,
})
reject();
} else if (isNewMember == 1 && hadAnswerQuestion == 0) {
this.setData({
tipsNewMemberVisible: true,
})
reject();
} else {
resolve();
}
});
},
/**
* 提交前判断状态
* 判断顺序
......@@ -109,8 +174,6 @@ Page({
isNewMember,
isBlackList,
hadAnswerQuestion,
isSelfAssist,
wishBillCode
} = indexInfo;
// 未登陆 出注册弹窗提示
// isCrmLogin = 1;
......@@ -121,6 +184,7 @@ Page({
reject();
return;
}
// 黑名单
if (isBlackList == 1) {
this.setData({
......@@ -129,6 +193,7 @@ Page({
reject();
return;
}
// 新老会员
// isNewMember
// hadAnswerQuestion = 1; //硬编码答题
......@@ -193,9 +258,13 @@ Page({
}).then((result) => {
if (app.globalData.indexInfo.isNewMember == 1) {
// 新会员
this.setData({
tipsCreateCompleteVisible: true,
wishBillInfo: result
// this.setData({
// tipsCreateCompleteVisible: true,
// wishBillInfo: result
// })
app.router.push({
openType: "reLaunch",
path: "wish"
})
} else {
// 老会员,自动助力,出提示页面
......@@ -247,6 +316,7 @@ Page({
* @param {*} evt
*/
onAddWishHandler(evt) {
this.checkCanPlay().then((result) => {
let myWishList = this.data.myWishList;
let curWish = this.data.curWish;
......@@ -277,6 +347,8 @@ Page({
myWishList
})
app.store.setItem("wish", myWishList);
});
},
/**
* 取消心愿单
......
......@@ -35,10 +35,12 @@ Page({
let {
wishBillCode
} = app.globalData.indexInfo;
// 判断页面跳转
let path = "createWish";
if (wishBillCode) {
path = "wish"
}
console.log("path:",path);
app.router.push({
path: path
})
......
......@@ -19,7 +19,7 @@
<view class="display">
<view class="border border2">
<view class="inner inner2">
<image class="portrait" mode="widthFix" src="{{rank[0].avatar}}" />
<image class="portrait" mode="widthFix" src="{{rank[1].avatar}}" />
</view>
<view class="no no2 ">NO.2</view>
</view>
......
......@@ -12,7 +12,7 @@ Page({
data: {
isOverShare: true, //自定义分享
tipsRuleVisible: false,
tipsPirzeVisible: true,
tipsPirzeVisible: false,
userInfo: {},
wishInfo: {},
wishList: [],
......