Commit 3492b48e authored by 徐士卿's avatar 徐士卿

merge

parent 9d8216b0
...@@ -51,7 +51,7 @@ export default [ ...@@ -51,7 +51,7 @@ export default [
"resignQg": 999, "resignQg": 999,
} }
], ],
"hasChallengeDay": 30, "hasChallengeDay": 29,
"boolNeedResign": false, "boolNeedResign": false,
"boolNeedResignPop": false, "boolNeedResignPop": false,
"taskInfoList": [ "taskInfoList": [
......
...@@ -97,8 +97,8 @@ export default [ ...@@ -97,8 +97,8 @@ export default [
"prizeId": "g0e432eeb", "prizeId": "g0e432eeb",
"type": 4, "type": 4,
"moneyStatus": 10, "moneyStatus": 10,
"moneyCanReissueStartTimestamp": 1565213353000, "moneyCanReissueStartTimestamp": Date.now() -1565213353000,
"moneyCanReissueEndTimestamp": 1565213353000, "moneyCanReissueEndTimestamp": Date.now() + 1565213353000,
}, },
{ {
"extra": { "extra": {
......
...@@ -11,6 +11,7 @@ import API from "../../../src/api/index"; ...@@ -11,6 +11,7 @@ import API from "../../../src/api/index";
import store from "../../../src/store/store.ts"; import store from "../../../src/store/store.ts";
import { pre_reduce_score } from "../../store/credits.js"; import { pre_reduce_score } from "../../store/credits.js";
import { handleLogExposure, handleLogClick } from "@/MD"; import { handleLogExposure, handleLogClick } from "@/MD";
import { _asyncThrottle } from "../../utils/utils.ts";
@observer @observer
class Consume_credits extends React.Component { class Consume_credits extends React.Component {
...@@ -18,8 +19,8 @@ class Consume_credits extends React.Component { ...@@ -18,8 +19,8 @@ class Consume_credits extends React.Component {
super(props); super(props);
} }
handleclock = async (n, code) => { handleclock = _asyncThrottle(async (n, code) => {
handleLogClick(16) handleLogClick(16);
await pre_reduce_score( await pre_reduce_score(
{ {
toPlaywayId: "challenge", toPlaywayId: "challenge",
...@@ -35,11 +36,11 @@ class Consume_credits extends React.Component { ...@@ -35,11 +36,11 @@ class Consume_credits extends React.Component {
if (success) { if (success) {
ModalCtrl.closeModal(); ModalCtrl.closeModal();
} }
store.getTaskInfo() store.getTaskInfo();
store.getBaseIndex() store.getBaseIndex();
} }
); );
}; });
handleclose = () => { handleclose = () => {
ModalCtrl.closeModal(); ModalCtrl.closeModal();
...@@ -47,7 +48,7 @@ class Consume_credits extends React.Component { ...@@ -47,7 +48,7 @@ class Consume_credits extends React.Component {
render() { render() {
const { n = 0, code, title } = this.props; const { n = 0, code, title } = this.props;
handleLogExposure(16) handleLogExposure(16);
return ( return (
<div className="consume_credits modal_center"> <div className="consume_credits modal_center">
<span className="bg"></span> <span className="bg"></span>
......
...@@ -10,6 +10,7 @@ import Finish_task from "../finish_task/finish_task"; ...@@ -10,6 +10,7 @@ import Finish_task from "../finish_task/finish_task";
import API from "../../../src/api/index"; import API from "../../../src/api/index";
import store from "../../../src/store/store.ts"; import store from "../../../src/store/store.ts";
import { handleLogExposure, handleLogClick } from "@/MD"; import { handleLogExposure, handleLogClick } from "@/MD";
import { _asyncThrottle } from "../../utils/utils.ts";
@observer @observer
class Consume_qg extends React.Component { class Consume_qg extends React.Component {
...@@ -17,7 +18,7 @@ class Consume_qg extends React.Component { ...@@ -17,7 +18,7 @@ class Consume_qg extends React.Component {
super(props); super(props);
} }
handleclock = async (code) => { handleclock = _asyncThrottle(async (code) => {
handleLogClick(17); handleLogClick(17);
const { success } = await API.getChallenegeComplete({ taskCode: code }); const { success } = await API.getChallenegeComplete({ taskCode: code });
if (success) { if (success) {
...@@ -25,7 +26,7 @@ class Consume_qg extends React.Component { ...@@ -25,7 +26,7 @@ class Consume_qg extends React.Component {
} }
store.getTaskInfo(); store.getTaskInfo();
store.getBaseIndex(); store.getBaseIndex();
}; });
handleclose = () => { handleclose = () => {
ModalCtrl.closeModal(); ModalCtrl.closeModal();
......
...@@ -11,6 +11,7 @@ import store from "../../../src/store/store.ts"; ...@@ -11,6 +11,7 @@ import store from "../../../src/store/store.ts";
import { pre_reduce_score } from "../../store/credits.js"; import { pre_reduce_score } from "../../store/credits.js";
import Finish_resign from "../finish_resign/finish_resign.jsx"; import Finish_resign from "../finish_resign/finish_resign.jsx";
import { handleLogExposure, handleLogClick } from "@/MD"; import { handleLogExposure, handleLogClick } from "@/MD";
import { _asyncThrottle } from "../../utils/utils.ts";
@observer @observer
class Renewmodule extends React.Component { class Renewmodule extends React.Component {
constructor(props) { constructor(props) {
...@@ -32,7 +33,8 @@ class Renewmodule extends React.Component { ...@@ -32,7 +33,8 @@ class Renewmodule extends React.Component {
this.setState({ activeChoice: choice }); this.setState({ activeChoice: choice });
}; };
handleUse = async (activeChoice, inferQg, inferJf, resignJf) => { handleUse = _asyncThrottle(
async (activeChoice, inferQg, inferJf, resignJf) => {
handleLogClick(18); handleLogClick(18);
if (activeChoice === "credits") { if (activeChoice === "credits") {
// 执行积分续签逻辑 todo // 执行积分续签逻辑 todo
...@@ -68,7 +70,8 @@ class Renewmodule extends React.Component { ...@@ -68,7 +70,8 @@ class Renewmodule extends React.Component {
store.getTaskInfo(); store.getTaskInfo();
store.getBaseIndex(); store.getBaseIndex();
} }
}; }
);
render() { render() {
handleLogExposure(18); handleLogExposure(18);
......
...@@ -273,11 +273,12 @@ ...@@ -273,11 +273,12 @@
.subcribe { .subcribe {
position: absolute; position: absolute;
left: 580px; left: 574px;
width: 380px; width: 92px;
height: 46px; height: 34px;
font-size: 26px; top: -2px;
// .webpBg("HomePage/未订阅.png"); // font-size: 26px;
.webpBg("HomePage/订阅.png");
} }
.list { .list {
......
...@@ -152,7 +152,7 @@ class Check extends React.Component<any, any> { ...@@ -152,7 +152,7 @@ class Check extends React.Component<any, any> {
<div className="task"> <div className="task">
<div className="task-bg"> <div className="task-bg">
{hasChallengeDay !== challengeTotalDay && ( {hasChallengeDay !== challengeTotalDay && (
<div className="task-plan">打卡任务 {completedTasks} {taskCount}</div> <div className="task-plan">打卡任务 | {completedTasks} / {taskCount}</div>
)} )}
{hasChallengeDay !== challengeTotalDay && Array.isArray(taskInfoList) && {hasChallengeDay !== challengeTotalDay && Array.isArray(taskInfoList) &&
taskInfoList.length > 0 && taskInfoList.length > 0 &&
...@@ -268,7 +268,7 @@ class Check extends React.Component<any, any> { ...@@ -268,7 +268,7 @@ class Check extends React.Component<any, any> {
<div className="calendar"> <div className="calendar">
<span className="remind">提醒我签到 挑战失败重新开始</span> <span className="remind">提醒我签到 挑战失败重新开始</span>
<Button className="subcribe" onClick={this.handlesubscribe}>去订阅</Button> <Button className="subcribe" onClick={this.handlesubscribe} />
<div className="list"> <div className="list">
{Array.from({ length: challengeTotalDay }).map((_, dayIndex) => ( {Array.from({ length: challengeTotalDay }).map((_, dayIndex) => (
<div <div
......
...@@ -74,16 +74,18 @@ ...@@ -74,16 +74,18 @@
.yifafang { .yifafang {
position: absolute; position: absolute;
width: 178px; width: 141px;
height: 44px; height: 44px;
left: 490px; left: 520px;
top: 53px; top: 53px;
text-align: center; text-align: center;
line-height: 44px; line-height: 44px;
.webpBg("MyPrize/已发放.png"); font-size: 23px;
color: white;
.webpBg("MyPrize/grayBg.png");
} }
.bufa { .fafangzhong {
position: absolute; position: absolute;
width: 141px; width: 141px;
height: 44px; height: 44px;
...@@ -91,10 +93,12 @@ ...@@ -91,10 +93,12 @@
top: 53px; top: 53px;
text-align: center; text-align: center;
line-height: 44px; line-height: 44px;
.webpBg("MyPrize/补发红包.png"); .webpBg("MyPrize/redBg.png");
color: white;
font-size: 23px;
} }
.fafangzhong { .shibai {
position: absolute; position: absolute;
width: 141px; width: 141px;
height: 44px; height: 44px;
...@@ -102,18 +106,60 @@ ...@@ -102,18 +106,60 @@
top: 53px; top: 53px;
text-align: center; text-align: center;
line-height: 44px; line-height: 44px;
.webpBg("MyPrize/发放中.png"); font-size: 23px;
color: white;
.webpBg("MyPrize/grayBg.png");
} }
.shibai { .meidaoshijian {
position: absolute; position: absolute;
width: 178px; width: 141px;
height: 44px; height: 44px;
left: 490px; left: 520px;
top: 53px; top: 53px;
text-align: center; text-align: center;
line-height: 44px; line-height: 44px;
.webpBg("MyPrize/发放失败.png"); font-size: 23px;
color: white;
.webpBg("MyPrize/redBg.png");
}
.shijianguole {
position: absolute;
width: 141px;
height: 44px;
left: 520px;
top: 53px;
text-align: center;
line-height: 44px;
font-size: 23px;
color: white;
.webpBg("MyPrize/grayBg.png");
}
.keyibufa {
position: absolute;
width: 141px;
height: 44px;
left: 520px;
top: 53px;
text-align: center;
line-height: 44px;
font-size: 23px;
color: white;
.webpBg("MyPrize/redBg.png");
}
.remian {
position: absolute;
width: 200px;
height: 44px;
left: 454px;
top: 100px;
text-align: right;
line-height: 30px;
font-size: 23px;
.lineClamp1();
} }
.prizeImg { .prizeImg {
......
...@@ -2,7 +2,7 @@ import React from 'react'; ...@@ -2,7 +2,7 @@ import React from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import './MyPrize.less'; import './MyPrize.less';
import { Button, Toast } from "@grace/ui"; import { Button, Toast } from "@grace/ui";
import { dateFormatter, miniGoUrl } from "@/utils/utils.ts"; import { _asyncThrottle, dateFormatter, miniGoUrl } from "@/utils/utils.ts";
import API from "@/api"; import API from "@/api";
import { PageCtrl } from "@/core/ctrls/PageCtrl.tsx"; import { PageCtrl } from "@/core/ctrls/PageCtrl.tsx";
...@@ -11,6 +11,7 @@ class MyPrize extends React.Component<any, any> { ...@@ -11,6 +11,7 @@ class MyPrize extends React.Component<any, any> {
state = { state = {
list: [], list: [],
time: 0
} }
componentDidMount() { componentDidMount() {
...@@ -18,12 +19,13 @@ class MyPrize extends React.Component<any, any> { ...@@ -18,12 +19,13 @@ class MyPrize extends React.Component<any, any> {
} }
async initList() { async initList() {
const { success, data } = await API.records({ const { success, data, timeStamp } = await API.records({
ignoreSp: true, ignoreSp: true,
}); });
if (!success) return; if (!success) return;
this.setState({ this.setState({
list: data, list: data,
time: timeStamp
}); });
} }
...@@ -66,30 +68,27 @@ class MyPrize extends React.Component<any, any> { ...@@ -66,30 +68,27 @@ class MyPrize extends React.Component<any, any> {
} }
} }
handleyifafang = (item) => { handleMeidaoshijian = _asyncThrottle(() => {
Toast.show("已发放") Toast.show("未到补发时间")
} })
handleShijianguole = _asyncThrottle(() => {
Toast.show("补发已过时效")
})
handlebufa = async (item) => { handleKeyibufa = _asyncThrottle(async (item) => {
const { success } = await API.redpacket({ await API.redpacket({
prizeRecordId: item.id, prizeRecordId: item.id,
}); });
if (success) {
this.initList(); this.initList();
} }
} );
handleshibai = (item) => {
Toast.show("发放失败")
}
handlefafangzhong = (item) => {
Toast.show("正在发放中,请耐心等待")
}
render() { render() {
const { list } = this.state; const { list } = this.state;
const { time } = this.state;
return <div className="MyPrize"> return <div className="MyPrize">
<div className="MyPrizeBg" /> <div className="MyPrizeBg" />
...@@ -97,17 +96,57 @@ class MyPrize extends React.Component<any, any> { ...@@ -97,17 +96,57 @@ class MyPrize extends React.Component<any, any> {
<div className="prizeList"> <div className="prizeList">
{ {
list.length > 0 ? list.map((item, index) => { list.length > 0 ? list.map((item, index) => {
const remainingTime = item.moneyCanReissueEndTimestamp - time;
const days = Math.floor(remainingTime / (24 * 60 * 60 * 1000));
const hours = Math.floor((remainingTime % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000));
let ProgressText;
if (days === 0 && hours === 0) {
ProgressText = '剩余1小时';
} else {
ProgressText = `剩余${days}天${hours}小时`;
}
return ( return (
<div className="prizeItem" key={index}> <div className="prizeItem" key={index}>
<img className="prizeImg" src={item.extra.icon} /> <img className="prizeImg" src={item.extra.icon} />
<div className="prizeName">{item.extra.name}</div> <div className="prizeName">{item.extra.name}</div>
<div className="getTime">{dateFormatter(item.gmtCreate, "yyyy.MM.dd")}</div> <div className="getTime">{item?.gmtCreate ? dateFormatter(item.gmtCreate, "yyyy.MM.dd") : ""}</div>
{item.type == 4 ? ( {item.type == 4 ? (
<> <>
{item.moneyStatus === 1 && <Button className="yifafang" onClick={() => this.handleyifafang(item)} />} {item.moneyStatus === 1 && <Button className="yifafang">已发放</Button>}
{item.moneyStatus === 2 && <Button className="shibai" onClick={() => this.handleshibai(item)} />} {item.moneyStatus === 2 && <Button className="shibai">发放失败</Button>}
{item.moneyStatus === 10 && <Button className="bufa" onClick={() => this.handlebufa(item)} />} {item.moneyStatus === 11 && <Button className="fafangzhong">发放中</Button>}
{item.moneyStatus === 11 && <Button className="fafangzhong" onClick={() => this.handlefafangzhong(item)} />} {item.moneyStatus === 10 && (
<>
{/* 1. 未到可补发时 */}
{item.moneyCanReissueStartTimestamp > time && (
<Button className="meidaoshijian" onClick={this.handleMeidaoshijian}>
补发红包
</Button>
)}
{/* 2. 已过可补发时间 */}
{time > item.moneyCanReissueEndTimestamp && (
<Button className="shijianguole" onClick={this.handleShijianguole}>
补发失败
</Button>
)}
{/* 3. 可补发 */}
{time < item.moneyCanReissueEndTimestamp &&
time > item.moneyCanReissueStartTimestamp && (
<>
<Button className="keyibufa" onClick={() => this.handleKeyibufa(item)}>
补发红包
</Button>
<span className="remian">{ProgressText}</span>
</>
)}
</>
)}
</> </>
) : ( ) : (
<Button className="use" onClick={() => this.clickItem(item)} /> <Button className="use" onClick={() => this.clickItem(item)} />
......
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