|
|
|
|
@ -12,9 +12,8 @@ import { userRefresh } from "../../store/features/userInfo";
|
|
|
|
|
|
|
|
|
|
/** 自定义组件 **/
|
|
|
|
|
import Navbar from "../../components/navbar/navbar";
|
|
|
|
|
/** 自定义组件 **/
|
|
|
|
|
|
|
|
|
|
import PopupAlert from "../../components/popup/popup-alert";
|
|
|
|
|
/** 自定义组件 **/
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
GetOtherSetting,
|
|
|
|
|
@ -25,6 +24,8 @@ import {
|
|
|
|
|
GetCloseOfficialAccount,
|
|
|
|
|
} from "../../utils/Interface";
|
|
|
|
|
|
|
|
|
|
import { msg } from "../../utils/traoAPI";
|
|
|
|
|
|
|
|
|
|
class IntegralList extends Component<any, any> {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
@ -58,8 +59,6 @@ class IntegralList extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
async initData() {
|
|
|
|
|
this.GetObtainUserIntegral();
|
|
|
|
|
// this.checkOfficialAccount();
|
|
|
|
|
this.GetOfficialAccount();
|
|
|
|
|
this.GetIsAttentionOfficialAccount();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -111,27 +110,52 @@ class IntegralList extends Component<any, any> {
|
|
|
|
|
let targetTime = dayjs().month(9).day(30).valueOf();
|
|
|
|
|
// 仅9月30日前触发:提醒过期弹窗
|
|
|
|
|
if (currentTime <= targetTime) {
|
|
|
|
|
let isOfficialAccount = Taro.getStorageSync("isOfficialAccount");
|
|
|
|
|
if (isOfficialAccount) {
|
|
|
|
|
let oldYear = isOfficialAccount;
|
|
|
|
|
let currentYear = dayjs().format("YYYY");
|
|
|
|
|
if (currentYear < oldYear) {
|
|
|
|
|
// 检查:今年未提醒,则弹窗
|
|
|
|
|
this.setState({ isOfficialAccount: true });
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({ isOfficialAccount: true });
|
|
|
|
|
}
|
|
|
|
|
// 检查:今年未提醒,则弹窗
|
|
|
|
|
this.setState({ isOfficialAccount: true });
|
|
|
|
|
// let isOfficialAccount = Taro.getStorageSync("isOfficialAccount");
|
|
|
|
|
// if (isOfficialAccount) {
|
|
|
|
|
// let oldYear = isOfficialAccount;
|
|
|
|
|
// let currentYear = dayjs().format("YYYY");
|
|
|
|
|
// if (currentYear < oldYear) {
|
|
|
|
|
// // 检查:今年未提醒,则弹窗
|
|
|
|
|
// this.setState({ isOfficialAccount: true });
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// this.setState({ isOfficialAccount: true });
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 用户是否已关闭提醒
|
|
|
|
|
GetOfficialAccount = async () => {
|
|
|
|
|
let res = await GetOfficialAccount();
|
|
|
|
|
console.log("GetOfficialAccount", res);
|
|
|
|
|
if (res.data.code === 200) {
|
|
|
|
|
if (!res.data.data) {
|
|
|
|
|
// 如果false则是未关闭提醒
|
|
|
|
|
this.checkOfficialAccount(); // 检测时间,弹窗提示关注公众号
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
// 用户是否关注公众号
|
|
|
|
|
GetIsAttentionOfficialAccount = async () => {
|
|
|
|
|
let res = await GetIsAttentionOfficialAccount();
|
|
|
|
|
console.log("GetIsAttentionOfficialAccount", res);
|
|
|
|
|
if (res.data.code === 200) {
|
|
|
|
|
if (!res.data.data) {
|
|
|
|
|
// 如果false则是没关注
|
|
|
|
|
this.GetOfficialAccount();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 用户关闭提醒
|
|
|
|
|
GetCloseOfficialAccount = async () => {
|
|
|
|
|
let { data } = await GetCloseOfficialAccount();
|
|
|
|
|
if (data.code === 200) {
|
|
|
|
|
msg("已关闭提醒");
|
|
|
|
|
} else {
|
|
|
|
|
msg("操作失败");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
GetObtainUserIntegral = async () => {
|
|
|
|
|
@ -167,8 +191,9 @@ class IntegralList extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
/** 关注公众号弹窗 */
|
|
|
|
|
officialPopupConfirm = () => {
|
|
|
|
|
let currentYear = dayjs().format("YYYY");
|
|
|
|
|
Taro.setStorageSync("isOfficialAccount", currentYear); // 标记:本年度已提醒
|
|
|
|
|
// let currentYear = dayjs().format("YYYY");
|
|
|
|
|
// Taro.setStorageSync("isOfficialAccount", currentYear); // 标记:本年度已提醒
|
|
|
|
|
this.GetCloseOfficialAccount();
|
|
|
|
|
this.officialPopupClose();
|
|
|
|
|
};
|
|
|
|
|
officialPopupClose = () => {
|
|
|
|
|
|