Przeglądaj źródła

Merge branch 'master' of http://192.168.0.115:3000/shaogen1995/qingDao_goods into master

shaogen1995 2 tygodni temu
rodzic
commit
d88f0f34d5

+ 58 - 0
src/pages/Eculture/E2story/E2edit/index.module.scss

@@ -0,0 +1,58 @@
+// .D1edit {
+
+//   // :global {}
+// }
+
+.EditTop {
+  :global {
+    .EdTit {
+      padding: 15px;
+      font-weight: 700;
+      font-size: 18px;
+      display: flex;
+      justify-content: space-between;
+      .ant-btn {
+        margin-left: 15px;
+      }
+      .EdTitBtn {
+        pointer-events: none;
+      }
+    }
+
+    .Edtop1 {
+      border-top: 1px solid #ccc;
+      padding: 15px;
+      display: flex;
+      justify-content: space-between;
+      flex-wrap: wrap;
+      .Edtop1row {
+        display: flex;
+        width: 48%;
+        margin-bottom: 15px;
+        min-height: 32px;
+        line-height: 32px;
+        .Edtop1ll {
+          font-weight: 700;
+          width: 100px;
+          text-align: right;
+
+          span {
+            color: #ff4d4f;
+          }
+        }
+        .Edtop1rr {
+          width: calc(100% - 100px);
+          & > div {
+            width: 100%;
+          }
+          .ant-btn {
+            margin-right: 15px;
+          }
+        }
+      }
+      .Edtop1rowFull {
+        width: 100%;
+      }
+    }
+  }
+}

+ 67 - 0
src/pages/Eculture/E2story/E2edit/index.tsx

@@ -0,0 +1,67 @@
+import React from 'react'
+import styles from './index.module.scss'
+import EditTop from '@/pages/Zother/EditTop'
+import EditBtn from '@/pages/Zother/EditBtn'
+import { D1API_obj } from '@/store/action/Dmanage/D1register'
+import { InfoProvider } from '@/pages/Zother/InfoContext'
+import { rowArrTemp } from '@/pages/Zother/data'
+import SonGoodsList from '@/pages/Zother/SonGoodsList'
+import { Button, Input } from 'antd'
+
+function E2edit() {
+  return (
+    <InfoProvider>
+      <div className={styles.D1edit} id='editBox'>
+        <div className='editMain'>
+          <div className={styles.EditTop}>
+            <div className='pageTitle'>藏品故事-新增</div>
+            <div className='EdTit'>
+              <div>藏品故事</div>
+            </div>
+            <div className='Edtop1'>
+              <div className='Edtop1row'>
+                <div className='Edtop1ll'>
+                  <span>* </span>
+                  故事标题 :
+                </div>
+                <div className='Edtop1rr'>
+                  <Input
+                    readOnly={false}
+                    placeholder='请输入内容,不超过30个字'
+                    value={1}
+                    onChange={e => console.log(e.target.value)}
+                    maxLength={30}
+                    showCount
+                  />
+                </div>
+              </div>
+              <div className='Edtop1row Edtop1rowFull'>
+                <div className='Edtop1ll'>关联产品 :</div>
+                <div className='Edtop1rr'>
+                  <Button type='primary'>添加藏品</Button>
+                </div>
+              </div>
+              <div className='Edtop1rowFull'>
+                <div className='Edtop1rr'>
+                  <SonGoodsList
+                    fileUpInfo={{
+                      myUrl: 'cms/order/register/son/upload',
+                      dirCode: 'registerGoods'
+                    }}
+                  />
+                </div>
+              </div>
+            </div>
+          </div>
+
+          {/* 底部按钮 */}
+          <EditBtn path='/register' APIobj={D1API_obj} />
+        </div>
+      </div>
+    </InfoProvider>
+  )
+}
+
+const MemoE2edit = React.memo(E2edit)
+
+export default MemoE2edit

+ 4 - 4
src/pages/Eculture/E2story/index.module.scss

@@ -1,4 +1,4 @@
-.E2story {
-  :global {
-  }
-}
+// .E2story {
+//   :global {
+//   }
+// }

+ 74 - 3
src/pages/Eculture/E2story/index.tsx

@@ -1,13 +1,84 @@
 import React from 'react'
 import styles from './index.module.scss'
-function E2story() {
+import { useSelector } from 'react-redux'
+import { RootState } from '@/store'
+import { E2_APIgetList } from '@/store/action/Eculture/E2story'
+import TableList from '@/pages/Zother/TableList'
+import { baseFormData } from '@/pages/Zother/data'
+import { storyTableC } from '@/utils/tableData'
+import { Button } from 'antd'
+import history from '@/utils/history'
+
+const E2topSearch = [
+  {
+    type: 'input',
+    key: 'searchKey',
+    placeholder: `请输入故事标题、关联藏品`
+  },
+  {
+    type: 'input',
+    key: 'searchTagName',
+    placeholder: '搜索藏品标签'
+  },
+  {
+    type: 'time',
+    key: ['startTime', 'endTime'],
+    placeholder: [`录入日期开始`, `录入日期结束`]
+  }
+]
+
+const D1baseFormData = baseFormData()
+
+const dataExport = () => {
+  console.log('数据导出了')
+}
+
+function D1register() {
+  // 从仓库拿数据
+  const tableInfo = useSelector((state: RootState) => state.E2story.tableInfo)
+
+  const storyTableListToprr = ({
+    clickSearch,
+    resetSelectFu
+  }: {
+    clickSearch: () => void
+    resetSelectFu: () => void
+  }) => {
+    return (
+      <>
+        <Button type='primary' onClick={() => history.push(`/story_edit/1/null`)}>
+          新增故事
+        </Button>
+        <Button type='primary' onClick={dataExport}>
+          数据导出
+        </Button>
+        <Button type='primary' onClick={clickSearch}>
+          查询
+        </Button>
+        <Button onClick={resetSelectFu}>重置</Button>
+      </>
+    )
+  }
+
   return (
     <div className={styles.E2story}>
       <div className='pageTitle'>故事管理</div>
+
+      <TableList
+        baseFormData={D1baseFormData}
+        getListAPI={E2_APIgetList}
+        pageKey='story'
+        tableInfo={tableInfo}
+        columnsTemp={storyTableC}
+        rightBtnWidth={350}
+        yHeight={585}
+        searchDom={E2topSearch}
+        storyTableListToprr={storyTableListToprr}
+      />
     </div>
   )
 }
 
-const MemoE2story = React.memo(E2story)
+const MemoD1register = React.memo(D1register)
 
-export default MemoE2story
+export default MemoD1register

+ 7 - 0
src/pages/Layout/data.ts

@@ -334,5 +334,12 @@ export const routerSon: RouterTypeRow[] = [
     name: '藏品登记-详情页',
     path: '/register_edit/:key/:id',
     Com: React.lazy(() => import('../Dmanage/D1register/D1edit'))
+  },
+
+  {
+    id: 602,
+    name: '故事管理-详情页',
+    path: '/story_edit/:key/:id',
+    Com: React.lazy(() => import('../Eculture/E2story/E2edit'))
   }
 ]

+ 17 - 8
src/pages/Zother/TableList/index.tsx

@@ -20,6 +20,8 @@ type Props = {
   rightBtnWidth?: number
   // 左侧每个输入框盒子的宽度
   leftRowWidth?: string
+  // 故事管理定制右侧内容
+  storyTableListToprr?: (props: any) => React.ReactNode
 }
 
 function TableList({
@@ -31,7 +33,8 @@ function TableList({
   yHeight,
   searchDom,
   rightBtnWidth = 250,
-  leftRowWidth = '25%'
+  leftRowWidth = '25%',
+  storyTableListToprr
 }: Props) {
   const dispatch = useDispatch()
 
@@ -173,13 +176,19 @@ function TableList({
           ))}
         </div>
         <div className='TableListToprr' style={{ width: rightBtnWidth + 'px' }}>
-          <Button type='primary' onClick={() => history.push(`/${pageKey}_edit/1/null`)}>
-            发起申请
-          </Button>
-          <Button type='primary' onClick={clickSearch}>
-            查询
-          </Button>
-          <Button onClick={resetSelectFu}>重置</Button>
+          {storyTableListToprr ? (
+            storyTableListToprr({ clickSearch, resetSelectFu })
+          ) : (
+            <>
+              <Button type='primary' onClick={() => history.push(`/${pageKey}_edit/1/null`)}>
+                发起申请
+              </Button>
+              <Button type='primary' onClick={clickSearch}>
+                查询
+              </Button>
+              <Button onClick={resetSelectFu}>重置</Button>
+            </>
+          )}
         </div>
       </div>
       <div className={styles.TableListTable}>

+ 40 - 0
src/store/action/Eculture/E2story.ts

@@ -0,0 +1,40 @@
+import { AppDispatch } from '@/store'
+import http from '@/utils/http'
+
+/**
+ * 故事 - 获取分页列表
+ */
+export const E2_APIgetList = (data: any): any => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.post('cms/story/page', data)
+    if (res.code === 0) {
+      const obj = {
+        list: res.data.records,
+        total: res.data.total
+      }
+
+      dispatch({ type: 'E2/getList', payload: obj })
+    }
+  }
+}
+
+/**
+ * 故事 - 删除
+ */
+export const E2_APIdel = (id: string) => {
+  return http.post(`cms/story/removes/`, { ids: [id] })
+}
+
+/**
+ * 故事 - 获取详情
+ */
+export const E2_APIgetInfo = (id: string) => {
+  return http.get(`cms/story/detail/${id}`)
+}
+
+/**
+ * 故事 - 新增或修改
+ */
+export const E2_APIsave = (data: any) => {
+  return http.post('cms/story/save', data)
+}

+ 28 - 0
src/store/reducer/Eculture/E2story.ts

@@ -0,0 +1,28 @@
+import { Typetable } from '@/pages/Zother/data'
+
+// 初始化状态
+const initState = {
+  // 列表数据
+  tableInfo: {
+    list: [] as Typetable[],
+    total: 0
+  }
+}
+
+// 定义 action 类型
+type Props = {
+  type: 'E2/getList'
+  payload: { list: Typetable[]; total: number }
+}
+
+// reducer
+export default function Reducer(state = initState, action: Props) {
+  switch (action.type) {
+    // 获取列表数据
+    case 'E2/getList':
+      return { ...state, tableInfo: action.payload }
+
+    default:
+      return state
+  }
+}

+ 2 - 0
src/store/reducer/index.ts

@@ -7,6 +7,7 @@ import B1collect from './Benter/B1collect'
 import B2enterGuan from './Benter/B2enterGuan'
 import D1register from './Dmanage/D1register'
 import E1tag from './Eculture/E1tag'
+import E2story from './Eculture/E2story'
 
 import I2dict from './Isystem/I2dict'
 import I3numSet from './Isystem/I3numSet'
@@ -23,6 +24,7 @@ const rootReducer = combineReducers({
   B2enterGuan,
   D1register,
   E1tag,
+  E2story,
 
   I2dict,
   I3numSet,

+ 9 - 0
src/utils/tableData.ts

@@ -106,3 +106,12 @@ export const I8tableC = [
   ['txt', '操作模块', 'type'],
   ['txt', '操作事件', 'description']
 ]
+
+// 故事gl
+export const storyTableC = [
+  ['txt', '故事标题', 'description'],
+  ['txt', '关联藏品', 'goodsNum'],
+  ['txt', '藏品标签', 'tagDictId'],
+  ['txt', '录入人', 'creatorName'],
+  ['txt', '录入日期', 'createTime']
+]