Commit 30b99dc1 authored by wildfirecode13's avatar wildfirecode13

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

parents f054e24f e4e8b123
{
"success": true,
"message":"",
"data": {
"sence": 1,
"senceTips":["测试","测试"],
"senceGuide":{
"1":false,
"2":true,
"3":false,
"4":true
}
}
}
\ No newline at end of file
...@@ -2,18 +2,19 @@ ...@@ -2,18 +2,19 @@
"success": true, "success": true,
"message":"", "message":"",
"data": { "data": {
"catType": 2, "catType": 4,
"userNick": "Edwise", "userNick": "Edwise",
"energy": 1000, "energy": 1000,
"happyCoin":1000, "happyCoin":1000,
"experience": 80, "experience": 80,
"level": "1", "level": "1",
"avatar": "https://yun.duiba.com.cn/spark/assets/a3ae99684afa9a1f8d94f4c95ee6f1ed81de9996.png", "avatar": "http://wwc.alicdn.com/avatar/getAvatar.do?userIdStr=vFHbMm8SPFPHPFRHPG7HPmPhvmgyPGPIP07-OF*eMmQT&width=80&height=80&type=sns",
"sence": 4, "sence": 1,
"catName": "哈哈哈", "catName": "哈哈哈",
"senceTips":["1说话说话说话说话说话说话说话说话说话说话说话","2说话说话说话说话说话说话说话说话说话说话说话说话","3说话说话说话说话说话说话说话说话说话说话说话说话"], "senceTips":["1说话说话说话说话说话说话说话说话说话说话说话","2说话说话说话说话说话说话说话说话说话说话说话说话","3说话说话说话说话说话说话说话说话说话说话说话说话"],
"energyMax":2000, "energyMax":2000,
"experienceMax":100 "experienceMax":100,
"senceGuide":true
} }
} }
\ No newline at end of file
{
"success": true,
"data": null,
"code": "culpa eu Ut"
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -688,6 +688,134 @@ const resCanvasList = { ...@@ -688,6 +688,134 @@ const resCanvasList = {
ext: '.png', ext: '.png',
url: 'https://yun.duiba.com.cn/spark/assets/shapGoBtn1.d4d2cbdd9ab87642e34600c20ca627c9a377ffb7.png', url: 'https://yun.duiba.com.cn/spark/assets/shapGoBtn1.d4d2cbdd9ab87642e34600c20ca627c9a377ffb7.png',
uuid: 'dba58651-57a3-4b75-9447-0e4d498dd8cd' uuid: 'dba58651-57a3-4b75-9447-0e4d498dd8cd'
} },
'5ae12c38-05d8-4105-9101-765e7f32525e': {
name: 'classRoomGuide1',
ext: '.png',
uuid: '5ae12c38-05d8-4105-9101-765e7f32525e',
url: 'https://yun.duiba.com.cn/spark/assets/02ca473f5f7828e4801c6de8d6c81cf459d4a366.png'
},
'e8ad2e4e-925c-4db5-b229-882ee98881a7': {
name: 'classRoomGuide2',
ext: '.png',
uuid: 'e8ad2e4e-925c-4db5-b229-882ee98881a7',
url: 'https://yun.duiba.com.cn/spark/assets/c00974abebadf768413be923f88e4cec0836b275.png'
},
'c549f0a7-085e-444d-b839-4f2172094b0b': {
name: 'classRoomGuide3',
ext: '.png',
uuid: 'c549f0a7-085e-444d-b839-4f2172094b0b',
url: 'https://yun.duiba.com.cn/spark/assets/d1696c00719725364450dd178fc7da4b6d9446de.png'
},
'3f48a757-495b-4ed7-957c-9ec95f82ea5e': {
name: 'classRoomGuide4',
ext: '.png',
uuid: '3f48a757-495b-4ed7-957c-9ec95f82ea5e',
url: 'https://yun.duiba.com.cn/spark/assets/383ce57472efe68f0f16079f122b6cff5ec71995.png'
},
'd37358ea-ba10-4c08-ab3c-7ff682629ada': {
name: 'playGroundGuide1',
ext: '.png',
url: 'https://yun.duiba.com.cn/spark/assets/playGroundGuide1.9ca482960425bac644131a9ae90a45b700ea7642.png',
uuid: 'd37358ea-ba10-4c08-ab3c-7ff682629ada'
},
'f44dd5ee-2fa3-4a47-b398-527b0398544b': {
name: 'playgroundGuide2',
ext: '.png',
uuid: 'f44dd5ee-2fa3-4a47-b398-527b0398544b',
url: 'https://yun.duiba.com.cn/spark/assets/90b5cff8c620e9b2a81da22ab1cdc130a78da592.png'
},
'6583475b-201e-4324-b15e-4632f33f57ec': {
name: 'playgroundGuide3',
ext: '.png',
uuid: '6583475b-201e-4324-b15e-4632f33f57ec',
url: 'https://yun.duiba.com.cn/spark/assets/bb6780d281325d2753204eded63f5c1f9824dc38.png'
},
'a90aa98b-2ff1-41a2-8a71-749bb76d6ba3': {
name: 'playgroundGuide4',
ext: '.png',
url: 'https://yun.duiba.com.cn/spark/assets/playgroundGuide4.a20dd536f9ebe4a7884fd577434d129a49d790df.png',
uuid: 'a90aa98b-2ff1-41a2-8a71-749bb76d6ba3'
},
'5996c68c-2626-4a97-a36a-8d5af6b777c0': {
name: 'touchImg',
ext: '.png',
url: 'https://yun.duiba.com.cn/spark/assets/touchImg.bababfd52ef6f99d5599d5dd09fd71a994e141d3.png',
uuid: '5996c68c-2626-4a97-a36a-8d5af6b777c0'
},
'90b114e6-83cb-46f1-b607-f88c50077b05': {
name: 'bluCat',
ext: '.png',
url: 'https://yun.duiba.com.cn/spark/assets/bluCat.57cf00351ffde1985720a877d2e1384390970cd6.png',
uuid: '90b114e6-83cb-46f1-b607-f88c50077b05'
},
'4e471df6-01ab-421d-ba0b-084b2110dc6d': {
name: 'orengeCat',
ext: '.png',
url: 'https://yun.duiba.com.cn/spark/assets/orengeCat.c664a89d9d7f63895c5460144098a5bac5fc31f5.png',
uuid: '4e471df6-01ab-421d-ba0b-084b2110dc6d'
},
'003e9904-aee4-4b8d-8d5d-fb4b1188bec1': {
name: 'sanhuaCat',
ext: '.png',
url: 'https://yun.duiba.com.cn/spark/assets/sanhuaCat.b58ed1a3960ecd123ff0b0ff38b9cb8ad44c1b4d.png',
uuid: '003e9904-aee4-4b8d-8d5d-fb4b1188bec1'
},
'90283bd3-4b18-4535-97a8-90318f068781': {
name: 'xianluoCat',
ext: '.png',
url: 'https://yun.duiba.com.cn/spark/assets/xianluoCat.c28961a75753d2d6ffe788a3ae38e7f3c3937344.png',
uuid: '90283bd3-4b18-4535-97a8-90318f068781'
},
'd4740497-ed95-4e35-b107-df545896cf05': {
name: 'bedRoomGuide1',
ext: '.png',
uuid: 'd4740497-ed95-4e35-b107-df545896cf05',
url: 'https://yun.duiba.com.cn/spark/assets/b81c5e7ec197bbcc310ec84dc425d1419238c470.png'
},
'ba92a69d-fc74-482a-8839-6b483d2290b8': {
name: 'bedRoomGuide2',
ext: '.png',
uuid: 'ba92a69d-fc74-482a-8839-6b483d2290b8',
url: 'https://yun.duiba.com.cn/spark/assets/fa384c300572a403ce99bf7cfe506fe5d95ff9e2.png'
},
'ff460e08-76fd-4888-8361-2b65b7ee95ea': {
name: 'bedRoomGuide3',
ext: '.png',
uuid: 'ff460e08-76fd-4888-8361-2b65b7ee95ea',
url: 'https://yun.duiba.com.cn/spark/assets/dfaa85ae186e20803592e30f535af8c5a527f745.png'
},
'f1154565-9a56-4d95-83de-44832d700b5f': {
name: 'bedRoomGuide4',
ext: '.png',
uuid: 'f1154565-9a56-4d95-83de-44832d700b5f',
url: 'https://yun.duiba.com.cn/spark/assets/fd6a0511d7feee32869253d7b380ca6870ef1492.png'
},
'6ab7cbb8-6c9d-412f-9d57-8404465d9e35': {
name: 'bedRoomGuide5',
ext: '.png',
uuid: '6ab7cbb8-6c9d-412f-9d57-8404465d9e35',
url: 'https://yun.duiba.com.cn/spark/assets/19abee4b0b5e64dcfc219d69ded2bf89ed19847c.png'
},
'df6ccefe-756c-4383-aac3-7da9f74b3a0f': {
name: 'bedRoomGuide6',
ext: '.png',
uuid: 'df6ccefe-756c-4383-aac3-7da9f74b3a0f',
url: 'https://yun.duiba.com.cn/spark/assets/b6800bb9c52624fe34ae6065333733fe691db8a9.png'
},
'1a4f7c9e-0857-425a-8abe-3dd5c79b2528': {
name: 'bedRoomGuide7',
ext: '.png',
uuid: '1a4f7c9e-0857-425a-8abe-3dd5c79b2528',
url: 'https://yun.duiba.com.cn/spark/assets/e2822fc4c01310e66f2276f9b03d56519b122e1e.png'
},
}; };
export default resCanvasList; export default resCanvasList;
...@@ -6,8 +6,8 @@ var fs = require("fs"); ...@@ -6,8 +6,8 @@ var fs = require("fs");
// fs.readFileSync("./output.js") // fs.readFileSync("./output.js")
// ) // )
// var endPath = 'D:/duibaGame/测试项目0527/taobaominiTest/client/pages/index1/'; // var endPath = 'D:/duibaGame/测试项目0527/taobaominiTest/client/pages/index1/';
var endPath = '/Users/wanghongyuan/new_taobao/taobao_mini/client/pages/pagecanvas/'; // var endPath = '/Users/wanghongyuan/new_taobao/taobao_mini/client/pages/pagecanvas/';
var endPath = 'D:/taobaoProject/tmyangcheng/new_taobao/taobao_mini/client/pages/pagecanvas';
var version = Math.round(new Date().getTime() / 1000); var version = Math.round(new Date().getTime() / 1000);
// fs.writeFileSync(endPath + "output." + version + ".js", fs.readFileSync("./released/output.js")); // fs.writeFileSync(endPath + "output." + version + ".js", fs.readFileSync("./released/output.js"));
......
/**当前场景对应的类型 */ /**当前场景对应的类型 */
export enum SCENETYPE{ export enum SCENETYPE {
/**教室 */ /**教室 */
CLASSROOM=1, CLASSROOM = 1,
/**操场 */ /**操场 */
PLAYGROUND, PLAYGROUND,
/**寝室 */ /**寝室 */
BEADROOM BEADROOM
} }
/**自定义事件 */ /**自定义事件 */
export enum MSG{ export enum MSG {
/**改变场景,参数为uiType */ /**改变场景,参数为uiType */
CHANGE_SCENE="CHANGE_SCENE", CHANGE_SCENE = "CHANGE_SCENE",
/**选择猫咪 */ /**选择猫咪 */
SELECT_CAT="SELECT_CAT", SELECT_CAT = "SELECT_CAT",
/**猫咪互动 */ /**猫咪互动 */
CAT_ACT="CAT_ACT", CAT_ACT = "CAT_ACT",
/**刷新用户领养信息 */ /**刷新用户领养信息 */
UPDATE_USERINFO = "UPDATE_USERINFO" UPDATE_USERINFO = "UPDATE_USERINFO",
/**结束寝室引导 */
GUIDE_BEDROOMEND = "GUIDE_BEDROOMEND",
/**结束教室引导 */
GUIDE_CLASSROOMEND = "GUIDE_CLASSROOMEND",
/**结束操场引导 */
GUIDE_PLAYGROUNDEND = "GUIDE_PLAYGROUNDEND",
/**找回猫咪 */
RECALL_CAT = "RECALL_CAT"
} }
/**猫咪类型 */ /**猫咪类型 */
export enum CATTYPE{ export enum CATTYPE {
/**蓝猫 */ /**蓝猫 */
BLUE, BLUE,
/**橙猫 */ /**橙猫 */
...@@ -33,7 +41,7 @@ export enum CATTYPE{ ...@@ -33,7 +41,7 @@ export enum CATTYPE{
} }
/**猫咪互动动作 */ /**猫咪互动动作 */
export enum CAT_ACTTYPEP{ export enum CAT_ACTTYPEP {
/**睡觉 */ /**睡觉 */
SLEEP, SLEEP,
/**说话 */ /**说话 */
......
...@@ -9,7 +9,7 @@ export namespace InitLottie { ...@@ -9,7 +9,7 @@ export namespace InitLottie {
list.push(resList[key]); list.push(resList[key]);
} }
console.log(list) console.log(list)
let p: Promise<any> = new Promise((resolve, reject) => { let p: Promise<any> = new Promise((resolve, reject) => {8
initLottie((s) => { initLottie((s) => {
if (s) { if (s) {
resolve() resolve()
......
...@@ -31,10 +31,17 @@ export class Ins { ...@@ -31,10 +31,17 @@ export class Ins {
"sence": number, //场景 "sence": number, //场景
"senceTips":string[], //场景互动文案(猫咪说话) "senceTips":string[], //场景互动文案(猫咪说话)
"energyMax":number, "energyMax":number,
"experienceMax":number "experienceMax":number,
"senceGuide":boolean
} }
public static senceInfo: {
"sence":number,
"senceTips":string[],
"senceGuide":{}
}
public static showModule(name:string,data?){ public static showModule(name:string,data?){
sendTbNet(TbNetName.showModal, { name: name, data: data?data:{} }, (s, res) => { sendTbNet(TbNetName.showModal, { name: name, data: data?data:{} }, (s, res) => {
console.log('showModal ruleModal, success,res', s, res) console.log('showModal ruleModal, success,res', s, res)
......
...@@ -10,5 +10,5 @@ export const ResJson = { ...@@ -10,5 +10,5 @@ export const ResJson = {
"name": "startScene" "name": "startScene"
} }
], ],
"path": "https://yun.duiba.com.cn/db_games/activity/babycare_xiaoxiao/1601005193/resource/" "path": "https://yun.duiba.com.cn/db_games/activity/babycare_xiaoxiao/1601176297/resource/"
} }
\ No newline at end of file
...@@ -27,6 +27,16 @@ export enum TbNetName { ...@@ -27,6 +27,16 @@ export enum TbNetName {
*/ */
getUserEnergy = "tmallCat.getUserEnergy", getUserEnergy = "tmallCat.getUserEnergy",
/**
* 获取场景
*/
getSence = "tmallCat.getSence",
/**
* 完成上报场景引导
*/
updateSenceGuide = "tmallCat.updateSenceGuide",
/** /**
* 埋点统计 到时改名字 * 埋点统计 到时改名字
* activityId params elemType * activityId params elemType
......
...@@ -51,15 +51,13 @@ export class Cat extends Module { ...@@ -51,15 +51,13 @@ export class Cat extends Module {
dialogPos:any[]=[{x:1,y:1}]; //猫咪对话框气泡位置 dialogPos:any[]=[{x:1,y:1}]; //猫咪对话框气泡位置
initUi() { initUi() {
this.initEvents();
this.initCatLottieArr(); this.initCatLottieArr();
console.log(this.catLottieArr); console.log(this.catLottieArr);
this.initCat(); this.initCat();
this.initDialog(); this.initDialog();
var tipsArr = Ins.userInfo.senceTips; this.catTalk();
var index = Math.floor(Math.random()*tipsArr.length)
this.showDialog(1,tipsArr[index]);
this.setCatAnimShow(1,()=>{this.stopCatAct()});
this.initEvents();
} }
/**初始化猫咪Lottie数据组 */ /**初始化猫咪Lottie数据组 */
...@@ -147,6 +145,14 @@ export class Cat extends Module { ...@@ -147,6 +145,14 @@ export class Cat extends Module {
that.dialog.alpha = 0; that.dialog.alpha = 0;
} }
/**在每天进入场景或是在引导后,猫咪说话 */
catTalk(){
var tipsArr = Ins.senceInfo.senceTips;
var index = Math.floor(Math.random()*tipsArr.length)
this.showDialog(1,tipsArr[index]);
this.setCatAnimShow(1,()=>{this.stopCatAct()});
}
/**显示对话框 */ /**显示对话框 */
showDialog(type,msg:string){ showDialog(type,msg:string){
var that = this; var that = this;
...@@ -196,6 +202,8 @@ export class Cat extends Module { ...@@ -196,6 +202,8 @@ export class Cat extends Module {
/**猫咪互动 */ /**猫咪互动 */
catAct(e) { catAct(e) {
console.log("eruighuerihgrueeigh")
console.log("当前猫咪是否在互动",this.actRunning);
if (this.actRunning) return; if (this.actRunning) return;
var that = this; var that = this;
let actType = e.data; let actType = e.data;
...@@ -213,13 +221,17 @@ export class Cat extends Module { ...@@ -213,13 +221,17 @@ export class Cat extends Module {
console.log(actType); console.log(actType);
sendTbNet(TbNetName.interaction, {type:type,sence:Ins.curScene}, (s, r) => { sendTbNet(TbNetName.interaction, {type:type,sence:Ins.curScene}, (s, r) => {
if (s) { if (s) {
if(r.data.isUpgrade){
Ins.showModule("levelupModal",{prizeData:r.data,energyMax1:Ins.userInfo.energyMax,energyMax2:r.data.energyMax});
}
GDispatcher.dispatchEvent(MSG.UPDATE_USERINFO); GDispatcher.dispatchEvent(MSG.UPDATE_USERINFO);
that.actRunning = true; that.actRunning = true;
switch (actType) { switch (actType) {
case CAT_ACTTYPEP.SLEEP: case CAT_ACTTYPEP.SLEEP:
break; break;
default: default:
that.showDialog(actType,r.data.tips); var index = Math.floor(Math.random()*r.data.tips.length)
that.showDialog(actType,r.data.tips[index]);
that.setCatAnimShow(actType, () => { that.setCatAnimShow(actType, () => {
that.stopCatAct(); that.stopCatAct();
}); });
...@@ -233,10 +245,12 @@ export class Cat extends Module { ...@@ -233,10 +245,12 @@ export class Cat extends Module {
} }
initEvents() { initEvents() {
console.log("猫咪添加互动事件")
FYGE.GDispatcher.addEventListener(MSG.CAT_ACT, this.catAct, this); FYGE.GDispatcher.addEventListener(MSG.CAT_ACT, this.catAct, this);
} }
removeEvents() { removeEvents() {
console.log("猫咪移除互动事件")
FYGE.GDispatcher.removeEventListener(MSG.CAT_ACT, this.catAct, this); FYGE.GDispatcher.removeEventListener(MSG.CAT_ACT, this.catAct, this);
} }
} }
\ No newline at end of file
import { RES } from "../../module/RES";
import { Module } from "../../module/views/Module";
import resCanvasList from "../../resCanvasList";
import { MSG } from "../Enum";
import { Ins } from "../Ins";
import { GDispatcher } from "../Main";
export class Guide extends Module {
constructor(data?) {
super(data);
this.guideType = data.type;
this.callBack = data.callBack
}
guideTouch: FYGE.Sprite;
guide: FYGE.Sprite;
/**寝室引导图片组 */
guideUUIDArr_3: string[] = [];
/**操场引导图片组 */
guideUUIDArr_2: string[] = [];
/**教室引导图片组 */
guideUUIDArr_1: string[] = [];
/**当前引导索引 */
index: number = 0;
/**当前引导类型 */
guideType: number = 0; //1:教室,2:操场,3:寝室
/**猫咪图片 */
catImg: FYGE.Sprite;
/**猫咪图片UUID */
catImgUUIDArr: string[] = [];
/**猫咪位置组 */
catPosArr: number[] = [];
/**猫咪在对应index的引导中是否出现 */
catIsShow: boolean[] = [];
callBack;
initUi() {
var that = this;
that.index = 0;
that.catPosArr = [80, 40, 60, 70];
/**猫咪图片 */
that.catImgUUIDArr = ['90b114e6-83cb-46f1-b607-f88c50077b05', '4e471df6-01ab-421d-ba0b-084b2110dc6d', '003e9904-aee4-4b8d-8d5d-fb4b1188bec1', '90283bd3-4b18-4535-97a8-90318f068781']
/**教室引导图片 */
that.guideUUIDArr_1 = ['5ae12c38-05d8-4105-9101-765e7f32525e', 'e8ad2e4e-925c-4db5-b229-882ee98881a7', 'c549f0a7-085e-444d-b839-4f2172094b0b', '3f48a757-495b-4ed7-957c-9ec95f82ea5e'];
/**操场引导图片 */
that.guideUUIDArr_2 = ['d37358ea-ba10-4c08-ab3c-7ff682629ada', 'f44dd5ee-2fa3-4a47-b398-527b0398544b', '6583475b-201e-4324-b15e-4632f33f57ec', 'a90aa98b-2ff1-41a2-8a71-749bb76d6ba3'];
/**寝室引导图片 */
that.guideUUIDArr_3 = ['d4740497-ed95-4e35-b107-df545896cf05', 'ba92a69d-fc74-482a-8839-6b483d2290b8', 'ff460e08-76fd-4888-8361-2b65b7ee95ea',
'f1154565-9a56-4d95-83de-44832d700b5f', '6ab7cbb8-6c9d-412f-9d57-8404465d9e35', 'df6ccefe-756c-4383-aac3-7da9f74b3a0f', '1a4f7c9e-0857-425a-8abe-3dd5c79b2528'];
that.guide = new FYGE.Sprite(Ins.getRes(that['guideUUIDArr_' + that.guideType][0]));
that.addChild(that.guide);
that.catImg = new FYGE.Sprite(Ins.getRes(that.catImgUUIDArr[Ins.userInfo.catType - 1]))
that.addChild(that.catImg);
var x = (Ins.stageW - that.catImg.width) * 0.5;
var y = (Ins.stageH * 0.5)
that.catImg.position.set(x , y);
console.log("引导猫的位置",x,y)
that.guideTouch = new FYGE.Sprite(RES.getRes(resCanvasList["5996c68c-2626-4a97-a36a-8d5af6b777c0"].url));
that.addChild(that.guideTouch);
that.guideTouch.mouseEnable = true;
that.initEvents();
}
changeGuide() {
this.index++;
if (this.index >= this['guideUUIDArr_' + this.guideType].length) {
// GDispatcher.dispatchEvent(MSG.GUIDE_BEDROOMEND);
this.callBack && this.callBack();
return;
}
this.guide.texture = RES.getRes(resCanvasList[this['guideUUIDArr_' + this.guideType][this.index]].url)
if (this.guideType == 3 || this.guideType == 4) {
if (this.index == 4 || this.index == 5) {
this.catImg.visible = false;
} else {
this.catImg.visible = true;
}
}
console.log(this.guide.x, this.guide.y)
}
initEvents() {
this.guideTouch.addEventListener(FYGE.MouseEvent.CLICK, this.changeGuide, this);
}
removeEvents() {
this.guideTouch.removeEventListener(FYGE.MouseEvent.CLICK, this.changeGuide, this);
}
}
\ No newline at end of file
...@@ -9,6 +9,7 @@ import { GDispatcher } from "../Main"; ...@@ -9,6 +9,7 @@ import { GDispatcher } from "../Main";
import { Cat } from "../cat/Cat"; import { Cat } from "../cat/Cat";
import { sendTbNet, TbNetName } from "../TaoBaoNet"; import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { letter } from "../lottieSrc/lottieTs/letter"; import { letter } from "../lottieSrc/lottieTs/letter";
import { Guide } from "../guide/Guide";
export class MainScene extends Scene { export class MainScene extends Scene {
/**场景背景 */ /**场景背景 */
...@@ -42,6 +43,9 @@ export class MainScene extends Scene { ...@@ -42,6 +43,9 @@ export class MainScene extends Scene {
/**猫咪等级 */ /**猫咪等级 */
private level: number = 0; private level: number = 0;
/**场景引导 */
private Guide: Guide;
initUi() { initUi() {
var that = this; var that = this;
that.initSceneEle(); that.initSceneEle();
...@@ -50,16 +54,20 @@ export class MainScene extends Scene { ...@@ -50,16 +54,20 @@ export class MainScene extends Scene {
/**初始化场景元素 */ /**初始化场景元素 */
initSceneEle() { initSceneEle() {
var that = this; var that = this;
that.x = (Ins.stageW - 750) >> 1;
that.y = (Ins.stageH - 1624) >> 1;
console.log(that.y); console.log(that.y);
that.mouseChildren = true; that.mouseChildren = true;
Ins.curScene = Ins.userInfo.sence; Ins.curScene = Ins.senceInfo.sence;
//0:教室,1:操场,2:寝室 //0:教室,1:操场,2:寝室
that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"]; that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"];
//生成默认场景,后面要改成根据接口值判断 //生成默认场景,后面要改成根据接口值判断
that.sceneBg = Ins.initSprite(that.bgUUID[Ins.curScene == 4 ? 2 : Ins.curScene - 1]); that.sceneBg = Ins.initSprite(that.bgUUID[Ins.curScene == 4 ? 2 : Ins.curScene - 1]);
that.addChild(that.sceneBg); that.addChild(that.sceneBg);
that.x = (Ins.stageW - that.sceneBg.width) >> 1;
that.y = (Ins.stageH - that.sceneBg.height) >> 1;
that.mainUi = new MainSceneBtnUi({ uiType: Ins.curScene == 4 ? 3 : Ins.curScene, callF: () => { that.initGuide(Ins.curScene > 3 ? 3 : Ins.curScene) } });
that.addChild(that.mainUi);
that.tlBtn = Ins.initSprite("1f8b040d-2fbc-4ff8-92f9-159773364fae", 0, 640); that.tlBtn = Ins.initSprite("1f8b040d-2fbc-4ff8-92f9-159773364fae", 0, 640);
that.tlBtn.alpha = 0.1; that.tlBtn.alpha = 0.1;
...@@ -81,12 +89,10 @@ export class MainScene extends Scene { ...@@ -81,12 +89,10 @@ export class MainScene extends Scene {
that.mxqBtn.visible = false; that.mxqBtn.visible = false;
} }
that.mainUi = new MainSceneBtnUi({ uiType: Ins.curScene == 4 ? 3 : Ins.curScene });
that.addChild(that.mainUi);
that.initCat(); that.initCat();
that.initEnergy(); that.initEnergy();
that.energyUp(); that.energyUp();
// that.initGuide(Ins.curScene > 3 ? 3 : Ins.curScene);
} }
/**初始化猫咪 */ /**初始化猫咪 */
...@@ -105,6 +111,45 @@ export class MainScene extends Scene { ...@@ -105,6 +111,45 @@ export class MainScene extends Scene {
} }
} }
/**初始化引导 */
initGuide(sence) {
var that = this;
if (!Ins.senceInfo.senceGuide['' + sence]) {
that.cat.visible = false;
that.Guide = new Guide({ type: sence, callBack: () => { that.senceGuideEnd(sence); } });
that.addChildAt(this.Guide,999);
}
// setTimeout(()=>{
console.log("引导", sence)
that.mainUi.changeBtnByUiType(sence, true)
// },100)
}
/**场景引导结束 */
senceGuideEnd(sence) {
var that = this;
that.updateUserInfo();
Ins.showLoading();
sendTbNet(TbNetName.updateSenceGuide, {sence:sence}, (s, r) => {
if (s) {
Ins.hideLoading();
var userSence = Ins.senceInfo.sence > 4 ? 3 : Ins.senceInfo.sence;
Ins.senceInfo.senceGuide[''+sence] = true
if (sence == userSence) {
that.cat.visible = true;
that.cat.catTalk();
}
that.mainUi.changeBtnByUiType(sence)
that.removeChild(that.Guide);
} else {
Ins.hideLoading();
Ins.showToast(r.message);
}
})
}
/**打开信封 */ /**打开信封 */
openLetter() { openLetter() {
console.log("打开信封弹窗") console.log("打开信封弹窗")
...@@ -165,10 +210,10 @@ export class MainScene extends Scene { ...@@ -165,10 +210,10 @@ export class MainScene extends Scene {
energyUp() { energyUp() {
var that = this; var that = this;
that.recoverEnergyHandler = setInterval(() => { that.recoverEnergyHandler = setInterval(() => {
sendTbNet(TbNetName.recoverEnergy,{},(s,r)=>{ sendTbNet(TbNetName.recoverEnergy, {}, (s, r) => {
if(s){ if (s) {
that.getUserEnergy(); that.getUserEnergy();
}else{ } else {
Ins.showToast(r.message); Ins.showToast(r.message);
} }
}); });
...@@ -176,24 +221,24 @@ export class MainScene extends Scene { ...@@ -176,24 +221,24 @@ export class MainScene extends Scene {
} }
/**时间到的时候拿取精力值 */ /**时间到的时候拿取精力值 */
getUserEnergy(){ getUserEnergy() {
var that = this; var that = this;
sendTbNet(TbNetName.getUserEnergy,{},(s,r)=>{ sendTbNet(TbNetName.getUserEnergy, {}, (s, r) => {
if(s){ if (s) {
if(r.data!=Ins.userInfo.energy){ if (r.data != Ins.userInfo.energy) {
Ins.userInfo.energy = r.data; Ins.userInfo.energy = r.data;
that.setEnergy(); that.setEnergy();
return; return;
}else{ } else {
if(Ins.userInfo.energy!=r.data.energyMax){ if (r.data != Ins.userInfo.energyMax) {
that.getUserEnergy(); that.getUserEnergy();
} }
else{ else {
return; return;
} }
} }
}else{ } else {
Ins.showToast(r.message); Ins.showToast(r.message);
} }
}) })
} }
...@@ -204,13 +249,15 @@ export class MainScene extends Scene { ...@@ -204,13 +249,15 @@ export class MainScene extends Scene {
var that = this; var that = this;
Ins.curScene = type > 3 ? 3 : type; Ins.curScene = type > 3 ? 3 : type;
that.sceneBg.texture = RES.getRes(resCanvasList[that.bgUUID[type - 1]].url) that.sceneBg.texture = RES.getRes(resCanvasList[that.bgUUID[type - 1]].url)
that.initGuide(Ins.curScene);
//切换场景时判断猫在不在,后面要改成与接口值判断 //切换场景时判断猫在不在,后面要改成与接口值判断
if (Ins.catIsOut) { if (Ins.catIsOut) {
that.cat.visible = false; that.cat.visible = false;
that.cat.stopCatAct(); that.cat.stopCatAct();
} else { } else {
if ((type) == Ins.userInfo.sence) { if ((type) == Ins.senceInfo.sence) {
that.cat.visible = true; that.cat.visible = true;
that.cat.stopCatAct();
} else { } else {
that.cat.visible = false; that.cat.visible = false;
that.cat.stopCatAct(); that.cat.stopCatAct();
...@@ -236,7 +283,12 @@ export class MainScene extends Scene { ...@@ -236,7 +283,12 @@ export class MainScene extends Scene {
} }
break; break;
} }
that.mainUi.changeBtnByUiType(type); if (!Ins.senceInfo.senceGuide['' + Ins.curScene]) {
that.mainUi.changeBtnByUiType(type, true);
} else {
that.mainUi.changeBtnByUiType(type);
}
} }
/**更新用户信息时更新场景信息 */ /**更新用户信息时更新场景信息 */
...@@ -251,27 +303,43 @@ export class MainScene extends Scene { ...@@ -251,27 +303,43 @@ export class MainScene extends Scene {
sendTbNet(TbNetName.getUserInfo, {}, (s, r) => { sendTbNet(TbNetName.getUserInfo, {}, (s, r) => {
if (s) { if (s) {
Ins.userInfo = r.data; Ins.userInfo = r.data;
// if (r.data.sence > 3) {
// Ins.catIsOut = true;
// that.cat.visible = false;
// that.cat.stopCatAct();
// that.mainUi.changeBtnByCatIsOuT(Ins.curScene)
// if (Ins.curScene == 3) {
// that.letter.visible = true;
// }
// } else {
// if (Ins.catIsOut) {
// that.cat.visible = true;
// that.letter.visible = false;
// }
// Ins.catIsOut = false;
// }
that.setEnergy(); that.setEnergy();
that.mainUi.updateUserInfo(); that.mainUi.updateUserInfo();
} else { } else {
Ins.showToast(r.message)
}
})
}
/**召回猫咪 */
recallCat() {
console.log("找回猫咪,刷新用户信息,刷新出勤状态")
var that = this;
sendTbNet(TbNetName.getUserInfo, {}, (s, r) => {
if (s) {
Ins.userInfo = r.data;
that.setEnergy();
that.mainUi.updateUserInfo();
if (Ins.catIsOut) {
sendTbNet(TbNetName.getSence, {}, (s, r) => {
if (s) {
Ins.senceInfo = r.data;
if (r.data.sence < 4) {
Ins.catIsOut = false;
that.letter.visible = false;
if (r.data.sence == 3) {
that.cat.visible = true;
that.cat.stopCatAct();
}
that.mainUi.changeBtnByUiType(Ins.curScene > 3 ? 3 : Ins.curScene);
}
} else {
Ins.showToast(r.message);
}
})
}
} else {
Ins.showToast(r.message) Ins.showToast(r.message)
} }
}) })
...@@ -286,6 +354,7 @@ export class MainScene extends Scene { ...@@ -286,6 +354,7 @@ export class MainScene extends Scene {
that.letter && that.letter.addEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that); that.letter && that.letter.addEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that);
FYGE.GDispatcher.addEventListener(MSG.CHANGE_SCENE, () => { that.changeMainScene(SCENETYPE.BEADROOM) }, that); FYGE.GDispatcher.addEventListener(MSG.CHANGE_SCENE, () => { that.changeMainScene(SCENETYPE.BEADROOM) }, that);
GDispatcher.addEventListener(MSG.UPDATE_USERINFO, that.updateUserInfo, that); GDispatcher.addEventListener(MSG.UPDATE_USERINFO, that.updateUserInfo, that);
GDispatcher.addEventListener(MSG.RECALL_CAT, that.recallCat, that);
} }
removeEvents() { removeEvents() {
...@@ -297,5 +366,6 @@ export class MainScene extends Scene { ...@@ -297,5 +366,6 @@ export class MainScene extends Scene {
that.letter && that.letter.removeEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that); that.letter && that.letter.removeEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that);
FYGE.GDispatcher.removeEventListener(MSG.CHANGE_SCENE, () => { that.changeMainScene(SCENETYPE.BEADROOM) }, that); FYGE.GDispatcher.removeEventListener(MSG.CHANGE_SCENE, () => { that.changeMainScene(SCENETYPE.BEADROOM) }, that);
GDispatcher.removeEventListener(MSG.UPDATE_USERINFO, that.updateUserInfo, that); GDispatcher.removeEventListener(MSG.UPDATE_USERINFO, that.updateUserInfo, that);
GDispatcher.removeEventListener(MSG.RECALL_CAT, that.recallCat, that);
} }
} }
\ No newline at end of file
...@@ -8,29 +8,30 @@ import { Ins } from "../Ins"; ...@@ -8,29 +8,30 @@ import { Ins } from "../Ins";
import { changeScene, showPanel, showToast } from "../../module/ctrls"; import { changeScene, showPanel, showToast } from "../../module/ctrls";
import { SelectCatPanel } from "../panels/selectcatpanel/SelectCatPanel"; import { SelectCatPanel } from "../panels/selectcatpanel/SelectCatPanel";
import { sendTbNet, TbNetName } from "../TaoBaoNet"; import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { GDispatcher } from "../Main";
export class StartScene extends Scene { export class StartScene extends Scene {
initUi() { initUi() {
super.initUi(); super.initUi();
var that = this;
var sceneBg = Ins.initSprite("b3c8c187-e5c9-4968-9a00-a118d18ab2fc"); var sceneBg = Ins.initSprite("b3c8c187-e5c9-4968-9a00-a118d18ab2fc");
this.addChild(sceneBg); that.addChild(sceneBg);
this.x = (Ins.stageW - 750) >> 1; sceneBg.visible = false;
this.y = (Ins.stageH - 1624) >> 1; that.x = (Ins.stageW - 750) >> 1;
that.y = (Ins.stageH - 1624) >> 1;
Ins.showLoading();
sendTbNet(TbNetName.getUserInfo, {}, (s, r) => { sendTbNet(TbNetName.getUserInfo, {}, (s, r) => {
if (s) { if (s) {
if (r.data) { if (r.data) {
Ins.userInfo = r.data; Ins.userInfo = r.data;
/**判断猫咪是否出寝,只在用户进入游戏时判断,后面要根据接口改写,现在先做测试 */ /**判断猫咪是否出寝,只在用户进入游戏时判断,后面要根据接口改写,现在先做测试 */
if (r.data.sence == 4) { that.judgeCatIsOutAChangeMainScene();
Ins.catIsOut = true;
} else {
Ins.catIsOut = false;
}
changeScene(MainScene)
} else { } else {
sceneBg.visible = true;
Ins.showModule("selectcatModal") Ins.showModule("selectcatModal")
} }
} else { } else {
sceneBg.visible = true;
Ins.hideLoading();
Ins.showToast(r.message) Ins.showToast(r.message)
} }
}) })
...@@ -44,15 +45,33 @@ export class StartScene extends Scene { ...@@ -44,15 +45,33 @@ export class StartScene extends Scene {
console.log("选择完猫咪",r) console.log("选择完猫咪",r)
Ins.userInfo = r.data; Ins.userInfo = r.data;
/**判断猫咪是否出寝,只在用户进入游戏时判断,后面要根据接口改写,现在先做测试 */ /**判断猫咪是否出寝,只在用户进入游戏时判断,后面要根据接口改写,现在先做测试 */
if (r.data.sence == 4) { this.judgeCatIsOutAChangeMainScene();
Ins.catIsOut = true; }
} else {
Ins.catIsOut = false; /**判断猫咪是否出寝,并且改变到主场景 */
} judgeCatIsOutAChangeMainScene(){
changeScene(MainScene) console.log("aaa")
sendTbNet(TbNetName.getSence,{},(s,r)=>{
if(s){
Ins.senceInfo = r.data;
if (r.data.sence == 4) {
Ins.catIsOut = true;
} else {
Ins.catIsOut = false;
}
Ins.hideLoading();
changeScene(MainScene)
}else{
Ins.showToast(r.message);
}
})
} }
initEvents(){ initEvents(){
FYGE.GDispatcher.addEventListener("selectEnd",this.getCat,this); GDispatcher.addEventListener("selectEnd",this.getCat,this);
}
removeEvents(){
GDispatcher.removeEventListener("selectEnd",this.getCat,this);
} }
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<image class="catbackbedbgaccident" a:if="{{backType==2}}" src={{resList['98a3f684-846b-479c-91ac-75b588e2b51b'].url}} /> <image class="catbackbedbgaccident" a:if="{{backType==2}}" src={{resList['98a3f684-846b-479c-91ac-75b588e2b51b'].url}} />
<image class="catbackbedbgsurprise" a:if="{{backType==1}}" src={{resList['98a3f684-846b-479c-91ac-75b588e2b51b'].url}} /> <image class="catbackbedbgsurprise" a:if="{{backType==1}}" src={{resList['98a3f684-846b-479c-91ac-75b588e2b51b'].url}} />
<image class="catbackbedbgunluck" a:if="{{backType==3}}" src={{resList['3fa827d6-e333-4b56-a5d9-5f3ae2089127'].url}} /> <image class="catbackbedbgunluck" a:if="{{backType==3}}" src={{resList['3fa827d6-e333-4b56-a5d9-5f3ae2089127'].url}} />
<image class="catbackbedok" onTap="onModalClose" src={{resList['b701826c-63c5-4490-a380-52f273dad9af'].url}} /> <image class="catbackbedok" onTap="onModalClose" src="{{okBtnImg}}" />
<label class="catbackbedtip2"><text>{{getTypeText}}</text> <text style="color:{{getColor}}">{{getText}}</text> </label> <label class="catbackbedtip2"><text>{{getTypeText}}</text> <text style="color:{{getColor}}">{{getText}}</text> </label>
<label class="catbackbedtip"> <label class="catbackbedtip">
{{desc}} {{desc}}
......
...@@ -17,6 +17,8 @@ Component({ ...@@ -17,6 +17,8 @@ Component({
"61869bae-f55f-46e3-be58-23ed6485b18e", "cfc54c6d-4233-478a-ae00-ef42d58718c1" "61869bae-f55f-46e3-be58-23ed6485b18e", "cfc54c6d-4233-478a-ae00-ef42d58718c1"
], ],
}, },
//收下按钮,0是倒霉的按钮,1是惊喜与意外的按钮
okBtnImgArr: ["c8c50400-1d65-4971-8be5-e4fb2eecfcd5","b701826c-63c5-4490-a380-52f273dad9af"],
//从召回猫接口中拿到的信息 //从召回猫接口中拿到的信息
recallCatInfo: null, recallCatInfo: null,
mydata: null, //mydata.catType 猫的类型 mydata: null, //mydata.catType 猫的类型
...@@ -31,23 +33,26 @@ Component({ ...@@ -31,23 +33,26 @@ Component({
getText: '+100欢乐币', //获取或减少收益文本 getText: '+100欢乐币', //获取或减少收益文本
getColor: 'red', //获取或减少收益文本颜色 getColor: 'red', //获取或减少收益文本颜色
getTypeText: '获得', //获取或减少收益类型文本 getTypeText: '获得', //获取或减少收益类型文本
okBtnImg: '' //收下按钮
}, },
methods: { methods: {
onModalClose() { onModalClose() {
const { const {
onModalClose,onUpdateUserInfo onModalClose
} = this.props; } = this.props;
onModalClose && onModalClose(); onModalClose && onModalClose();
onUpdateUserInfo&&onUpdateUserInfo(); my.__updateUserInfo__();
// onUpdateUserInfo&&onUpdateUserInfo();
}, },
}, },
didMount() { didMount() {
console.log(this.props.catImgArr,this.props.recallCatInfo) console.log(this.props.catImgArr,this.props.recallCatInfo)
const { value, type, backType, desc } = this.props.recallCatInfo; const { value, type, backType, tips } = this.props.recallCatInfo;
let getText = ''; let getText = '';
let getTextColor = ''; let getTextColor = '';
let getTypeText = ''; let getTypeText = '';
let okBtnImg = '';
if (type == 4) { if (type == 4) {
getText = '精力值'; getText = '精力值';
} else if (type == 6) { } else if (type == 6) {
...@@ -57,17 +62,20 @@ Component({ ...@@ -57,17 +62,20 @@ Component({
case 1: case 1:
getText = '+' + value + getText; getText = '+' + value + getText;
getTextColor = 'red'; getTextColor = 'red';
getTypeText = '获得' getTypeText = '获得';
okBtnImg = this.props.okBtnImgArr[1];
break; break;
case 2: case 2:
getText = '+' + value + getText; getText = '+' + value + getText;
getTextColor = 'red'; getTextColor = 'red';
getTypeText = '意外获得'; getTypeText = '意外获得';
okBtnImg = this.props.okBtnImgArr[1];
break; break;
case 3: case 3:
getText = '-' + value + getText; getText = '-' + value + getText;
getTextColor = 'black'; getTextColor = 'black';
getTypeText = '损失'; getTypeText = '损失';
okBtnImg = this.props.okBtnImgArr[0];
break; break;
} }
console.log("mm" + this.props.mydata.catType - 1) console.log("mm" + this.props.mydata.catType - 1)
...@@ -77,7 +85,9 @@ Component({ ...@@ -77,7 +85,9 @@ Component({
getText: getText, getText: getText,
getColor: getTextColor, getColor: getTextColor,
getTypeText:getTypeText, getTypeText:getTypeText,
backType:backType backType:backType,
desc:tips[Math.floor(Math.random()*tips.length)],
okBtnImg:resList[okBtnImg].url
}) })
}, },
}); });
\ No newline at end of file
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
width: 750rpx; width: 750rpx;
height: 1093rpx; height: 1093rpx;
opacity: 1; opacity: 1;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 50% 50% 0rpx;
top:50%; top:50%;
margin-top: -546rpx; margin-top: -546rpx;
} }
...@@ -64,15 +64,16 @@ ...@@ -64,15 +64,16 @@
} }
.levelup .levelup_txt { .levelup .levelup_txt {
width: 371rpx; width: 750rpx;
height: 26rpx; height: 26rpx;
opacity: 1; opacity: 1;
left: 191rpx; left: 0rpx;
top: 711rpx; top: 711rpx;
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
font-size: 26rpx; font-size: 26rpx;
color: #574738; color: #574738;
text-align: center;
} }
.levelup .levelup_title { .levelup .levelup_title {
...@@ -95,6 +96,16 @@ ...@@ -95,6 +96,16 @@
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
} }
.levelup .levelup_prizeImg {
width: 352rpx;
height: 291rpx;
opacity: 1;
left: 201rpx;
top: 381rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.levelup .levelup_btn { .levelup .levelup_btn {
width: 351rpx; width: 351rpx;
height: 105rpx; height: 105rpx;
...@@ -102,5 +113,5 @@ ...@@ -102,5 +113,5 @@
left: 201rpx; left: 201rpx;
top: 773rpx; top: 773rpx;
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 50% 50% 0rpx;
} }
\ No newline at end of file
...@@ -4,10 +4,11 @@ ...@@ -4,10 +4,11 @@
<image class="levelup_light " src={{resList['a158cbff-9dcd-49df-bb91-16213d58036e'].url}} /> <image class="levelup_light " src={{resList['a158cbff-9dcd-49df-bb91-16213d58036e'].url}} />
<image class="levelup_bg " src={{resList['b027d194-0fad-45ea-8b1c-3502f7869d2d'].url}} /> <image class="levelup_bg " src={{resList['b027d194-0fad-45ea-8b1c-3502f7869d2d'].url}} />
<image class="levelup_bg2 " src={{resList['f88dfc75-c9f1-4e9d-8826-8a1d0e513259'].url}} /> <image class="levelup_bg2 " src={{resList['f88dfc75-c9f1-4e9d-8826-8a1d0e513259'].url}} />
<label class="levelup_txt ">{{mydata.tips}}</label> <label class="levelup_txt ">{{levelupTxt}}</label>
<image class="levelup_title " src={{resList['69bff61a-b5a6-4979-ba8d-9e008aed737a'].url}} /> <image class="levelup_title " src={{resList['69bff61a-b5a6-4979-ba8d-9e008aed737a'].url}} />
<image class="levelup_imgbg " src={{resList['f56872e2-5e79-4906-99a2-576231f153af'].url}} /> <image class="levelup_imgbg " src={{resList['f56872e2-5e79-4906-99a2-576231f153af'].url}} />
<image class="levelup_btn " onTap="onBtnClick" src={{resList['95520b55-9655-4988-a833-3907978dbffb'].url}} /> <image class="levelup_prizeImg" src="{{prizeImg}}"/>>
<image class="levelup_btn btn" onTap="onBtnClick" src={{resList['95520b55-9655-4988-a833-3907978dbffb'].url}} />
<image class="levelup_closebtn " onTap="onModalClose" src={{resList['d33bbf87-ed39-4959-8673-02a4c31dca77'].url}} /> <image class="levelup_closebtn " onTap="onModalClose" src={{resList['d33bbf87-ed39-4959-8673-02a4c31dca77'].url}} />
</view> </view>
</view> </view>
\ No newline at end of file
...@@ -5,8 +5,11 @@ Component({ ...@@ -5,8 +5,11 @@ Component({
props: { props: {
mydata:{} mydata:{}
}, },
// {prizeData:r.data,energyMax1:Ins.userInfo.energyMax,energyMax2:r.data.energyMax}
data: { data: {
resList: resList resList: resList,
levelupTxt:'精力上限1200 → 精力上限1500',
prizeImg:'//yun.duiba.com.cn/spark-prod/assets/lihe.f12fa204705c3e790a3300a890d088212f49a5c9.png'
}, },
methods: { methods: {
onBtnClick() { onBtnClick() {
...@@ -18,6 +21,15 @@ Component({ ...@@ -18,6 +21,15 @@ Component({
onModalClose && onModalClose(); onModalClose && onModalClose();
console.log('onModalClose') console.log('onModalClose')
} }
} },
didMount(){
console.log("升级弹窗"+this.props.mydata);
var txt = '精力上限'+this.props.mydata.energyMax1+' → 精力上限'+this.props.mydata.energyMax2;
this.setData({
levelupTxt:txt,
prizeImg:this.props.mydata.prizeData.image
})
}
}); });
\ No newline at end of file
...@@ -89,41 +89,40 @@ Page({ ...@@ -89,41 +89,40 @@ Page({
//授权和登录先搞 //授权和登录先搞
// await this.getAuth(); // await this.getAuth();
// this.initCanvas(); // this.initCanvas();
// my.__onMessage__ = (e) => { my.__onMessage__ = (e) => {
// this.onMessage(e) this.onMessage(e)
// } }
// my.__getdata__ = (key) => { my.__getdata__ = (key) => {
// my.__onMessage__({ my.__onMessage__({
// data: { data: {
// netName: 'tmallCat.' + key netName: 'tmallCat.' + key
// } }
// }) })
// } }
// my.__showModal__ = (key, data) => { my.__showModal__ = (key, data) => {
// this.onMessage({ this.onMessage({
// data: { data: {
// netName: 'mine.showModal', netName: 'mine.showModal',
// parameter: { parameter: {
// name: key + 'Modal', name: key + 'Modal',
// data: data data: data
// } }
// } }
// }); });
// } }
// my.__pageTo__ = (key, data) => { my.__pageTo__ = (key, data) => {
// this.onMessage({ this.onMessage({
// data: { data: {
// netName: 'mine.navigateToPage', netName: 'mine.navigateToPage',
// parameter: { parameter: {
// name: key name: key
// } }
// } }
// }); });
// } }
my.__updateUserInfo__ = () => { my.__updateUserInfo__ = () => {
console.log("通知canvas刷新用户信息") console.log("通知canvas刷新用户信息")
this.main && this.main.dispatchGlobalEvent("UPDATE_USERINFO") this.main && this.main.dispatchGlobalEvent("UPDATE_USERINFO")
...@@ -300,30 +299,25 @@ Page({ ...@@ -300,30 +299,25 @@ Page({
* 获取用户授权信息 * 获取用户授权信息
*/ */
async getAuth() { async getAuth() {
return new Promise(async (s, r) => { const userInfo = await getAuthUserInfo().catch(err => {
const userInfo = await getAuthUserInfo().catch(err => { console.log('未授权成功', err);
console.log('未授权成功', err); });
r(); if (userInfo) {
}); console.log('授权成功 userInfo', userInfo);
if (userInfo) { const {
console.log('授权成功 userInfo', userInfo); nickName,
const { avatar
nickName, } = userInfo;
avatar app.nickName = nickName;
} = userInfo; app.avatar = avatar;
app.nickName = nickName; this.login();
app.avatar = avatar;
await this.login(); }
this.initCanvas();
s();
}
})
}, },
/** /**
* 登录接口 * 登录接口
*/ */
async login() { async login() {
return new Promise(async (s, r) => {
const { const {
nickName, nickName,
avatar avatar
...@@ -334,16 +328,13 @@ Page({ ...@@ -334,16 +328,13 @@ Page({
userNick: nickName, userNick: nickName,
avatar avatar
}).catch(res => { }).catch(res => {
r();
commonToast(res && res.message); commonToast(res && res.message);
}) || {}; }) || {};
if (success) { if (success) {
data && (app.openId = data.openId); this.initCanvas();
s();
} }
})
}, },
/**刷新用户信息 */ /**刷新用户信息 */
updateUserInfo() { updateUserInfo() {
......
This diff is collapsed.
...@@ -490,5 +490,11 @@ const resList = { ...@@ -490,5 +490,11 @@ const resList = {
url: '//yun.duiba.com.cn/spark/assets/a67137c922a0d539215aed739676aa7636e3c4d8.png' url: '//yun.duiba.com.cn/spark/assets/a67137c922a0d539215aed739676aa7636e3c4d8.png'
}, },
'c8c50400-1d65-4971-8be5-e4fb2eecfcd5': {
name: 'unluckyBtn',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/unluckyBtn.e57fc34e49370d30a6942fb835395377a9cf4721.png',
uuid: 'c8c50400-1d65-4971-8be5-e4fb2eecfcd5'
}
}; };
export default resList; export default resList;
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