Commit fca880c5 authored by 王勇霞's avatar 王勇霞

feat: 代码冗余

parent f185ecb0
......@@ -27,17 +27,3 @@ https://90548-activity.dexfu.cn/customShare/share?id=Did1NjE3MzU&projectId=pf909
@后端
1.绑定手机号弹窗 需要展示当前渠道的协议标题和内容 哪个接口返回? -- 新加了接口
2.活动结束后 微信端扫码 绑定手机号时 拿不到uid origenUid怎么传? -- 只有华夏理财才必传
3.home/isWhiteUser.do 重定向地址不需要前端传吗? -- 后端写死
4.home/coop_checkCode.do 不需要加密吗?重定向地址不需要前端传吗? -- 不加密 后端写死
5.首页接口 home/index.do
5.1 codeList 返回的是需要查询的code么?已经查过的还会返回吗?需要返回产品类型 -- 已经查过的不会返回
5.2 缺少字段:活动结束通知弹窗是否展示 -- 补了
5.3 金额的相关字段 单位是分还是元? --分 签到那边是元
5.4 缺少字段:今日是否已签到、最高可得xx万资金、checkInConfig每个item的id和是否已领奖 -- 补了
5.5 缺少字段:底部产品列表、我的持仓列表 -- 补了
export default [
{
url: '/home/isWhiteUser.do',
response: () => {
return {
success: true,
code: "60002",
// code: "60001",
// code: "100001",
message: "",
timeStamp: Date.now(),
data: null
}
},
},
{
url: '/home/coop_codeUpdate.do',
response: () => {
return {
success: true,
code: "",
message: "",
timeStamp: Date.now(),
data: null
}
},
},
{
url: '/home/coop_queryAgreement.do',
response: () => {
return {
success: true,
code: "",
message: "",
timeStamp: Date.now(),
data: {
agreementTitle: '服务协议',
agreementText: '服务协议内容',
}
}
},
},
{
url: '/real/index.do',
response: () => {
......@@ -170,6 +129,48 @@ export default [
}
},
},
{
url: '/product/index.do',
response: () => {
return {
success: true,
code: "",
message: "",
timeStamp: Date.now(),
data: {
productName: "productName",
totalProfit: Math.random() * 100000 >> 0,
tranche: 7660,
marketValue: Math.random() * 10000000 >> 0,
yesterdayProfit: Math.random() * 10000 >> 0,
availableFunds: 7690,
minBuyLimit: 1,
}
}
},
},
{
url: '/product/buy.do',
response: () => {
return {
success: true,
code: "",
message: "",
data: null,
}
},
},
{
url: '/product/redeem.do',
response: () => {
return {
success: true,
code: "",
message: "",
data: null,
}
},
},
{
url: '/checkIn_1/doCheckIn.do',
response: () => {
......@@ -458,57 +459,6 @@ export default [
}
}
},
{
url: '/home/coop_sendCode.do',
method: 'post',
response: () => {
return {
"code": "magna laborum amet",
"data": {
"resCode": "0000",
"errorMsg": '错误信息', // 错误信息
},
"message": "nostrud aliqua irure dolore mollit",
"success": true,
"timestamp": -15469760.648778364
}
},
},
{
url: '/home/coop_checkCode.do',
method: 'post',
response: () => {
return {
"code": "magna laborum amet",
"data": 'http://localhost:5173/?t=1',
"message": "nostrud aliqua irure dolore mollit",
"success": true,
"timestamp": -15469760.648778364
}
},
},
{
url: '/home/doCheckIn.do',
response: () => {
return {
success: true,
code: "",
message: "",
data: 'ok',
}
},
},
{
url: '/home/doRewards.do',
response: () => {
return {
success: true,
code: "",
message: "",
data: 'ok',
}
},
},
{
url: '/customActivity/hxlc/login',
response: () => {
......@@ -817,27 +767,6 @@ export default [
}
},
},
{
url: '/home/queryWealthRecords.do',
response: () => {
return {
success: true,
code: "",
message: "",
data: {
haveMore: true,
list: new Array(20).fill(1).map((_, i) => {
return {
description: "模拟理财金获取记录--" + i,
gmtCreate: Date.now() + Math.random() * 1000000000,
changeType: "+",
buyAmount: 23333,
}
}),
}
}
},
},
{
url: '/invite/coop_assist.do',
response: () => {
......
export default [
{
url: '/mncp/index.do',
response: ({ query }) => {
return {
success: true,
code: "",
message: "",
timeStamp: Date.now(),
data: {
productName: "productName",
totalProfit: Math.random() * 100000 >> 0,
tranche: 7660,
marketValue: Math.random() * 10000000 >> 0,
yesterdayProfit: Math.random() * 10000 >> 0,
availableFunds: 7690,
minBuyLimit: 1,
}
}
},
},
{
url: '/mncp/buy.do',
response: ({ query }) => {
return {
success: true,
code: "",
message: "",
data: null,
}
},
},
{
url: '/mncp/redeem.do',
response: ({ query }) => {
return {
success: true,
code: "",
message: "",
data: null,
}
},
},
{
url: '/mncp/tradeRecords.do',
response: ({ query }) => {
return {
success: true,
code: "",
message: "",
data: {
haveMore: true,
list: new Array(20).fill(1).map((_, i) => {
return {
desc: "模拟交易记录页--" + i,
gmtCreate: Date.now() + Math.random() * 1000000000,
amount: Math.random() * 10000000 >> 0,
tradeStatus: Math.random() * 3 >> 0,
}
}),
}
}
},
},
]
......@@ -20,6 +20,12 @@ const API = generateAPI({
doSign: "checkIn_1/doCheckIn.do",
// 完成签到浏览任务
completeSignView: "checkIn_1/completeSignView.do",
// 产品首页信息
productIndex: "product/index.do",
// 产品赎回
redeem: "product/redeem.do",
// 产品买入
buy: "product/buy.do",
// 查看排行榜
queryRankInfo: "rank/queryRankInfo.do",
// 查询分布信息
......@@ -34,8 +40,6 @@ const API = generateAPI({
// =============
// getShareInfo: '/wechatShare/getShareInfo/v2',
getShareInfo: '/wechatMiniApp/ticket/info',
// cookie丢失-重新设置cookie
......@@ -44,7 +48,6 @@ const API = generateAPI({
uri: "userLogin.check",
showMsg: false,
},
getInviteCode: {
uri: 'inviteAssist_1/getInviteCode.do',
withToken: true,
......@@ -56,7 +59,6 @@ const API = generateAPI({
method: 'post',
showMsg: false,
},
/** 二维码 */
getQrcode: "/customActivity/qrcode/getQrcode",
// 免登-华夏理财
......@@ -67,107 +69,15 @@ const API = generateAPI({
'Content-Type': 'application/json',
},
},
// 首页-产品参数更新
coop_codeUpdate: {
uri: "home/coop_codeUpdate.do",
method: 'post',
headers: {
'Content-Type': 'application/json',
},
},
// 首页-白名单限制弹窗
isWhiteUser: {
uri: "home/isWhiteUser.do",
showMsg: false,
},
// 首页-查询服务协议
coop_queryAgreement: "home/coop_queryAgreement.do",
// 首页-校验验证码并登录(渠道5-昆仑银行使用)
coop_checkCode: {
uri: 'home/coop_checkCode.do',
method: 'post',
},
// 首页-校验验证码并登录(渠道1-华夏理财,渠道2-华夏银行使用)
checkCode: {
uri: 'home/checkCode.do',
method: 'post',
},
// 首页-发送验证码
coop_sendCode: {
uri: 'home/coop_sendCode.do',
method: 'post',
},
// 签到-签到
doCheckIn: "home/doCheckIn.do",
// 签到-领奖
doRewards: "home/doRewards.do",
tradeRecords: "mncp/tradeRecords.do",
queryWealthRecords: "home/queryWealthRecords.do",
redeem: "mncp/redeem.do",
buy: "mncp/buy.do",
mncpIndex: "mncp/index.do",
// 新人礼抽奖
newbieDraw: `home/tradeDraw.do`,
// 红包雨开始游戏
redStartGame: `redRain/startGame.do`,
// 红包雨提交
redSubmitGame: `redRain/submitGame.do`,
/** 分享落地页接口 */
getSharePageInfo: "invite/coop_queryRecommand.do",
// 获取任务列表的接口
getTaskList: "task/queryTasks.do",
// 完成任务接口
completeTask: "task/doCompleted.do",
// 任务领奖接口
sendPrizeTask: "task/sendPrize.do",
// 查询题目
queryQS: "answer_1/query.do",
// 开始答题
startQS: {
uri: "answer_1/start.do",
method: 'post',
withToken: true,
},
// 获取题目
getQS: {
uri: "answer_1/getQuestion.do",
method: 'post',
withToken: true,
},
// 提交题目
submitQS: {
uri: "answer_1/submit.do",
method: 'post',
withToken: true,
},
// 完成答题
completeQS: {
uri: "answer_1/doCompleted.do",
method: 'post',
withToken: true,
},
doAsistInSharePage: {
uri: "invite/coop_assist.do",
},
queryInviteCode: {
uri: 'invite/queryInviteCode.do',
withToken: true,
}
})
// console.log('======', API)
export default API
This diff is collapsed.
......@@ -54,7 +54,7 @@ class DetailPage extends React.Component<any, any> {
}
async updateInfo() {
const { success, data } = await API.mncpIndex({ code: this.props.code, });
const { success, data } = await API.productIndex({ code: this.props.code, });
if (!success) return;
this.setState({
productName: data.productName,
......
......@@ -5,16 +5,13 @@ import store from "@/store/store.ts";
import { Button, Toast } from "@grace/ui";
import Rulepop from '@/panels/rulepop/rulepop';
import Positionpop from '@/panels/positionpop/positionpop';
import Endpop from '@/panels/endPop/index.jsx';
import { PageCtrl } from '@/core/ctrls/PageCtrl';
import { ModalCtrl } from '@/core/ctrls/ModalCtrl';
import { _asyncThrottle, dateFormatter, formatThousand } from '@/utils/utils';
import NewRecordPage from '../newRecordPage/index.jsx';
import { diffJump, RATE_NAME } from '@/AppTools';
import API from '@/api';
import DetailPage from '../DetailPage/DetailPage';
import MyQradesPage from '../myQradesPage/myqradespage';
import Countdown from '@/core/components/ComCountdown/index.jsx';
import PrizePage from "@/pages/PrizePage/PrizePage.tsx";
import SignCom from '@/panels/signCom/signCom.jsx';
import SetupSuccessPop from '@/panels/setupSuccessPop';
......@@ -50,7 +47,6 @@ class HomePage extends React.Component<any, any> {
store.updateIndex()
// 获取排行榜信息
this.getQueryRankInfo(this.state.rankingTab);
// ModalCtrl.showModal(Endpop)
}
// 获取排行榜信息
getQueryRankInfo = async (type) => {
......@@ -93,22 +89,6 @@ class HomePage extends React.Component<any, any> {
PageCtrl.changePage(MyQradesPage)
})
/** 已签到 */
signedHandle = _asyncThrottle(async () => {
if (!store.judgeActTime()) return
Toast.show("今日已签到")
})
/** 签到 */
signHandle = _asyncThrottle(async () => {
if (!store.judgeActTime()) return
const { success } = await API.doCheckIn();
if (success) {
Toast.show("签到成功")
}
await store.updateIndex();
})
/** 切换tab */
toggleTab = async (type) => {
this.setState({ curTab: type })
......
'use strict';
import React from 'react';
import { observer } from 'mobx-react';
import './index.less';
import { _throttle } from '@/utils/utils';
import { Button } from '@grace/ui';
import { PageCtrl } from '@/core/ctrls/PageCtrl';
import { dateFormatter } from "@/utils/utils.ts";
import HomePage from "@/pages/HomePage/HomePage.tsx";
import API from '@/api';
@observer
class NewRecordPage extends React.Component {
constructor(props) {
super(props);
this.state = {
list: [],
tab: props?.tab || 1
}
this.pageNum = 1;
this.pageSize = 20;
this.haveMore = true;
this.API = this.props.tab === 1 ? API.tradeRecords : API.queryWealthRecords;
}
clickBack = () => {
PageCtrl.changePage(HomePage);
}
componentDidMount() {
this.updateList();
}
async updateList() {
const { pageNum, pageSize, haveMore } = this;
if (!haveMore) return;
const { success, data } = await this.API({ pageNum, pageSize, channel: CFG.channel });
if (!success) return;
this.pageNum++;
this.haveMore = data.haveMore;
const list = this.state.list.concat(data.list);
this.setState({ list })
}
handleScroll = (e) => {
if (e.target.scrollHeight - e.target.scrollTop <= e.target.clientHeight) {
this.updateList();
}
}
tabChange(tab) {
this.setState({
tab: tab,
list: []
})
this.pageNum = 1;
this.pageSize = 20;
this.haveMore = true;
this.API = tab === 1 ? API.tradeRecords : API.queryWealthRecords;
this.updateList();
}
render() {
const { list, tab } = this.state;
return (
<div className="newRecordPage">
<span className="bg"></span>
<span className='bg-lachang'></span>
<Button className="backBtn" onClick={this.clickBack} />
<div className={`tab-con tab-${this.state.tab}`}>
<div className='tab-btn-1' onClick={_throttle(() => {
this.tabChange(1)
})}></div>
<div className='tab-btn-2' onClick={_throttle(() => {
this.tabChange(2)
})}></div>
</div>
<div>
{list?.length
? <div className="list" onScroll={this.handleScroll}>
{
tab === 1 && list.map((item, index) => {
const state = {
0: { txt: "购买待确认", color: "rgba(0,0,0,0.6)" },
1: { txt: "购买成功", color: "#ee4e32" },
2: { txt: "赎回成功", color: "#1b8a4f" },
3: { txt: "购买失败", color: "rgba(0,0,0,0.6)" },
}[item.tradeStatus];
return <div className="item" key={index}>
<div className="title">{item.desc}</div>
<div
className="date">{dateFormatter(item.gmtCreate, "yyyy.MM.dd hh:mm:ss")}</div>
<div className="num">¥{item.amount / 100}</div>
{/*<div className={styles.num}>¥0000000.00</div>*/}
<div className="state" style={{ color: state.color }}>{state.txt}</div>
</div>
})
}
{
tab === 2 && list.map((item, index) => {
return <div className="item" key={index}>
<div className="title">{item.description}</div>
<div
className="date">{dateFormatter(item.gmtCreate, "yyyy.MM.dd hh:mm:ss")}</div>
<div className="num" style={{ color: 'rgba(0,0,0,1)' }}>{`${item.changeType}¥${item.buyAmount / 100}`}</div>
</div>
})
}
</div>
: <div className="listNone">暂无交易记录哦</div>
}
</div>
</div>
);
}
}
export default NewRecordPage;
@import "../../res.less";
.newRecordPage {
width: 750px;
height: 100vh;
left: 0px;
top: 0px;
position: absolute;
.backBtn {
position: absolute;
left: 28px;
top: 58px;
width: 18px;
height: 32px;
.sparkBg("RecordPage/backBtn.png");
}
.bg {
width: 750px;
height: 1624px;
left: 0px;
top: 0px;
position: absolute;
.sparkBg("RecordPage/recordPageBg.png");
}
.bg-lachang {
display: inline-block;
width: 713px;
height: 641px;
position: absolute;
left: 19px;
bottom: 40px;
background-color: #fff;
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
}
.tab-con {
position: absolute;
left: 19px;
top: 120px;
width: 713px;
height: 1041px;
}
.tab-1 {
.sparkBg("RecordPage/tab1.png");
}
.tab-2 {
.sparkBg("RecordPage/tab2.png");
}
.tab-btn-1 {
position: absolute;
left: 0px;
top: 5px;
width: 50%;
height: 70px;
// background-color: aqua;
}
.tab-btn-2 {
position: absolute;
right: 0px;
width: 50%;
top: 5px;
height: 70px;
// background-color: rgb(158, 64, 109);
}
.listNone {
position: absolute;
top: 400px;
left: 0;
width: 100%;
font-size: 32px;
color: #d62928;
text-align: center;
font-weight: bold;
}
.list {
position: absolute;
top: 203px;
bottom: 40px;
width: 710px;
border-top-left-radius: 30px;
border-top-right-radius: 30px;
overflow-x: hidden;
overflow-y: auto;
.item {
position: relative;
width: 100%;
height: 141px;
.title {
position: absolute;
left: 56px;
top: 57px;
font-size: 30px;
color: black;
font-weight: bold;
width: 390px;
.lineClamp1();
}
.date {
position: absolute;
left: 56px;
top: 104px;
font-size: 24px;
color: rgba(0, 0, 0, 0.6);
}
.num {
position: absolute;
right: 60px;
top: 61px;
font-size: 30px;
color: black;
font-weight: bold;
}
.state {
position: absolute;
right: 60px;
top: 100px;
font-size: 24px;
color: rgba(0, 0, 0, 0.6);
// #ee4e32
// #1b8a4f
}
}
}
}
\ No newline at end of file
......@@ -4,17 +4,9 @@ import "./PrizePanel.less";
import { Button } from "@grace/ui";
import { ModalCtrl } from "@/core/ctrls/ModalCtrl.tsx";
import { _throttle } from "@/utils/utils";
import { PageCtrl } from "@/core/ctrls/PageCtrl";
import NewRecordPage from '../../pages/newRecordPage/index.jsx';
export class PrizePanel extends Component<any, any> {
BTN_MD = {
new_turntable: '14',
red: '26',
final_turntable: '33'
}
componentDidMount() {
}
......@@ -24,11 +16,6 @@ export class PrizePanel extends Component<any, any> {
clickBtn = _throttle(() => {
const { type } = this.props;
if (type == 'red') {
PageCtrl.changePage(NewRecordPage, { tab: 2 })
}
ModalCtrl.closeModal();
})
......@@ -41,7 +28,7 @@ export class PrizePanel extends Component<any, any> {
<img className="img" src={optionImg} />
<div className="prizeName">{optionName}</div>
<Button className={`btn`} onClick={this.clickBtn} />
{type != 'red' && <div className="tips">奖品可在【首页】-【我的奖品】中查看</div>}
<div className="tips">奖品可在【首页】-【我的奖品】中查看</div>
<Button className="close" onClick={this.clickClose} />
</div>
}
......
'use strict';
import React from 'react';
import { observer } from 'mobx-react';
import './index.less';
import store from '../../store/store';
import { Button } from '@grace/ui';
import { _asyncThrottle } from "../../utils/utils";
import { ModalCtrl } from "@/core/ctrls/ModalCtrl";
import AnswerPrizePanel from "@/panels/answerPrizePanel/index";
import API from '@/api';
import taskStore from '@/store/task';
@observer
class AnswerPanel extends React.Component {
constructor(props) {
super(props);
this.startId = null;
this.state = {
qsInfo: {},
correctAnswers: [],
selAnswer: null
}
}
componentDidMount() {
this.getQuestion();
}
getQuestion = async () => {
const { success } = await API.queryQS();
if (success) {
this.startQuestion();
}
}
startQuestion = async () => {
const { success, data } = await API.startQS();
if (success) {
this.startId = data.startId;
this.getQsDesc();
}
}
getQsDesc = async () => {
const { success, data } = await API.getQS({
startId: this.startId
});
if (success) {
this.setState({
qsInfo: data
})
}
}
async submit(index) {
if (this.state.selAnswer) return;
const { success, data } = await API.submitQS({
startId: this.startId,
answer: index + 1 + ''
})
this.setState({
selAnswer: index + 1 + ''
})
if (success) {
if (data.answer) {
this.setState({
correctAnswers: data.answer?.correctAnswers || []
})
}
this.completeQS();
}
}
async completeQS() {
const { success, data } = await API.completeQS({
startId: this.startId,
})
if (success) {
setTimeout(() => {
this.handleClose();
ModalCtrl.showModal(AnswerPrizePanel, data.options[0] || {});
}, 2000)
taskStore.queryTaskInfo();
store.updateIndex();
}
}
handleClose = _asyncThrottle(() => {
ModalCtrl.closeModal()
})
getBLen = function (str) {
if (str == null) return 0;
if (typeof str != "string") {
str += "";
}
return str.replace(/[^\x00-\xff]/g, "01").length;
}
render() {
const qsInfo = this.state.qsInfo || {};
const correctAnswers = this.state.correctAnswers || [];
const selAnswer = this.state.selAnswer;
const labelObj = {
0: 'A',
1: 'B',
2: 'C',
3: 'D'
}
return (
<div className="answerPanel modal_center">
<span className="bg"></span>
<div className='question-title'>{qsInfo.content || ''}</div>
<div className='answer-con'>
{(qsInfo.answers || []).map((el, index) => {
const str = labelObj[index] + '、' + el;
let len = this.getBLen(str);
return <div className={`${len > 44 ? 'toolong' : ''} answer-item ${(selAnswer === index + 1 + '') && correctAnswers.length > 0 && !correctAnswers.includes(index + 1 + '') ? 'error' : ''} ${correctAnswers.includes(index + 1 + '') ? 'correct' : ''}`} key={index} onClick={_asyncThrottle(() => {
this.submit(index)
})}>{str}
{(selAnswer === index + 1 + '') && correctAnswers.length > 0 && !correctAnswers.includes(index + 1 + '') && <span className='error-icon'></span>}
{correctAnswers.includes(index + 1 + '') && <span className='correct-icon'></span>}
</div>
})}
</div>
<div className="tips">完成答题即可获得理财体验金奖励</div>
<Button className="close" onClick={this.handleClose} />
</div>
);
}
}
export default AnswerPanel;
@import "../../res.less";
.answerPanel {
width: 750px;
height: 1624px;
left: 0px;
top: 0px;
position: absolute;
padding-top: 590px;
box-sizing: border-box;
.bg {
left: 41px;
top: 440px;
width: 669px;
height: 812px;
position: absolute;
.sparkBg("answerPanel/answerPanelBg.png");
}
.question-title {
// top: 590px;
left: 103px;
position: relative;
width: 540px;
max-height: 190px;
overflow-y: scroll;
overflow-x: hidden;
font-size: 26px;
color: rgb(70, 26, 18);
font-weight: bold;
line-height: 1.4;
margin-bottom: 20px;
}
.answer-con {
width: 586px;
height: 360px;
position: relative;
// top: 800px;
left: 80px;
display: flex;
flex-direction: column;
row-gap: 10px;
.answer-item {
width: 100%;
height: auto;
text-align: left;
color: rgb(88, 88, 88);
font-size: 24px;
font-weight: bold;
line-height: 1.5;
vertical-align: middle;
word-break: break-all;
background-color: rgb(253, 239, 236);
border-radius: 14px;
padding: 16px 40px;
// .sparkBg("answerPanel/normalBg.png");
position: relative;
margin: 0 auto;
box-sizing: border-box;
}
// .toolong {
// line-height: 1.5;
// }
.error {
color: #fff;
background-color: rgb(220, 65, 69);
// .sparkBg("answerPanel/errorBg.png");
}
.correct {
color: #fff;
background-color: rgb(107, 200, 129);
// .sparkBg("answerPanel/correctBg.png");
}
.correct-icon {
display: inline-block;
position: absolute;
width: 40px;
height: 29px;
right: 20px;
top: 50%;
transform: translateY(-50%);
.sparkBg("answerPanel/correctIcon.png");
}
.error-icon {
position: absolute;
width: 29px;
height: 29px;
right: 24px;
top: 50%;
transform: translateY(-50%);
display: inline-block;
.sparkBg("answerPanel/errorIcon.png");
}
}
.tips {
width: 669px;
font-size: 24px;
color: rgb(115, 49, 31);
text-align: center;
position: absolute;
left: 41px;
top: 1190px;
}
.close {
left: 346px;
top: 1300px;
width: 58px;
height: 58px;
position: absolute;
.sparkBg("common/close.png");
}
}
\ No newline at end of file
'use strict';
import React from 'react';
import { observer } from 'mobx-react';
import './index.less';
import store from '../../store/store';
import { Button } from '@grace/ui';
import { _asyncThrottle } from "../../utils/utils";
import { ModalCtrl } from "@/core/ctrls/ModalCtrl";
import API from '@/api';
@observer
class AnswerPrizePanel extends React.Component {
constructor(props) {
super(props);
}
handleClose = _asyncThrottle(() => {
ModalCtrl.closeModal()
})
render() {
const { optionName, optionImg } = this.props
return (
<div className="answerPrizePanel modal_center">
<span className="bg"></span>
<div className='prizeimg-con'>
<img className='prizeimg' src={optionImg}></img>
</div>
<div className='prize-name'>{optionName}</div>
<div className='receive' onClick={this.handleClose} ></div>
{/* <div className='tip'></div> */}
<Button className="close" onClick={this.handleClose} />
</div>
);
}
}
export default AnswerPrizePanel;
@import "../../res.less";
.answerPrizePanel {
width: 750px;
height: 1624px;
left: 0px;
top: 0px;
position: absolute;
.bg {
left: 82px;
top: 406px;
width: 585px;
height: 671px;
position: absolute;
.sparkBg("ansPrizePanel/ansPrizePanelBg.png");
}
.prizeimg-con {
width: 230px;
height: 230px;
left: 270px;
top: 586px;
position: absolute;
.sparkBg("ansPrizePanel/prizebg.png");
.prizeimg {
width: 210px;
height: 210px;
left: 10px;
top: 10px;
position: absolute;
}
}
.prize-name {
text-align: center;
width: 540px;
height: 210px;
left: 105px;
top: 835px;
position: absolute;
font-size: 24px;
color: rgb(1, 1, 1);
}
.receive {
width: 510px;
height: 138px;
left: 120px;
top: 885px;
position: absolute;
.sparkBg("ansPrizePanel/receivedBtn.png");
}
.tip {
width: 410px;
height: 23px;
left: 170px;
top: 1020px;
position: absolute;
.sparkBg("ansPrizePanel/tip.png");
}
.close {
left: 346px;
top: 1186px;
width: 58px;
height: 58px;
position: absolute;
.sparkBg("ansPrizePanel/closeBtn.png");
}
}
\ No newline at end of file
......@@ -8,7 +8,6 @@ import { Button, Toast } from '@grace/ui';
import { _asyncThrottle, formatThousand } from '@/utils/utils';
import store from '@/store/store';
import API from '@/api';
import TaskPanel from '@/panels/taskPanel/index.jsx';
import SignTaskPop from '@/panels/signTaskPop';
import { weekList } from "@/contants"
import classNames from 'classnames';
......
'use strict';
import React from 'react';
import { observer } from 'mobx-react';
import './index.less';
import store from '../../store/store';
import { Button } from '@grace/ui';
import { _asyncThrottle, _throttle } from "../../utils/utils";
import { ModalCtrl } from "@/core/ctrls/ModalCtrl";
import SignCom from './signCom/signCom';
import API from '@/api';
import taskStore from '@/store/task';
@observer
class TaskPanel extends React.Component {
constructor(props) {
super(props);
this.state = {
taskList: []
}
}
componentDidMount() {
taskStore.queryTaskInfo();
}
// getTaskList = _asyncThrottle(async () => {
// const { success, data } = await API.getTaskList();
// if (success) {
// this.setState({
// taskList: data.item || []
// })
// }
// })
handleClose = _asyncThrottle(() => {
ModalCtrl.closeModal()
})
render() {
const { taskList } = taskStore;
return (
<div className="taskPanel modal_center">
<span className="bg">
<div className='sign-con'>
<SignCom></SignCom>
</div>
<div className='taskList'>
{
taskList.map((el, index) => {
return <div className='taskItem' key={index}>
<img src={el.icon} className='taskIcon' />
<span className='taskTitle'>{`${el.title}(${el.completeSize || 0}/${el.intervalLimit || 0})`}</span>
<span className='taskSubTitle'>{el.subtitle}</span>
{el.taskStatus == 0 && <Button className='goToBtn' onClick={_asyncThrottle(() => {
taskStore.doComplete(el)
})}></Button>}
{el.taskStatus == 1 && <Button className='dailingqu' onClick={_asyncThrottle(() => {
taskStore.sendPrize(el.code);
})}></Button>}
{el.taskStatus == 2 && <Button className='completed'></Button>}
</div>
})
}
</div>
<Button className="close" onClick={this.handleClose} />
</span>
</div>
);
}
}
export default TaskPanel;
@import "../../res.less";
.taskPanel {
width: 750px;
height: 100vh;
left: 0px;
top: 0px;
position: absolute;
.bg {
left: 0px;
bottom: 0px;
width: 750px;
height: 1132px;
position: absolute;
.sparkBg("taskPop/taskBg.png");
}
.sign-con {
left: 18px;
top: 308px;
width: 716px;
height: 323px;
position: absolute;
}
.taskList {
position: absolute;
width: 716px;
left: 18px;
top: 632px;
height: 500px;
overflow-y: scroll;
overflow-x: hidden;
.taskItem {
position: relative;
width: 716px;
height: 133px;
.sparkBg("taskPop/taskItemBg.png");
.taskIcon {
position: absolute;
width: 92px;
height: 92px;
left: 23px;
top: 15px;
border-radius: 46px;
}
.taskTitle {
position: absolute;
width: 430px;
height: 35px;
line-height: 35px;
left: 125px;
top: 25px;
font-size: 29px;
font-weight: bold;
color: rgb(111, 55, 17);
.lineClamp1()
}
.taskSubTitle {
position: absolute;
width: 430px;
height: 35px;
line-height: 35px;
left: 125px;
top: 65px;
font-size: 29px;
color: rgb(137, 101, 50);
font-size: 24px;
.lineClamp1()
}
.goToBtn {
right: 20px;
top: 40px;
width: 127px;
height: 47px;
position: absolute;
.sparkBg("taskPop/goToBtn.png");
}
.dailingqu {
right: 20px;
top: 40px;
width: 127px;
height: 47px;
position: absolute;
.sparkBg("taskPop/receiveBtn.png");
}
.completed {
right: 20px;
top: 40px;
width: 127px;
height: 47px;
position: absolute;
.sparkBg("taskPop/completedBtn.png");
}
}
}
.close {
left: 665px;
top: 99px;
width: 58px;
height: 58px;
position: absolute;
.sparkBg("taskPop/closeBtn.png");
}
}
\ No newline at end of file
'use strict';
import React from 'react';
import { observer } from 'mobx-react';
import './signCom.less';
import { ModalCtrl } from '@/core/ctrls/ModalCtrl';
import { Button, Toast } from '@grace/ui';
import { _asyncThrottle, formatThousand } from '@/utils/utils';
import store from '@/store/store';
import API from '@/api';
import TaskPanel from '@/panels/taskPanel/index.jsx';
@observer
class SignCom extends React.Component {
constructor(props) {
super(props);
}
/** 已签到 */
signedHandle = _asyncThrottle(async () => {
if (!store.judgeActTime()) return
Toast.show("今日已签到")
})
/** 签到 */
signHandle = _asyncThrottle(async () => {
if (!store.judgeActTime()) return
const { success } = await API.doCheckIn();
if (success) {
Toast.show("签到成功")
}
await store.updateIndex();
})
/** 签到-领奖 */
signPrizeHandle = _asyncThrottle(async (item) => {
// 已领奖
if (item.status) return false
// 未签到
const { checkIn } = store.indexData
if (item.days > checkIn?.totalCheckIn) return false
if (!store.judgeActTime()) return
const { endPoint, currentTime } = store.indexData || {}
if (endPoint <= currentTime) {
Toast.show("模拟理财已结束~")
return false
}
const { success } = await API.doRewards({ checkInConfigId: item.id });
if (success) {
Toast.show("领取成功")
}
await store.updateIndex();
})
render() {
const { checkIn } = store.indexData
return (
<div className="task_sign_section">
<span className="sign_section_bg"></span>
<span className="sign_tips">最高可得{((checkIn?.totalExperienceNum || 0) / 10000).toFixed(0)}万理财体验金</span>
{checkIn?.todayCheckIn
? <Button className="signed_btn" onClick={this.signedHandle}></Button>
: <Button className="sign_btn" onClick={this.signHandle}></Button>
}
<div className="sign_progress">
<span className="progress_bg"></span>
<div className="progress_bar_box">
<div className="progress_bar" style={{ width: `${store.percent}%` }}></div>
</div>
{checkIn?.checkInConfig?.map((item, index) => {
return (
<div
className={`step_item step_item${index + 1} ${item.days > checkIn?.totalCheckIn ? 'locked' : item.status ? 'received' : 'signed'}`}
key={`sign_${index}`}
onClick={() => this.signPrizeHandle(item)}
>
<span className="prize_bg"></span>
<div className="prize_amount">{((item.experienceNum || 0) / 10000).toFixed(0)}<span className="unit"></span></div>
<span className="prize_day">累计{item.days}</span>
</div>
)
})}
</div>
</div>
);
}
}
export default SignCom;
@import "../../../res.less";
.task_sign_section {
width: 712px;
height: 323px;
position: relative;
.sign_section_bg {
width: 712px;
height: 323px;
left: 0px;
top: 0px;
position: absolute;
.sparkBg("taskPop/signPartBg.png");
}
.sign_tips {
width: 434px;
height: 24px;
left: 25px;
top: 70px;
position: absolute;
font-size: 24px;
line-height: 24px;
color: rgb(145, 99, 38);
}
.sign_btn {
width: 202px;
height: 72px;
left: 478px;
top: 22px;
position: absolute;
.sparkBg("taskPop/signBtn.png");
}
.signed_btn {
width: 202px;
height: 72px;
left: 478px;
top: 22px;
position: absolute;
.sparkBg("taskPop/signedBtn.png");
}
.sign_total_tips {
display: inline-block;
width: 172px;
height: 30px;
left: 27px;
top: 110px;
position: absolute;
font-size: 20px;
color: rgb(145, 99, 38);
line-height: 30px;
text-align: center;
// background-color: #ff3333;
}
.sign_progress {
width: 591px;
height: 109px;
left: 60px;
top: 158px;
position: absolute;
.progress_bg {
width: 576px;
height: 20px;
left: 0px;
top: 35px;
position: absolute;
background-color: #f8cec6;
border-radius: 10px;
}
.progress_bar_box {
width: 576px;
height: 20px;
left: 0px;
top: 35px;
position: absolute;
.progress_bar {
width: 0%;
height: 20px;
left: 0px;
top: 0px;
position: absolute;
background-image: linear-gradient(90deg, rgb(253, 118, 95) 8%, #ff3333 100%);
border-radius: 10px 10px 10px 10px;
}
}
.step_item {
width: 71px;
height: 109px;
left: 72px;
top: 0px;
position: absolute;
&.step_item2 {
left: 216px;
}
&.step_item3 {
left: 359px;
}
&.step_item4 {
left: 510px;
}
&.locked .prize_bg {
.sparkBg("taskPop/lockIcon.png");
}
&.signed .prize_bg {
.sparkBg("taskPop/daiLingquIcon.png");
}
&.received .prize_bg {
.sparkBg("taskPop/receivedIcon.png");
}
&.locked,
&.received {
.prize_amount {
opacity: 0.7;
}
}
.prize_bg {
width: 68px;
height: 73px;
left: 0px;
top: 0px;
position: absolute;
}
.prize_amount {
width: 100%;
height: 21px;
left: 0px;
top: 12px;
position: absolute;
font-size: 28px;
color: rgba(238, 78, 50, 1);
font-weight: bold;
.flex_center();
.unit {
height: 30px;
font-size: 18px;
line-height: 34px;
}
}
.prize_day {
width: 91px;
height: 19px;
left: -10px;
top: 90px;
position: absolute;
opacity: 0.6;
font-size: 20px;
line-height: 19px;
color: rgba(0, 0, 0, 1);
text-align: center;
}
}
}
}
\ No newline at end of file
import API from '@/api';
import { makeAutoObservable } from 'mobx';
import store from './store';
import { ModalCtrl } from '@/core/ctrls/ModalCtrl';
import AnswerPanel from '@/panels/answerPanel';
import HomePage from '@/pages/HomePage/HomePage';
import { windowJumpUrl } from '@/utils/utils';
import { Toast } from '@grace/ui';
import shareStore from './share';
// import { handleTaskLogExposure } from '@/MD';
const taskStore = makeAutoObservable({
// 任务列表
taskInfo: {},
taskList: [],
setTaskInfo(data) {
this.taskInfo = data || {};
},
async queryTaskInfo() {
const { data, success } = await API.getTaskList({
channel: CFG.channel
});
if (data && success) {
this.setTaskInfo(data || {});
const arr1 = data.item.filter((el) => { return Number(el.taskStatus) === 1; });
const arr2 = data.item.filter((el) => { return Number(el.taskStatus) === 0; });
const arr3 = data.item.filter((el) => { return Number(el.taskStatus) === 2; });
this.taskList = arr1.concat(arr2, arr3);
this.taskList.forEach(el => {
const { code } = el;
if (el.taskStatus == 0) {
// handleTaskLogExposure(28, code, 1);
}
if (el.taskStatus == 1) {
// handleTaskLogExposure(28, code, 2);
}
});
}
},
// 完成任务
completeInfo: {},
setCompleteInfo(data) {
this.completeInfo = data || {};
},
async doComplete(item) {
if (!store.judgeActTime()) return;
const { code, jumpUrl, extra, id } = item;
if (code === 'invite') {
// 邀请
shareStore.doShare(true)
}
if (code === 'answer') {
// 答题
ModalCtrl.showModal(AnswerPanel)
}
if (code === 'fxcp') {
// 风险测评
this.completeTask(code)
setTimeout(() => {
windowJumpUrl(jumpUrl)
}, 500)
}
if (code === 'csbj') {
console.log("ssssss")
// 花完初始本金
ModalCtrl.closeModal()
setTimeout(() => {
store.homeRoot.scrollTop = 1800 * window.remScale;
}, 300)
}
},
async completeTask(code) {
const { success, data } = await API.completeTask({ channel: CFG.channel, code: code });
if (success) {
await this.queryTaskInfo();
}
},
// 领奖
sendPrizeInfo: {},
setSendPrizeInfo(data) {
this.sendPrizeInfo = data || {};
},
async sendPrize(code) {
const { success, data } = await API.sendPrizeTask({ code: code, channel: CFG.channel });
if (success) {
store.updateIndex();
taskStore.queryTaskInfo();
Toast.show("领取成功~")
} else {
this.sendPrizeInfo = {};
}
},
});
export default taskStore;
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