fix:注册页默认不勾选

master
blak-kong 2 years ago
parent 7b9f47712a
commit 8c544a17df

@ -1,8 +1,10 @@
import classnames from "classnames";
import Taro from "@tarojs/taro";
import dayjs, { Dayjs } from "dayjs";
import React from "react";
import { Text, View, Block } from "@tarojs/components";
import { DatetimePicker, Popup } from "@antmjs/vantui";
import _ from "lodash";
import {
AtCalendarControllerProps,
@ -11,13 +13,16 @@ import {
import "./index.less";
let _currentDate = 0;
export default class AtCalendarController extends React.Component<any, any> {
public constructor(props: any) {
super(props);
this.state = {
showDatePicker: false,
selectDate: 0,
curDate: 0,
curDate: dayjs(this.props.currentDate).valueOf(),
tempDate: 0,
};
}
@ -26,7 +31,7 @@ export default class AtCalendarController extends React.Component<any, any> {
};
onInput = (e) => {
this.setState({ curDate: e.detail });
_currentDate = e.detail;
};
onClickStop = (e) => {
@ -34,8 +39,7 @@ export default class AtCalendarController extends React.Component<any, any> {
};
onSelectDate = () => {
let { curDate } = this.state;
this.props.onSelectDate(curDate);
this.props.onSelectDate(_currentDate);
this.onPopupClose();
};
@ -43,6 +47,10 @@ export default class AtCalendarController extends React.Component<any, any> {
this.setState({ showDatePicker: false });
};
onConfirm(e) {
console.log("confirm", e);
}
public render(): JSX.Element {
const {
generateDate,
@ -70,7 +78,9 @@ export default class AtCalendarController extends React.Component<any, any> {
? dayjsMaxDate.format("YYYY-MM")
: "";
let { showDatePicker, selectDate, curDate } = this.state;
let { showDatePicker, curDate } = this.state;
_currentDate = curDate;
return (
<Block>
@ -127,9 +137,9 @@ export default class AtCalendarController extends React.Component<any, any> {
</View>
<DatetimePicker
type="date"
value={dayjs(currentDate).valueOf()}
value={curDate}
maxDate={maxDate}
onInput={this.onInput}
onInput={_.throttle(this.onInput.bind(this), 500)}
/>
<View className="btn_confirm" onClick={this.onSelectDate}>

@ -60,7 +60,7 @@ export default class PopupPrivacy extends Component<any, any> {
});
};
handleAgreePrivacyAuthorization = (event) => {
Taro.setStorageSync("isPrivacyPopup", "true");
// Taro.setStorageSync("isPrivacyPopup", "true");
this.props.closePrivacy(); // 通知父组件关闭
};

@ -70,7 +70,7 @@
}
.common-popup-btn2:first-child {
margin-left: 22rpx;
margin-right: 22rpx;
background-color: transparent;
}

@ -34,12 +34,10 @@ export default class About extends Component<any, any> {
// this.setState({ version: res.data.data.value });
// }
const accountInfo = Taro.getAccountInfoSync();
console.log("accountInfo", accountInfo);
if (accountInfo?.miniProgram?.version) {
this.setState({
version: accountInfo?.miniProgram?.version || "暂无",
});
}
this.setState({
version: accountInfo?.miniProgram?.version || "开发版",
// accountInfo?.miniProgram?.envVersion,
});
}
render() {

@ -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));
},

@ -12,9 +12,6 @@ import {
SwiperItem,
} from "@tarojs/components";
// import { Toast } from "@antmjs/vantui";
// const Toast_ = Toast.createOnlyToast();
/*** redux ***/
import { connect } from "react-redux";
import { userRefresh } from "../../store/features/userInfo";
@ -57,7 +54,6 @@ class Initiate extends Component<any, any> {
Taro.setStorageSync("isWelcome", true);
await this.initData();
} else {
// this.setBg();
go("/pages/entry/entry");
}
}
@ -79,12 +75,15 @@ class Initiate extends Component<any, any> {
let url = "";
if (data.rows.length) {
Taro.setStorageSync("MpSplashDetail_type1", JSON.stringify(data.rows));
}
let bgObj = data.rows.find((item: any) => item.fileSuffix === "video");
if (bgObj) {
url = bgObj.filePath;
this.setState({ url });
let bgObj = data.rows.find((item: any) => item.fileSuffix === "video");
if (bgObj) {
url = bgObj.filePath;
this.setState({ url });
}
} else {
Taro.reLaunch({
url: "/pages/index/index",
});
}
} else {
msg("获取首页视频失败!");

@ -44,7 +44,10 @@ export default class Instrument extends Component<any, any> {
loading: true,
channelList: [],
channelInfo: {
id: "",
image: "",
serial: "",
bind_intro_Video: "",
},
equipmentList: [
{
@ -77,14 +80,20 @@ export default class Instrument extends Component<any, any> {
onSerial = (event) => {
const { value } = event.detail;
this.setState({ "channelInfo.serial": value });
let { channelInfo } = this.state;
channelInfo.serial = value;
this.setState({ channelInfo });
};
onScanCode() {
Taro.scanCode({
scanType: ["qrCode"],
success: (res) => {
this.setState({ "channelInfo.serial": res.result });
let { channelInfo } = this.state;
channelInfo.serial = res.result;
this.setState({ channelInfo });
},
});
}
@ -219,7 +228,7 @@ export default class Instrument extends Component<any, any> {
});
};
async onChangeImg() {
onChangeImg = async () => {
Taro.chooseMedia({
count: 1,
mediaType: ["image"],
@ -230,12 +239,13 @@ export default class Instrument extends Component<any, any> {
// 压缩后文件地址
let compressTempFilePath = compressImage.tempFilePath;
console.log(" this.state", this.state);
let { channelInfo } = this.state;
channelInfo.image = compressTempFilePath;
this.setState({ channelInfo });
},
});
}
};
onSubmit = () => {
const that = this;
@ -338,6 +348,7 @@ export default class Instrument extends Component<any, any> {
className="instrument_img"
src={utilHtml.getHttpsUrl(item.banner)}
mode="aspectFill"
// mode="aspectFit"
></Image>
<View className="desc">{item.titile}</View>
</View>
@ -407,7 +418,10 @@ export default class Instrument extends Component<any, any> {
</View>
<View className="photo_box" onClick={this.onChangeImg}>
{channelInfo.image && (
<Image src={channelInfo.image}></Image>
<Image
src={channelInfo.image}
mode="aspectFill"
></Image>
)}
{!channelInfo.image && (
<Image

@ -8,6 +8,7 @@ import "./integral_list.less";
/*** redux ***/
import { connect } from "react-redux";
import { userRefresh } from "../../store/features/userInfo";
import { otherSettingRefresh } from "../../store/features/otherSetting";
/*** redux end ***/
/** 自定义组件 **/
@ -34,6 +35,12 @@ class IntegralList extends Component<any, any> {
userinfo: {
...this.props.userInfo,
},
otherSetting: {
// skipAppid: "",
// skipPath: "",
// envVersion: "",
...this.props.otherSetting,
},
page: 1,
list: [],
isIntegral: false, // 积分规则
@ -74,8 +81,6 @@ class IntegralList extends Component<any, any> {
GetOtherSetting = async () => {
let res = await GetOtherSetting();
if (res.data.code === 200) {
this.props.otherSettingRefresh(res.data.data);
let { otherSetting } = this.state;
otherSetting.skipAppid = res.data.data.skipAppid;
otherSetting.skipPath = res.data.data.skipPath;
@ -92,14 +97,14 @@ class IntegralList extends Component<any, any> {
envVersion: otherSetting.envVersion,
success(res) {
// 打开成功
Taro.reLaunch({
url: "/pages/index/index",
});
// Taro.reLaunch({
// url: "/pages/index/index",
// });
},
fail(res) {
Taro.reLaunch({
url: "/pages/index/index",
});
// Taro.reLaunch({
// url: "/pages/index/index",
// });
},
});
};
@ -227,9 +232,10 @@ class IntegralList extends Component<any, any> {
style={{
width: "100%",
height: "600rpx",
backgroundColor: "#666",
// backgroundColor: "#666",
}}
src=""
src={require("../../img/qrcode.jpg")}
mode="aspectFit"
></Image>
<View style={{ marginTop: "20rpx" }}>
@ -308,10 +314,14 @@ class IntegralList extends Component<any, any> {
// export default IntegralList
const mapStateToProps = (state) => ({
userInfo: state.userInfo,
otherSetting: state.otherSetting,
});
const mapDispatchToProps = (dispatch) => ({
userRefresh(data) {
dispatch(userRefresh(data));
},
otherSettingRefresh(data) {
dispatch(otherSettingRefresh(data));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(IntegralList);

@ -225,6 +225,7 @@ export default class Message extends Component<any, any> {
);
})}
</View>
<View style="height: 20rpx"></View>
</View>
</ScrollView>
@ -239,7 +240,9 @@ export default class Message extends Component<any, any> {
)}
{list.length > 0 && list.length === total && (
<Text style="color: #666"></Text>
<View style="margin: 10rpx 0;text-align: center;">
<Text style="color: #666;"></Text>
</View>
)}
</View>

@ -28,7 +28,7 @@ class Register extends Component<any, any> {
"width:calc(100% - 100rpx);background:#fff;border-radius: 20rpx;box-shadow: -2rpx 0 12rpx .5rpx rgba(129, 129, 129, 0.1); height: 800rpx; padding: 30rpx;",
titleHeight: "",
menu: {},
isChecked: true,
isChecked: false,
isRegister: false,
isShow: false,
isButtonDisabled: false,

@ -72,6 +72,7 @@ class User extends Component<any, any> {
let res = await RefreshWxUserInfo();
if (res.data.code === 200) {
this.props.userRefresh(res.data.data);
this.setState({ userInfo: res.data.data });
}
};
@ -118,12 +119,12 @@ class User extends Component<any, any> {
gominiapp() {
Taro.navigateToMiniProgram({
appId: this.state.otherSetting.skipAppid,
path: this.state.otherSetting.skipPath,
envVersion: this.state.otherSetting.sysVersion,
appId: "wx438760012de48d74",
path: "/pages/home/home",
envVersion: "release",
success(res) {
// 打开成功
console.log("res", res);
// console.log("res", res);
},
});
}

@ -182,10 +182,11 @@ class UserInfo extends Component<any, any> {
userInfo.areaId = res.data.data.areaId;
userInfo.nickname = res.data.data.nickname;
userInfo.headimg = res.data.data.headimg;
userInfo.integralText = res.data.data.integralText;
this.props.userRefresh(userInfo);
this.setState({ userInfo: userInfo });
if (userInfo.integralText) {
if (res.data.data.integralText) {
this.setState({ isShowIntegralText: true });
} else {
this.goUser();

@ -209,10 +209,11 @@ class UserInfoDetail extends Component<any, any> {
userInfo.areaId = res.data.data.areaId;
userInfo.nickname = res.data.data.nickname;
userInfo.headimg = res.data.data.headimg;
userInfo.integralText = res.data.data.integralText;
this.props.userRefresh(userInfo);
this.setState({ userInfo: userInfo });
if (userInfo.integralText) {
if (res.data.data.integralText) {
this.setState({ isShowIntegralText: true });
} else {
this.goUser();

@ -5,7 +5,7 @@ import { createSlice } from "@reduxjs/toolkit";
const globalStoreReducer = createSlice({
name: "globalStore", // store的名字
initialState: {
domain: "http://flossom.yq-h5.cn:8080", // 请求地址
domain: "https://flossom.yq-h5.cn/prod-api/", // 请求地址
// domain: "http://192.168.10.147:8080", // 请求地址
// 是否首次进入首页
isShowIndexFlag: false,

Loading…
Cancel
Save