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';

const sid1 = Math.random().toString(36).substring(2, 8);

export default (props) => {

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

  const params = React.useMemo(() => {
    return {bizStatus, isMine: true};
  }, [bizStatus]);

  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
        sid={sid1}
        request={getTaFeedback}
        params={params}
        renderItem={(item) => (
          <Card key={item.issueId} issue={item} onClick={() => onClick(item)} />
        )}
      />
    </Page>
  )
}
