Commit 5a1a528f authored by wildfirecode13's avatar wildfirecode13

1

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