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.

185 lines
4.9 KiB
TypeScript

import classnames from "classnames";
import Taro from "@tarojs/taro";
import { Component } from "react";
import {
Block,
View,
Image,
Text,
Button,
PageMeta,
Swiper,
SwiperItem,
} from "@tarojs/components";
import { Popup } from "@antmjs/vantui";
import "./popup.less";
import "./popup-instrument-upload-tips.less";
import "./fade.css";
import { go, goJump } from "../../utils/traoAPI";
/*** props
* isLarge 是否大尺寸
* isShow 是否显示
* data 数据
* @confirm 关闭回调
* ***/
export default class PopupInstrumentUploadTips extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "打卡介绍弹窗",
current: 0,
toRight: false,
isClick: false,
};
}
async onLoad() {}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {}
componentDidHide() {}
initData = () => {
if (this.props.siteData) {
let arr = JSON.parse(JSON.stringify(this.props.siteData));
this.setState({ siteList: arr });
}
};
onClose = () => {
this.props.close();
};
onClickStop = (e) => {
e.stopPropagation();
};
onChange(event) {
const current = event.detail.current;
const { current: curCurrent } = this.state;
const { siteData } = this.props;
if (curCurrent + 2 === siteData.length && current + 1 === siteData.length) {
this.setState({ toRight: true });
}
this.setState({ current });
}
onFinish(event) {
const { current } = event.detail;
const { toRight, isClick } = this.state;
const { siteData } = this.props;
if (current === siteData.length - 1) {
if (toRight || isClick) {
this.setState({ toRight: false, isClick: false });
} else {
// this.toHomePage();
}
}
}
onPrev = async () => {
let { current } = this.state;
this.setState({ current: current - 1 });
};
onNext = async () => {
let { current } = this.state;
if (current === this.props.data.length - 1) {
this.onClose();
} else {
this.setState({ current: current + 1 });
}
};
render() {
let { isShow, data, isLarge, title } = this.props;
let { current } = this.state;
return (
<Block>
<PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} />
<Popup
style="background-color: #fff;"
show={isShow}
closeOnClickOverlay={false}
round
overlayStyle="width: 100vw;padding: 0;"
onClick={this.onClickStop}
>
<View
className="at-icon at-icon-close site-close"
onClick={this.onClose}
></View>
<View className={classnames("common-box upload-tips-common-box")}>
<View className="site-popup-content-box">
<View className="absolutely instrument-swiper-step">
{data.map((item, index) => {
return (
current === index && (
<View className="absolutely" key={"swiper_" + index}>
<View
style={{
width: "100%",
height: "600rpx",
}}
>
<Image
className="cover"
src={item.file}
mode="aspectFit"
></Image>
</View>
<View className="tips-message">{item.message}</View>
</View>
)
);
})}
</View>
</View>
<View>
{data.length === 1 && (
<View className="popup-btn-one">
<Button className="popup-btn" onClick={this.onClose}>
</Button>
</View>
)}
{data.length > 1 && current === 0 && (
<View className="popup-btn-one">
<Button className="popup-btn" onClick={this.onNext}>
</Button>
</View>
)}
{data.length > 1 && current > 0 && (
<View className="common-popup-btns">
<Button
className="common-popup-btn2"
style="color:#000"
onClick={this.onPrev}
>
</Button>
<Button className="common-popup-btn2" onClick={this.onNext}>
{current > 0 && current < data.length - 1 && "下一步"}
{current > 0 && current === data.length - 1 && "知道了"}
</Button>
</View>
)}
</View>
</View>
</Popup>
</Block>
);
}
}