Commit e54dad35 authored by Edwise's avatar Edwise 🍷

删除旧项目文件

parent 37635c7d
.catbackbed1 {
width: 750rpx;
height: 1093rpx;
opacity: 1;
position: absolute;
top:265rpx;
transform-origin: 50% 50% 0rpx;
}
.catbackbed1 .catbackbed {
width: 750rpx;
height: 1093rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catbackbed1 .catbackbed .catbackbedbgaccident {
width: 750rpx;
height: 1093rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
display: block;
}
.catbackbed1 .catbackbed .catbackbedbgsurprise {
width: 750rpx;
height: 1093rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
display: block;
}
.catbackbed1 .catbackbed .catbackbedbgunluck {
width: 584rpx;
height: 715rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
display: block;
top: 196rpx;
left: 84rpx;
}
.catbackbed1 .catbackbed .catbackbedok {
width: 351rpx;
height: 105rpx;
opacity: 1;
left: 201rpx;
top: 773rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catbackbed1 .catbackbed .catbackbedtip2 {
width: 750rpx;
height: 32rpx;
opacity: 1;
left: 0rpx;
top: 706rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 32rpx;
color: #685b4e;
text-align: center;
font-weight: bold
}
.catbackbed1 .catbackbed .catbackbedtip {
width: 447rpx;
height: 111rpx;
opacity: 1;
left: 152rpx;
top: 563rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 28rpx;
color: #685b4e;
}
.catbackbed1 .catbackbed .catbackbedclose {
width: 44rpx;
height: 44rpx;
opacity: 1;
display: block;
left: 586rpx;
top: 238rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catbackbed1 .catbackbed .catbackbedcatimg {
width: 494rpx;
height: 262rpx;
opacity: 1;
display: block;
left: 128rpx;
top: 290rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
<view class="catbackbed1 modal-animate-zoom-in">
<view class="catbackbed">
<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="catbackbedbgunluck" a:if="{{backType==3}}" src={{resList['3fa827d6-e333-4b56-a5d9-5f3ae2089127'].url}} />
<image class="catbackbedok" onTap="onModalClose" src="{{okBtnImg}}" />
<label class="catbackbedtip2"><text>{{getTypeText}}</text> <text style="color:{{getColor}}">{{getText}}</text> </label>
<label class="catbackbedtip">
{{desc}}
</label>
<image class="catbackbedclose" onTap="onModalClose" src={{resList['29e80fbb-98ed-40fb-a11b-e14b45fee158'].url}} />
<image class="catbackbedcatimg" src="{{catImg}}" />
</view>
</view>
\ No newline at end of file
'use strict';
import resList from '../../resconfig/resList';
Component({
props: {
catImgArr: { //回归猫的图片,1:惊喜欢乐币,2:意外精力值,3:倒霉
'1': [
"36279db8-3376-4710-bb1f-89e69130e6dd", "6dc7422e-d6bf-4b03-9fd3-637b71e5e88e",
"5c01ebd0-dac7-4ff9-89a5-054ea7214f62", "e7156f22-22f6-45f5-8002-898c142ba6ae"
],
'2': [
"51c97f4c-1f39-48cf-8865-c1c2fec500d8", "0a80398a-972a-4ea2-a9d1-604fe54a9d62",
"32f6f1ff-1ad7-4296-a922-d9073b31a921", "377e50f3-cbec-45a5-9bcd-d4923b9873a6"
],
'3': [
"e143c361-01b3-488f-b213-7a97040e245b", "a1a5d4a5-8039-4a6f-a620-8fb465eec68f",
"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,
mydata: null, //mydata.catType 猫的类型
},
data: {
resList: resList,
backType: 0, //回归类型,1:惊喜欢乐币,2:意外精力值,3:倒霉
value: 0, //对应的具体值
prizeType: 0, //奖品类型 4:精力,6:欢乐币
catImg: '',
desc: '恭喜恭喜恭喜恭喜恭喜恭喜恭喜恭喜恭喜恭喜恭喜恭喜恭喜恭喜恭喜恭喜恭喜恭喜恭喜恭喜', //描述
getText: '+100欢乐币', //获取或减少收益文本
getColor: 'red', //获取或减少收益文本颜色
getTypeText: '获得', //获取或减少收益类型文本
okBtnImg: '' //收下按钮
},
methods: {
onModalClose() {
const {
onModalClose
} = this.props;
onModalClose && onModalClose();
my.__updateUserInfo__();
// onUpdateUserInfo&&onUpdateUserInfo();
},
},
didMount() {
console.log(this.props.catImgArr,this.props.recallCatInfo)
const { value, type, backType, tips } = this.props.recallCatInfo;
let getText = '';
let getTextColor = '';
let getTypeText = '';
let okBtnImg = '';
if (type == 4) {
getText = '精力值';
} else if (type == 6) {
getText = '欢乐币'
}
switch (backType) {
case 1:
getText = '+' + value + getText;
getTextColor = 'red';
getTypeText = '获得';
okBtnImg = this.props.okBtnImgArr[1];
break;
case 2:
getText = '+' + value + getText;
getTextColor = 'red';
getTypeText = '意外获得';
okBtnImg = this.props.okBtnImgArr[1];
break;
case 3:
getText = '-' + value + getText;
getTextColor = 'black';
getTypeText = '损失';
okBtnImg = this.props.okBtnImgArr[0];
break;
}
console.log("mm" + this.props.mydata.catType - 1)
console.log(this.props.catImgArr['' + backType][this.props.mydata.catType - 1]);
this.setData({
catImg: resList[this.props.catImgArr[backType][this.props.mydata.catType - 1]].url,
getText: getText,
getColor: getTextColor,
getTypeText:getTypeText,
backType:backType,
desc:tips[Math.floor(Math.random()*tips.length)],
okBtnImg:resList[okBtnImg].url
})
},
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.catname {
width: 500rpx;
height: 842rpx;
opacity: 1;
left: 126rpx;
top: 378rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catname .catnamecatimg {
width: 421rpx;
height: 301rpx;
opacity: 1;
left: 38rpx;
top: 202rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catname .catnamedialog {
width: 466rpx;
height: 177rpx;
opacity: 1;
left: 5rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catname .catnamedialog .catnamedialogbg {
width: 466rpx;
height: 177rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catname .catnamedialog .catnamedialoglabel {
width: 359rpx;
height: 72rpx;
opacity: 1;
left: 59rpx;
top: 38rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 28rpx;
color: #574b45;
}
.catname .catnamesure {
width: 282rpx;
height: 106rpx;
opacity: 1;
left: 111rpx;
top: 736rpx;
position: absolute;
transform-origin: 50% 50% 0rpx;
}
.catname .catnameNo {
width: 282rpx;
height: 106rpx;
opacity: 1;
left: 111rpx;
top: 736rpx;
position: absolute;
transform-origin: 50% 50% 0rpx;
}
.catname .catnameinput {
width: 500rpx;
height: 147rpx;
opacity: 1;
top: 538rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catname .catnameinput .catnameinputbg {
width: 500rpx;
height: 102rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catname .catnameinput .catnameinputlabel {
width: 420rpx;
height: 47rpx;
opacity: 1;
left: 33rpx;
top: 25rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 28rpx;
color: #685b4e;
background-color: rgba(0, 0, 0, 0);
}
.catname .catnameinput .catnameinputrandom {
width: 150rpx;
height: 26rpx;
opacity: 1;
left: 175rpx;
top: 121rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 24rpx;
color: #f8f1eb;
text-align: center
}
<view class="catname">
<image class="catnamecatimg" src="{{catImg}}" />
<view class="catnamedialog">
<image class="catnamedialogbg" src={{resList['50779aee-069e-4dd9-b2ff-88beda9f43d1'].url}} />
<label class="catnamedialoglabel">铲屎官~帮我取个名字吧!喵~</label>
</view>
<image class="catnamesure btn" a:if="{{btnV}}" onTap="catNameSure" src={{resList['c7916d41-ea9d-4f8e-b5aa-e2060d6ae265'].url}} />
<image class="catnameNo" a:if="{{!btnV}}" src={{resList['3fe9ac60-f1aa-4da3-93da-c67e5a9dc3a6'].url}} />
<view class="catnameinput">
<image class="catnameinputbg" src={{resList['947d970f-52bf-4319-82f0-a3e65620ed75'].url}} />
<input class="catnameinputlabel" maxlength="6" onInput="getCatName" controlled="true" value="{{catNameText}}" placeholder="输入名字" name="" ></input>
<text class="catnameinputrandom" onTap="randomName" >随机名字</text>
</view>
</view>
\ No newline at end of file
'use strict';
import API from '../../api';
import resList from '../../resconfig/resList';
const app = getApp();
const {
tbcc
} = app;
const {
textRiskIdentification,
commonToast
} = tbcc.tb;
const nameArr = [
'Edwise',
'爱德',
'Mr.W'
];
Component({
props: {
//catImgArr: ["90b114e6-83cb-46f1-b607-f88c50077b05", "4e471df6-01ab-421d-ba0b-084b2110dc6d", "003e9904-aee4-4b8d-8d5d-fb4b1188bec1", "90283bd3-4b18-4535-97a8-90318f068781"],
catImgArr: ["3e6311fd-15ab-4656-bb84-1c49f4ad4ed9", "bbb10ff2-f4fb-43a8-83d8-abbb04949f2d", "9fc6517e-debe-4457-88ef-9c733d5bc072", "ecb49f23-2e65-4507-8be6-1eee021a3b35"],
catName: ""
},
data: {
resList: resList,
catNameText: "",
catImg: "",
btnV: false,
isControlled: false
},
methods: {
/**获取字符串字符长度 */
getlen(str) {
var strlen = 0;
console.log("名称长度", str.length)
console.log("charChodeAt", str.charCodeAt)
for (var i = 0; i < str.length; i++) {
if (str.charCodeAt(i) > 255) //如果是汉字,则字符串长度加2
strlen += 2;
else
strlen++;
}
return strlen;
},
onModalClose() {
const {
onModalClose
} = this.props;
onModalClose && onModalClose();
},
onSelectCatOk() {
const {
onSelectCatOk
} = this.props;
onSelectCatOk && onSelectCatOk(this.props.catName);
},
/**随机名字,需要根据运营数据可配置 */
randomName() {
console.log("随即名字")
let index = Math.floor(Math.random()*nameArr.length)
let name = nameArr[index];
this.setData({
catNameText: name
})
this.setCatName(name);
},
/**获取名字 */
getCatName(e) {
this.setData({
catNameText: e.detail.value
})
console.log("input", e)
this.setCatName(e.detail.value)
},
/**设置名字 */
setCatName(name) {
this.props.catName = name;
if (this.props.catName && this.props.catName.length > 0) {
this.setData({
btnV: true
})
} else {
this.setData({
btnV: false
})
}
},
/**确认领养 */
async catNameSure() {
let name = this.props.catName;
let len = this.getlen(name);
console.log("名称字符长度", len)
if (len <= 0) {
my.showToast({
content: "名字不能为空哦",
});
} else if (len > 6) {
my.showToast({
content: "名字过长哦",
});
} else {
/**检查敏感词 */
console.log('检查敏感词', name)
const success = await textRiskIdentification(name).catch(err => {
commonToast(err)
console.log('textRiskIdentification error', err);
});
console.log('敏感词校验结果', success)
if (!success) {
commonToast("非法名称")
console.log('敏感词校验失败.')
return;
} else {
my.showLoading();
/**调用领养接口 */
const adoptCat = await API.adoptCat({
catName: name,
catType: this.props.selectType,
// invitedId: 'openId:AAHVNvjuAMaJc3uyPjeHlCEF'//honingwon
invitedId: app.inviteId
});
console.log("aaaa", adoptCat)
if (adoptCat && adoptCat.success) {
// my.showToast({content:'邀请成功'+app.inviteId})
my.hideLoading();
this.onModalClose();
this.onSelectCatOk();
} else {
console.log("ergerg")
my.hideLoading();
my.showToast({
content: adoptCat.message || '网络异常,请稍后重试~'
})
}
}
}
console.log(this.props.catName)
}
},
didMount() {
console.log(this.props.catImgArr[this.props.selectType - 1].url)
this.setData({
catImg: resList[this.props.catImgArr[this.props.selectType - 1]].url
})
console.log("类型" + this.props.selectType + "起名")
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.catrule {
width: 721rpx;
height: 559rpx;
opacity: 1;
left: 18rpx;
top: 442rpx;
position: absolute;
transform-origin: 50% 50% 0rpx;
display: block;
}
.catrule .catrulebg {
width: 721rpx;
height: 559rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catrule .catrulep {
width: 13rpx;
height: 69rpx;
opacity: 1;
left: 667rpx;
top: 168rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catrule .catrulelabel {
width: 574rpx;
height: 279rpx;
opacity: 1;
left: 76rpx;
top: 167rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 24rpx;
color: #685b4e;
overflow-y: scroll
}
.catrule.catrulelabel.catruleText{
width: 574rpx;
height: 279rpx;
font-size: 24rpx;
color: #685b4e;
transform-origin: 0rpx 0rpx 0rpx;
position: absolute;
}
.catrule .catrulebtnclose {
width: 44rpx;
height: 44rpx;
opacity: 1;
display: block;
left: 624rpx;
top: 38rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
<view class="catrule modal-animate-zoom-in">
<image class="catrulebg" src={{resList['716ced79-de7f-40ca-ac98-46a5adf13db0'].url}} />
<!-- <image class="catrulep" src={{resList['617927a2-2dd6-456a-9d92-1f607a137dbc'].url}} /> -->
<view class="catrulelabel" onTouchMove="touchMove" >
<label class="catruleText" >{{rule}}</label>
</view>
<image class="catrulebtnclose" onTap="onModalClose" src={{resList['29e80fbb-98ed-40fb-a11b-e14b45fee158'].url}} />
</view>
\ No newline at end of file
'use strict';
import resList from '../../resconfig/resList';
Component({
props: {},
data: {
resList: resList,
rule:''
},
methods: {
onModalClose() {
const {
onModalClose
} = this.props;
onModalClose && onModalClose();
console.log('onModalClose')
},
touchMove(e){
console.log(e)
}
},
didMount(){
const {rule} = this.props;
console.log("规则",rule);
this.setData({
rule:rule.rule
})
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.exchanged {
width: 750rpx;
height: 1093rpx;
opacity: 1;
top: 50%;
margin-top: -550rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.exchanged .exchanged_bg {
width: 750rpx;
height: 1093rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.exchanged .exchanged_imgbg {
width: 299rpx;
height: 299rpx;
opacity: 1;
left: 227rpx;
top: 377rpx;
border-radius: 10rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.exchanged .exchanged_close {
width: 45rpx;
height: 45rpx;
opacity: 1;
left: 584rpx;
top: 236rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.exchanged .exchanged_title {
width: 750rpx;
text-align: center;
/* height: 35rpx; */
opacity: 1;
/* left: 295rpx; */
top: 300rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 36rpx;
color: #e74846;
}
.exchanged .exchanged_btn {
width: 351rpx;
height: 105rpx;
opacity: 1;
left: 201rpx;
top: 773rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
<view class="exchanged">
<image class="exchanged_bg " src={{resList['65d97f17-4b35-4ba7-b21b-7ec0bfac6639'].url}} />
<image class="exchanged_imgbg " src={{resList['e0ce2abf-64d3-40f3-a016-c7fb7772b3f6'].url}} />
<image class="exchanged_imgbg " src={{mydata.image}} />
<image class="exchanged_close " onTap="onModalClose" src={{resList['06f8e9d0-f0bf-41d3-bbc2-8a782eacae59'].url}} />
<label class="exchanged_title ">{{mydata.name}}</label>
<image class="exchanged_btn " onTap="onModalClose" src={{resList['923ae629-84ed-406d-b3cb-258742ffa2ba'].url}} />
</view>
\ No newline at end of file
'use strict';
import resList from '../../resconfig/resList';
Component({
props: { mydata:null},
data: {
resList: resList,
},
methods: {
// onBtnClick() {
// console.log('onBtnClick');
// this.onModalClose();
// },
onModalClose() {
const { onModalClose } = this.props;
onModalClose && onModalClose();
console.log('onModalClose')
}
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.getcat {
width: 465rpx;
height: 671rpx;
opacity: 1;
left: 130rpx;
top: 378rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.getcat .getcatimg {
width: 421rpx;
height: 301rpx;
opacity: 1;
left: 34rpx;
top: 202rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.getcat .getcatdialog {
width: 465rpx;
height: 176rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.getcat .getcatdialog .getcatdialogbg {
width: 465rpx;
height: 176rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.getcat .getcatdialog .getcatdialogtext {
width: 326rpx;
height: 73rpx;
opacity: 1;
left: 69rpx;
top: 39rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 28rpx;
color: #574b45;
}
.getcat .getcatgo {
width: 282rpx;
height: 106rpx;
opacity: 1;
left: 107rpx;
top: 565rpx;
position: absolute;
transform-origin: 50% 50% 0rpx;
}
<view class="getcat">
<image class="getcatimg" src="{{catImg}}" />
<view class="getcatdialog">
<image class="getcatdialogbg" src={{resList['24b7d459-41d6-408c-9829-4768fe38abf5'].url}} />
<label class="getcatdialogtext">好了,现在你就是{{catName}}的铲屎官了~</label>
</view>
<image class="getcatgo btn" onTap="onPostSelectCat" src={{resList['97484cf2-5146-4287-b104-ed1f43c71ee0'].url}} />
</view>
\ No newline at end of file
'use strict';
import API from '../../api';
import resList from '../../resconfig/resList';
Component({
props: {
//catImgArr: ["90b114e6-83cb-46f1-b607-f88c50077b05", "4e471df6-01ab-421d-ba0b-084b2110dc6d" , "003e9904-aee4-4b8d-8d5d-fb4b1188bec1","90283bd3-4b18-4535-97a8-90318f068781"],
catImgArr:["3e6311fd-15ab-4656-bb84-1c49f4ad4ed9","bbb10ff2-f4fb-43a8-83d8-abbb04949f2d","9fc6517e-debe-4457-88ef-9c733d5bc072","ecb49f23-2e65-4507-8be6-1eee021a3b35"],
catName: ''
},
data: {
resList: resList,
catImg:''
},
methods: {
onModalClose() {
const {
onModalClose
} = this.props;
onModalClose && onModalClose();
console.log('onModalClose')
},
async onPostSelectCat() {
const userInfo = await API.getUserInfo().catch(res=>{
my.showToast({content:res?res.message:null})
});
if(userInfo&&userInfo.success){
console.log("aaa",userInfo)
const {
onPostSelectCat
} = this.props;
console.log("领养完毕")
this.onModalClose();
// my.__updateUserInfo__();
onPostSelectCat && onPostSelectCat(userInfo);
}
}
},
didMount(){
this.setData({
catImg: resList[this.props.catImgArr[this.props.selectType - 1]].url
})
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.levelup-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 20;
}
.levelup__shade {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
}
.levelup {
position: absolute;
width: 750rpx;
height: 1093rpx;
opacity: 1;
transform-origin: 50% 50% 0rpx;
top:50%;
margin-top: -546rpx;
}
.levelup .levelup_light {
width: 750rpx;
height: 1093rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.levelup .levelup_bg {
width: 584rpx;
height: 715rpx;
opacity: 1;
left: 85rpx;
top: 200rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.levelup .levelup_closebtn {
width: 45rpx;
height: 45rpx;
opacity: 1;
left: 584rpx;
top: 236rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.levelup .levelup_bg2 {
width: 651rpx;
height: 784rpx;
opacity: 1;
left: 52rpx;
top: 182rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.levelup .levelup_txt {
width: 750rpx;
height: 26rpx;
opacity: 1;
left: 0rpx;
top: 711rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 26rpx;
color: #574738;
text-align: center;
}
.levelup .levelup_title {
width: 206rpx;
height: 35rpx;
opacity: 1;
left: 274rpx;
top: 314rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.levelup .levelup_imgbg {
width: 360rpx;
height: 299rpx;
opacity: 1;
left: 197rpx;
top: 377rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.levelup .levelup_prizeView {
width: 350rpx;
height: 293rpx;
opacity: 1;
left: 202rpx;
top: 380rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
overflow: hidden;
/* border: 3rpx solid black; */
border-radius: 10rpx;
}
.levelup .levelup_prizeImg {
width: 356rpx;
height: 299rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
left: -1rpx;
top: -3rpx;
}
.levelup .levelup_btn {
width: 351rpx;
height: 105rpx;
opacity: 1;
left: 201rpx;
top: 773rpx;
position: absolute;
transform-origin: 50% 50% 0rpx;
}
\ No newline at end of file
<view class="levelup-modal">
<view class="levelup__shade modal-animate-fade-in" />
<view class="levelup modal-animate-zoom-in">
<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_bg2 " src={{resList['f88dfc75-c9f1-4e9d-8826-8a1d0e513259'].url}} />
<label class="levelup_txt ">{{levelupTxt}}</label>
<image class="levelup_title " src={{resList['69bff61a-b5a6-4979-ba8d-9e008aed737a'].url}} />
<image class="levelup_imgbg " src={{resList['f56872e2-5e79-4906-99a2-576231f153af'].url}} />
<view class="levelup_prizeView">
<image class="levelup_prizeImg" src="{{prizeImg}}"/>>
</view>
<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}} />
</view>
</view>
\ No newline at end of file
'use strict';
import resList from '../../resconfig/resList';
Component({
props: {
mydata:{}
},
// {prizeData:r.data,energyMax1:Ins.userInfo.energyMax,energyMax2:r.data.energyMax}
data: {
resList: resList,
levelupTxt:'精力上限1200 → 精力上限1500',
prizeImg:''
},
methods: {
onBtnClick() {
console.log('onBtnClick');
this.onModalClose();
},
onModalClose() {
const { onModalClose } = this.props;
onModalClose && 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
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.message-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 20;
}
.message__shade {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
}
.message {
width: 676rpx;
height: 650rpx;
opacity: 1;
left: 40rpx;
top:50%;
margin-top: -325rpx;
/* top: 418rpx; */
position: absolute;
transform-origin: 50% 50% 0rpx;
}
.message .message_bg {
width: 676rpx;
height: 650rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.message .message_txt {
width: 676rpx;
height: 25rpx;
opacity: 1;
left: 0rpx;
top: 355rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 26rpx;
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 {
width: 45rpx;
height: 45rpx;
opacity: 1;
left: 577rpx;
top: 24rpx;
position: absolute;
transform-origin: 50% 50% 0rpx;
}
.message .message_closebtn {
width: 352rpx;
height: 106rpx;
opacity: 1;
left: 161rpx;
top: 510rpx;
position: absolute;
transform-origin: 50% 50% 0rpx;
}
<view class="message-modal">
<view class="message__shade modal-animate-fade-in" />
<view class="message modal-animate-zoom-in">
<image class="message_bg " src={{resList['fc1fd3ee-e606-46de-9bb6-ea5fb41567df'].url}} />
<label class="message_txt ">{{mydata.catName+" 留"}}</label>
<label class="message_backTime ">{{backTime}}</label>
<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>
\ No newline at end of file
'use strict';
import API from '../../api';
import resList from '../../resconfig/resList';
const app = getApp();
const { tbcc } = app;
const { commonToast } = tbcc.tb;
Component({
props: {
mydata: null
},
data: {
resList: resList,
backTime: ''
},
methods: {
onModalClose() {
const { onModalClose } = this.props;
onModalClose && onModalClose();
console.log('onModalClose')
},
/**根据时间戳获取日期-月-日 */
getDateDayMonthByTime(time) {
let date = new Date(time);
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({
backTime: this.getDateDayMonthByTime(this.props.mydata.recallInfo.backTime)
})
// }
}
},
didMount() {
this.getBackTime();
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.common-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 20;
}
.common-modal__shade {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.75);
}
.common-modal__container {
position: absolute;
width: 500rpx;
height: 300rpx;
background: #4eafd7;
background-size: 100% 100%;
left: 50%;
top: 50%;
margin-left: -250rpx;
margin-top: -150rpx;
padding: 30rpx;
}
.common-modal__bd {
font-size: 28rpx;
text-align: center;
color: #fff;
padding: 50rpx 0;
}
.common-modal__close {
position: absolute;
right: -20rpx;
top: -80rpx;
height: 86rpx;
width: 86rpx;
background: url('../../assets/modal_close_btn.png') center center no-repeat;
background-size: 48rpx 48rpx;
z-index: 9;
}
.common-modal__confirm-btn {
margin: 0 auto;
text-align: center;
width: 341rpx;
height: 77rpx;
line-height: 77rpx;
background: #FFF;
background-size: 100% 100%;
font-size: 30rpx;
color: #0077a9;
font-weight: bold;
}
<view class="common-modal">
<view class="common-modal__shade modal-animate-fade-in" />
<view class="common-modal__container modal-animate-zoom-in">
<view class="common-modal__close" onTap="onModalClose" />
<view class="common-modal__bd">
<text>{{data.content}}</text>
</view>
<view class="common-modal__ft" a:if="{{data.btnText}}">
<view onTap="onModalConfirm" class="common-modal__confirm-btn">{{data.btnText}}</view>
</view>
</view>
</view>
Component({
methods: {
onModalClose() {
const { onModalClose } = this.props;
onModalClose && onModalClose();
},
onModalConfirm () {
const { onModalConfirm } = this.props;
onModalConfirm && onModalConfirm();
}
}
});
\ No newline at end of file
{
"component": true
}
\ No newline at end of file
.recallcat {
width: 721rpx;
height: 562rpx;
opacity: 1;
left: 18rpx;
top: 500rpx;
position: absolute;
transform-origin: 50% 50% 0rpx;
}
.recallcat .recallcatbg {
width: 721rpx;
height: 562rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.recallcat .recallcatbacklabel {
width: 615rpx;
height: 25rpx;
opacity: 1;
left: 52rpx;
top: 335rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 26rpx;
color: #685b4e;
text-align: center;
}
.recallcat .recallcathappycoin {
width: 119rpx;
height: 29rpx;
opacity: 1;
left: 265rpx;
top: 235rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 36rpx;
color: #e74846;
text-align: center;
}
.recallcat .recallbtngroup {
width: 608rpx;
height: 105rpx;
opacity: 1;
left: 54rpx;
top: 421rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.recallcat .recallbtngroup .recallbtncancel {
width: 281rpx;
height: 105rpx;
opacity: 1;
position: absolute;
transform-origin: 50% 50% 0rpx;
}
.recallcat .recallbtngroup .recallbtngo {
width: 281rpx;
height: 105rpx;
opacity: 1;
left: 327rpx;
position: absolute;
transform-origin: 50% 50% 0rpx;
}
.recallcat .recallbtnclose {
width: 44rpx;
height: 44rpx;
opacity: 1;
display: block;
left: 624rpx;
top: 38rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
<view class="recallcat modal-animate-zoom-in">
<image class="recallcatbg" src={{resList['40cac443-7998-4c2a-8f9c-38121b2385e3'].url}} />
<label class="recallcatbacklabel">{{timeText}}</label>
<label class="recallcathappycoin">{{happyCoinCnt}}</label>
<view class="recallbtngroup">
<image class="recallbtncancel btn" onTap="onModalClose" src={{resList['6957d9f3-9aa4-4ed6-9b83-57cc68f16512'].url}} />
<image class="recallbtngo btn" disabled="{{btnEnable}}" onTap="onRecallCat" src={{resList['6d8cdd11-fbc5-4e84-b5ef-1f74c9070738'].url}} />
</view>
<image class="recallbtnclose" onTap="onModalClose" src={{resList['29e80fbb-98ed-40fb-a11b-e14b45fee158'].url}} />
</view>
\ No newline at end of file
'use strict';
import API from '../../api';
import resList from '../../resconfig/resList';
const app = getApp();
const {
tbcc
} = app;
const {
commonToast
} = tbcc.tb;
Component({
props: {
mydata: null
},
data: {
resList: resList,
timeText: '',
happyCoinCnt: '',
btnEnable: true
},
methods: {
onModalClose() {
const {
onModalClose
} = this.props;
onModalClose && onModalClose();
console.log('onModalClose')
},
/**根据时间戳获取日期-月-日 */
getDateDayMonthByTime(time) {
let date = new Date(time);
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
let hours = date.getHours();
let minutes = date.getMinutes();;
let seconds = date.getSeconds();
if (hours <= 0) {
if (minutes <= 0) {
// if (seconds <= 0) {
date = 0 + '小时' + 0 + '分';
// } else {
// date = seconds + "秒"
// }
} else {
date = hours + '小时' + minutes + '分';
}
} else {
date = hours + '小时' + minutes + '分';
}
console.log(hours);
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() {
// 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) {
my.hideLoading();
this.onModalClose();
const {
onRecallCat
} = this.props;
onRecallCat && onRecallCat(recallCat.data);
}
}
},
async didMount() {
// const recall = await API.recallInfo().catch(r=>{
// commonToast(r&&r.message)
// })||{};
// console.log(recall);
// if (recall && recall.success) {
var text = "猫咪预计" + this.compareTime(this.props.mydata.recallInfo.serverTime, this.props.mydata.recallInfo.backTime) + "后回寝";
this.setData({
timeText: text,
happyCoinCnt: this.props.mydata.recallInfo.value + ''
})
// }
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.selectcat {
width: 721rpx;
height: 943rpx;
opacity: 1;
left: 15rpx;
top: 320rpx;
/* margin-top: -472.5rpx; */
position: absolute;
transform-origin: 50% 50% 0rpx;
}
.selectcat .selectcatbg {
width: 721rpx;
height: 943rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
left: 0rpx;
top: 0rpx;
}
.selectcat .selectcatblue {
width: 303rpx;
height: 272rpx;
opacity: 1;
left: 377rpx;
top: 501rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatblue .bluebg {
width: 303rpx;
height: 272rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatblue .blueimg {
width: 161rpx;
height: 145rpx;
opacity: 1;
left: 68rpx;
top: 32rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatblue .bluename {
width: 244rpx;
height: 26rpx;
opacity: 1;
left: 26rpx;
top: 198rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 28rpx;
color: #685b4e;
text-align: center;
}
.selectcat .selectcatblue .bluesure {
width: 68rpx;
height: 53rpx;
opacity: 1;
left: 224rpx;
top: 172rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatsh {
width: 302rpx;
height: 272rpx;
opacity: 1;
left: 43rpx;
top: 501rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatsh .shbg {
width: 302rpx;
height: 272rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatsh .shimg {
width: 173rpx;
height: 138rpx;
opacity: 1;
left: 59rpx;
top: 43rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatsh .shname {
width: 244rpx;
height: 26rpx;
opacity: 1;
left: 26rpx;
top: 198rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 28rpx;
color: #685b4e;
text-align: center;
}
.selectcat .selectcatsh .shsure {
width: 68rpx;
height: 53rpx;
opacity: 1;
left: 224rpx;
top: 172rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatxl {
width: 303rpx;
height: 271rpx;
opacity: 1;
left: 377rpx;
top: 197rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatxl .xlbg {
width: 303rpx;
height: 271rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatxl .xlimg {
width: 157rpx;
height: 153rpx;
opacity: 1;
left: 72rpx;
top: 29rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatxl .xlname {
width: 244rpx;
height: 26rpx;
opacity: 1;
left: 26rpx;
top: 198rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 28rpx;
color: #685b4e;
text-align: center;
}
.selectcat .selectcatxl .xlsure {
width: 68rpx;
height: 53rpx;
opacity: 1;
left: 224rpx;
top: 172rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatorge {
width: 302rpx;
height: 271rpx;
opacity: 1;
left: 43rpx;
top: 197rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatorge .orgebg {
width: 302rpx;
height: 271rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatorge .orgeimg {
width: 164rpx;
height: 141rpx;
opacity: 1;
left: 67rpx;
top: 36rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatorge .orgename {
width: 244rpx;
height: 26rpx;
opacity: 1;
left: 26rpx;
top: 198rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 28rpx;
color: #685b4e;
text-align: center;
}
.selectcat .selectcatorge .orgesure {
width: 68rpx;
height: 53rpx;
opacity: 1;
left: 224rpx;
top: 172rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcattrue {
width: 352rpx;
height: 106rpx;
opacity: 1;
left: 185rpx;
top: 804rpx;
position: absolute;
transform-origin: 50% 50% 0rpx;
}
<view class="selectcat modal-animate-zoom-in">
<image class="selectcatbg" src={{resList['db53267d-4141-4d3e-afda-9b523c89be3e'].url}} />
<view class="selectcatblue" id="cat_1" onTap="changeSelectCat">
<image class="bluebg" src={{resList['02183198-f4da-4ac2-8bf3-d6b7a07d3279'].url}} />
<image class="blueimg" src={{resList['95a6b0a9-3e7a-4a0b-82b6-6742e2a8bddf'].url}} />
<label class="bluename">蓝猫</label>
<image class="bluesure" a:if="{{curSelect==1}}" src={{resList['f956cda2-5eef-4942-8737-742d171527bd'].url}} />
</view>
<view class="selectcatsh" id="cat_3" onTap="changeSelectCat">
<image class="shbg" src={{resList['02183198-f4da-4ac2-8bf3-d6b7a07d3279'].url}} />
<image class="shimg" src={{resList['fe52ffae-fadd-40f3-97b5-d3d56fd04781'].url}} />
<label class="shname">三花</label>
<image class="shsure" a:if="{{curSelect==3}}" src={{resList['f956cda2-5eef-4942-8737-742d171527bd'].url}} />
</view>
<view class="selectcatxl" id="cat_4" onTap="changeSelectCat">
<image class="xlbg" src={{resList['02183198-f4da-4ac2-8bf3-d6b7a07d3279'].url}} />
<image class="xlimg" src={{resList['193f6955-d754-4b9f-80ca-b9b9a72e8a8b'].url}} />
<label class="xlname">暹罗</label>
<image class="xlsure" a:if="{{curSelect==4}}" src={{resList['f956cda2-5eef-4942-8737-742d171527bd'].url}} />
</view>
<view class="selectcatorge" id="cat_2" onTap="changeSelectCat">
<image class="orgebg" src={{resList['02183198-f4da-4ac2-8bf3-d6b7a07d3279'].url}} />
<image class="orgeimg" src={{resList['e28e5250-c740-4e4f-a855-c415c557e77e'].url}} />
<label class="orgename">橘猫</label>
<image class="orgesure" a:if="{{curSelect==2}}" src={{resList['f956cda2-5eef-4942-8737-742d171527bd'].url}} />
</view>
<image class="selectcattrue btn" onTap="selectSure" src={{resList['628fc38b-7dc0-4c69-aac1-279d60c8f1ed'].url}} />
</view>
\ No newline at end of file
'use strict';
import resList from '../../resconfig/resList';
Component({
props: {
},
data: {
resList: resList,
curSelect: 1 //1:蓝猫,2:橘猫,3:三花,4:暹罗
},
methods: {
onModalClose() {
const {
onModalClose
} = this.props;
onModalClose && onModalClose();
console.log('onModalClose')
},
changeSelectCat(e) {
// console.log(e.currentTarget.id);
let type = parseInt(e.currentTarget.id.split("_")[1]);
this.setData({
curSelect: type
})
console.log(type);
},
selectSure() {
console.log(this.props);
this.onModalClose();
const {
onSelectCat
} = this.props;
console.log(onSelectCat)
onSelectCat && onSelectCat(this.data.curSelect);
}
},
didMount() {
console.log(this.data.curSelect)
this.setData({
curSelect: 2
})
},
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
.canvas {
width:100%;
height:100%;
}
.page-game {
/* position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
min-height: 100vh; */
width:100%;
height:100vh;
flex: 1;
display: flex;
flex-direction: column;
}
<view disable-scroll="true" class="page-game">
<canvas disable-scroll="true" id="canvas" class="canvas" onTouchStart="onMouseEvent" onTouchMove="onMouseEvent" onTouchEnd="onMouseEvent" onReady="onCanvasReady">
</canvas>
</view>
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="closeRuleModal"><text>{{rule}}</text></rule-modal>
<levelup-modal a:if="{{levelupModalVisible}}" mydata="{{levelupModalData}}" onModalClose="closeLevelupModal"></levelup-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="{{catnameModalVisible}}" ><catname-modal selectType="{{catType}}" onModalClose="closeCatnameModal" onSelectCatOk="selectCatOk" /></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="{{catbackbedModalVisible}}"><catbackbed-modal mydata="{{recallcatModalData}}" recallCatInfo="{{recallCatInfo}}" onUpdateUserInfo="updateUserInfo" onModalClose="closeCatbackModal"></catbackbed-modal></view>
<task-modal a:if="{{taskModalVisible}}" onModalClose="closeTaskModal"></task-modal>
<view class="popcontainer" a:if="{{catruleModalVisible}}"><catrule-modal rule="{{activityBaseInfo}}" onModalClose="closeCatruleModal"></catrule-modal></view>
'use strict';
import {
Main
} from './output';
import API from '../../api';
import mock from '../../mock';
const app = getApp();
const {
tbcc
} = app;
const {
commonToast,
getAuthUserInfo,
navigateToOutside,
getSystemInfo
} = tbcc.tb;
const SHARE_CONFIG = {
title: '一起养宠物吧~',
desc: '养宠物真好玩啊~',
imageUrl: "https://isv.alibabausercontent.com/00000000/imgextra/i2/2208492139886/O1CN012432Re2Mtq8QOqwUP_!!2208492139886-0-isvtu-00000000.jpg",
path: 'pages/pagecanvas/pagecanvas'
}
const checkSystem = async () => {
const {
version
} = await getSystemInfo();
console.log('version', version);
return tbcc.utils.versionCompare(version, '9.8.0');
}
Page({
data: {
catType: 1,
catName: '',
activityBaseInfo: null,
recallCatInfo: {},
taskModalVisible: 0,
messageModalVisible: false,
messageModalData: {},
ruleModalVisible: false,
levelupModalVisible: 0,
levelupModalData: null,
selectcatModalVisible: false,
catnameModalVisible: false,
recallcatModalVisible: false,
recallcatModalData: {},
getcatModalVisible: false,
getcatModalData: {},
catbackbedModalVisible: false,
catruleModalVisible: 0
},
async doHelp() {
if (!app.inviteId) return;
commonToast('正在发起助力~')
const {
success,
data,
message
} = await API.doHelp({
inviteId: app.inviteId
}).catch(res => {
commonToast(res && res.message);
}) || {};
if (success) {
commonToast('助力成功~');
}
},
onLoad(query) {
this.setData({});
if (query) app.inviteId = query.openId;
console.log('onload=>query', query);
// my.showToast({
// content: "query " + JSON.stringify(query),
// duration: 5000
// });
checkSystem().then(r => {
if (!r) {
my.showToast({
content: "请升级最新版本的淘宝",
duration: 5000
});
}
});
},
async onReady() {
console.log('on ready')
//授权和登录先搞
// await this.getAuth();
// this.initCanvas();
my.__onMessage__ = (e) => {
this.onMessage(e)
}
my.__getdata__ = (key) => {
my.__onMessage__({
data: {
netName: 'tmallCat.' + key
}
})
}
my.__showModal__ = (key, data) => {
this.onMessage({
data: {
netName: 'mine.showModal',
parameter: {
name: key + 'Modal',
data: data
}
}
});
}
my.__pageTo__ = (key, data) => {
this.onMessage({
data: {
netName: 'mine.navigateToPage',
parameter: {
name: key
}
}
});
}
my.__updateUserInfo__ = () => {
console.log("通知canvas刷新用户信息")
this.main && this.main.dispatchGlobalEvent("UPDATE_USERINFO")
}
my.__clickDelay__ = (obj) => {
obj.setData({
btnEnable:false
})
setTimeout(()=>{
if(obj){
obj.setData({
btnEnable:true
})
}
},2000)
}
// setTimeout(() => {
// my.__pageTo__('myprize')
// }, 100);
},
initCanvas() {
console.log('do init cavans');
this.spark_startEngine();
},
spark_startEngine() {
console.log('spark_startEngine', my)
var self = this;
my.createCanvas({
id: 'canvas',
success: ccc => {
console.log('createCanvas success');
const dpr = my.getSystemInfoSync().pixelRatio;
const windowWidth = my.getSystemInfoSync().windowWidth;
const windowHeight = my.getSystemInfoSync().windowHeight;
ccc.width = windowWidth * dpr + dpr; //重新修改会有误差
ccc.height = windowHeight * dpr + dpr;
if (!this.main) {
this.main = new Main(ccc); //添加事件,为了和main里的通信
app.canvasMain = this.main;
this.main.addGlobalEvent("onMessage", self.onMessage, self);
this.main.addGlobalEvent("toast", self.showToastHandler, self);
this.main.addGlobalEvent("loading", self.showLoadingHandler, self);
this.main.addGlobalEvent("hideloading", self.hideLoadingHandler, self);
}
},
fail: () => {
console.log('createCanvas fail');
}
});
},
onCanvasReady(query) {
console.log('onCanvasReady', query)
//授权和登录先搞
checkSystem().then(r => {
if (r) {
this.getAuth();
}
});
},
showToastHandler(e) {
console.log("接受到消息展示canvas的toast")
my.showToast({
content: e.data || "网络异常,请稍后重试~",
duration: 2000
});
},
showLoadingHandler() {
my.showLoading();
},
hideLoadingHandler() {
my.hideLoading();
},
postMessage(netName, data) {
this.main && this.main.dispatchGlobalEvent({
type: netName
}, data); //以防复用事件event串了,就用这种方式
},
//和main通信的方法,接收main的信息
onMessage(e) {
//接口名字
let netName = e.data.netName; //接口参数
let parameter = e.data.parameter || {};
//定制的授权
if (netName.indexOf("mine") == 0) {
var data = {
success: true
};
switch (netName) {
case "mine.getAppData":
//获取信息
data = {
success: true,
data: {
activityId: app.activityId,
nickName: app.nickName,
avatar: app.avatar,
openId: app.openId,
inviteId: app.inviteId
}
};
break;
case "mine.navigateToPage": //切换page
data = {
success: true,
data: {}
};
my.navigateTo({
url: `/pages/${parameter.name}/${parameter.name}`
});
break;
case "mine.showModal": //切换page
data = {
success: true,
data: {}
};
const key = `${parameter.name}Visible`;
const datakey = `${parameter.name}Data`;
const toSetData = {};
toSetData[key] = true;
toSetData[datakey] = parameter.data;
this.setData(toSetData);
break;
case 'test':
console.log('测试一下', parameter.hint);
break;
}
this.postMessage(netName, data);
} else {
const {
function: fc
} = app.cloud;
const [myCloudName, handler] = netName.split("."); //待写,
if (app.requestType == 'yapi') {
console.log('mock[handler]', mock[handler])
this.postMessage(netName, mock[handler]);
return;
}
parameter.activityId = app.activityId;
fc.invoke(myCloudName, parameter, handler).then(res => {
this.postMessage(netName, res);
console.log('request Cloud callback=>', handler, res, JSON.stringify(res));
});
}
},
//鼠标事件
onMouseEvent(e) {
if (this.main) this.main.stage.onMouseEvent(e);
},
onShow() {
// 页面显示
if (this.main) {
this.main.run();
this.main.dispatchGlobalEvent("onShow");
this.showPageLogin();
}
},
onHide() {
// 页面隐藏
if (this.main) {
this.main.pause();
this.main.dispatchGlobalEvent("onHide");
}
},
/**
* 获取用户授权信息
*/
async getAuth() {
const userInfo = await getAuthUserInfo().catch(err => {
console.log('未授权成功', err);
});
if (userInfo) {
console.log('授权成功 userInfo', userInfo);
const {
nickName,
avatar
} = userInfo;
app.nickName = nickName;
app.avatar = avatar;
this.login();
}
},
/**
* 登录接口
*/
async login() {
const {
nickName,
avatar
} = app;
const {
success,
data,
} = await API.login({
userNick: nickName,
avatar
}).catch(res => {
commonToast(res && res.message);
}) || {};
if (success) {
app.openId = data.openId;
this.getActivityBaseInfoById();
}
},
/**
* 获取活动信息
*/
async getActivityBaseInfoById() {
my.showLoading();
const {
success,
data
} = await API.getActivityBaseInfoById().catch(r => {
my.hideLoading();
commonToast(r && r.message)
}) || {};
if (success) {
my.hideLoading();
this.setData({
activityBaseInfo: data
})
this.initCanvas();
}
},
/**页面显示登录 */
async showPageLogin() {
const {
nickName,
avatar
} = app;
const {
success,
data,
} = await API.login({
userNick: nickName,
avatar
}).catch(res => {
commonToast(res && res.message);
}) || {};
if (success) {
app.openId = data.openId;
my.__updateUserInfo__();
}
},
/**刷新用户信息 */
updateUserInfo() {
console.log("通知canvas刷新用户信息")
this.main && this.main.dispatchGlobalEvent("UPDATE_USERINFO")
},
/**选择猫咪,打开取名弹窗 */
selectCat(type) {
// this.catType = type;
this.setData({
catType: type,
catnameModalVisible: true
})
console.log("选择了", type)
},
/**选择好猫咪后打开getCat弹窗 */
selectCatOk(name) {
this.setData({
catName: name,
getcatModalVisible: true
})
},
/**领养完猫咪之后传输消息给主页 */
postSelectCat(r) {
this.main.dispatchGlobalEvent("selectEnd", r);
},
/**召回猫 */
recallCat(r) {
this.main.dispatchGlobalEvent("RECALL_CAT");
this.setData({
recallCatInfo: r,
catbackbedModalVisible: true
})
},
closeLevelupModal() {
this.setData({
levelupModalVisible: false
});
},
closeRuleModal() {
this.setData({
ruleModalVisible: false
});
},
closeMessageModal() {
this.setData({
messageModalVisible: false
});
},
closeCatnameModal() {
this.setData({
catnameModalVisible: false
})
},
closeSelectcatModal() {
this.setData({
selectcatModalVisible: false
})
},
closeRecallcatModal() {
this.setData({
recallcatModalVisible: false
})
},
closeTaskModal() {
console.log('onModalClose')
this.setData({
taskModalVisible: false
})
},
closeGetcatModal() {
this.setData({
getcatModalVisible: false
})
},
closeCatbackModal() {
this.setData({
catbackbedModalVisible: false
})
},
closeCatruleModal() {
this.setData({
catruleModalVisible: false
})
},
onShareAppMessage() {
// 返回自定义分享信息
let {
path,
...rest
} = SHARE_CONFIG;
console.log('app.openId', app.openId);
if (app.openId) {
path = '/pages/pagecanvas/pagecanvas' + '?openId=' + app.openId;
}
console.log('path', path)
return {
...rest,
path
}
}
});
{
"usingComponents": {
"task-modal": "/components/comtask/comtask",
"rule-modal": "/components/ruleModal/ruleModal",
"levelup-modal": "/components/comlevelup/comlevelup",
"message-modal": "/components/commessage/commessage",
"selectcat-modal":"/components/comselectcat/comselectcat",
"catname-modal":"/components/comcatname/comcatname",
"recallcat-modal":"/components/comrecallcat/comrecallcat",
"getcat-modal":"/components/comgetcat/comgetcat",
"catbackbed-modal":"/components/comcatbackbed/comcatbackbed",
"catrule-modal":"/components/comcatrule/comcatrule"
}
}
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