import { View, Text } from '@tarojs/components' import './MetricModalChoose.scss' import { alphaToHex } from '@/utils/tools' import { useTranslation } from 'react-i18next' import { useState } from 'react' import { IconRadio, IconRadioCheck } from '@/components/basic/Icons' import Taro from '@tarojs/taro' export default function Component(props: { themeColor: string, cancel: Function, confirm: Function, array: any, limit: any, orders: any }) { const color = props.themeColor ? props.themeColor : '#ff0000' const [list, setList] = useState(props.array) const [orderList,setOrderList] = useState(props.orders) const min = props.limit.min const max = props.limit.max const { t } = useTranslation() var alpha = alphaToHex(0.4) function cancel() { props.cancel() } function confirm() { // var datas: any = [] // list.map(item => { // item.items.map(data => { // if (data.is_following) { // datas.push(data as any) // } // }) // }) if (min > orderList.length) { Taro.showToast({ icon: 'none', title: t('feature.common.toast.min_value'), }) return } if (max < orderList.length) { Taro.showToast({ icon: 'none', title: t('feature.common.toast.max_value'), }) return } props.confirm(orderList) } function tapItem(obj) { var check = !obj.is_following if (check){ orderList.push({ name:obj.name, code:obj.code }) } else { for (var i =0;i {t('feature.track_something.metric.choose_metric')} 按需选择自己常用的指标 { list.map((item, index) => { return {item.name} { item.items.map((obj, i) => { return tapItem(obj)}> { obj.is_following ? : } {obj.name} }) } }) } 取消 下一步 }