index.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { View, Text, ITouchEvent } from "@tarojs/components";
  2. import Taro, { FC } from "@tarojs/taro";
  3. import classNames from "classnames";
  4. import React from "react";
  5. import { AtIcon } from "taro-ui";
  6. import "./index.scss";
  7. export interface FooterProtocolProps {
  8. style?: React.CSSProperties;
  9. checked: boolean;
  10. setChecked: Function;
  11. }
  12. export const FooterProtocol: FC<FooterProtocolProps> = ({
  13. style,
  14. checked,
  15. setChecked,
  16. }) => {
  17. const handleClick = () => {
  18. setChecked(!checked);
  19. };
  20. const goDetail = (e: ITouchEvent, id: number) => {
  21. e.stopPropagation();
  22. Taro.navigateTo({
  23. url: `/subModule/pages/protocol/index?id=${id}`,
  24. });
  25. };
  26. return (
  27. <View
  28. className={classNames("footer-protocol", { checked })}
  29. style={style}
  30. onClick={handleClick}
  31. >
  32. <View className="footer-protocol__checkbox">
  33. {checked && <AtIcon value="check" size={8} color="#589498" />}
  34. </View>
  35. 阅读并同意
  36. <Text className="primary" onClick={(e) => goDetail(e, 2)}>
  37. 《用户服务协议》
  38. </Text>
  39. <Text className="primary" onClick={(e) => goDetail(e, 3)}>
  40. 《个人信息保护政策》
  41. </Text>
  42. </View>
  43. );
  44. };