Pārlūkot izejas kodu

封面图编辑问题

shaogen1995 1 mēnesi atpakaļ
vecāks
revīzija
bb37aa0049

+ 9 - 26
src/pages/C_goodsManage/C1register/AddGoods/index.tsx

@@ -16,7 +16,7 @@ import { GoodFileType } from './type'
 import { baseURL } from '@/utils/http'
 import { fileImgArr, fileVideoArr } from '@/store/action/layout'
 import { API_C2dels } from '@/store/action/C2files'
-import { API_goodsAdd, API_goodsInfo, API_setThumb } from '@/store/action/C1ledger'
+import { API_goodsAdd, API_goodsInfo } from '@/store/action/C1ledger'
 import { C1GoodType } from '@/pages/A3_ledger/C1ledger/type'
 import { MessageFu } from '@/utils/message'
 import history, { cascaderObjFu } from '@/utils/history'
@@ -103,11 +103,11 @@ function AddGoods({ nowSta, closeFu, succFu, isEdit, editSnap }: Props) {
         FormBoxRef.current?.setFieldsValue(obj)
 
         // 设置封面图
-        // ZupThumbRef.current?.setFileComFileFu({
-        //   fileName: '',
-        //   filePath: obj.thumbPc,
-        //   thumb: obj.thumb
-        // })
+        ZupThumbRef.current?.setFileComFileFu({
+          fileName: '',
+          filePath: obj.thumbPc,
+          thumb: obj.thumb
+        })
 
         // 设置富文本
         if (obj.rtf) ZRichTextRef.current?.ritxtShowFu(JSON.parse(obj.rtf))
@@ -321,7 +321,9 @@ function AddGoods({ nowSta, closeFu, succFu, isEdit, editSnap }: Props) {
         fileSet,
         // inGoodsDate,
         dateMaking,
-        id: idRes
+        id: idRes,
+        thumb: coverUrl1.thumb || '',
+        thumbPc: coverUrl1.filePath || ''
       }
 
       for (const k in obj) {
@@ -357,19 +359,6 @@ function AddGoods({ nowSta, closeFu, succFu, isEdit, editSnap }: Props) {
           }
         }
 
-        if (objOld.current.thumb !== coverUrl1.thumb) {
-          // 只修改封面图
-          coverUrl1 &&
-            (await API_setThumb({
-              id: objOld.current.id,
-              thumb: coverUrl1.thumb,
-              thumbPc: coverUrl1.thumb
-            }))
-          MessageFu.success(`${staTxt.current}成功`)
-          closeFu()
-          return
-        }
-
         if (flag) return MessageFu.warning('未修改藏品信息')
 
         // -----------藏品编辑模块进来---------------
@@ -392,12 +381,6 @@ function AddGoods({ nowSta, closeFu, succFu, isEdit, editSnap }: Props) {
 
         const res = await API_goodsAdd(obj, idRes ? '编辑' : '新增')
         if (res.code === 0) {
-          coverUrl1 &&
-            (await API_setThumb({
-              id: res.data.id,
-              thumb: coverUrl1.thumb,
-              thumbPc: coverUrl1.thumb
-            }))
           MessageFu.success(nowSta.id === 'null' ? `${staTxt.current}成功` : '编辑成功')
           succFu(res.data, nowSta.id === 'null' ? '新增' : '编辑', staTxt.current as '提交')
           closeFu()

+ 0 - 7
src/store/action/C1ledger.ts

@@ -71,10 +71,3 @@ export const API_getGoodsStorage = () => {
 export const API_getGoodsLedger = (goodId: number | string) => {
   return http.get(`cms/print/goods/ledger/${goodId}`)
 }
-
-/**
- * 设置封面图
- */
-export const API_setThumb = (data: any) => {
-  return http.post('cms/goods/updateThumb', data)
-}