Commit 1e17ae37 authored by wildfirecode13's avatar wildfirecode13

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

parents 5f8bb25b 68634529
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -4,6 +4,7 @@ import resCanvasList from "../resCanvasList" ...@@ -4,6 +4,7 @@ import resCanvasList from "../resCanvasList"
import { SCENETYPE } from "./Enum"; import { SCENETYPE } from "./Enum";
import { GDispatcher } from "./Main"; import { GDispatcher } from "./Main";
import { sendTbNet, TbNetName } from "./TaoBaoNet"; import { sendTbNet, TbNetName } from "./TaoBaoNet";
import { Button } from "./ui/button";
/**记录全局信息与全局方法 */ /**记录全局信息与全局方法 */
export class Ins { export class Ins {
/**舞台宽高 */ /**舞台宽高 */
...@@ -91,6 +92,20 @@ export class Ins { ...@@ -91,6 +92,20 @@ export class Ins {
return btn; return btn;
} }
/**生成一个按钮 */
public static initButton(uuid?: string, x = 0, y = 0){
let btn;
if (uuid) {
btn = new Button(this.getRes(uuid));
}else{
btn = new Button();
}
// btn.initButton();
btn.x = x;
btn.y = y;
return btn;
}
/**生成一个文本 /**生成一个文本
* data:{color?:string,size?:number,x?:number,y?:number,text?:string} * data:{color?:string,size?:number,x?:number,y?:number,text?:string}
*/ */
......
...@@ -37,6 +37,11 @@ export enum TbNetName { ...@@ -37,6 +37,11 @@ export enum TbNetName {
*/ */
updateSenceGuide = "tmallCat.updateSenceGuide", updateSenceGuide = "tmallCat.updateSenceGuide",
/**
* 召回信息
*/
recallInfo = "tmallCat.recallInfo",
/** /**
* 埋点统计 到时改名字 * 埋点统计 到时改名字
* activityId params elemType * activityId params elemType
......
...@@ -39,7 +39,7 @@ export class Guide extends Module { ...@@ -39,7 +39,7 @@ export class Guide extends Module {
callBack; callBack;
catImg1:FYGE.Lottie; catImg1: FYGE.Lottie;
initUi() { initUi() {
var that = this; var that = this;
...@@ -47,7 +47,7 @@ export class Guide extends Module { ...@@ -47,7 +47,7 @@ export class Guide extends Module {
that.catPosArr = [80, 40, 60, 70]; that.catPosArr = [80, 40, 60, 70];
var arr = [lanmao02shuohua,jumaoshuohua,sanhua02shuohua2,xianluoshuohua] var arr = [lanmao02shuohua, jumaoshuohua, sanhua02shuohua2, xianluoshuohua]
/**猫咪图片 */ /**猫咪图片 */
that.catImgUUIDArr = ['3e6311fd-15ab-4656-bb84-1c49f4ad4ed9', 'bbb10ff2-f4fb-43a8-83d8-abbb04949f2d', '9fc6517e-debe-4457-88ef-9c733d5bc072', 'ecb49f23-2e65-4507-8be6-1eee021a3b35'] that.catImgUUIDArr = ['3e6311fd-15ab-4656-bb84-1c49f4ad4ed9', 'bbb10ff2-f4fb-43a8-83d8-abbb04949f2d', '9fc6517e-debe-4457-88ef-9c733d5bc072', 'ecb49f23-2e65-4507-8be6-1eee021a3b35']
...@@ -66,7 +66,7 @@ export class Guide extends Module { ...@@ -66,7 +66,7 @@ export class Guide extends Module {
// that.addChild(that.catImg); // that.addChild(that.catImg);
that.catImg1 = new FYGE.Lottie(arr[Ins.userInfo.catType - 1]) that.catImg1 = new FYGE.Lottie(arr[Ins.userInfo.catType - 1])
that.addChild(that.catImg1); that.addChild(that.catImg1);
if(Ins.userInfo.catType == 2){ if (Ins.userInfo.catType == 2) {
that.catImg1.y = 30; that.catImg1.y = 30;
} }
// var x = (Ins.stageW - that.catImg.width) * 0.5; // var x = (Ins.stageW - that.catImg.width) * 0.5;
...@@ -82,21 +82,27 @@ export class Guide extends Module { ...@@ -82,21 +82,27 @@ export class Guide extends Module {
} }
changeGuide() { changeGuide() {
this.index++; var that = this;
if (this.index >= this['guideUUIDArr_' + this.guideType].length) { that.index++;
if (that.index >= that['guideUUIDArr_' + that.guideType].length) {
that.guideTouch.mouseEnable = false;
setTimeout(() => {
if (that && that.guideTouch)
that.guideTouch.mouseEnable = true;
}, 1000);
// GDispatcher.dispatchEvent(MSG.GUIDE_BEDROOMEND); // GDispatcher.dispatchEvent(MSG.GUIDE_BEDROOMEND);
this.callBack && this.callBack(); that.callBack && that.callBack();
return; return;
} }
this.guide.texture = RES.getRes(resCanvasList[this['guideUUIDArr_' + this.guideType][this.index]].url) that.guide.texture = RES.getRes(resCanvasList[that['guideUUIDArr_' + that.guideType][that.index]].url)
if (this.guideType == 3 || this.guideType == 4) { if (that.guideType == 3 || that.guideType == 4) {
if (this.index == 4 || this.index == 5) { if (that.index == 4 || that.index == 5) {
this.catImg1.visible = false; that.catImg1.visible = false;
} else { } else {
this.catImg1.visible = true; that.catImg1.visible = true;
} }
} }
console.log(this.guide.x, this.guide.y) console.log(that.guide.x, that.guide.y)
} }
initEvents() { initEvents() {
......
...@@ -40,6 +40,9 @@ export class MainScene extends Scene { ...@@ -40,6 +40,9 @@ export class MainScene extends Scene {
private maxEnergy: number = 1500; //最大精力值 private maxEnergy: number = 1500; //最大精力值
private recoverEnergyHandler: any; //恢复精力的定时器,用于保存下来方便清空 private recoverEnergyHandler: any; //恢复精力的定时器,用于保存下来方便清空
/**召回倒计时 */
private recallTimer;
/**猫咪等级 */ /**猫咪等级 */
private level: number = 0; private level: number = 0;
...@@ -108,9 +111,23 @@ export class MainScene extends Scene { ...@@ -108,9 +111,23 @@ export class MainScene extends Scene {
that.cat.visible = false; that.cat.visible = false;
//当猫出走的时候,隐藏猫咪,创建信封 //当猫出走的时候,隐藏猫咪,创建信封
that.letter.visible = true; that.letter.visible = true;
// that.initRecallCatTimer()
} }
} }
/**当猫出走的时候,初始化前端的召回倒计时 */
initRecallCatTimer(){
var that = this;
sendTbNet(TbNetName.recallInfo,{},(s,r)=>{
if(s){
that.recallTimer = setTimeout(()=>{
that.recallCat();
},r.data.backTime-r.data.serverTime)
}
})
}
/**初始化引导 */ /**初始化引导 */
initGuide(sence) { initGuide(sence) {
var that = this; var that = this;
...@@ -154,7 +171,17 @@ export class MainScene extends Scene { ...@@ -154,7 +171,17 @@ export class MainScene extends Scene {
openLetter() { openLetter() {
console.log("打开信封弹窗") console.log("打开信封弹窗")
if (this.letter && this.letter.visible) { if (this.letter && this.letter.visible) {
Ins.showModule('messageModal', { catName: Ins.userInfo.catName }) Ins.showLoading();
sendTbNet(TbNetName.recallInfo,{},(s,r)=>{
if(s){
Ins.hideLoading();
Ins.showModule('messageModal', { catName: Ins.userInfo.catName ,recallInfo:r.data})
}else{
Ins.hideLoading();
Ins.showToast(r.message);
}
})
} }
} }
...@@ -327,6 +354,7 @@ export class MainScene extends Scene { ...@@ -327,6 +354,7 @@ export class MainScene extends Scene {
Ins.senceInfo = r.data; Ins.senceInfo = r.data;
if (r.data.sence < 4) { if (r.data.sence < 4) {
Ins.catIsOut = false; Ins.catIsOut = false;
// clearTimeout(that.recallTimer)
that.letter.visible = false; that.letter.visible = false;
if (r.data.sence == 3) { if (r.data.sence == 3) {
that.cat.visible = true; that.cat.visible = true;
......
export class Button extends FYGE.Sprite{
constructor(texture?:FYGE.Texture){
super(texture)
this.anchorX = texture.baseTexture.width/2;
this.anchorY = texture.baseTexture.width/2;
this.initButton();
// this.addEventListener(FYGE.Event.ADDED_TO_STAGE,this.initButton,this);
this.addEventListener(FYGE.Event.REMOVED_FROM_STAGE,this.removeButton,this);
}
initButton(){
console.log("初始化按钮")
this.addEventListener(FYGE.MouseEvent.MOUSE_DOWN,this.touchEvent,this);
this.addEventListener(FYGE.MouseEvent.MOUSE_OUT,this.touchEvent,this);
this.addEventListener(FYGE.MouseEvent.MOUSE_UP,this.touchEvent,this)
}
touchEvent(e:FYGE.MouseEvent){
console.log("按钮事件")
var that = this;
if(!that) return;
if(e.type==FYGE.MouseEvent.MOUSE_DOWN){
FYGE.Tween.removeTweens(that);
FYGE.Tween.get(that).to({scaleX:0.9,scaleY:0.9},50)
}else{
FYGE.Tween.removeTweens(that);
FYGE.Tween.get(that).to({scaleX:1,scaleY:1},50)
}
}
removeButton(){
this.removeEventListener(FYGE.MouseEvent.MOUSE_DOWN,this.touchEvent,this);
this.removeEventListener(FYGE.MouseEvent.MOUSE_OVER,this.touchEvent,this);
this.removeEventListener(FYGE.MouseEvent.MOUSE_UP,this.touchEvent,this)
}
}
\ No newline at end of file
...@@ -7,6 +7,9 @@ import PanelCtrl from "../../module/ctrls/panelCtrl"; ...@@ -7,6 +7,9 @@ import PanelCtrl from "../../module/ctrls/panelCtrl";
import { changeScene, showPanel } from "../../module/ctrls"; import { changeScene, showPanel } from "../../module/ctrls";
import { RulePanel } from "../panels/rulePanel"; import { RulePanel } from "../panels/rulePanel";
import { MyPrizeScene } from "../scenes/MyPrizeScene"; import { MyPrizeScene } from "../scenes/MyPrizeScene";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { getStage } from "../scenes/stage";
import { Button } from "./button";
export class MainSceneBtnUi extends Module { export class MainSceneBtnUi extends Module {
/**主场景ui /**主场景ui
...@@ -25,7 +28,7 @@ export class MainSceneBtnUi extends Module { ...@@ -25,7 +28,7 @@ export class MainSceneBtnUi extends Module {
/**商城按钮 */ /**商城按钮 */
private shapGoBtn: FYGE.Sprite; private shapGoBtn: FYGE.Sprite;
/**返回按钮 */ /**返回按钮 */
private returnBtn: FYGE.Sprite; private returnBtn: Button;
/**攻略按钮 */ /**攻略按钮 */
private strategyBtn: FYGE.Sprite; private strategyBtn: FYGE.Sprite;
/**奖品按钮 */ /**奖品按钮 */
...@@ -59,6 +62,8 @@ export class MainSceneBtnUi extends Module { ...@@ -59,6 +62,8 @@ export class MainSceneBtnUi extends Module {
/**互动进行中,当互动进行中时,无法点击互动按钮进行互动 */ /**互动进行中,当互动进行中时,无法点击互动按钮进行互动 */
private actRunning: boolean = false; private actRunning: boolean = false;
// private btnArr:FYGE.Sprite[] = [];
initUi() { initUi() {
var that = this; var that = this;
that.initUniversalUi(); that.initUniversalUi();
...@@ -80,19 +85,19 @@ export class MainSceneBtnUi extends Module { ...@@ -80,19 +85,19 @@ export class MainSceneBtnUi extends Module {
that.bottomBtnGroup.mouseEnable = that.bottomBtnGroup.mouseChildren = true; that.bottomBtnGroup.mouseEnable = that.bottomBtnGroup.mouseChildren = true;
that.addChild(that.bottomBtnGroup); that.addChild(that.bottomBtnGroup);
that.strategyBtn = Ins.initSprite("e636bd22-361f-442a-8684-ccfe1141485a", 579, 112); that.strategyBtn = Ins.initButton("e636bd22-361f-442a-8684-ccfe1141485a", 579, 112);
that.topBtnGroup.addChild(that.strategyBtn); that.topBtnGroup.addChild(that.strategyBtn);
that.prizeBtn = Ins.initSprite("e8b083c7-307a-4446-9bc9-99f75c3573e5", 579, 237); that.prizeBtn = Ins.initButton("e8b083c7-307a-4446-9bc9-99f75c3573e5", 579, 237);
that.topBtnGroup.addChild(that.prizeBtn); that.topBtnGroup.addChild(that.prizeBtn);
that.energyBtn = Ins.initSprite("cdb8e186-9872-442e-b71e-bba0a9ce5846", 542, -7); that.energyBtn = Ins.initButton("cdb8e186-9872-442e-b71e-bba0a9ce5846", 542, -7);
that.bottomBtnGroup.addChild(that.energyBtn); that.bottomBtnGroup.addChild(that.energyBtn);
that.initActBtn(); that.initActBtn();
that.initCatInfoGroup(); that.initCatInfoGroup();
that.initFishPointGroup(); that.initFishPointGroup();
that.shapGoBtn = Ins.initSprite("dba58651-57a3-4b75-9447-0e4d498dd8cd") that.shapGoBtn = Ins.initButton("dba58651-57a3-4b75-9447-0e4d498dd8cd")
that.shapGoBtn.position.set((Ins.stageW - that.shapGoBtn.width) >> 1, 137); that.shapGoBtn.position.set((Ins.stageW - that.shapGoBtn.width) >> 1, 137);
that.bottomBtnGroup.addChild(that.shapGoBtn); that.bottomBtnGroup.addChild(that.shapGoBtn);
that.updateUserInfo(); that.updateUserInfo();
...@@ -153,17 +158,17 @@ export class MainSceneBtnUi extends Module { ...@@ -153,17 +158,17 @@ export class MainSceneBtnUi extends Module {
/**初始化互动按钮 */ /**初始化互动按钮 */
initActBtn() { initActBtn() {
var that = this; var that = this;
that.combingBtn = Ins.initSprite("aa17cfa9-f1db-47eb-9eeb-f5947b7f47a8", 69); that.combingBtn = Ins.initButton("aa17cfa9-f1db-47eb-9eeb-f5947b7f47a8", 69);
that.bottomBtnGroup.addChild(that.combingBtn); that.bottomBtnGroup.addChild(that.combingBtn);
that.catBtn = Ins.initSprite("0b44efa9-1e8a-4c43-a2a5-93852d88918c", 214); that.catBtn = Ins.initButton("0b44efa9-1e8a-4c43-a2a5-93852d88918c", 214);
that.bottomBtnGroup.addChild(that.catBtn); that.bottomBtnGroup.addChild(that.catBtn);
that.returnBtn = Ins.initSprite("55f703cd-f0d2-4ec1-9430-6193c1cbc1cb", 69); that.returnBtn = Ins.initButton("55f703cd-f0d2-4ec1-9430-6193c1cbc1cb", 69);
that.bottomBtnGroup.addChild(that.returnBtn); that.bottomBtnGroup.addChild(that.returnBtn);
that.touchHeadBtn = Ins.initSprite("b7ec0f16-ea48-4e41-8def-7cc660fa93d7", 214); that.touchHeadBtn = Ins.initButton("b7ec0f16-ea48-4e41-8def-7cc660fa93d7", 214);
that.bottomBtnGroup.addChild(that.touchHeadBtn); that.bottomBtnGroup.addChild(that.touchHeadBtn);
that.playBtn = Ins.initSprite("922deced-62d2-4995-9dd6-82bc7913f362", 214); that.playBtn = Ins.initButton("922deced-62d2-4995-9dd6-82bc7913f362", 214);
that.bottomBtnGroup.addChild(that.playBtn); that.bottomBtnGroup.addChild(that.playBtn);
that.catRecall = Ins.initSprite("72345190-f95b-4152-bccf-393b8a5aa8d0", 69) that.catRecall = Ins.initButton("72345190-f95b-4152-bccf-393b8a5aa8d0", 69)
that.bottomBtnGroup.addChild(that.catRecall); that.bottomBtnGroup.addChild(that.catRecall);
that.hideAllActBtn(); that.hideAllActBtn();
that.changeBtnByUiType(that.uiType) that.changeBtnByUiType(that.uiType)
...@@ -298,7 +303,17 @@ export class MainSceneBtnUi extends Module { ...@@ -298,7 +303,17 @@ export class MainSceneBtnUi extends Module {
/**召回猫咪事件 */ /**召回猫咪事件 */
catRecallHandler() { catRecallHandler() {
console.log("召回猫咪"); console.log("召回猫咪");
Ins.showModule("recallcatModal", { catType: Ins.userInfo.catType }) Ins.showLoading();
sendTbNet(TbNetName.recallInfo, {}, (s, r) => {
if (s) {
Ins.hideLoading();
Ins.showModule('recallcatModal', { catType: Ins.userInfo.catType, catName: Ins.userInfo.catName, recallInfo: r.data })
} else {
Ins.hideLoading();
Ins.showToast(r.message);
}
})
// Ins.showModule("recallcatModal", { catType: Ins.userInfo.catType })
} }
/**补充精力 */ /**补充精力 */
......
...@@ -79,10 +79,10 @@ ...@@ -79,10 +79,10 @@
background-color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);
} }
.catname .catnameinput .catnameinputrandom { .catname .catnameinput .catnameinputrandom {
width: 500rpx; width: 150rpx;
height: 26rpx; height: 26rpx;
opacity: 1; opacity: 1;
left: 0rpx; left: 175rpx;
top: 121rpx; top: 121rpx;
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
......
...@@ -2,16 +2,19 @@ ...@@ -2,16 +2,19 @@
import API from '../../api'; import API from '../../api';
import resList from '../../resconfig/resList'; import resList from '../../resconfig/resList';
const app = getApp(); const app = getApp();
const { tbcc } = app; const {
tbcc
} = app;
const { const {
textRiskIdentification textRiskIdentification,
} = tbcc.tb; commonToast
} = tbcc.tb;
Component({ Component({
props: { props: {
catImgArr: ["90b114e6-83cb-46f1-b607-f88c50077b05", "4e471df6-01ab-421d-ba0b-084b2110dc6d" , "003e9904-aee4-4b8d-8d5d-fb4b1188bec1","90283bd3-4b18-4535-97a8-90318f068781"], catImgArr: ["90b114e6-83cb-46f1-b607-f88c50077b05", "4e471df6-01ab-421d-ba0b-084b2110dc6d", "003e9904-aee4-4b8d-8d5d-fb4b1188bec1", "90283bd3-4b18-4535-97a8-90318f068781"],
catName: "" catName: ""
}, },
data: { data: {
...@@ -23,6 +26,8 @@ Component({ ...@@ -23,6 +26,8 @@ Component({
/**获取字符串字符长度 */ /**获取字符串字符长度 */
getlen(str) { getlen(str) {
var strlen = 0; var strlen = 0;
console.log("名称长度", str.length)
console.log("charChodeAt", str.charCodeAt)
for (var i = 0; i < str.length; i++) { for (var i = 0; i < str.length; i++) {
if (str.charCodeAt(i) > 255) //如果是汉字,则字符串长度加2 if (str.charCodeAt(i) > 255) //如果是汉字,则字符串长度加2
strlen += 2; strlen += 2;
...@@ -59,29 +64,33 @@ Component({ ...@@ -59,29 +64,33 @@ Component({
this.props.catName = e.detail.value; this.props.catName = e.detail.value;
// console.log(this.props.catName) // console.log(this.props.catName)
}, },
/**确认 */ /**确认领养 */
async catNameSure() { async catNameSure() {
let name = this.props.catName; let name = this.props.catName;
let len = this.getlen(name); let len = this.getlen(name);
console.log("名称字符长度",len)
if (len <= 0) { if (len <= 0) {
my.showToast({ my.showToast({
content: "名字不能为空哦", content: "名字不能为空哦",
}); });
}else if(len>12){ } else if (len > 6) {
my.showToast({ my.showToast({
content: "名字过长哦", content: "名字过长哦",
}); });
}else { } else {
/**检查敏感词 */ /**检查敏感词 */
console.log('检查敏感词',name) console.log('检查敏感词', name)
const success = await textRiskIdentification(name).catch(err => { const success = await textRiskIdentification(name).catch(err => {
console.log('textRiskIdentification error',err); commonToast(err)
console.log('textRiskIdentification error', err);
}); });
console.log('敏感词校验结果',success) console.log('敏感词校验结果', success)
if(success!== true) { if (!success) {
commonToast("非法名称")
console.log('敏感词校验失败.') console.log('敏感词校验失败.')
} return;
} else {
my.showLoading(); my.showLoading();
/**调用领养接口 */ /**调用领养接口 */
...@@ -91,7 +100,7 @@ Component({ ...@@ -91,7 +100,7 @@ Component({
// invitedId: 'openId:AAHVNvjuAMaJc3uyPjeHlCEF'//honingwon // invitedId: 'openId:AAHVNvjuAMaJc3uyPjeHlCEF'//honingwon
invitedId: app.inviteId invitedId: app.inviteId
}); });
console.log("aaaa",adoptCat) console.log("aaaa", adoptCat)
if (adoptCat && adoptCat.success) { if (adoptCat && adoptCat.success) {
// my.showToast({content:'邀请成功'+app.inviteId}) // my.showToast({content:'邀请成功'+app.inviteId})
my.hideLoading(); my.hideLoading();
...@@ -99,9 +108,15 @@ Component({ ...@@ -99,9 +108,15 @@ Component({
this.onSelectCatOk(); this.onSelectCatOk();
} else { } else {
console.log("ergerg") console.log("ergerg")
my.showToast({content:adoptCat.message||'网络异常,请稍后重试~'}) my.hideLoading();
my.showToast({
content: adoptCat.message || '网络异常,请稍后重试~'
})
} }
} }
}
console.log(this.props.catName) console.log(this.props.catName)
} }
}, },
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
margin-top: -325rpx; margin-top: -325rpx;
/* top: 418rpx; */ /* top: 418rpx; */
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 50% 50% 0rpx;
} }
.message .message_bg { .message .message_bg {
width: 676rpx; width: 676rpx;
...@@ -34,15 +34,30 @@ ...@@ -34,15 +34,30 @@
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
} }
.message .message_txt { .message .message_txt {
width: 142rpx; width: 676rpx;
height: 25rpx; height: 25rpx;
opacity: 1; opacity: 1;
left: 268rpx; left: 0rpx;
top: 355rpx; top: 355rpx;
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
font-size: 26rpx; font-size: 26rpx;
color: #685b4e; color: #685b4e;
text-align: center;
}
.message .message_backTime {
width: 578rpx;
height: 58rpx;
opacity: 1;
display: block;
left: 60rpx;
top: 211rpx;
position: absolute;
font-size: 28rpx;
color: rgba(104, 91, 78, 1);
transform-origin: 0rpx 0rpx 0rpx;
text-align: center;
font-weight: bold;
} }
.message .message_btn { .message .message_btn {
width: 45rpx; width: 45rpx;
...@@ -51,7 +66,7 @@ ...@@ -51,7 +66,7 @@
left: 577rpx; left: 577rpx;
top: 24rpx; top: 24rpx;
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 50% 50% 0rpx;
} }
.message .message_closebtn { .message .message_closebtn {
width: 352rpx; width: 352rpx;
...@@ -60,5 +75,5 @@ ...@@ -60,5 +75,5 @@
left: 161rpx; left: 161rpx;
top: 510rpx; top: 510rpx;
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 50% 50% 0rpx;
} }
<view class="message-modal"> <view class="message-modal">
<view class="message__shade modal-animate-fade-in" /> <view class="message__shade modal-animate-fade-in" />
<view class="message "> <view class="message modal-animate-zoom-in">
<image class="message_bg " src={{resList['ed31e83e-535d-45bf-ba5b-20827a4cd104'].url}} /> <image class="message_bg " src={{resList['fc1fd3ee-e606-46de-9bb6-ea5fb41567df'].url}} />
<label class="message_txt ">{{mydata.catName+" 留"}}</label> <label class="message_txt ">{{mydata.catName+" 留"}}</label>
<image class="message_btn " onTap="onModalClose" src={{resList['3ad6a924-dda8-49f4-b8fc-0e796347e802'].url}} /> <label class="message_backTime ">{{backTime}}</label>
<image class="message_closebtn " onTap="onModalClose" src={{resList['5488b126-f520-496f-ace6-010a89eb108f'].url}} /> <image class="message_btn" onTap="onModalClose" src={{resList['3ad6a924-dda8-49f4-b8fc-0e796347e802'].url}} />
<image class="message_closebtn btn" onTap="onModalClose" src={{resList['5488b126-f520-496f-ace6-010a89eb108f'].url}} />
</view> </view>
</view> </view>
\ No newline at end of file
...@@ -2,31 +2,50 @@ ...@@ -2,31 +2,50 @@
import API from '../../api'; import API from '../../api';
import resList from '../../resconfig/resList'; import resList from '../../resconfig/resList';
const app = getApp();
const { tbcc } = app;
const { commonToast } = tbcc.tb;
Component({ Component({
props: { props: {
mydata:null mydata: null
}, },
data: { data: {
resList: resList, resList: resList,
backTime:'' backTime: ''
}, },
methods: { methods: {
onModalClose() { onModalClose() {
const { onModalClose } = this.props; const { onModalClose } = this.props;
onModalClose && onModalClose(); onModalClose && onModalClose();
console.log('onModalClose') console.log('onModalClose')
}
}, },
/**根据时间戳获取日期-月-日 */
async didMount(){ getDateDayMonthByTime(time) {
const recall = await API.recallInfo(); let date = new Date(time);
if(recall&&recall.success){ let hours = date.getHours();
let minutes = date.getMinutes();
minutes = minutes <= 0 ? '' : minutes + '分'
date = hours + "点" + minutes;
return date;
},
async getBackTime() {
// my.showLoading();
// const recall = await API.recallInfo().catch(r=>{
// commonToast(r&&r.message)
// my.hideLoading();
// })||{};
// if (recall && recall.success) {
// my.hideLoading();
this.setData({ this.setData({
backTime:recall.data.backTime backTime: this.getDateDayMonthByTime(this.props.mydata.recallInfo.backTime)
}) })
}else{ // }
my.showToast(recall?recall.message:null);
} }
},
didMount() {
this.getBackTime();
} }
}); });
\ No newline at end of file
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
height: 105rpx; height: 105rpx;
opacity: 1; opacity: 1;
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 50% 50% 0rpx;
} }
.recallcat .recallbtngroup .recallbtngo { .recallcat .recallbtngroup .recallbtngo {
width: 281rpx; width: 281rpx;
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
opacity: 1; opacity: 1;
left: 327rpx; left: 327rpx;
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 50% 50% 0rpx;
} }
.recallcat .recallbtnclose { .recallcat .recallbtnclose {
width: 44rpx; width: 44rpx;
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<label class="recallcatbacklabel">{{timeText}}</label> <label class="recallcatbacklabel">{{timeText}}</label>
<label class="recallcathappycoin">{{happyCoinCnt}}</label> <label class="recallcathappycoin">{{happyCoinCnt}}</label>
<view class="recallbtngroup"> <view class="recallbtngroup">
<image class="recallbtncancel" onTap="onModalClose" src={{resList['6957d9f3-9aa4-4ed6-9b83-57cc68f16512'].url}} /> <image class="recallbtncancel btn" onTap="onModalClose" src={{resList['6957d9f3-9aa4-4ed6-9b83-57cc68f16512'].url}} />
<image class="recallbtngo" onTap="onRecallCat" src={{resList['6d8cdd11-fbc5-4e84-b5ef-1f74c9070738'].url}} /> <image class="recallbtngo btn" disable="{{btnEnable}}" onTap="onRecallCat" src={{resList['6d8cdd11-fbc5-4e84-b5ef-1f74c9070738'].url}} />
</view> </view>
<image class="recallbtnclose" onTap="onModalClose" src={{resList['29e80fbb-98ed-40fb-a11b-e14b45fee158'].url}} /> <image class="recallbtnclose" onTap="onModalClose" src={{resList['29e80fbb-98ed-40fb-a11b-e14b45fee158'].url}} />
</view> </view>
...@@ -2,12 +2,18 @@ ...@@ -2,12 +2,18 @@
import API from '../../api'; import API from '../../api';
import resList from '../../resconfig/resList'; import resList from '../../resconfig/resList';
const app = getApp();
const { tbcc } = app;
const { commonToast } = tbcc.tb;
Component({ Component({
props: {}, props: {
mydata:null
},
data: { data: {
resList: resList, resList: resList,
timeText: '', timeText: '',
happyCoinCnt: '' happyCoinCnt: '',
btnEnable:true
}, },
methods: { methods: {
onModalClose() { onModalClose() {
...@@ -27,6 +33,7 @@ Component({ ...@@ -27,6 +33,7 @@ Component({
let hours = date.getHours(); let hours = date.getHours();
let minutes = date.getMinutes();; let minutes = date.getMinutes();;
let seconds = date.getSeconds(); let seconds = date.getSeconds();
if (hours <= 0) { if (hours <= 0) {
if (minutes <= 0) { if (minutes <= 0) {
// if (seconds <= 0) { // if (seconds <= 0) {
...@@ -47,36 +54,66 @@ Component({ ...@@ -47,36 +54,66 @@ Component({
return date; return date;
}, },
/**计算两个时间戳相差的时间,小时,分,秒 */
compareTime(startTime,endTime){
let between = (endTime - startTime)/1000;
let hours = Math.floor(between%(24*36000)/3600);
let minutes = Math.floor(between%3600/60);
let seconds = Math.floor(between%60/60);
let date;
if (hours <= 0) {
if (minutes <= 0) {
// if (seconds <= 0) {
date = 0 + '小时' + 0 + '分';
// } else {
// date = seconds + "秒"
// }
} else {
date = hours + '小时' + minutes + '分';
}
} else {
date = hours + '小时' + minutes + '分';
}
return date;
},
/**召回猫,打开召回猫的奖励弹窗 */ /**召回猫,打开召回猫的奖励弹窗 */
async onRecallCat() { async onRecallCat() {
const recallCat = await API.recallCat(); if(!this.data.btnEnable) return;
console.log("召回猫")
my.__clickDelay__(this);
my.showLoading();
const recallCat = await API.recallCat().catch(r=>{
my.hideLoading();
commonToast(r&&r.message);
})||{};
if (recallCat && recallCat.success) { if (recallCat && recallCat.success) {
my.hideLoading();
this.onModalClose(); this.onModalClose();
const { const {
onRecallCat onRecallCat
} = this.props; } = this.props;
onRecallCat && onRecallCat(recallCat.data); onRecallCat && onRecallCat(recallCat.data);
my.__updateUserInfo__();
} else {
my.showToast({content:recallCat ? recallCat.message : null})
} }
} }
}, },
async didMount() { async didMount() {
const recall = await API.recallInfo(); // const recall = await API.recallInfo().catch(r=>{
console.log(recall); // commonToast(r&&r.message)
if (recall && recall.success) { // })||{};
var text = "猫咪预计" + this.getDateDayMonthByTime(recall.data.backTime - recall.data.serverTime) + "后回寝"; // console.log(recall);
// if (recall && recall.success) {
var text = "猫咪预计" + this.compareTime(this.props.mydata.recallInfo.serverTime , this.props.mydata.recallInfo.backTime) + "后回寝";
this.setData({ this.setData({
timeText: text, timeText: text,
happyCoinCnt: recall.data.value + '' happyCoinCnt: this.props.mydata.recallInfo.value + ''
}) })
} else { // }
my.showToast(recall ? recall.message : null)
}
} }
}); });
\ No newline at end of file
<view disable-scroll="true" class="page-game"> <view disable-scroll="true" class="page-game">
<canvas disable-scroll="true" id="canvas" class="canvas" onTouchStart="onMouseEvent" onTouchMove="onMouseEvent" onTouchEnd="onMouseEvent" onReady="onCanvasReady"> <canvas disable-scroll="true" id="canvas" type="webgl" class="canvas" onTouchStart="onMouseEvent" onTouchMove="onMouseEvent" onTouchEnd="onMouseEvent" onReady="onCanvasReady">
</canvas> </canvas>
</view> </view>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<message-modal a:if="{{messageModalVisible}}" mydata="{{messageModalData}}" onModalClose="closeMessageModal"></message-modal> <message-modal a:if="{{messageModalVisible}}" mydata="{{messageModalData}}" onModalClose="closeMessageModal"></message-modal>
<view class="popcontainer" a:if="{{selectcatModalVisible}}"><selectcat-modal onModalClose="closeSelectcatModal" onSelectCat="selectCat"></selectcat-modal></view> <view class="popcontainer" a:if="{{selectcatModalVisible}}"><selectcat-modal onModalClose="closeSelectcatModal" onSelectCat="selectCat"></selectcat-modal></view>
<view class="popcontainer" a:if="{{catnameModalVisible}}" ><catname-modal selectType="{{catType}}" onModalClose="closeCatnameModal" onSelectCatOk="selectCatOk" /></view> <view class="popcontainer" a:if="{{catnameModalVisible}}" ><catname-modal selectType="{{catType}}" onModalClose="closeCatnameModal" onSelectCatOk="selectCatOk" /></view>
<view class="popcontainer" a:if="{{recallcatModalVisible}}"><recallcat-modal onRecallCat="recallCat" onModalClose="closeRecallcatModal"></recallcat-modal></view> <view class="popcontainer" a:if="{{recallcatModalVisible}}"><recallcat-modal mydata="{{recallcatModalData}}" onRecallCat="recallCat" onModalClose="closeRecallcatModal"></recallcat-modal></view>
<view class="popcontainer" a:if="{{getcatModalVisible}}"><getcat-modal selectType="{{catType}}" catName="{{catName}}" onPostSelectCat="postSelectCat" onModalClose="closeGetcatModal"></getcat-modal></view> <view class="popcontainer" a:if="{{getcatModalVisible}}"><getcat-modal selectType="{{catType}}" catName="{{catName}}" onPostSelectCat="postSelectCat" onModalClose="closeGetcatModal"></getcat-modal></view>
<view class="popcontainer" a:if="{{catbackbedModalVisible}}"><catbackbed-modal mydata="{{recallcatModalData}}" recallCatInfo="{{recallCatInfo}}" onUpdateUserInfo="updateUserInfo" onModalClose="closeCatbackModal"></catbackbed-modal></view> <view class="popcontainer" a:if="{{catbackbedModalVisible}}"><catbackbed-modal mydata="{{recallcatModalData}}" recallCatInfo="{{recallCatInfo}}" onUpdateUserInfo="updateUserInfo" onModalClose="closeCatbackModal"></catbackbed-modal></view>
<task-modal a:if="{{taskModalVisible}}" onModalClose="closeTaskModal"></task-modal> <task-modal a:if="{{taskModalVisible}}" onModalClose="closeTaskModal"></task-modal>
......
...@@ -35,7 +35,7 @@ Page({ ...@@ -35,7 +35,7 @@ Page({
data: { data: {
catType: 1, catType: 1,
catName: '', catName: '',
activityBaseInfo:null, activityBaseInfo: null,
recallCatInfo: {}, recallCatInfo: {},
taskModalVisible: 0, taskModalVisible: 0,
messageModalVisible: false, messageModalVisible: false,
...@@ -53,9 +53,15 @@ Page({ ...@@ -53,9 +53,15 @@ Page({
catruleModalVisible: 0 catruleModalVisible: 0
}, },
async doHelp() { async doHelp() {
if(!app.inviteId) return; if (!app.inviteId) return;
commonToast('正在发起助力~') commonToast('正在发起助力~')
const { success, data, message } = await API.doHelp({ inviteId: app.inviteId }).catch(res => { const {
success,
data,
message
} = await API.doHelp({
inviteId: app.inviteId
}).catch(res => {
commonToast(res && res.message); commonToast(res && res.message);
}) || {}; }) || {};
...@@ -89,7 +95,7 @@ Page({ ...@@ -89,7 +95,7 @@ Page({
console.log('on ready') console.log('on ready')
//授权和登录先搞 //授权和登录先搞
await this.getAuth(); // await this.getAuth();
// this.initCanvas(); // this.initCanvas();
my.__onMessage__ = (e) => { my.__onMessage__ = (e) => {
this.onMessage(e) this.onMessage(e)
...@@ -128,7 +134,18 @@ Page({ ...@@ -128,7 +134,18 @@ Page({
console.log("通知canvas刷新用户信息") console.log("通知canvas刷新用户信息")
this.main && this.main.dispatchGlobalEvent("UPDATE_USERINFO") this.main && this.main.dispatchGlobalEvent("UPDATE_USERINFO")
} }
my.__clickDelay__ = (obj) => {
obj.setData({
btnEnable:false
})
setTimeout(()=>{
if(obj){
obj.setData({
btnEnable:true
})
}
},2000)
}
// setTimeout(() => { // setTimeout(() => {
// my.__pageTo__('myprize') // my.__pageTo__('myprize')
// }, 100); // }, 100);
...@@ -166,12 +183,14 @@ Page({ ...@@ -166,12 +183,14 @@ Page({
this.doHelp(); this.doHelp();
} }
}, },
fail: () => { console.log('createCanvas fail'); } fail: () => {
console.log('createCanvas fail');
}
}); });
}, },
onCanvasReady(query) { onCanvasReady(query) {
console.log('onCanvasReady',query) console.log('onCanvasReady', query)
//授权和登录先搞 //授权和登录先搞
checkSystem().then(r => { checkSystem().then(r => {
if (r) { if (r) {
...@@ -324,7 +343,8 @@ Page({ ...@@ -324,7 +343,8 @@ Page({
avatar avatar
} = app; } = app;
const { const {
success, data, success,
data,
} = await API.login({ } = await API.login({
userNick: nickName, userNick: nickName,
avatar avatar
...@@ -333,7 +353,7 @@ Page({ ...@@ -333,7 +353,7 @@ Page({
}) || {}; }) || {};
if (success) { if (success) {
app.openId=data.openId; app.openId = data.openId;
this.getActivityBaseInfoById(); this.getActivityBaseInfoById();
} }
...@@ -341,16 +361,20 @@ Page({ ...@@ -341,16 +361,20 @@ Page({
/** /**
* 获取活动信息 * 获取活动信息
*/ */
async getActivityBaseInfoById(){ async getActivityBaseInfoById() {
my.showLoading(); my.showLoading();
const {success,data} = await API.getActivityBaseInfoById().catch(r=>{ const {
commonToast(r&&r.message) success,
})||{}; data
} = await API.getActivityBaseInfoById().catch(r => {
my.hideLoading();
commonToast(r && r.message)
}) || {};
if(success){ if (success) {
my.hideLoading(); my.hideLoading();
this.setData({ this.setData({
activityBaseInfo:data activityBaseInfo: data
}) })
this.initCanvas(); this.initCanvas();
} }
...@@ -382,6 +406,7 @@ Page({ ...@@ -382,6 +406,7 @@ Page({
}, },
/**召回猫 */ /**召回猫 */
recallCat(r) { recallCat(r) {
this.main.dispatchGlobalEvent("RECALL_CAT");
this.setData({ this.setData({
recallCatInfo: r, recallCatInfo: r,
catbackbedModalVisible: true catbackbedModalVisible: true
...@@ -440,12 +465,15 @@ Page({ ...@@ -440,12 +465,15 @@ Page({
}, },
onShareAppMessage() { onShareAppMessage() {
// 返回自定义分享信息 // 返回自定义分享信息
let { path, ...rest } = SHARE_CONFIG; let {
console.log('app.openId',app.openId); path,
...rest
} = SHARE_CONFIG;
console.log('app.openId', app.openId);
if (app.openId) { if (app.openId) {
path = '/pages/pagecanvas/pagecanvas' + '?openId=' + app.openId; path = '/pages/pagecanvas/pagecanvas' + '?openId=' + app.openId;
} }
console.log('path',path) console.log('path', path)
return { return {
...rest, ...rest,
......
...@@ -495,6 +495,12 @@ const resList = { ...@@ -495,6 +495,12 @@ const resList = {
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/unluckyBtn.e57fc34e49370d30a6942fb835395377a9cf4721.png', url: '//yun.duiba.com.cn/spark/assets/unluckyBtn.e57fc34e49370d30a6942fb835395377a9cf4721.png',
uuid: 'c8c50400-1d65-4971-8be5-e4fb2eecfcd5' uuid: 'c8c50400-1d65-4971-8be5-e4fb2eecfcd5'
},
'fc1fd3ee-e606-46de-9bb6-ea5fb41567df': {
name: 'catMessageBg',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/catMessageBg.e74d2bf93254933a994d05aa9ce29f9e3914c149.png',
uuid: 'fc1fd3ee-e606-46de-9bb6-ea5fb41567df'
} }
}; };
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