import Taro, { canIUse, Component } from '@tarojs/taro' import { View, Picker, ScrollView } from '@tarojs/components' import { connect } from '@tarojs/redux' import * as template from '@actions/template' import * as actions from '@actions/increase' import { getWindowHeight } from '@utils/style' import './increase.scss' const RECOMMEND_SIZE = 20 @connect(state => state.home, { ...actions, ...template }) class Increase extends Component { config = { navigationBarTitleText: '生成报告' } state = { selector: [], loaded: false, loading: false, lastItemId: 0, hasMore: true, selectorChecked: {}, } componentDidMount() { this.getData() } getData() { let payload = {} this.props.getList(payload).then((data) => { let list = data.items list.push({ id: null, name: "空白模板" }) this.setState({ loading: false, selector: list, }) }).catch(() => { this.setState({ loading: false }) }) } onChange = e => { this.creatReports(this.state.selector[e.detail.value]) } // 创建报告 creatReports(obj) { const payload = { templateId: obj.id, } this.props.creatReport(payload).then((data) => { this.setState({ loading: false, }) Taro.navigateTo({ url: "/pages/user/reportdetail?id=" + data }) }).catch(() => { this.setState({ loading: false }) }) } render() { return ( + 新建报告 ) } } export default Increase