Commit 135780b9 authored by 徐士卿's avatar 徐士卿

modify

parent 6b25127f
...@@ -57,7 +57,8 @@ export default [ ...@@ -57,7 +57,8 @@ export default [
"title": "签到", "title": "签到",
"completedSize": 0, "completedSize": 0,
"intervalLimitSize": 1, "intervalLimitSize": 1,
"intervalType": -18649400.705077305 "intervalType": -18649400.705077305,
"jumUrl": '',
}, },
{ {
"code": "xhqg_{200}", "code": "xhqg_{200}",
...@@ -66,7 +67,8 @@ export default [ ...@@ -66,7 +67,8 @@ export default [
"title": "消耗200青果", "title": "消耗200青果",
"completedSize": 0, "completedSize": 0,
"intervalLimitSize": 1, "intervalLimitSize": 1,
"intervalType": 69737947.09434697 "intervalType": 69737947.09434697,
"jumUrl": '',
}, },
{ {
"code": "xhjf_{300}", "code": "xhjf_{300}",
...@@ -75,7 +77,8 @@ export default [ ...@@ -75,7 +77,8 @@ export default [
"title": "消耗300积分", "title": "消耗300积分",
"completedSize": 0, "completedSize": 0,
"intervalLimitSize": 1, "intervalLimitSize": 1,
"intervalType": 15800400.399293274 "intervalType": 15800400.399293274,
"jumUrl": '',
}, },
{ {
"code": "yqzl", "code": "yqzl",
...@@ -84,7 +87,8 @@ export default [ ...@@ -84,7 +87,8 @@ export default [
"title": "邀请助力", "title": "邀请助力",
"completedSize": 3, "completedSize": 3,
"intervalLimitSize": 6, "intervalLimitSize": 6,
"intervalType": -54395962.26549375 "intervalType": -54395962.26549375,
"jumUrl": '',
}, },
{ {
"code": "yqzl_new", "code": "yqzl_new",
...@@ -93,7 +97,8 @@ export default [ ...@@ -93,7 +97,8 @@ export default [
"title": "邀请新用户", "title": "邀请新用户",
"completedSize": 3, "completedSize": 3,
"intervalLimitSize": 6, "intervalLimitSize": 6,
"intervalType": -54395962.26549375 "intervalType": -54395962.26549375,
"jumUrl": '',
}, },
{ {
"code": "scan", "code": "scan",
...@@ -102,7 +107,8 @@ export default [ ...@@ -102,7 +107,8 @@ export default [
"title": "扫码", "title": "扫码",
"completedSize": 3, "completedSize": 3,
"intervalLimitSize": 6, "intervalLimitSize": 6,
"intervalType": -54395962.26549375 "intervalType": -54395962.26549375,
"jumUrl": '',
}, },
{ {
"code": "browse_{x}", "code": "browse_{x}",
...@@ -111,7 +117,8 @@ export default [ ...@@ -111,7 +117,8 @@ export default [
"title": "浏览", "title": "浏览",
"completedSize": 3, "completedSize": 3,
"intervalLimitSize": 6, "intervalLimitSize": 6,
"intervalType": -54395962.26549375 "intervalType": -54395962.26549375,
"jumUrl": '',
}, },
], ],
"boolNeedChallengeCompletePop": false, "boolNeedChallengeCompletePop": false,
......
...@@ -11,6 +11,7 @@ import Finish_task from '../../../components/finish_task/finish_task'; ...@@ -11,6 +11,7 @@ import Finish_task from '../../../components/finish_task/finish_task';
import Consume_qg from '../../../components/consume_qg/consume_qg'; import Consume_qg from '../../../components/consume_qg/consume_qg';
import Consume_credits from '../../../components/consume_credits/consume_credits'; import Consume_credits from '../../../components/consume_credits/consume_credits';
import Renewmodule from '../../../components/renewmodule/renewmodule'; import Renewmodule from '../../../components/renewmodule/renewmodule';
import { unwatchPageVisibility, watchPageVisibility } from '@/core/page-visibility-notify';
@observer @observer
class Check extends React.Component<any, any> { class Check extends React.Component<any, any> {
...@@ -22,10 +23,24 @@ class Check extends React.Component<any, any> { ...@@ -22,10 +23,24 @@ class Check extends React.Component<any, any> {
componentDidMount() { componentDidMount() {
store.getTaskInfo() store.getTaskInfo()
store.getBaseIndex() store.getBaseIndex()
watchPageVisibility(this.onPageVisibilityChange)
}
componentWillUnmount() {
unwatchPageVisibility(this.onPageVisibilityChange);
}
/** 页面显隐行 */
onPageVisibilityChange = (visible) => {
console.log('页面' + visible ? '可见' : '不可见')
if (visible) {
store.getTaskInfo(); //跳转回来,刷接口
}
} }
// 按钮 // 按钮
handlegofinish = async (type, n, code, title) => { handlegofinish = async (type, n, code, title, jumpUrl) => {
const { jfNum = 0, qgNum = 0 } = store?.baseInfo || {}; const { jfNum = 0, qgNum = 0 } = store?.baseInfo || {};
if (type === "xhqg") { if (type === "xhqg") {
if (n <= qgNum) { if (n <= qgNum) {
...@@ -44,14 +59,11 @@ class Check extends React.Component<any, any> { ...@@ -44,14 +59,11 @@ class Check extends React.Component<any, any> {
} else if (type === "yqzl_new") { } else if (type === "yqzl_new") {
// todo // todo
} else if (type === "scan") { } else if (type === "scan") {
// todo // todo
wx.miniProgram.switchTab({ url: jumpUrl });
} else if (type === "browse") { } else if (type === "browse") {
// wx.miniProgram.switchTab({ url: jumpUrl }) await API.getChallenegeComplate({ taskCode: code });
const { success } = await API.getChallenegeComplate({ taskCode: code }); window.location.href = jumpUrl;
if (success) {
ModalCtrl.showModal(Finish_task, { title });
}
store.getTaskInfo();
} }
}; };
...@@ -141,7 +153,7 @@ class Check extends React.Component<any, any> { ...@@ -141,7 +153,7 @@ class Check extends React.Component<any, any> {
{Array.isArray(taskInfoList) && {Array.isArray(taskInfoList) &&
taskInfoList.length > 0 && taskInfoList.length > 0 &&
taskInfoList?.map((v, i) => { taskInfoList?.map((v, i) => {
const { title, subTitle, icon, code, completedSize, intervalLimitSize } = v || {}; const { title, subTitle, icon, code, completedSize, intervalLimitSize, jumpUrl } = v || {};
// 获取按钮状态 // 获取按钮状态
const renderActionButton = (code, completedSize, intervalLimitSize) => { const renderActionButton = (code, completedSize, intervalLimitSize) => {
...@@ -157,7 +169,7 @@ class Check extends React.Component<any, any> { ...@@ -157,7 +169,7 @@ class Check extends React.Component<any, any> {
return ( return (
<Button <Button
className="gofinish" className="gofinish"
onClick={() => this.handlegofinish("xhqg", n, code, title)} onClick={() => this.handlegofinish("xhqg", n, code, title, '')}
/> />
); );
} }
...@@ -168,7 +180,7 @@ class Check extends React.Component<any, any> { ...@@ -168,7 +180,7 @@ class Check extends React.Component<any, any> {
return ( return (
<Button <Button
className="gofinish" className="gofinish"
onClick={() => this.handlegofinish("xhjf", n, code, title)} onClick={() => this.handlegofinish("xhjf", n, code, title, '')}
/> />
); );
} }
...@@ -177,7 +189,7 @@ class Check extends React.Component<any, any> { ...@@ -177,7 +189,7 @@ class Check extends React.Component<any, any> {
return ( return (
<Button <Button
className="gofinish" className="gofinish"
onClick={() => this.handlegofinish("yqzl", '', code, title)} onClick={() => this.handlegofinish("yqzl", '', code, title, '')}
/> />
) )
} }
...@@ -186,27 +198,27 @@ class Check extends React.Component<any, any> { ...@@ -186,27 +198,27 @@ class Check extends React.Component<any, any> {
return ( return (
<Button <Button
className="gofinish" className="gofinish"
onClick={() => this.handlegofinish("yqzl_new", '', code, title)} onClick={() => this.handlegofinish("yqzl_new", '', code, title, '')}
/> />
) )
} }
// 扫码 // 扫码
case code.startsWith("scan"): { case code.startsWith("scan"): {
const number = (code.split("_")[1]); // const number = (code.split("_")[1]);
const n = parseInt(number.replace(/[{}]/g, ''), 10); // const n = parseInt(number.replace(/[{}]/g, ''), 10);
return ( return (
<Button <Button
className="gofinish" className="gofinish"
onClick={() => this.handlegofinish("scan", '', code, title)} onClick={() => this.handlegofinish("scan", '', code, title, jumpUrl)}
/> />
); );
} }
// 浏览 // 浏览
case code.startsWith("browse_"): { case code.startsWith("browse"): {
return ( return (
<Button <Button
className="gofinish" className="gofinish"
onClick={() => this.handlegofinish("browse", '', code, title)} onClick={() => this.handlegofinish("browse", '', code, title, jumpUrl)}
/> />
); );
} }
......
...@@ -173,6 +173,7 @@ class Store { ...@@ -173,6 +173,7 @@ class Store {
completedSize: number; completedSize: number;
intervalLimitSize: number; intervalLimitSize: number;
intervalType: number; intervalType: number;
jumpUrl?: string;
}>; }>;
boolNeedChallengeCompletePop?: boolean; boolNeedChallengeCompletePop?: boolean;
latestChallengeSuccessTime?: number; latestChallengeSuccessTime?: number;
......
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