|
|
|
|
@ -31,7 +31,6 @@ import Navbar from "../../components/navbar/navbar";
|
|
|
|
|
import {
|
|
|
|
|
RefreshWxUserInfo,
|
|
|
|
|
GetNoReadMessageNum,
|
|
|
|
|
GetOtherSetting,
|
|
|
|
|
GetSitePopupList,
|
|
|
|
|
GetSiteCarousel,
|
|
|
|
|
GetSiteAddTag,
|
|
|
|
|
@ -106,48 +105,51 @@ class Index extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
showInit() {
|
|
|
|
|
const isFirst = Taro.getStorageSync("isWelcome");
|
|
|
|
|
const mobile = Taro.getStorageSync("mobile");
|
|
|
|
|
if (isFirst) {
|
|
|
|
|
this.checkShowPrivacyPopup();
|
|
|
|
|
this.GetSitePopupList();
|
|
|
|
|
this.GetSiteCarousel();
|
|
|
|
|
// this.GetOtherSetting(); // 获取小程序设置:商城地址和版本
|
|
|
|
|
|
|
|
|
|
if (mobile) {
|
|
|
|
|
this.GetNoReadMessageNum(); // 查询是否有消息
|
|
|
|
|
// this.RefreshWxUserInfo();
|
|
|
|
|
|
|
|
|
|
// if (!this.state.isShowIndexFlag) {
|
|
|
|
|
// // 仅初次进入首页运行
|
|
|
|
|
// this.GetSitePopupList();
|
|
|
|
|
// this.props.setIndexFlag(true);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 检测是否弹出隐私协议
|
|
|
|
|
checkShowPrivacyPopup() {
|
|
|
|
|
const isPrivacy = Taro.getStorageSync("isPrivacy");
|
|
|
|
|
if (isPrivacy !== "true") {
|
|
|
|
|
Taro.getPrivacySetting({
|
|
|
|
|
success: (res) => {
|
|
|
|
|
// console.log("检测是否弹出隐私协议", res); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
|
|
|
|
|
if (res.needAuthorization) {
|
|
|
|
|
// 需要弹出隐私协议
|
|
|
|
|
const isPrivacyPopup = Taro.getStorageSync("isPrivacyPopup");
|
|
|
|
|
if (!isPrivacyPopup) {
|
|
|
|
|
// 隐私确认弹窗
|
|
|
|
|
this.setState({ isShowPrivacyPopup: true });
|
|
|
|
|
Taro.setStorageSync("isPrivacy", "true");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用隐私接口
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
fail: () => {},
|
|
|
|
|
complete: () => {},
|
|
|
|
|
});
|
|
|
|
|
Taro.getPrivacySetting({
|
|
|
|
|
success: (res) => {
|
|
|
|
|
// console.log("检测是否弹出隐私协议", res); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
|
|
|
|
|
if (res.needAuthorization) {
|
|
|
|
|
this.setState({ isShowPrivacyPopup: true });
|
|
|
|
|
// Taro.setStorageSync("isPrivacy", "true");
|
|
|
|
|
// 需要弹出隐私协议
|
|
|
|
|
// const isPrivacyPopup = Taro.getStorageSync("isPrivacyPopup");
|
|
|
|
|
// if (!isPrivacyPopup) {
|
|
|
|
|
// // 隐私确认弹窗
|
|
|
|
|
// this.setState({ isShowPrivacyPopup: true });
|
|
|
|
|
// Taro.setStorageSync("isPrivacy", "true");
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
// 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用隐私接口
|
|
|
|
|
this.initData();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
fail: () => {},
|
|
|
|
|
complete: () => {
|
|
|
|
|
// 授权完成运行页面初始化
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 页面初始化
|
|
|
|
|
initData() {
|
|
|
|
|
const mobile = Taro.getStorageSync("mobile");
|
|
|
|
|
this.GetSitePopupList();
|
|
|
|
|
this.GetSiteCarousel();
|
|
|
|
|
|
|
|
|
|
if (mobile) {
|
|
|
|
|
this.GetNoReadMessageNum(); // 查询是否有消息
|
|
|
|
|
|
|
|
|
|
// if (!this.state.isShowIndexFlag) {
|
|
|
|
|
// // 仅初次进入首页运行
|
|
|
|
|
// this.GetSitePopupList();
|
|
|
|
|
// this.props.setIndexFlag(true);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -168,14 +170,6 @@ class Index extends Component<any, any> {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 获取小程序设置
|
|
|
|
|
GetOtherSetting = async () => {
|
|
|
|
|
let res = await GetOtherSetting();
|
|
|
|
|
if (res.data.code === 200) {
|
|
|
|
|
this.props.otherSettingRefresh(res.data.data);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 获取站点管理-弹窗列表 1-首页 2-发现模块 3-活动模块
|
|
|
|
|
GetSitePopupList = async () => {
|
|
|
|
|
let res = await GetSitePopupList(1);
|
|
|
|
|
@ -242,6 +236,7 @@ class Index extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
closePrivacy = () => {
|
|
|
|
|
this.setState({ isShowPrivacyPopup: false });
|
|
|
|
|
this.initData();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
closeAlert = () => {
|
|
|
|
|
@ -562,9 +557,6 @@ const mapDispatchToProps = (dispatch) => ({
|
|
|
|
|
userRefresh(data) {
|
|
|
|
|
dispatch(userRefresh(data));
|
|
|
|
|
},
|
|
|
|
|
otherSettingRefresh(data) {
|
|
|
|
|
dispatch(otherSettingRefresh(data));
|
|
|
|
|
},
|
|
|
|
|
setIndexFlag(data) {
|
|
|
|
|
dispatch(setIndexFlag(data));
|
|
|
|
|
},
|
|
|
|
|
|