|
|
@@ -45,6 +45,12 @@ cc.Class({
|
|
|
type: cc.Node,
|
|
|
serializable: true
|
|
|
},
|
|
|
+ //输入节点
|
|
|
+ inputContainer:{
|
|
|
+ default:null,
|
|
|
+ type:cc.Node,
|
|
|
+ serializable:true
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
@@ -63,7 +69,9 @@ cc.Class({
|
|
|
this.node.active = true;
|
|
|
this.myInviteValue.string = GlobalD.Dapp.UserInfo.invite_code;
|
|
|
if (GlobalD.Dapp.UserInfo.parent) {
|
|
|
- this.parentInviteValue.string = GlobalD.Dapp.UserInfo.parent;
|
|
|
+ this.parentInviteValue.string = GlobalD.Dapp.UserInfo.parent.invite_code;
|
|
|
+ //如果存在父节点,隐藏输入框
|
|
|
+ this.inputContainer.active = false;
|
|
|
}
|
|
|
|
|
|
// {
|
|
|
@@ -74,14 +82,14 @@ cc.Class({
|
|
|
// "team_cnt_amount": 0 // 伞下团队租赁土地消费CNT数量(含直推数量)
|
|
|
// }
|
|
|
// 获取镇长/村长团队信息(村长或镇长身份才需要)
|
|
|
- if (0 === GlobalD.Dapp.UserInfo.agent_level) {
|
|
|
- console.log("村民不需要获取团队信息");
|
|
|
- return;
|
|
|
- }
|
|
|
+ // if (0 === GlobalD.Dapp.UserInfo.agent_level) {
|
|
|
+ // console.log("村民不需要获取团队信息");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
GlobalD.dapp.teamData().then((data) => {
|
|
|
+ console.log("teamData:" + JSON.stringify(data));
|
|
|
if (data.err === null) {
|
|
|
// 返回成功,见下面消息体
|
|
|
- console.log("==========>" + JSON.stringify(data));
|
|
|
this.neighborValue.string = data.res.children_count;
|
|
|
this.neighborConsumValue.string = data.res.children_cnt_amount;
|
|
|
this.neighborDirectValue.string = data.res.children_village_chief_count;
|
|
|
@@ -110,17 +118,23 @@ cc.Class({
|
|
|
return;
|
|
|
}
|
|
|
let _self = this;
|
|
|
- GlobalD.dapp.bindParent(this.inputInviteValue).then((data) => {
|
|
|
+ GlobalD.dapp.bindParent(_self.inputInviteValue).then((data) => {
|
|
|
if (data.err === null) {
|
|
|
// 返回成功,见下面消息体
|
|
|
console.log(data.res)
|
|
|
- gameToast.getInstance().show(_self.ToastParent, data.res, 3, () => {
|
|
|
+ //绑定成功时候,隐藏输入框,设置父节点
|
|
|
+ GlobalD.Dapp.UserInfo.parent = data.res;
|
|
|
+ _self.parentInviteValue.string = GlobalD.Dapp.UserInfo.parent.invite_code;
|
|
|
+ //如果存在父节点,隐藏输入框
|
|
|
+ _self.inputContainer.active = false;
|
|
|
+
|
|
|
+ gameToast.getInstance().show(_self.ToastParent, "绑定成功!", 3, () => {
|
|
|
console.log("finish toast!");
|
|
|
}, _self);
|
|
|
} else {
|
|
|
//TODO 服务错误
|
|
|
console.log(data.err)
|
|
|
- gameToast.getInstance().show(_self.ToastParent, data.err, 3, () => {
|
|
|
+ gameToast.getInstance().show(_self.ToastParent, "绑定失败!", 3, () => {
|
|
|
console.log("finish toast!");
|
|
|
}, _self);
|
|
|
}
|