Commit 79b1c046 authored by zhangjinzhou's avatar zhangjinzhou

新增mock

parent 213de510
export const homeInfo = {
"code": null,
"data": {
"result": true,
"type": "joyBean",
"awardName": "100欢趣豆"
},
"message": null,
"success": true
}
export const updateUinfo = {
"code": null,
"data": true,
"message": null,
"success": true
}
export const doshare = {
"code": null,
"data": true,
"message": null,
"success": true
}
export const signInfo = {
"code": null,
"data": {
"continuousDays": 0,
"needPopup": true,
"signLists": [
{
"awardName": "欢趣豆",
"awardValue": 100,
"day": 1,
"ruleId": "",
"type": "joyBean"
},
{
"awardName": "欢趣豆",
"awardValue": 100,
"day": 2,
"ruleId": "",
"type": "joyBean"
},
{
"awardName": "欢趣豆",
"awardValue": 200,
"day": 3,
"ruleId": "",
"type": "joyBean"
},
{
"awardName": "欢趣豆",
"awardValue": 100,
"day": 4,
"ruleId": "",
"type": "joyBean"
},
{
"awardName": "欢趣豆",
"awardValue": 100,
"day": 5,
"ruleId": "",
"type": "joyBean"
},
{
"awardName": "欢趣豆",
"awardValue": 100,
"day": 6,
"ruleId": "",
"type": "joyBean"
},
{
"awardName": "大牌券",
"awardValue": null,
"day": 7,
"ruleId": "ru_1",
"type": "daPaiCoupons"
}
],
"todaySigned": false
},
"message": null,
"success": true
}
export const dosign = {
"code": null,
"data": {
"result": true,
"type": "joyBean",
"awardName": "100欢趣豆"
},
"message": null,
"success": true
}
\ No newline at end of file
import * as common from './common';
import * as collect_0722 from './collect_0722';
import * as efamily from './e-family';
let projectId = window.CFG.projectId || '';
export default {
get: {
[`/projectx/${projectId}/projectRule.query`]: common.rule
[`/projectx/${projectId}/projectRule.query`]: common.rule,
[`/projectx/${projectId}/e-family/index.do`]: efamily.homeInfo,
[`/projectx/${projectId}/e-family/update.do`]: efamily.updateUinfo,
[`/projectx/${projectId}/e-family/share.do`]: efamily.doshare,
[`/projectx/${projectId}/e-family/signInfo.do`]: efamily.signInfo,
[`/projectx/${projectId}/e-family/sign.do`]: efamily.dosign,
},
post: {
[`/projectx/${projectId}/join.do`]: collect_0722.join
......
......@@ -5,6 +5,11 @@ const apiCfg = {
uri: `join.do`,
method: "post"
},
homeInfo: `/projectx/${projectId}/e-family/index.do`,
updateUinfo: `/projectx/${projectId}/e-family/update.do`,
doshare: `/projectx/${projectId}/e-family/share.do`,
signInfo:`/projectx/${projectId}/e-family/signInfo.do`,
dosign:`/projectx/${projectId}/e-family/sign.do`,
}
export default apiCfg;
const Datas = new Map();
const dataCenter = {
setData: (key, value) => {
Datas.set(key, value);
},
getData: (key) => {
return Datas.get(key)
}
}
export default dataCenter
......@@ -17,7 +17,8 @@ class Loading extends Component {
};
}
componentDidMount() {
async componentDidMount() {
const homeInfo = await API.homeInfo();
Promise.all([this.getCountdown(), API.getRule()]).then(([, res]) => {
this.oncomplete(res);
});
......
......@@ -5,15 +5,18 @@ 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 '@spark/guideact';
import { widgetConfig } from './widgetConfig';
let _widget;
class Main3 extends Component {
constructor(props) {
super(props);
this.state = {
resList: resList,
nickname:'nickname',
avatar:1,
num:"1123"
nickname: 'nickname',
avatar: 1,
num: "1123"
};
}
......@@ -27,8 +30,22 @@ class Main3 extends Component {
}
}
onReady(widget) {
_widget = widget;
}
onEvent(type, payload) {
console.log(type, payload);
}
onAssetsProcess(loaded, total) {
console.log(`assets load process:${loaded}/${total}`)
}
onAssetsComplete() {
console.log(`assets load complete`)
}
render() {
const {avatar,nickname,num} = this.state;
const { avatar, nickname, num } = this.state;
return (
<div className="main3 " uuid="8754a9d1-7453-474b-b722-7cb71483ae85">
<img
......@@ -43,17 +60,17 @@ class Main3 extends Component {
uuid="5316b02a-5b8e-4355-b556-cd801852df7e"
src={this.state.resList['31522099-3ea6-4d2b-ae84-99e2877bd2d0'].url}
/>
{avatar == 1 &&<img
{avatar == 1 && <img
className="main3_avatar1 "
uuid="f2277018-36fd-4f47-9124-d73324505dff"
src={this.state.resList['6dda365e-565e-4e15-9fc9-89b5e173dcd9'].url}
/>}
{avatar == 2 &&<img
{avatar == 2 && <img
className="main3_avatar2 "
uuid="07d1620b-d31e-4ef7-a63a-9b0ef49497da"
src={this.state.resList['6ff31046-e036-4218-8cc9-5d715dfa64a1'].url}
/>}
{avatar == 3 &&<img
{avatar == 3 && <img
className="main3_avatar3 "
uuid="dc2306b9-90e0-4e98-a967-e0f263a3217a"
src={this.state.resList['b4aa3a56-6a4f-4984-9aa2-1932c35de3b4'].url}
......@@ -134,6 +151,11 @@ class Main3 extends Component {
uuid="c27fef65-4506-42f8-85df-207999e11de1"
src={this.state.resList['56b64b91-4e9a-49bd-bfd0-20d10b6e6556'].url}
/>
<CanvasWidget className="canvas-widget" widgetFactory={Guideact} widgetConfig={widgetConfig}
onEvent={this.onEvent.bind(this)}
onReady={this.onReady.bind(this)} onAssetsProcess={this.onAssetsProcess.bind(this)}
onAssetsComplete={this.onAssetsComplete.bind(this)} />
</div>
);
}
......
export let widgetConfig = {
props:{
},
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