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

modify

parent 6b25127f
......@@ -57,7 +57,8 @@ export default [
"title": "签到",
"completedSize": 0,
"intervalLimitSize": 1,
"intervalType": -18649400.705077305
"intervalType": -18649400.705077305,
"jumUrl": '',
},
{
"code": "xhqg_{200}",
......@@ -66,7 +67,8 @@ export default [
"title": "消耗200青果",
"completedSize": 0,
"intervalLimitSize": 1,
"intervalType": 69737947.09434697
"intervalType": 69737947.09434697,
"jumUrl": '',
},
{
"code": "xhjf_{300}",
......@@ -75,7 +77,8 @@ export default [
"title": "消耗300积分",
"completedSize": 0,
"intervalLimitSize": 1,
"intervalType": 15800400.399293274
"intervalType": 15800400.399293274,
"jumUrl": '',
},
{
"code": "yqzl",
......@@ -84,7 +87,8 @@ export default [
"title": "邀请助力",
"completedSize": 3,
"intervalLimitSize": 6,
"intervalType": -54395962.26549375
"intervalType": -54395962.26549375,
"jumUrl": '',
},
{
"code": "yqzl_new",
......@@ -93,7 +97,8 @@ export default [
"title": "邀请新用户",
"completedSize": 3,
"intervalLimitSize": 6,
"intervalType": -54395962.26549375
"intervalType": -54395962.26549375,
"jumUrl": '',
},
{
"code": "scan",
......@@ -102,7 +107,8 @@ export default [
"title": "扫码",
"completedSize": 3,
"intervalLimitSize": 6,
"intervalType": -54395962.26549375
"intervalType": -54395962.26549375,
"jumUrl": '',
},
{
"code": "browse_{x}",
......@@ -111,7 +117,8 @@ export default [
"title": "浏览",
"completedSize": 3,
"intervalLimitSize": 6,
"intervalType": -54395962.26549375
"intervalType": -54395962.26549375,
"jumUrl": '',
},
],
"boolNeedChallengeCompletePop": false,
......
......@@ -11,6 +11,7 @@ import Finish_task from '../../../components/finish_task/finish_task';
import Consume_qg from '../../../components/consume_qg/consume_qg';
import Consume_credits from '../../../components/consume_credits/consume_credits';
import Renewmodule from '../../../components/renewmodule/renewmodule';
import { unwatchPageVisibility, watchPageVisibility } from '@/core/page-visibility-notify';
@observer
class Check extends React.Component<any, any> {
......@@ -22,10 +23,24 @@ class Check extends React.Component<any, any> {
componentDidMount() {
store.getTaskInfo()
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 || {};
if (type === "xhqg") {
if (n <= qgNum) {
......@@ -44,14 +59,11 @@ class Check extends React.Component<any, any> {
} else if (type === "yqzl_new") {
// todo
} else if (type === "scan") {
// todo
// todo
wx.miniProgram.switchTab({ url: jumpUrl });
} else if (type === "browse") {
// wx.miniProgram.switchTab({ url: jumpUrl })
const { success } = await API.getChallenegeComplate({ taskCode: code });
if (success) {
ModalCtrl.showModal(Finish_task, { title });
}
store.getTaskInfo();
await API.getChallenegeComplate({ taskCode: code });
window.location.href = jumpUrl;
}
};
......@@ -141,7 +153,7 @@ class Check extends React.Component<any, any> {
{Array.isArray(taskInfoList) &&
taskInfoList.length > 0 &&
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) => {
......@@ -157,7 +169,7 @@ class Check extends React.Component<any, any> {
return (
<Button
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> {
return (
<Button
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> {
return (
<Button
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> {
return (
<Button
className="gofinish"
onClick={() => this.handlegofinish("yqzl_new", '', code, title)}
onClick={() => this.handlegofinish("yqzl_new", '', code, title, '')}
/>
)
}
// 扫码
case code.startsWith("scan"): {
const number = (code.split("_")[1]);
const n = parseInt(number.replace(/[{}]/g, ''), 10);
// const number = (code.split("_")[1]);
// const n = parseInt(number.replace(/[{}]/g, ''), 10);
return (
<Button
className="gofinish"
onClick={() => this.handlegofinish("scan", '', code, title)}
onClick={() => this.handlegofinish("scan", '', code, title, jumpUrl)}
/>
);
}
// 浏览
case code.startsWith("browse_"): {
case code.startsWith("browse"): {
return (
<Button
className="gofinish"
onClick={() => this.handlegofinish("browse", '', code, title)}
onClick={() => this.handlegofinish("browse", '', code, title, jumpUrl)}
/>
);
}
......
......@@ -173,6 +173,7 @@ class Store {
completedSize: number;
intervalLimitSize: number;
intervalType: number;
jumpUrl?: string;
}>;
boolNeedChallengeCompletePop?: boolean;
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