wjx 4 周之前
父节点
当前提交
831407f6ab

+ 8 - 7
src/pages/dataStatisticsNovel/weChat/todayRanking/index.tsx

@@ -6,7 +6,7 @@ import { useAccess, useModel, useRequest } from '@umijs/max';
 import { Card, message } from 'antd';
 import React, { useEffect, useRef, useState } from 'react';
 import columns12 from './tableConfig';
-import { getAccApi } from '@/services/dataStatisticsNovel';
+import { getChannelListApi } from '@/services/dataStatisticsNovel';
 import moment from 'moment';
 import { getLocalStoragePage } from '@/utils';
 
@@ -25,7 +25,7 @@ const TodayRanking: React.FC = () => {
     const access = useAccess()
 
     const getcHannelStatRankList = useRequest((params) => getcHannelStatRankListApi(params), { manual: true })
-    const getAcc = useRequest((params) => getAccApi(params), { manual: true })
+    const getAcc = useRequest(() => getChannelListApi(), { manual: true })
     /*****************************************/
 
     useEffect(() => {
@@ -38,15 +38,16 @@ const TodayRanking: React.FC = () => {
     }
 
     // 点击公众号跳转
-    const weChatJump = (data: any) => {
-        getAcc.run({ user_id: initialState?.currentUser?.userId, name: data?.channel, pitcher_id: data.period_id }).then(res => {
-            if (res && res?.data && res?.data?.length > 0) {
-                if (res?.data?.data?.findIndex((item: { nick_name: string }) => item?.nick_name === data?.channel) === -1) {
+    const weChatJump = ({ channel, channel_id }: any) => {
+        getAcc.run().then(res => {
+            const data = res ? Object.keys(res).map(key => ({ label: res[key], value: Number(key) })) : []
+            if (data?.length) {
+                if (data?.findIndex((item: { label: string }) => item?.label === channel) === -1) {
                     message.error('没有这个公众号的权限')
                     return
                 }
                 const queryFormNovel = JSON.parse(localStorage.getItem('QUERYFORMNOVEL') || '{}')
-                localStorage.setItem('QUERYFORMNOVEL', JSON.stringify({ ...queryFormNovel, channel_ids: [data.channel_id] }))
+                localStorage.setItem('QUERYFORMNOVEL', JSON.stringify({ ...queryFormNovel, channel_ids: [channel_id] }))
                 window.location.href = '#/dataStatisticsNovel/weChat/payTrend'
             } else {
                 message.error('没有这个公众号的权限')

+ 3 - 3
src/pages/dataStatisticsNovel/weChat/todayRanking/tableConfig.tsx

@@ -1,6 +1,6 @@
 import WidthEllipsis from "@/components/WidthEllipsis";
-import { Progress, Statistic } from "antd";
-
+import { Progress, Statistic, Typography } from "antd";
+const { Text } = Typography;
 function columns12(handleBook: (data: { book_names: string[] }) => void, weChatJump: (data: any) => void): NOVEL_DATA_API.ColumnsProps[] {
 
     return [
@@ -25,7 +25,7 @@ function columns12(handleBook: (data: { book_names: string[] }) => void, weChatJ
                             b[2] = '*'
                             newchannel = b.join('')
                         }
-                        return <a onClick={() => weChatJump(b)}>{newchannel || a}</a>
+                        return <a style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', width: '100%', display: 'block' }} onClick={() => weChatJump(b)}>{newchannel || a}</a>
                     }
                 },
                 {

+ 1 - 10
src/services/dataStatisticsNovel/index.ts

@@ -13,7 +13,7 @@ export async function getPitcherListApi() {
 /** 公众号列表 POST /novel-data/base/channel_group/get_channel */
 export async function getChannelListApi() {
   return request<API.Result>(`${api}/novel-data/base/channel_group/get_channel`, {
-    method: 'POST',
+    method: 'POST'
   });
 }
 
@@ -45,13 +45,4 @@ export async function getPeriodListApi() {
   return request<API.Result>(`${api}/novel-data/base/channel_group/get_period`, {
     method: 'POST'
   });
-}
-
-
-/** 搜索公众号 POST /novel-data/operate/channel_group/get_channel */
-export async function getAccApi(data: any) {
-  return request<API.Result>(`${api}/novel-data/operate/channel_group/get_channel`, {
-    method: 'POST',
-    data
-  });
 }