Browse Source

云展+分类;馆藏+二维码

shaogen1995 1 year ago
parent
commit
b487759c7d
2 changed files with 52 additions and 5 deletions
  1. 18 3
      src/pages/A4exhibit/A4add/index.tsx
  2. 34 2
      src/pages/A5goods/A5add/index.tsx

+ 18 - 3
src/pages/A4exhibit/A4add/index.tsx

@@ -1,7 +1,7 @@
 import React, { useCallback, useEffect, useRef, useState } from "react";
 import styles from "./index.module.scss";
 import { A4_APIgetInfo, A4_APIsave } from "@/store/action/A4exhibit";
-import { Button, DatePicker, Form, FormInstance, Input } from "antd";
+import { Button, DatePicker, Form, FormInstance, Input, Select } from "antd";
 import TextArea from "antd/es/input/TextArea";
 import ZupOne from "@/components/ZupOne";
 import dayjs from "dayjs";
@@ -24,6 +24,7 @@ function A4add({ addId, closeFu, addTableFu, editTableFu }: Props) {
       FormBoxRef.current?.setFieldsValue({
         ...data,
         myTime: dayjs(data.releaseDate),
+        type: data.type ? data.type : null,
       });
 
       // 设置封面图
@@ -78,9 +79,10 @@ function A4add({ addId, closeFu, addTableFu, editTableFu }: Props) {
       const obj = {
         ...values,
         id: addId > 0 ? addId : null,
-        qrCode: qrCodeTemp.filePath ? qrCodeTemp.filePath : null,
+        qrCode: qrCodeTemp.filePath ? qrCodeTemp.filePath : "",
         releaseDate,
         thumb: coverUrl1.filePath,
+        type: values.type ? values.type : "",
       };
       const res = await A4_APIsave(obj);
       if (res.code === 0) {
@@ -116,6 +118,19 @@ function A4add({ addId, closeFu, addTableFu, editTableFu }: Props) {
             <Input maxLength={50} showCount placeholder="请输入内容" />
           </Form.Item>
 
+          <Form.Item label="分类" name="type">
+            <Select
+              allowClear
+              placeholder="请选择"
+              style={{ width: 200 }}
+              options={[
+                { value: "回顾云展", label: "回顾云展" },
+                { value: "展厅云展", label: "展厅云展" },
+                { value: "馆藏系列云展", label: "馆藏系列云展" },
+              ]}
+            />
+          </Form.Item>
+
           <Form.Item label="简介" name="description">
             <TextArea placeholder="请输入内容" showCount maxLength={1000} />
           </Form.Item>
@@ -165,7 +180,7 @@ function A4add({ addId, closeFu, addTableFu, editTableFu }: Props) {
             <DatePicker />
           </Form.Item>
 
-          {/* 封面 */}
+          {/* 二维码 */}
           <div className="formRow">
             <div className="formLeft">二维码:</div>
             <div className="formRight">

+ 34 - 2
src/pages/A5goods/A5add/index.tsx

@@ -44,6 +44,14 @@ function A5add({ addId, closeFu, addTableFu, editTableFu }: Props) {
         filePath: data.thumb,
       });
 
+      // 设置二维码
+      if (data.qrCode) {
+        ZupOneRefCode.current?.setFileComFileFu({
+          fileName: "",
+          filePath: data.qrCode,
+        });
+      }
+
       const file = res.data.file;
 
       // 传给 附件 组件的
@@ -97,14 +105,17 @@ function A5add({ addId, closeFu, addTableFu, editTableFu }: Props) {
       // 附件组件的 type 数组 和 附件id数组
       const { sonType, sonFileIds } = ZupOneRef2.current?.fileComFileResFu();
 
-      //  附件组件为必传信息
+      //  底部附件组件为必传信息
       //  if(sonInfo.sonIsOk) return
 
+      const qrCodeTemp = ZupOneRefCode.current?.fileComFileResFu();
+
       const obj = {
         ...values,
         id: addId > 0 ? addId : null,
         releaseDate,
         thumb: coverUrl1.filePath,
+        qrCode: qrCodeTemp.filePath ? qrCodeTemp.filePath : "",
         dirCode,
         fileType: sonType ? sonType.join(",") : null,
         fileIds: sonFileIds ? sonFileIds.join(",") : null,
@@ -122,6 +133,7 @@ function A5add({ addId, closeFu, addTableFu, editTableFu }: Props) {
   // 上传附件的ref
   const ZupOneRef1 = useRef<any>(null);
   const ZupOneRef2 = useRef<any>(null);
+  const ZupOneRefCode = useRef<any>(null);
 
   return (
     <div className={styles.A5add}>
@@ -168,7 +180,7 @@ function A5add({ addId, closeFu, addTableFu, editTableFu }: Props) {
                 fileCheck={fileCheck}
                 size={5}
                 dirCode={dirCode}
-                myUrl="cms/exhibition/upload"
+                myUrl="cms/goods/upload"
                 format={["image/jpeg", "image/png"]}
                 formatTxt="png、jpg和jpeg"
                 checkTxt="请上传封面图"
@@ -186,6 +198,26 @@ function A5add({ addId, closeFu, addTableFu, editTableFu }: Props) {
             <DatePicker />
           </Form.Item>
 
+          {/* 二维码 */}
+          <div className="formRow">
+            <div className="formLeft">二维码:</div>
+            <div className="formRight">
+              <ZupOne
+                ref={ZupOneRefCode}
+                isLook={false}
+                fileCheck={false}
+                size={5}
+                dirCode={dirCode + "Code"}
+                myUrl="cms/goods/upload"
+                format={["image/jpeg", "image/png"]}
+                formatTxt="png、jpg和jpeg"
+                checkTxt="请上传二维码"
+                upTxt="最多1张"
+                myType="thumb"
+              />
+            </div>
+          </div>
+
           <Form.Item
             label="分类"
             name="dictType"