Commit e949ac0e authored by zhangjinzhou's avatar zhangjinzhou

代码暂存

parent 5efcd2f4
......@@ -4,16 +4,16 @@ export const homeInfo = {
"canUpdateNickName": false,
"figures": [
{
"figureId": "1"
"figureId": "4"
},
{
"figureId": "2"
"figureId": "5"
},
{
"figureId": "3"
"figureId": "7"
}
],
"newUser": false,
"newUser": true,
"userInfo": {
"figureId": "1",
"joyBeans": 10000,
......
'use strict';
import { Toast } from '@spark/ui';
import React, { Component } from 'react';
import dataCenter, { getAPIdata, Store } from '../../dataCenter';
import dataCenter, { getAPIdata, netErrMsg, Role, Store } from '../../dataCenter';
import resList from '../../resconfig/resList'; //import API from '../../api';
import './select.less';
......@@ -18,6 +19,15 @@ class Select extends Component {
}
componentDidMount() {
const {figures} = dataCenter.getData(Store.homeinfo);
//现只有三个
for(let i=1;i<4;i++){
let ifigure = figures[i-1];
if(ifigure){
Role[i].figureid = ifigure.figureId;
}
}
console.log("figureid设置==》",Role);
// setTimeout(() => {
// console.log('关闭这个弹窗');
// this.props.onClose();
......@@ -113,12 +123,23 @@ class Select extends Component {
let planame = this.refs.planame.value;
console.log(planame);
if(planame.length<1){
return;
return Toast("名字不能为空");
}
let updateuinfo = await getAPIdata(Store.updateUinfo);
let updateuinfo = await getAPIdata(Store.updateUinfo,{
type:1,
nickName:planame,
figureId:Role[this.nshowidx].figureid
});
if(updateuinfo&&updateuinfo.success){
this.props.onClose();
dataCenter.setData(Store.needguide,true);
}else{
if(updateuinfo){
let msg = updateuinfo.message;
Toast(msg);
}else{
Toast(netErrMsg)
}
}
}
render() {
......
......@@ -12,7 +12,22 @@ export const Store = {
//新手引导
needguide:"needguide",
}
//人物角色对应
export let Role = {
1:{
name:"熊猫1",
figureid:1,
},
2:{
name:"熊猫2",
figureid:2,
},
3:{
name:"熊猫3",
figureid:3,
}
}
export const netErrMsg = "活动太火爆了,请稍后再试";
export async function getAPIdata(netname,reqdata=null){
let apidata;
try{
......
......@@ -9,7 +9,6 @@ import API from '../../api';
import './loading.less';
import { Aup } from '../../pop';
import dataCenter, { getAPIdata, getHomeInfo, Store } from '../../dataCenter';
import { homeInfo } from '../../../mock/e-family';
class Loading extends Component {
constructor(props) {
......
......@@ -34,11 +34,24 @@ var GameStage = /** @class */ (function (_super) {
__extends(GameStage, _super);
function GameStage() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.step = 1;
_this._step = 1;
_this.canclick = true;
_this.guideconfig = {};
return _this;
}
Object.defineProperty(GameStage.prototype, "step", {
get: function () {
return this._step;
},
set: function (val) {
if (this._step != val) {
this._step = val;
this.dispatchOutEvent("nowstep", val);
}
},
enumerable: false,
configurable: true
});
GameStage.prototype.onLaunched = function () {
this.stagew = this.stage.viewRect.width;
this.stageh = this.stage.viewRect.height;
......
......@@ -6,7 +6,7 @@ import resList from '../../resconfig/resList'; //import API from '../../api';
import { Aup, AUPOP, AUP_MBX_STATE } from '../../pop';
import './main3.less';
import { CanvasWidget } from 'spark-utils';
import { Guideact } from './bundle';//'@spark/guideact';//
import { Guideact } from '@spark/guideact';//'./bundle';//
import { widgetConfig } from './widgetConfig';
import { GDispatcher } from "spark-wrapper-fyge"
import dataCenter, { Store } from '../../dataCenter';
......@@ -290,6 +290,96 @@ class Main3 extends Component {
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.startGuide();
}
startGuide() {
......@@ -306,8 +396,17 @@ class Main3 extends Component {
dataCenter.setData(Store.needguide, false);
break;
case "nowstep":
//当前所处引导步骤
let nowstepdata = this.guideconfig[payload];
let nowpagey = nowstepdata.pagey;
this.refs.main3.scrollTop = nowpagey;
console.log("滑动位置调整===》",nowpagey);
break;
default:
break;
}
}
onAssetsProcess(loaded, total) {
......@@ -321,7 +420,7 @@ class Main3 extends Component {
render() {
const { avatar, nickname, num, needguide } = this.state;
return (
<div className="main3 diacontmidpos" uuid="8754a9d1-7453-474b-b722-7cb71483ae85">
<div className="main3 diacontmidpos" uuid="8754a9d1-7453-474b-b722-7cb71483ae85" ref="main3" >
<img
className="main3_bg "
uuid="25a6c3f8-3f78-4758-b2ab-5bcbfaa0d8bc"
......@@ -432,7 +531,7 @@ class Main3 extends Component {
src={this.state.resList['56b64b91-4e9a-49bd-bfd0-20d10b6e6556'].url}
/>
{needguide ? <CanvasWidget className="canvas-widget" widgetFactory={Guideact} widgetConfig={widgetConfig}
{needguide ? <CanvasWidget className="diacontmidpos" widgetFactory={Guideact} widgetConfig={widgetConfig}
onEvent={this.onEvent.bind(this)}
onReady={this.onReady.bind(this)} onAssetsProcess={this.onAssetsProcess.bind(this)}
onAssetsComplete={this.onAssetsComplete.bind(this)} /> : ""}
......
......@@ -158,8 +158,8 @@
}
.canvas-widget{
width: 750px;
height: 1624px;
position: absolute;
// width: 750px;
// height: 1624px;
// position: absolute;
}
}
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