import UserApi from '@/apis/userApi';
import Layout from '@/component/layout';
import { Cell } from '@taroify/core';
import { useRequest } from 'ahooks';
import React, { PropsWithChildren } from 'react';
import { Image } from "@tarojs/components";
import './index.scss'
import SizeBox from '@/component/sizeBox';
import { Arrow } from '@taroify/icons';
import RouteUtil from '@/utils/routeUtil';

interface IAggrementProps {

}

const Aggrement = (props: PropsWithChildren<IAggrementProps>) => {
    const aggrement = useRequest(() => {
        return UserApi.agreementsUsingPost({ data: { "pageView": "user_center_view" } }).toData();
    })
    console.log(666, aggrement);
    return (
        <Layout>
            {
                aggrement.data?.map(p => (
                    <React.Fragment key={p.name}>
                        <Cell size="large"
                            onClick={() => {
                                RouteUtil.toWebViewPage({
                                    url: p.url
                                })
                            }}
                            title={p.name} rightIcon={<Arrow />}></Cell>
                        <SizeBox height={8} />
                    </React.Fragment>
                ))
            }
        </Layout>
    )
}

export default Aggrement;