import React from 'react';
import Taro from '@tarojs/taro';
import { View } from '@tarojs/components';
import Page from '@/layouts/index';
import PowerList from '@/components/PowerList';
import Card from '@/components/IssueCard';
import { getTaFeedback } from '@/services/tafeedback';
import { getIssueStatus } from '@/utils/biz';

export default (props) => {

  const router = Taro.useRouter();
  const { title, bizStatus = '' } = router.params;

  React.useMemo(() => {
    if (title) {
      Taro.setNavigationBarTitle({ title });
    } else {
      Taro.setNavigationBarTitle({ title: '反馈列表' });
    }
  }, [title]);

  const onClick = (item) => {
    Taro.navigateTo({
      url: `/pages/issue/edit/index?id=${item.issueId}`
    })
  }
  
  return (
    <Page>
      <PowerList
        request={getTaFeedback}
        params={{bizStatus, isMine: true}}
        renderItem={(item) => (
          <Card key={item.issueId} issue={item} onClick={() => onClick(item)} />
        )}
      />
    </Page>
  )
}
