Commit 5a1a528f authored by wildfirecode13's avatar wildfirecode13

1

parent 8e825082
...@@ -29,7 +29,7 @@ class Sign extends Component { ...@@ -29,7 +29,7 @@ class Sign extends Component {
API.dosign().then((res) => { API.dosign().then((res) => {
const continuousDays = this.state.continuousDays + 1; const continuousDays = this.state.continuousDays + 1;
this.setState({ todaySigned: true, continuousDays: continuousDays }); this.setState({ todaySigned: true, continuousDays: continuousDays });
this.props.ctx.updateMoney(); this.props.ctx.freshHomeInfo();
if (res.data.type !== 'joyBean') if (res.data.type !== 'joyBean')
Aup.show('PrizeRule', res.data, this); Aup.show('PrizeRule', res.data, this);
}); });
......
...@@ -4,49 +4,59 @@ import React, { Component } from 'react'; ...@@ -4,49 +4,59 @@ import React, { Component } from 'react';
import { Aup } from '../../pop'; import { Aup } from '../../pop';
import resList from '../../resconfig/resList'; import resList from '../../resconfig/resList';
import './userinfo.less'; import './userinfo.less';
import dataCenter, { getAPIdata, getHomeInfo, netErrMsg, Role, Store } from '../../dataCenter';
import { Toast, Loading, Badge, CountDownButton, InputNumber } from '@spark/ui'; import { Toast, Loading, Badge, CountDownButton, InputNumber } from '@spark/ui';
import API from '../../api';
class Userinfo extends Component { class Userinfo extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
resList: resList, resList: resList,
figureId:props.data.figureId figureId: props.data.figureId
}; };
} }
onclick=()=>{ onclick = async () => {
let planame = this.refs.planame.value; let planame = this.refs.planame.value;
if(planame.length<1){ if (planame.length < 1) {
return Toast("名字不能为空"); return Toast("名字不能为空");
} }
let updateuinfo = await getAPIdata(Store.updateUinfo,{ API.updateUinfo({type: 2, nickName: planame}).then(res=>{
type:2, this.props.ctx.freshHomeInfo();
nickName:planame // console.log('res',res);
}).catch(e=>{
console.log('err',e);
}); });
if(updateuinfo&&updateuinfo.success){
// if(updateuinfo.data){ // let updateuinfo = await getAPIdata(Store.updateUinfo, {
// const {result,joyBeans} = updateuinfo.data; // type: 2,
// if(result){ // nickName: planame
// dataCenter.setData(Store.newgoldnum,joyBeans); // });
// } // if (updateuinfo && updateuinfo.success) {
// } // // if(updateuinfo.data){
// getHomeInfo(); // // const {result,joyBeans} = updateuinfo.data;
// this.props.onClose(); // // if(result){
// dataCenter.setData(Store.needguide,true); // // dataCenter.setData(Store.newgoldnum,joyBeans);
}else{ // // }
// if(updateuinfo){ // // }
// let msg = updateuinfo.message; // // getHomeInfo();
// Toast(msg); // // this.props.onClose();
// }else{ // // dataCenter.setData(Store.needguide,true);
// Toast(netErrMsg) // } else {
// // if(updateuinfo){
// // let msg = updateuinfo.message;
// // Toast(msg);
// // }else{
// // Toast(netErrMsg)
// // }
// } // }
}
} }
render() { render() {
const {figureId}=this.state; const { figureId } = this.state;
return ( return (
<div className="userinfo " uuid="a9143822-c421-48d3-92c3-de9eafe5c234"> <div className="userinfo " uuid="a9143822-c421-48d3-92c3-de9eafe5c234">
<input className="planame" type="text" placeholder="请输入昵称(不超过六字)" ref="planame" /> <input className="planame" type="text" placeholder="请输入昵称(不超过六字)" ref="planame" />
...@@ -61,9 +71,9 @@ class Userinfo extends Component { ...@@ -61,9 +71,9 @@ class Userinfo extends Component {
src={this.state.resList['5406c697-b889-4062-8910-343038c4dc93'].url} src={this.state.resList['5406c697-b889-4062-8910-343038c4dc93'].url}
/> />
{figureId==1&&<img className="userinfo_avatar " src="//yun.duiba.com.cn/spark/assets/393b5936219fa987a141cfcce17d2ffe13cc924e.png" />} {figureId == 1 && <img className="userinfo_avatar " src="//yun.duiba.com.cn/spark/assets/393b5936219fa987a141cfcce17d2ffe13cc924e.png" />}
{figureId==2&&<img className="userinfo_avatar " src="//yun.duiba.com.cn/spark/assets/042c2b238932872aa066fd989f2169715789a3c3.png" />} {figureId == 2 && <img className="userinfo_avatar " src="//yun.duiba.com.cn/spark/assets/042c2b238932872aa066fd989f2169715789a3c3.png" />}
{figureId==3&&<img className="userinfo_avatar " src="//yun.duiba.com.cn/spark/assets/5a672d98433d289091b879a2d546970c281cb9d2.png" />} {figureId == 3 && <img className="userinfo_avatar " src="//yun.duiba.com.cn/spark/assets/5a672d98433d289091b879a2d546970c281cb9d2.png" />}
<img <img
onClick={this.props.onClose} onClick={this.props.onClose}
className="userinfo_close " className="userinfo_close "
......
...@@ -38,7 +38,7 @@ export async function getAPIdata(netname,reqdata=null){ ...@@ -38,7 +38,7 @@ export async function getAPIdata(netname,reqdata=null){
apidata = await API[netname](); apidata = await API[netname]();
} }
}catch(e){ }catch(e){
console.log(e)
} }
return apidata; return apidata;
} }
......
...@@ -24,7 +24,7 @@ class Main3 extends Component { ...@@ -24,7 +24,7 @@ class Main3 extends Component {
}; };
} }
updateMoney() { freshHomeInfo() {
this.freshHomeInfo(); this.freshHomeInfo();
} }
......
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