Explorar el Código

:bug: 海报管理product为null解构出错问题修复

zhanghe hace 6 años
padre
commit
68c453b5e0
Se han modificado 2 ficheros con 5 adiciones y 6 borrados
  1. 4 5
      src/routes/Frontend/Recommend/RecommendPoster.js
  2. 1 1
      src/utils/utils.js

+ 4 - 5
src/routes/Frontend/Recommend/RecommendPoster.js

@@ -298,8 +298,7 @@ export default class RecommendPosterEditPage extends Component {
       key: 3,
       render: (_, record) => {
         // 将产品信息渲染成一个小表格
-        const { id, product = {}, isEdit, isNew } = record;
-        const { code, name, type } = product;
+        const { id, code, name, type, product, isEdit, isNew } = record;
         const columns = [{
           dataIndex: 'label',
           width: '40%',
@@ -310,15 +309,15 @@ export default class RecommendPosterEditPage extends Component {
         const data = [{
           key: 'name',
           label: '产品名称',
-          value: name,
+          value: name || (product || {}).name,
         }, {
           key: 'code',
           label: '产品编号',
-          value: code,
+          value: code || (product || {}).code,
         }, {
           key: 'type',
           label: '产品类型',
-          value: renderProductType(type),
+          value: renderProductType(type || (product || {}).type),
         }];
         return (
           <div className={styles.product}>

+ 1 - 1
src/utils/utils.js

@@ -324,7 +324,7 @@ export function renderProductType(type) {
   } else if (type === Hotax.PRODUCT_PACKAGE) {
     return '套餐包';
   } else {
-    return '未知';
+    return '';
   }
 }