Commit b3350494 authored by zhangjinzhou's avatar zhangjinzhou

适配引导代码暂存

parent e3d0a9dd
No preview for this file type
......@@ -4,6 +4,6 @@ module.exports = {
TEMP_DIR: "./.temp",
ENTRY: "src/app.jsx",
TEMPLATE: "./public/index.html",
MOCK_STATUS: true,
MOCK_STATUS: false,
PX2REM: true
};
......@@ -2,7 +2,7 @@
import { Toast } from '@spark/ui';
import React, { Component } from 'react';
import dataCenter, { getAPIdata, netErrMsg, Role, Store } from '../../dataCenter';
import dataCenter, { getAPIdata, getHomeInfo, netErrMsg, Role, Store } from '../../dataCenter';
import resList from '../../resconfig/resList'; //import API from '../../api';
import './select.less';
......@@ -130,7 +130,14 @@ class Select extends Component {
nickName:planame,
figureId:Role[this.nshowidx].figureid
});
updateuinfo = {
"code": null,
"data": true,
"message": null,
"success": true
}
if(updateuinfo&&updateuinfo.success){
getHomeInfo();
this.props.onClose();
dataCenter.setData(Store.needguide,true);
}else{
......
......@@ -43,7 +43,19 @@ export async function getAPIdata(netname,reqdata=null){
}
export async function getHomeInfo(){
let homeinfo = await getAPIdata(Store.homeinfo);
homeinfo = {
"code": null,
"data": {
"canUpdateNickName": null,
"figures": [
{ "figureId": "1" }, { "figureId": "2" }, { "figureId": "3" }
],
"newUser": true,
"userInfo": null
},
"message": null,
"success": true
}
if(homeinfo&&homeinfo.success&&homeinfo.data){
dataCenter.setData(Store.homeinfo,homeinfo.data);
}
......
......@@ -115,6 +115,9 @@ var GameStage = /** @class */ (function (_super) {
this.guideconfig = this.props['guideconfig'];
this.skipbtn.addEventListener(MouseEvent.CLICK, this.skipGuide, this);
this.touchrect.addEventListener(MouseEvent.CLICK, this.toNextLevel, this);
this.getAnirole();
this.getShou();
this.getFinarole();
this.dispatchOutEvent("canvasready", null);
};
/**
......
......@@ -7,7 +7,7 @@ import { Aup, AUPOP, AUP_MBX_STATE } from '../../pop';
import './main3.less';
import { CanvasWidget } from 'spark-utils';
import { Guideact } from './bundle';//'@spark/guideact';//
import { widgetConfig } from './widgetConfig';
import { getStepData, widgetConfig } from './widgetConfig';
import { GDispatcher } from "spark-wrapper-fyge"
import dataCenter, { Store } from '../../dataCenter';
let _widget;
......@@ -52,6 +52,7 @@ class Main3 extends Component {
}
componentDidMount() {
this.freshHomeInfo();
this.initEvent();
if (!this.props.data.isnewUser) {
API.signInfo().then((res) => {
......@@ -71,6 +72,7 @@ class Main3 extends Component {
//首页信息显示更新
freshHomeInfo() {
let homeinfo = dataCenter.getData(Store.homeinfo);
console.error("freshHome");
}
changeGuideShow() {
let needguide = dataCenter.getData(Store.needguide);
......@@ -87,327 +89,8 @@ class Main3 extends Component {
}
//新手引导的位置设定
setGuideConfig() {
let clientWidth = document.body.clientWidth;
let clientHeight = document.body.clientHeight;
let canvaswid = 750;
let canvashei = clientHeight * 750 / clientWidth;
console.log("CANVAS宽高===》", canvaswid, canvashei);
let holedata = {
holetype: "cirect",
holex: 15,
holey: 33,
holesize: [
395,
112,
70
]
}
let txtdata = {
text: "您可以在此处编辑信息查看欢趣豆数量",
txtwidth: 750,
txtx: 0,
txty: 224,
txtalign: "center"
}
let roledata = [
{
rolex: 375,
roley: 911,
roletex: "guide2_1"
}
];
let nextbtndata = {
btnx: 485,
btny: 303,
btntex: "nextbtn"
}
let skipbtndata = {
skipx: (canvaswid - 107) / 2,
skipy: canvashei - 200,
skiplevel: 9,
skiptex: "skipbtn",
};
let touchdata = {
touchx: 0,
touchy: 0,
touchsize: [
canvaswid,
canvashei
]
}
this.guideconfig[1] = {
hole: null,
txt: null,
role: [
{
"rolex": 360,
"roley": 875,
"roletex": "guide1"
}
],
nextbtn: null,
skipbtn: skipbtndata,
touch: touchdata,
pagey: 0,
}
_widget && _widget.dispatchInEvent("setStepData", {
step: 1,
stepdata: this.guideconfig[1]
});
this.guideconfig[2] = {
hole: {
holetype: "cirect",
holex: 15,
holey: 33,
holesize: [
395,
112,
70
]
},
txt: {
text: "您可以在此处编辑信息查看欢趣豆数量",
txtwidth: 750,
txtx: 0,
txty: 224,
txtalign: "center"
},
role: [
{
rolex: 375,
roley: canvashei - 550,
roletex: "guide2_1"
}
],
nextbtn: {
btnx: 485,
btny: 303,
btntex: "nextbtn"
},
skipbtn: skipbtndata,
touch: touchdata,
pagey: 0,
}
_widget && _widget.dispatchInEvent("setStepData", {
step: 2,
stepdata: this.guideconfig[2]
});
this.guideconfig[3] = {
hole: {
holetype: "cirect",
holex: 600,
holey: 26,
holesize: [
135,
440,
40
]
},
txt: {
text: "点击图标您可查看规则、进行分享和签到\n \n偷偷告诉您,连签7天可获得大额欢趣豆哦~",
txtwidth: 455,
txtx: 100,
txty: 245,
txtalign: "left"
},
role: [
{
rolex: 375,
roley: canvashei - 550,
roletex: "guide2_1"
}
],
nextbtn: {
btnx: 100,
btny: 520,
btntex: "nextbtn"
},
skipbtn: skipbtndata,
touch: touchdata,
pagey: 0,
}
_widget && _widget.dispatchInEvent("setStepData", {
step: 3,
stepdata: this.guideconfig[3]
});
this.guideconfig[4] = {
hole: {
holetype: "cir",
holex: 185,
holey: 465,
holesize: [
165,
440
]
},
txt: {
text: "欢趣豆可以兑换立减金,\n进入趣赶集即可进行\n兑换哦~",
txtwidth: 375,
txtx: 375,
txty: 357,
txtalign: "left"
},
role: [
{
rolex: 375,
roley: canvashei - 550,
roletex: "guide2_1"
}
],
nextbtn: {
btnx: 375,
btny: 536,
btntex: "nextbtn"
},
skipbtn: skipbtndata,
touch: touchdata,
pagey: 0,
}
_widget && _widget.dispatchInEvent("setStepData", {
step: 4,
stepdata: this.guideconfig[4]
});
this.guideconfig[5] = {
hole: {
holetype: "cir",
holex: 540,
holey: 600,
holesize: [
165,
440
]
},
txt: {
text: "农场主集结~在这里\n就是向往的生活!\n收获成果的同时还可\n以兑换丰厚礼物哦",
txtwidth: 320,
txtx: 55,
txty: 580,
txtalign: "left"
},
role: [
{
rolex: 375,
roley: canvashei - 550,
roletex: "guide2_1"
}
],
nextbtn: {
btnx: 55,
btny: 780,
btntex: "nextbtn"
},
skipbtn: skipbtndata,
touch: touchdata,
pagey: 0,
}
_widget && _widget.dispatchInEvent("setStepData", {
step: 5,
stepdata: this.guideconfig[5]
});
this.guideconfig[6] = {
hole: {
holetype: "cir",
holex: 170,
holey: 820,
holesize: [
165,
440
]
},
txt: {
text: "点击任务大厅,进入\n任务界面,完成任务\n可获得好礼哦~",
txtwidth: 375,
txtx: 375,
txty: 500,
txtalign: "left"
},
role: [
{
rolex: 375,
roley: canvashei - 550,
roletex: "guide2_1"
}
],
nextbtn: {
btnx: 375,
btny: 665,
btntex: "nextbtn"
},
skipbtn: skipbtndata,
touch: touchdata,
pagey: 0,
}
_widget && _widget.dispatchInEvent("setStepData", {
step: 6,
stepdata: this.guideconfig[6]
});
let offsety7 = 0;
let holly = 1110;
if ((holly + 165 / 2) > canvashei - 300) {
let holly1 = canvashei - 300 - 165 / 2;
offsety7 = holly - holly1;
}
this.guideconfig[7] = {
hole: {
holetype: "cir",
holex: 575,
holey: 1110 - offsety7,
holesize: [
165,
440
]
},
txt: {
text: "点击小卖铺可以进到\n商城页面,在这里购\n买心仪的物品哦~",
txtwidth: 320,
txtx: 85,
txty: 500 - offsety7,
txtalign: "left"
},
role: [
{
rolex: 0,
roley: canvashei - 550,
roletex: "guide2_1"
}
],
nextbtn: {
btnx: 86,
btny: 665 - offsety7,
btntex: "nextbtn"
},
skipbtn: {
skipx: (canvaswid - 107) / 2,
skipy: canvashei - 200,
skiplevel: 6,
skiptex: "skipbtn",
},
touch: touchdata,
pagey: offsety7,
}
console.log("77777偏移===》", offsety7);
_widget && _widget.dispatchInEvent("setStepData", {
step: 7,
stepdata: this.guideconfig[7]
});
this.guideconfig = getStepData();
_widget && _widget.dispatchInEvent("setStepConfig", this.guideconfig);
this.startGuide();
}
startGuide() {
......@@ -432,9 +115,10 @@ class Main3 extends Component {
case "nowstep":
//当前所处引导步骤
let nowstepdata = this.guideconfig[payload];
let nowpagey = nowstepdata.pagey;
this.refs.main3.scrollTop = nowpagey;
console.log("滑动位置调整===》", nowpagey);
if (nowstepdata) {
let nowpagey = nowstepdata.pagey;
this.refs.main3.scrollTop = nowpagey * window.remScale;
}
break;
default:
......
let clientWidth = document.body.clientWidth;
let clientHeight = document.body.clientHeight;
let canvaswid = 750;
let canvashei = clientHeight * 750 / clientWidth;
let holedata = {
holetype: "cirect",
holex: 15,
holey: 33,
holesize: [
395,
112,
70
]
}
let txtdata = {
text: "您可以在此处编辑信息查看欢趣豆数量",
txtwidth: 750,
txtx: 0,
txty: 224,
txtalign: "center"
}
let roledata = [
{
rolex: 375,
roley: canvashei - 550,
}
]
let nextbtndata = {
btnx: 485,
btny: 303,
btntex: "nextbtn"
}
let skipbtndata = {
skipx: (canvaswid - 107) / 2,
skipy: canvashei - 200,
skiplevel: 7,
skiptex: "skipbtn",
};
let touchdata = {
touchx: 0,
touchy: 0,
touchsize: [
canvaswid,
canvashei
]
}
function getstep1() {
return {
hole: null,
txt: null,
role: roledata,
nextbtn: null,
skipbtn: skipbtndata,
touch: touchdata,
pagey: 0,
}
}
function getstep2(){
return {
hole: {
holetype: "cirect",
holex: 15,
holey: 33,
holesize: [
395,
112,
70
]
},
txt: {
text: "您可以在此处编辑信息查看欢趣豆数量",
txtwidth: 750,
txtx: 0,
txty: 224,
txtalign: "center"
},
role: roledata,
nextbtn: {
btnx: 485,
btny: 303,
btntex: "nextbtn"
},
skipbtn: skipbtndata,
touch: touchdata,
pagey: 0,
}
}
function getstep3(){
return {
hole: {
holetype: "cirect",
holex: 600,
holey: 26,
holesize: [
135,
440,
40
]
},
txt: {
text: "点击图标您可查看规则、进行分享和签到\n \n偷偷告诉您,连签7天可获得大额欢趣豆哦~",
txtwidth: 455,
txtx: 100,
txty: 245,
txtalign: "left"
},
role: roledata,
nextbtn: {
btnx: 100,
btny: 520,
btntex: "nextbtn"
},
skipbtn: skipbtndata,
touch: touchdata,
pagey: 0,
}
}
function getstep4(){
return {
hole: {
holetype: "cir",
holex: 185,
holey: 465,
holesize: [
165,
440
]
},
txt: {
text: "欢趣豆可以兑换立减金,\n进入趣赶集即可进行\n兑换哦~",
txtwidth: 375,
txtx: 375,
txty: 357,
txtalign: "left"
},
role: roledata,
nextbtn: {
btnx: 375,
btny: 536,
btntex: "nextbtn"
},
skipbtn: skipbtndata,
touch: touchdata,
pagey: 0,
}
}
function getstep5(){
return {
hole: {
holetype: "cir",
holex: 540,
holey: 600,
holesize: [
165,
440
]
},
txt: {
text: "农场主集结~在这里\n就是向往的生活!\n收获成果的同时还可\n以兑换丰厚礼物哦",
txtwidth: 320,
txtx: 55,
txty: 580,
txtalign: "left"
},
role: roledata,
nextbtn: {
btnx: 55,
btny: 780,
btntex: "nextbtn"
},
skipbtn: skipbtndata,
touch: touchdata,
pagey: 0,
}
}
function getstep6(){
return {
hole: {
holetype: "cir",
holex: 170,
holey: 820,
holesize: [
165,
440
]
},
txt: {
text: "点击任务大厅,进入\n任务界面,完成任务\n可获得好礼哦~",
txtwidth: 375,
txtx: 375,
txty: 500,
txtalign: "left"
},
role: roledata,
nextbtn: {
btnx: 375,
btny: 665,
btntex: "nextbtn"
},
skipbtn: skipbtndata,
touch: touchdata,
pagey: 0,
}
}
function getstep7(){
let offsety = 0;
let holly = 1110;
if ((holly + 165 / 2) > canvashei - 300) {
let holly1 = canvashei - 300 - 165 / 2;
offsety = holly - holly1;
}
if(canvashei+offsety>1624){
offsety = 1624-canvashei;
}
return {
hole: {
holetype: "cir",
holex: 575,
holey: 1110 - offsety,
holesize: [
165,
440
]
},
txt: {
text: "点击小卖铺可以进到\n商城页面,在这里购\n买心仪的物品哦~",
txtwidth: 320,
txtx: 85,
txty: 750 - offsety,
txtalign: "left"
},
role: [
{
rolex: 0,
roley: canvashei - 550,
roletex: "guide2_1"
}
],
nextbtn: {
btnx: 86,
btny: 910 - offsety,
btntex: "nextbtn"
},
skipbtn: {
skipx: (canvaswid - 107) / 2,
skipy: canvashei - 200,
skiplevel: 6,
skiptex: "skipbtn",
},
touch: touchdata,
pagey: offsety,
}
}
function getstep8(){
let offsety = 0;
let holly = 1325;
if ((holly + 165 / 2) > canvashei - 300) {
let holly1 = canvashei - 300 - 165 / 2;
offsety = holly - holly1;
}
if(canvashei+offsety>1624){
offsety = 1624-canvashei;
}
return {
hole: {
holetype: "cir",
holex: 180,
holey: 1325 - offsety,
holesize: [
165,
440
]
},
txt: {
text: "这就是你的小家啦~\n进入我的e家可以查看在小\n镇获得的各项荣誉勋章",
txtwidth: 375,
txtx: 375,
txty: 1100 - offsety,
txtalign: "left"
},
role: [
{
rolex: 220,
roley: (canvashei - 400) / 2 - 100,
roletex: "guide2_1"
}
],
nextbtn: {
btnx: 375,
btny: 1280 - offsety,
btntex: "nextbtn"
},
skipbtn: {
skipx: (canvaswid - 107) / 2,
skipy: canvashei - 200,
skiplevel: 6,
skiptex: "skipbtn",
},
touch: touchdata,
pagey: offsety,
}
}
function getstep9(){
return {
hole: null,
txt: {
text: "小镇将会越来越热闹\n小e也会在这儿一直陪伴你哦,\n那么赶紧去逛逛吧~",
txtwidth: 750,
txtx: 0,
txty: canvashei - 400,
txtalign: "center"
},
role: [
{
rolex: 0,
roley: (canvashei-1624)/2-100,
roletex: "guide2_1"
}
],
nextbtn: {
btnx: 250,
btny: canvashei - 250,
btntex: "finaguidebtn"
},
skipbtn: null,
touch: touchdata,
pagey: 0,
}
}
export function getStepData() {
let stepdata1 = getstep1();
let stepdata2 = getstep2();
let stepdata3 = getstep3();
let stepdata4 = getstep4();
let stepdata5 = getstep5();
let stepdata6 = getstep6();
let stepdata7 = getstep7();
let stepdata8 = getstep8();
let stepdata9 = getstep9();
return {
1:stepdata1,
2:stepdata2,
3:stepdata3,
4:stepdata4,
5:stepdata5,
6:stepdata6,
7:stepdata7,
8:stepdata8,
9:stepdata9,
}
}
export let widgetConfig = {
props:{
props: {
},
assets:[
assets: [
]
}
\ No newline at end of file
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