Browse Source

fix:跳转当前小程序页面bug

lvkun 3 years ago
parent
commit
d22d7b467e
3 changed files with 74 additions and 23 deletions
  1. 34 14
      src/pages/setting/banner/item.tsx
  2. 10 8
      src/pages/setting/banner/modal.tsx
  3. 30 1
      src/pages/tieba/posts/index.tsx

+ 34 - 14
src/pages/setting/banner/item.tsx

@@ -1,15 +1,20 @@
-import React, {
-  useCallback,
-  useEffect,
-  useRef,
-  useState,
-  useImperativeHandle,
-  forwardRef,
-  useLayoutEffect,
-  memo,
-} from 'react';
-
-import { Button, Card, Col, Form, Input, Row, Select, Switch, Popconfirm } from 'antd';
+import React, { useEffect, useState, memo } from 'react';
+
+import {
+  Button,
+  Card,
+  Col,
+  Form,
+  Input,
+  Row,
+  Select,
+  Switch,
+  Popconfirm,
+  Tooltip,
+  Space,
+} from 'antd';
+
+import { QuestionCircleOutlined } from '@ant-design/icons';
 
 import CustomUpload from '@/components/upload/index';
 
@@ -92,8 +97,23 @@ const BannerItem: React.FC<IProps> = ({ itemData, collecrtItem, delItem }) => {
         {/* 跳转到小程序 */}
         {form.getFieldValue('jumpType') === Etype.miniprogram && (
           <>
-            <Form.Item label="appid" name="jumpAppId" required>
-              <Input onChange={(e) => changeForm('jumpAppId', e.target.value)} />
+            <Form.Item
+              label={
+                <span>
+                  <Space style={{ marginRight: 4 }}>appid</Space>
+                  <Space>
+                    <Tooltip title="不填appid, 默认跳转到精英俱乐部">
+                      <QuestionCircleOutlined />
+                    </Tooltip>
+                  </Space>
+                </span>
+              }
+              name="jumpAppId"
+            >
+              <Input
+                placeholder="不填appid, 默认跳转到精英俱乐部"
+                onChange={(e) => changeForm('jumpAppId', e.target.value)}
+              />
             </Form.Item>
 
             <Form.Item label="跳转地址" name="jumpPath">

+ 10 - 8
src/pages/setting/banner/modal.tsx

@@ -1,4 +1,4 @@
-import React, { memo, useCallback, useEffect, useState } from 'react';
+import React, { useEffect, useState } from 'react';
 
 import { Button, Col, Drawer, Row, Empty, message, Spin } from 'antd';
 
@@ -143,13 +143,15 @@ const BannerDrawer: React.FC<IProps> = ({ visible, opraModal, roleData }) => {
           msg: '存在跳转地址未填写',
           index,
         };
-      } else if (_banner.jumpType === EJumpType.h5 && !_banner.jumpPath) {
-        obj = {
-          r: false,
-          msg: '存在appid未填写',
-          index,
-        };
-      } else if (!_banner.imgUrl) {
+      }
+      // else if (_banner.jumpType === EJumpType.h5 && !_banner.jumpPath) {
+      //   obj = {
+      //     r: false,
+      //     msg: '存在appid未填写',
+      //     index,
+      //   };
+      // }
+      else if (!_banner.imgUrl) {
         obj = {
           r: false,
           msg: '图片封面未上传',

+ 30 - 1
src/pages/tieba/posts/index.tsx

@@ -22,6 +22,7 @@ import { useClassify } from '@/hooks/tieba/index';
 import type { initstateType, actionType } from './data';
 
 import DetailModal from './modal';
+import { Record } from 'immutable';
 
 const request = (url: string): Promise<any> => {
   return new Promise((resolve, reject) => {
@@ -216,7 +217,18 @@ const Posts: React.FC = () => {
           dataSource={postsList}
           pagination={{ total, onChange: (page) => dispatch({ type: 'curPage', value: page }) }}
         >
-          <Table.Column key="label" dataIndex="label" title="帖子标题"></Table.Column>
+          <Table.Column
+            key="label"
+            dataIndex="label"
+            title="帖子标题"
+            ellipsis
+            width={200}
+            render={(text, record) => (
+              <Tooltip title={'pagesarticle'} placement="topLeft">
+                <span>{text}</span>
+              </Tooltip>
+            )}
+          />
           <Table.Column
             key="content"
             width={320}
@@ -244,6 +256,23 @@ const Posts: React.FC = () => {
           />
           <Table.Column key="replyNum" dataIndex="replyNum" title="回帖数"></Table.Column>
           <Table.Column key="praiseNum" dataIndex="praiseNum" title="点赞数"></Table.Column>
+          <Table.Column
+            key="path"
+            dataIndex="path"
+            title="链接地址"
+            render={(text, record: Record<string, any>) => (
+              <Tooltip
+                title={
+                  record.hasOwnProperty('coverImg')
+                    ? `/pages/article/index?id=${record.id}&type=POSTS`
+                    : `/pages/article/index?id=${record.id}&type=ISSUES`
+                }
+                placement="topLeft"
+              >
+                <span>/pages/article/index....</span>
+              </Tooltip>
+            )}
+          />
           <Table.Column
             key="action"
             dataIndex="action"