You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.0 KiB
TypeScript

import { Component } from "react";
import { Dialog } from "@antmjs/vantui";
const Dialog_ = Dialog.createOnlyDialog();
/*** redux ***/
import { connect } from "react-redux";
import { setColor, resetColor } from "../../../store/features/navigation";
import { userRefresh } from "../../../store/features/userInfo";
/*** redux end ***/
import "./registerModal.less";
import { Block } from "@tarojs/components";
import { go } from "../../../utils/traoAPI";
class RegisterModal extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "导航组件",
statusBarHeight: 40, // 状态栏高度
navigationBarHeight: 0, // 导航栏高度
navHeight: 40,
};
this.initData();
}
async onLoad() {
// // 状态栏高度
}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {}
componentDidHide() {}
async initData() {
this.alertRegister();
}
public alertRegister = () => {
if (!this.props.mobile) {
this.setColor("#4C4C4C");
setTimeout(() => {
Dialog_.alert({
title: "提示",
message: "暂未授权注册,请点击注册",
theme: "round-button",
}).then((value) => {
this.resetColor();
this.goRegister();
});
}, 300);
} else {
go("/pages/instrument/instrument");
}
};
setColor = (color) => {
this.props.setColor(color);
};
resetColor = () => {
this.props.resetColor();
};
goRegister() {
go("/pages/register/register");
}
render() {
return (
<Block>
<Dialog_ />
</Block>
);
}
}
const mapStateToProps = (state) => ({
mobile: state.userInfo.mobile,
});
const mapDispatchToProps = (dispatch) => ({
setColor(color) {
dispatch(setColor(color));
},
resetColor() {
dispatch(resetColor());
},
userRefresh(data) {
dispatch(userRefresh(data));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(RegisterModal);