fix:注册页默认不勾选

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

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

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

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

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

@ -31,7 +31,6 @@ import Navbar from "../../components/navbar/navbar";
import { import {
RefreshWxUserInfo, RefreshWxUserInfo,
GetNoReadMessageNum, GetNoReadMessageNum,
GetOtherSetting,
GetSitePopupList, GetSitePopupList,
GetSiteCarousel, GetSiteCarousel,
GetSiteAddTag, GetSiteAddTag,
@ -106,48 +105,51 @@ class Index extends Component<any, any> {
showInit() { showInit() {
const isFirst = Taro.getStorageSync("isWelcome"); const isFirst = Taro.getStorageSync("isWelcome");
const mobile = Taro.getStorageSync("mobile");
if (isFirst) { if (isFirst) {
this.checkShowPrivacyPopup(); 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() { checkShowPrivacyPopup() {
const isPrivacy = Taro.getStorageSync("isPrivacy"); Taro.getPrivacySetting({
if (isPrivacy !== "true") { success: (res) => {
Taro.getPrivacySetting({ // console.log("检测是否弹出隐私协议", res); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
success: (res) => { if (res.needAuthorization) {
// console.log("检测是否弹出隐私协议", res); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' } this.setState({ isShowPrivacyPopup: true });
if (res.needAuthorization) { // Taro.setStorageSync("isPrivacy", "true");
// 需要弹出隐私协议 // 需要弹出隐私协议
const isPrivacyPopup = Taro.getStorageSync("isPrivacyPopup"); // const isPrivacyPopup = Taro.getStorageSync("isPrivacyPopup");
if (!isPrivacyPopup) { // if (!isPrivacyPopup) {
// 隐私确认弹窗 // // 隐私确认弹窗
this.setState({ isShowPrivacyPopup: true }); // this.setState({ isShowPrivacyPopup: true });
Taro.setStorageSync("isPrivacy", "true"); // Taro.setStorageSync("isPrivacy", "true");
} // }
} else { } else {
// 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用隐私接口 // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用隐私接口
} this.initData();
}, }
fail: () => {}, },
complete: () => {}, 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-活动模块 // 获取站点管理-弹窗列表 1-首页 2-发现模块 3-活动模块
GetSitePopupList = async () => { GetSitePopupList = async () => {
let res = await GetSitePopupList(1); let res = await GetSitePopupList(1);
@ -242,6 +236,7 @@ class Index extends Component<any, any> {
closePrivacy = () => { closePrivacy = () => {
this.setState({ isShowPrivacyPopup: false }); this.setState({ isShowPrivacyPopup: false });
this.initData();
}; };
closeAlert = () => { closeAlert = () => {
@ -562,9 +557,6 @@ const mapDispatchToProps = (dispatch) => ({
userRefresh(data) { userRefresh(data) {
dispatch(userRefresh(data)); dispatch(userRefresh(data));
}, },
otherSettingRefresh(data) {
dispatch(otherSettingRefresh(data));
},
setIndexFlag(data) { setIndexFlag(data) {
dispatch(setIndexFlag(data)); dispatch(setIndexFlag(data));
}, },

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

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

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

@ -225,6 +225,7 @@ export default class Message extends Component<any, any> {
); );
})} })}
</View> </View>
<View style="height: 20rpx"></View>
</View> </View>
</ScrollView> </ScrollView>
@ -239,7 +240,9 @@ export default class Message extends Component<any, any> {
)} )}
{list.length > 0 && list.length === total && ( {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> </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;", "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: "", titleHeight: "",
menu: {}, menu: {},
isChecked: true, isChecked: false,
isRegister: false, isRegister: false,
isShow: false, isShow: false,
isButtonDisabled: false, isButtonDisabled: false,

@ -72,6 +72,7 @@ class User extends Component<any, any> {
let res = await RefreshWxUserInfo(); let res = await RefreshWxUserInfo();
if (res.data.code === 200) { if (res.data.code === 200) {
this.props.userRefresh(res.data.data); this.props.userRefresh(res.data.data);
this.setState({ userInfo: res.data.data });
} }
}; };
@ -118,12 +119,12 @@ class User extends Component<any, any> {
gominiapp() { gominiapp() {
Taro.navigateToMiniProgram({ Taro.navigateToMiniProgram({
appId: this.state.otherSetting.skipAppid, appId: "wx438760012de48d74",
path: this.state.otherSetting.skipPath, path: "/pages/home/home",
envVersion: this.state.otherSetting.sysVersion, envVersion: "release",
success(res) { 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.areaId = res.data.data.areaId;
userInfo.nickname = res.data.data.nickname; userInfo.nickname = res.data.data.nickname;
userInfo.headimg = res.data.data.headimg; userInfo.headimg = res.data.data.headimg;
userInfo.integralText = res.data.data.integralText;
this.props.userRefresh(userInfo); this.props.userRefresh(userInfo);
this.setState({ userInfo: userInfo }); this.setState({ userInfo: userInfo });
if (userInfo.integralText) { if (res.data.data.integralText) {
this.setState({ isShowIntegralText: true }); this.setState({ isShowIntegralText: true });
} else { } else {
this.goUser(); this.goUser();

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

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

Loading…
Cancel
Save